-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi everyone,

I was playing around a bit with gem5 and noticed by accident that the
O3 CPU model seems to be unable to handle jumps to the same location
(at least, that's what it looks like).

I have the following piece of x86 assembly code:

_start:
    jmp     _start
    mov     $0xDEADBEEF, %rax
    mov     $0xDEADBEEF, %rbx

When I execute that in FS mode with Exec tracing, I get:

 355000: system.cpu T0 : @_start. 0 :   JMP_I : rdip   t1, %ctrl153,
: IntAlu :  D=0x0000000000240005
 355000: system.cpu T0 : @_start.1  :   JMP_I : limm   t2,
0xfffffffffffffffb : IntAlu :  D=0xfffffffffffffffb
 355000: system.cpu T0 : @_start.2  :   JMP_I : wrip   , t1, t2  :
IntAlu :
 359500: system.cpu T0 : @_start.0  :   JMP_I : rdip   t1, %ctrl153,
: IntAlu :  D=0x0000000000240008
 359500: system.cpu T0 : @_start.1  :   JMP_I : limm   t2,
0xfffffffffffffffb : IntAlu :  D=0xfffffffffffffffb
 359500: system.cpu T0 : @_start.2  :   JMP_I : wrip   , t1, t2  :
IntAlu :
 365000: system.cpu T0 : @_start+3.0  :   UD2 : fault   Invalid-Opcode
: No_OpClass :
 376500: system.cpu T0 : @_start+3.32768 :   Microcode_ROM : slli
t4, t1, 0x4 : IntAlu :  D=0x0000000000000060
 376500: system.cpu T0 : @_start+3.32769 :   Microcode_ROM : ld   t2,
IDTR:[t4 + 0x8] : MemRead :  D=0x0000000000000000 A=0x68
 376500: system.cpu T0 : @_start+3.32770 :   Microcode_ROM : ld   t4,
IDTR:[t4] : MemRead :  D=0x0000000000000000 A=0x60
[...]

What happens exactly after the jump, depends on the instructions
behind it. To "fix" that problem, it is sufficient to e.g. add a nop
in the loop:

_start:
        nop
        jmp     _start

Now everything works fine. Note that the problem does not occur with
the timing CPU model.

Best regards,
Nils
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJWBQHLAAoJEJs2bdYwYTUN0CwH/3McC6HAzQJg7WnHzES681X4
NlMm5hM3ra7GtmkYUs8e5vgEwSF/MTWWY4SHJWji+QXq9gOKdUV9pF7zxYBoqXgw
nZcAta0Cm0BrFXGsZed9f8QDx5FMrB3iI9YJsyBu/AzZ/A1hoiY62hyTdkk758r2
j8gGjlFjjsNqoC00kNcWsmg/p4hgQVAQMU86jfSRAAwKX9RuM4U/jIKTloTiqomr
4hNWVFHeI0xdD6lcipVgESij9RJjYR7847o/s1TuSbzYBER5Wgz/reiNFweA0luO
e4agXYoBcmWDAJ7HpYDf1MeIdcQJxzrs5+DfscSSjDeM0K4cCGBSnFVaQ3hSvbI=
=nOQ2
-----END PGP SIGNATURE-----
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to