Re: [Qemu-devel] [PATCH v2] tcg-i386: Use %gs prefixes for x86_64 GUEST_BASE

2012-10-29 Thread Aurelien Jarno
On Tue, Oct 23, 2012 at 07:19:20AM +1000, Richard Henderson wrote: > On 2012-10-22 15:59, Aurelien Jarno wrote: > > Yes, this is a know fact that this libc function doesn't have a > > prototype (for instance in the manpage), that said it exists and at > > least on x32 it's actually a wrapper doing

Re: [Qemu-devel] [PATCH v2] tcg-i386: Use %gs prefixes for x86_64 GUEST_BASE

2012-10-22 Thread Richard Henderson
On 2012-10-22 15:59, Aurelien Jarno wrote: > Yes, this is a know fact that this libc function doesn't have a > prototype (for instance in the manpage), that said it exists and at > least on x32 it's actually a wrapper doing things. > > That's why I think it's better to use it than doing the syscal

Re: [Qemu-devel] [PATCH v2] tcg-i386: Use %gs prefixes for x86_64 GUEST_BASE

2012-10-21 Thread Aurelien Jarno
On Mon, Oct 22, 2012 at 12:11:07PM +1000, Richard Henderson wrote: > When we allocate a reserved_va for the guest, the kernel will likely > choose an address well above 4G. At which point we must use a pair > of movabsq+addq to form the host address. If we have OS support, > set up a segment regi

[Qemu-devel] [PATCH v2] tcg-i386: Use %gs prefixes for x86_64 GUEST_BASE

2012-10-21 Thread Richard Henderson
When we allocate a reserved_va for the guest, the kernel will likely choose an address well above 4G. At which point we must use a pair of movabsq+addq to form the host address. If we have OS support, set up a segment register to point to guest_base instead. Signed-off-by: Richard Henderson ---

Re: [Qemu-devel] [PATCH v2] tcg-i386: Use %gs prefixes for x86_64 GUEST_BASE

2012-10-21 Thread Richard Henderson
On 2012-10-21 14:26, Aurelien Jarno wrote: >> > +static inline void setup_guest_base_seg(void) >> > +{ >> > +if (syscall(__NR_arch_prctl, ARCH_SET_GS, GUEST_BASE) == 0) { >> > +guest_base_flags = P_GS; >> > +} > Why calling the syscall directly instead of using arch_prctl(2)? > Er

Re: [Qemu-devel] [PATCH v2] tcg-i386: Use %gs prefixes for x86_64 GUEST_BASE

2012-10-20 Thread Richard Henderson
On 2012-10-21 14:26, Aurelien Jarno wrote: >> > -if (TCG_TARGET_REG_BITS == 64) { >> > -/* ??? We assume all operations have left us with register >> > - contents that are zero extended. So far this appears to >> > - be true. If we want to enforce t

Re: [Qemu-devel] [PATCH v2] tcg-i386: Use %gs prefixes for x86_64 GUEST_BASE

2012-10-20 Thread Aurelien Jarno
On Thu, Oct 18, 2012 at 01:36:05PM +1000, Richard Henderson wrote: > When we allocate a reserved_va for the guest, the kernel will likely > choose an address well above 4G. At which point we must use a pair > of movabsq+addq to form the host address. If we have OS support, > set up a segment regi

[Qemu-devel] [PATCH v2] tcg-i386: Use %gs prefixes for x86_64 GUEST_BASE

2012-10-17 Thread Richard Henderson
When we allocate a reserved_va for the guest, the kernel will likely choose an address well above 4G. At which point we must use a pair of movabsq+addq to form the host address. If we have OS support, set up a segment register to point to guest_base instead. Signed-off-by: Richard Henderson ---