blob: bdc914e77ff09b6d05746d293c562961fbc0b092 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
register: 0.688
device: 0.679
ppc: 0.612
graphic: 0.495
architecture: 0.486
assembly: 0.485
vnc: 0.479
semantic: 0.460
permissions: 0.424
performance: 0.363
risc-v: 0.314
boot: 0.291
kernel: 0.286
socket: 0.281
peripherals: 0.256
network: 0.239
hypervisor: 0.234
PID: 0.217
debug: 0.212
files: 0.176
VMM: 0.143
arm: 0.115
mistranslation: 0.100
x86: 0.098
i386: 0.085
user-level: 0.065
TCG: 0.052
KVM: 0.006
virtual: 0.006
SH4: SUBV instruction not emulated properly
Description of problem:
SUBV opcode is emulated incorrectly.
The documentation says:
`SUBV Rm, Rn Rn - Rm -> Rn, underflow -> T`
Qemu seems to perform the subtraction correctly, but will not detect an underflow.
Steps to reproduce:
```c
#include <stdio.h>
int main(void)
{
register unsigned int a asm("r8") = 0x80000001;
register unsigned int b asm("r9") = 0x2;
register unsigned int c asm("r10");
asm volatile("subv %2,%0\n"
"movt %1\n"
: "+r"(a), "=r"(c) : "r"(b) :);
printf("Values: a=0x%x b=0x%x c=0x%x\n", a, b, c);
return 0;
}
```
Additional information:
Tested on real hardware (SEGA Dreamcast, GCC 15.0), the program above prints:
`Values: a=0x7fffffff b=0x2 c=0x1`
Running with Qemu (and GCC 13.0), the same program prints:
`Values: a=0x7fffffff b=0x2 c=0x0`
|