64-bit target
Hi,
what changes has to be done to make QEMU support 64-bit targets? Any big overall changes needed at all?
Signature · 4 lines
Johan Rydberg, Free Software Developer, Sweden http://rtmk.sf.net | http://www.nongnu.org/guss/ Playing Deftones - Minerva
Quoted 3 lines · Johan Rydberg
Hi,
what changes has to be done to make QEMU support 64-bit targets? Any big overall changes needed at all?
No big changes, except that you must use a soft MMU if you want to use real 64 bit pointers.
Fabrice.
Fabrice Bellard <[email protected]> wrote:
: Johan Rydberg wrote:
: > Hi,
: >
: > what changes has to be done to make QEMU support 64-bit targets? : > Any big overall changes needed at all?
:
: No big changes, except that you must use a soft MMU if you want to use : real 64 bit pointers.
After doing a little research it seems that dyngen can not cope with 64-bit immediates. ie PARAMn can only be as large as sizeof (void *). This must of course be fixed for a 64-bit target. Any ideas how to fix it?
Signature · 4 lines
Johan Rydberg, Free Software Developer, Sweden http://rtmk.sf.net | http://www.nongnu.org/guss/ Playing Track No09
Quoted 10 lines · Johan Rydberg
Fabrice Bellard <[email protected]> wrote:
: Johan Rydberg wrote:
: > Hi,
: > : > what changes has to be done to make QEMU support 64-bit targets? : > Any big overall changes needed at all? : : No big changes, except that you must use a soft MMU if you want to use : real 64 bit pointers.After doing a little research it seems that dyngen can not cope with 64-bit immediates. ie PARAMn can only be as large as sizeof (void *). This must of course be fixed for a 64-bit target. Any ideas how to
fix it?
You can just use two parameters and load two 32 bit values.
Fabrice.
Fabrice Bellard <[email protected]> wrote:
: You can just use two parameters and load two 32 bit values.
Declaring T0 as a long long, and trying to set it to an immediate value results in the following code: Which is a bit of an overhead I think :)
void OPPROTOop_movdi_t0_uimm (void)
{
34: 83 ec 14 sub $0x14,%esp
T0 = (unsigned long long) (PARAM1 << 32 | PARAM2);
37: b8 00 00 00 00 mov $0x0,%eax
38: R_386_32 __op_param1
3c: 89 04 24 mov %eax,(%esp,1)
3f: 99 cltd
40: 8b 04 24 mov (%esp,1),%eax
43: 89 54 24 04 mov %edx,0x4(%esp,1)
47: 89 c2 mov %eax,%edx
49: 31 c0 xor %eax,%eax
4b: 89 04 24 mov %eax,(%esp,1)
4e: b8 00 00 00 00 mov $0x0,%eax
4f: R_386_32 __op_param2
53: 89 54 24 04 mov %edx,0x4(%esp,1)
57: 99 cltd
58: 89 44 24 08 mov %eax,0x8(%esp,1)
5c: 89 54 24 0c mov %edx,0xc(%esp,1)
60: 8b 04 24 mov (%esp,1),%eax
63: 8b 54 24 04 mov 0x4(%esp,1),%edx
67: 0b 44 24 08 or 0x8(%esp,1),%eax
6b: 0b 54 24 0c or 0xc(%esp,1),%edx
6f: 89 c6 mov %eax,%esi
71: 89 d7 mov %edx,%edi
}
73: 83 c4 14 add $0x14,%esp
76: c3 ret
77: 90 nop Signature · 4 lines
Johan Rydberg, Free Software Developer, Sweden http://rtmk.sf.net | http://www.nongnu.org/guss/ Playing Track No03
Johan Rydberg <[email protected]> wrote:
: Fabrice Bellard <[email protected]> wrote:
:
: : You can just use two parameters and load two 32 bit values. :
: Declaring T0 as a long long, and trying to set it to an immediate : value results in the following code: Which is a bit of an overhead : I think :)
Using an union like this;
union fast_move { struct { USI hi; USI lo; } s; UDI d; } x;
And a macro like this;
#define GET_UDI_FROM_PARAMS(p1, p2) (((union fast_move) { { (USI) p1, (USI) p2 } }).d)
Reduces the code:
void OPPROTOop_movdi_t0_uimm (void)
{
T0 = GET_UDI_FROM_PARAMS (PARAM1, PARAM2);
}
To:
00000034 <op_movdi_t0_uimm>:
34: b8 00 00 00 00 mov $0x0,%eax
35: R_386_32 __op_param1
39: ba 00 00 00 00 mov $0x0,%edx
3a: R_386_32 __op_param2
3e: 89 c6 mov %eax,%esi
40: 89 d7 mov %edx,%ediCan you figure out how to make it move to %esi and %edi directly? I can, for one, not.
Signature · 4 lines
Johan Rydberg, Free Software Developer, Sweden http://rtmk.sf.net | http://www.nongnu.org/guss/ Playing Various Artists - Deftones / My Own Summer (Shove It)