diff mbox series

[v2,5/5] tcg: restrict i386 regs definitions

Message ID 20170911213328.9701-6-f4bug@amsat.org
State New
Headers show
Series move user-exec, tcg-runtime, atomic_template.h to accel/tcg/ | expand

Commit Message

Philippe Mathieu-Daudé Sept. 11, 2017, 9:33 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
cleaning while here :)

 accel/tcg/user-exec.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Kamil Rytarowski Sept. 11, 2017, 9:44 p.m. UTC | #1
On 11.09.2017 23:33, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> cleaning while here :)
> 
>  accel/tcg/user-exec.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
> index 2a975eaf69..484a3f5f8f 100644
> --- a/accel/tcg/user-exec.c
> +++ b/accel/tcg/user-exec.c
> @@ -25,15 +25,6 @@
>  #include "exec/cpu_ldst.h"
>  #include "translate-all.h"
>  
> -#undef EAX
> -#undef ECX
> -#undef EDX
> -#undef EBX
> -#undef ESP
> -#undef EBP
> -#undef ESI
> -#undef EDI
> -#undef EIP
>  #ifdef __linux__
>  #include <sys/ucontext.h>
>  #endif
> @@ -131,6 +122,15 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
>  }
>  
>  #if defined(__i386__)
> +#undef EAX
> +#undef ECX
> +#undef EDX
> +#undef EBX
> +#undef ESP
> +#undef EBP
> +#undef ESI
> +#undef EDI
> +#undef EIP
>  
>  #if defined(__NetBSD__)
>  #include <ucontext.h>
> 

Why to move under i386?

SmartOS pollutes namespace with these symbols on x86_64.
Philippe Mathieu-Daudé Sept. 11, 2017, 10:13 p.m. UTC | #2
On 09/11/2017 06:44 PM, Kamil Rytarowski wrote:
> On 11.09.2017 23:33, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> cleaning while here :)
>>
>>   accel/tcg/user-exec.c | 18 +++++++++---------
>>   1 file changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
>> index 2a975eaf69..484a3f5f8f 100644
>> --- a/accel/tcg/user-exec.c
>> +++ b/accel/tcg/user-exec.c
>> @@ -25,15 +25,6 @@
>>   #include "exec/cpu_ldst.h"
>>   #include "translate-all.h"
>>   
>> -#undef EAX
>> -#undef ECX
>> -#undef EDX
>> -#undef EBX
>> -#undef ESP
>> -#undef EBP
>> -#undef ESI
>> -#undef EDI
>> -#undef EIP
>>   #ifdef __linux__
>>   #include <sys/ucontext.h>
>>   #endif
>> @@ -131,6 +122,15 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
>>   }
>>   
>>   #if defined(__i386__)
>> +#undef EAX
>> +#undef ECX
>> +#undef EDX
>> +#undef EBX
>> +#undef ESP
>> +#undef EBP
>> +#undef ESI
>> +#undef EDI
>> +#undef EIP
>>   
>>   #if defined(__NetBSD__)
>>   #include <ucontext.h>
>>
> 
> Why to move under i386?

I tracked the origin of these #defines in op-i386.c (7bfdb6d18c7b) and 
thought the Exx naming was for i386 while the x86_64 uses the Rxx naming 
(RAX .. RIP) so you'd only have them on i386 arch.
However it seems I didn't realize you can access x86_64 registers in 
32-bit mode via the EAX .. EIP naming, as you see I'm not confident with 
this CISC arch :S

So I guess it's best to ignore this patch?

> 
> SmartOS pollutes namespace with these symbols on x86_64.
> 

you should provide some VM :P

I plan to test this project soon:
https://www.packer.io/docs/builders/qemu.html

Regards,

Phil.
Kamil Rytarowski Sept. 11, 2017, 10:37 p.m. UTC | #3
On 12.09.2017 00:13, Philippe Mathieu-Daudé wrote:
> On 09/11/2017 06:44 PM, Kamil Rytarowski wrote:
>> On 11.09.2017 23:33, Philippe Mathieu-Daudé wrote:
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>> cleaning while here :)
>>>
>>>   accel/tcg/user-exec.c | 18 +++++++++---------
>>>   1 file changed, 9 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
>>> index 2a975eaf69..484a3f5f8f 100644
>>> --- a/accel/tcg/user-exec.c
>>> +++ b/accel/tcg/user-exec.c
>>> @@ -25,15 +25,6 @@
>>>   #include "exec/cpu_ldst.h"
>>>   #include "translate-all.h"
>>>   -#undef EAX
>>> -#undef ECX
>>> -#undef EDX
>>> -#undef EBX
>>> -#undef ESP
>>> -#undef EBP
>>> -#undef ESI
>>> -#undef EDI
>>> -#undef EIP
>>>   #ifdef __linux__
>>>   #include <sys/ucontext.h>
>>>   #endif
>>> @@ -131,6 +122,15 @@ static inline int handle_cpu_signal(uintptr_t
>>> pc, unsigned long address,
>>>   }
>>>     #if defined(__i386__)
>>> +#undef EAX
>>> +#undef ECX
>>> +#undef EDX
>>> +#undef EBX
>>> +#undef ESP
>>> +#undef EBP
>>> +#undef ESI
>>> +#undef EDI
>>> +#undef EIP
>>>     #if defined(__NetBSD__)
>>>   #include <ucontext.h>
>>>
>>
>> Why to move under i386?
> 
> I tracked the origin of these #defines in op-i386.c (7bfdb6d18c7b) and
> thought the Exx naming was for i386 while the x86_64 uses the Rxx naming
> (RAX .. RIP) so you'd only have them on i386 arch.
> However it seems I didn't realize you can access x86_64 registers in
> 32-bit mode via the EAX .. EIP naming, as you see I'm not confident with
> this CISC arch :S
> 
> So I guess it's best to ignore this patch?
> 

A typical 64-bit x86_64 OS can run 32-bit programs and reuse x86 32-bit
headers.

>>
>> SmartOS pollutes namespace with these symbols on x86_64.
>>
> 
> you should provide some VM :P
> 

Hope to see it too.

> I plan to test this project soon:
> https://www.packer.io/docs/builders/qemu.html
> 
> Regards,
> 
> Phil.
diff mbox series

Patch

diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 2a975eaf69..484a3f5f8f 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -25,15 +25,6 @@ 
 #include "exec/cpu_ldst.h"
 #include "translate-all.h"
 
-#undef EAX
-#undef ECX
-#undef EDX
-#undef EBX
-#undef ESP
-#undef EBP
-#undef ESI
-#undef EDI
-#undef EIP
 #ifdef __linux__
 #include <sys/ucontext.h>
 #endif
@@ -131,6 +122,15 @@  static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
 }
 
 #if defined(__i386__)
+#undef EAX
+#undef ECX
+#undef EDX
+#undef EBX
+#undef ESP
+#undef EBP
+#undef ESI
+#undef EDI
+#undef EIP
 
 #if defined(__NetBSD__)
 #include <ucontext.h>