I am working on my emulator. When I am porting to 64-bit Intel from old
32-bit, I ended up many bugs in my emulator! I think that I found a bug in
GNU C/C++ v4.1 compiler to treat 32-bit integer as 64-bit integer. For
examples:
typedef unsigned long uint32;
:
:
uint32 instr, opcode;
opcode = instr >> 26; // extract high 6-bit opcode from instruction word.
That bring garbage from upper 32-bit into lower 32-bit and it cause my
emulator to crash with segementation fault errors. With a solution, I had
to revise it:
opcode = (instr >> 26) & 0x3F;
cpu->fnCode[opcode](cpu);
It now works...
How do I force my GNU C/C++ compiler to treat 32-bit integers instead of
default 64-bit integer? When I used -S option, I found out that alot of
instructions like movq, addq, etc for just uint32!
Does anyone have any information about porting to 64-bit Intel (x86-64) by
using GNU C/C++ v4.1 compiler?
Thanks!
Tim
Have you tried using:
typedef unsigned int uint32;
To the best of my knowledge, the "int" type is still only 32 bits. What
made you decide to use "long" instead?
--
Conrad J. Sabatier <con...@cox.net>