From: Jakub Jermar <jakub@jermar.eu>
To: HelenOS development mailing list <helenos-devel@lists.modry.cz>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [HelenOS-devel] [sparc64] Miscomputed minimum of a group of numbers in sparc64 emulation
Date: Fri, 01 Jul 2011 14:57:52 +0200 [thread overview]
Message-ID: <4E0DC450.4000700@jermar.eu> (raw)
In-Reply-To: <CACXAS8B8E=z0w9fTzO_ZGzh91V5iGFiw_Hb5E=joip1D0=f9=g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1478 bytes --]
On 1.7.2011 12:41, Artyom Tarasenko wrote:
> Looks like it's a pretty nice test case.
>
> The test case scenario is to load the initial values into the
> registers (you already know them),
> calculate the mins, cmp the result with expected and jump somewhere.
> Since it happens with interrupts disabled, we don't need an OS or bios
> to test that. The binary just has to have an entry point at 0x20,
> then we can load it instead of bios.
>
> Care to produce the test case? (Otherwise I'll do it, but probably not
> until the weekend after the next one).
Yes I have a small reproducible testcase, see the attachments.
When _not_ singlestepping via GDB's `stepi`, the testcase will fail and
crash Qemu like this:
qemu: fatal: Trap 0x0101 while trap level (5) >= MAXTL (5), Error state
<register dumped here>
On the other hand, when I attach GDB to Qemu and step through all
instructions using `stepi`, the testcase will succeed and crash Qemu
like this:
qemu: fatal: Trap 0x0100 while trap level (5) >= MAXTL (5), Error state
<registers dumped here>
Mind the difference in the trap type - 0x100 for success, 0x101 for failure.
This is how I run the test:
Without GDB:
$ qemu-system-sparc64 -bios ./testcase
With GDB:
$ qemu-system-sparc64 -bios ./testcase -s -S
>From another terminal:
$ /usr/local/cross/sparc64/bin/sparc64-linux-gnu-gdb
(gdb) set architecture sparc:v9
(gdb) target remote localhost:1234
(gdb) stepi
...
Hope this helps to fix the problem.
Jakub
[-- Attachment #2: Makefile --]
[-- Type: text/plain, Size: 216 bytes --]
.PHONY=all
all:
rm *.o testcase
/usr/local/cross/sparc64/bin/sparc64-linux-gnu-as -g testcase.S -o testcase.o
/usr/local/cross/sparc64/bin/sparc64-linux-gnu-ld -Ttext 0x00 testcase.o -o testcase --oformat binary
[-- Attachment #3: testcase --]
[-- Type: application/octet-stream, Size: 116 bytes --]
[-- Attachment #4: testcase.S --]
[-- Type: text/plain, Size: 444 bytes --]
.global _start
.register %g2, #scratch
.register %g3, #scratch
.text
.space 0x20
_start:
set 110393, %i1
set 0, %i2
set 131072, %g1
set 0x40, %g3
cmp %i1, %g3
srl %g1, 8, %g4
srl %g1, 0x18, %g1
or %g4, %g1, %g4
sllx %g4, 0x30, %g2
srlx %g2, 0x30, %g2
udivx %i2, %g2, %g1
mulx %g1, %g2, %g1
movgu %xcc, %g3, %i1
sub %i2, %g1, %g1
sub %g2, %g1, %g1
cmp %i1, %g1
bgu %xcc, 0f
nop
succ:
ta 0
fail:
0:
ta 1
next prev parent reply other threads:[~2011-07-01 12:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-30 21:12 [Qemu-devel] [sparc64] Miscomputed minimum of a group of numbers in sparc64 emulation Jakub Jermar
2011-07-01 9:15 ` [Qemu-devel] [HelenOS-devel] " Artyom Tarasenko
2011-07-01 9:36 ` Jakub Jermar
2011-07-01 10:41 ` Artyom Tarasenko
2011-07-01 12:57 ` Jakub Jermar [this message]
2011-07-01 14:11 ` Jakub Jermar
2011-07-01 14:24 ` Laurent Desnogues
2011-07-01 14:28 ` Jakub Jermar
2011-07-01 15:08 ` Artyom Tarasenko
2011-07-01 14:15 ` Laurent Desnogues
2011-07-01 14:21 ` Jakub Jermar
2011-07-01 15:03 ` Artyom Tarasenko
2011-07-01 15:20 ` Laurent Desnogues
2011-07-01 15:53 ` Artyom Tarasenko
2011-07-01 16:14 ` Artyom Tarasenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E0DC450.4000700@jermar.eu \
--to=jakub@jermar.eu \
--cc=helenos-devel@lists.modry.cz \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.