diff mbox series

[03/16] linux-user/i386: Use explicit little-endian LD/ST API

Message ID 20241003234211.53644-4-philmd@linaro.org
State New
Headers show
Series misc: Use explicit endian LD/ST API | expand

Commit Message

Philippe Mathieu-Daudé Oct. 3, 2024, 11:41 p.m. UTC
The x86 architecture uses little endianness. Directly use
the little-endian LD/ST API.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 linux-user/i386/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thomas Huth Oct. 7, 2024, 5:52 a.m. UTC | #1
On 04/10/2024 01.41, Philippe Mathieu-Daudé wrote:
> The x86 architecture uses little endianness. Directly use
> the little-endian LD/ST API.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   linux-user/i386/signal.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c
> index cb90711834f..0f11dba831f 100644
> --- a/linux-user/i386/signal.c
> +++ b/linux-user/i386/signal.c
> @@ -754,8 +754,8 @@ static bool restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc)
>       env->eip = tswapl(sc->rip);
>   #endif
>   
> -    cpu_x86_load_seg(env, R_CS, lduw_p(&sc->cs) | 3);
> -    cpu_x86_load_seg(env, R_SS, lduw_p(&sc->ss) | 3);
> +    cpu_x86_load_seg(env, R_CS, lduw_le_p(&sc->cs) | 3);
> +    cpu_x86_load_seg(env, R_SS, lduw_le_p(&sc->ss) | 3);
>   
>       tmpflags = tswapl(sc->eflags);
>       env->eflags = (env->eflags & ~0x40DD5) | (tmpflags & 0x40DD5);

Reviewed-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c
index cb90711834f..0f11dba831f 100644
--- a/linux-user/i386/signal.c
+++ b/linux-user/i386/signal.c
@@ -754,8 +754,8 @@  static bool restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc)
     env->eip = tswapl(sc->rip);
 #endif
 
-    cpu_x86_load_seg(env, R_CS, lduw_p(&sc->cs) | 3);
-    cpu_x86_load_seg(env, R_SS, lduw_p(&sc->ss) | 3);
+    cpu_x86_load_seg(env, R_CS, lduw_le_p(&sc->cs) | 3);
+    cpu_x86_load_seg(env, R_SS, lduw_le_p(&sc->ss) | 3);
 
     tmpflags = tswapl(sc->eflags);
     env->eflags = (env->eflags & ~0x40DD5) | (tmpflags & 0x40DD5);