All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/i386/seg_helper: remove shadowed variable
@ 2023-09-25 14:49 Paolo Bonzini
  2023-09-26 13:16 ` Markus Armbruster
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2023-09-25 14:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: armbru

Return the width of the new task directly from switch_tss_ra.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/tcg/seg_helper.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c
index b5198db82bc..2b92aee2073 100644
--- a/target/i386/tcg/seg_helper.c
+++ b/target/i386/tcg/seg_helper.c
@@ -245,10 +245,10 @@ static void tss_set_busy(CPUX86State *env, int tss_selector, bool value,
 #define SWITCH_TSS_IRET 1
 #define SWITCH_TSS_CALL 2
 
-/* XXX: restore CPU state in registers (PowerPC case) */
-static void switch_tss_ra(CPUX86State *env, int tss_selector,
-                          uint32_t e1, uint32_t e2, int source,
-                          uint32_t next_eip, uintptr_t retaddr)
+/* return 0 if switching to a 16-bit selector */
+static int switch_tss_ra(CPUX86State *env, int tss_selector,
+                         uint32_t e1, uint32_t e2, int source,
+                         uint32_t next_eip, uintptr_t retaddr)
 {
     int tss_limit, tss_limit_max, type, old_tss_limit_max, old_type, v1, v2, i;
     target_ulong tss_base;
@@ -502,13 +502,14 @@ static void switch_tss_ra(CPUX86State *env, int tss_selector,
         cpu_x86_update_dr7(env, env->dr[7] & ~DR7_LOCAL_BP_MASK);
     }
 #endif
+    return type >> 3;
 }
 
-static void switch_tss(CPUX86State *env, int tss_selector,
-                       uint32_t e1, uint32_t e2, int source,
-                        uint32_t next_eip)
+static int switch_tss(CPUX86State *env, int tss_selector,
+                      uint32_t e1, uint32_t e2, int source,
+                      uint32_t next_eip)
 {
-    switch_tss_ra(env, tss_selector, e1, e2, source, next_eip, 0);
+    return switch_tss_ra(env, tss_selector, e1, e2, source, next_eip, 0);
 }
 
 static inline unsigned int get_sp_mask(unsigned int e2)
@@ -650,14 +651,11 @@ static void do_interrupt_protected(CPUX86State *env, int intno, int is_int,
         if (!(e2 & DESC_P_MASK)) {
             raise_exception_err(env, EXCP0B_NOSEG, intno * 8 + 2);
         }
-        switch_tss(env, intno * 8, e1, e2, SWITCH_TSS_CALL, old_eip);
+        shift = switch_tss(env, intno * 8, e1, e2, SWITCH_TSS_CALL, old_eip);
         if (has_error_code) {
-            int type;
             uint32_t mask;
 
             /* push the error code */
-            type = (env->tr.flags >> DESC_TYPE_SHIFT) & 0xf;
-            shift = type >> 3;
             if (env->segs[R_SS].flags & DESC_B_MASK) {
                 mask = 0xffffffff;
             } else {
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] target/i386/seg_helper: remove shadowed variable
  2023-09-25 14:49 [PATCH] target/i386/seg_helper: remove shadowed variable Paolo Bonzini
@ 2023-09-26 13:16 ` Markus Armbruster
  2023-09-26 14:33   ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Armbruster @ 2023-09-26 13:16 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

I still get these:

../target/i386/tcg/seg_helper.c: In function ‘switch_tss_ra’:
../target/i386/tcg/seg_helper.c:344:22: warning: declaration of ‘ptr’ shadows a previous local [-Wshadow=compatible-local]
  344 |         target_ulong ptr;
      |                      ^~~
../target/i386/tcg/seg_helper.c:245:18: note: shadowed declaration is here
  245 |     target_ulong ptr;
      |                  ^~~
../target/i386/tcg/seg_helper.c:345:18: warning: declaration of ‘e2’ shadows a parameter [-Wshadow=compatible-local]
  345 |         uint32_t e2;
      |                  ^~
../target/i386/tcg/seg_helper.c:235:48: note: shadowed declaration is here
  235 |                          uint32_t e1, uint32_t e2, int source,
      |                                       ~~~~~~~~~^~
../target/i386/tcg/seg_helper.c:402:22: warning: declaration of ‘ptr’ shadows a previous local [-Wshadow=compatible-local]
  402 |         target_ulong ptr;
      |                      ^~~
../target/i386/tcg/seg_helper.c:245:18: note: shadowed declaration is here
  245 |     target_ulong ptr;
      |                  ^~~
../target/i386/tcg/seg_helper.c:403:18: warning: declaration of ‘e2’ shadows a parameter [-Wshadow=compatible-local]
  403 |         uint32_t e2;
      |                  ^~
../target/i386/tcg/seg_helper.c:235:48: note: shadowed declaration is here
  235 |                          uint32_t e1, uint32_t e2, int source,
      |                                       ~~~~~~~~~^~



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] target/i386/seg_helper: remove shadowed variable
  2023-09-26 13:16 ` Markus Armbruster
@ 2023-09-26 14:33   ` Paolo Bonzini
  2023-09-26 14:53     ` Markus Armbruster
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2023-09-26 14:33 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1736 bytes --]

Il mar 26 set 2023, 15:16 Markus Armbruster <armbru@redhat.com> ha scritto:

> I still get these:
>
> ../target/i386/tcg/seg_helper.c: In function ‘switch_tss_ra’:
> ../target/i386/tcg/seg_helper.c:344:22: warning: declaration of ‘ptr’
> shadows a previous local [-Wshadow=compatible-local]
>   344 |         target_ulong ptr;
>       |                      ^~~
> ../target/i386/tcg/seg_helper.c:245:18: note: shadowed declaration is here
>   245 |     target_ulong ptr;
>       |                  ^~~
> ../target/i386/tcg/seg_helper.c:345:18: warning: declaration of ‘e2’
> shadows a parameter [-Wshadow=compatible-local]
>   345 |         uint32_t e2;
>       |                  ^~
> ../target/i386/tcg/seg_helper.c:235:48: note: shadowed declaration is here
>   235 |                          uint32_t e1, uint32_t e2, int source,
>       |                                       ~~~~~~~~~^~
> ../target/i386/tcg/seg_helper.c:402:22: warning: declaration of ‘ptr’
> shadows a previous local [-Wshadow=compatible-local]
>   402 |         target_ulong ptr;
>       |                      ^~~
> ../target/i386/tcg/seg_helper.c:245:18: note: shadowed declaration is here
>   245 |     target_ulong ptr;
>       |                  ^~~
> ../target/i386/tcg/seg_helper.c:403:18: warning: declaration of ‘e2’
> shadows a parameter [-Wshadow=compatible-local]
>   403 |         uint32_t e2;
>       |                  ^~
> ../target/i386/tcg/seg_helper.c:235:48: note: shadowed declaration is here
>   235 |                          uint32_t e1, uint32_t e2, int source,
>       |                                       ~~~~~~~~~^~
>

There's another seg_helper patch. 8)

Paolo


>

[-- Attachment #2: Type: text/html, Size: 2517 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] target/i386/seg_helper: remove shadowed variable
  2023-09-26 14:33   ` Paolo Bonzini
@ 2023-09-26 14:53     ` Markus Armbruster
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2023-09-26 14:53 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

Paolo Bonzini <pbonzini@redhat.com> writes:

> Il mar 26 set 2023, 15:16 Markus Armbruster <armbru@redhat.com> ha scritto:
>
>> I still get these:
>>
>> ../target/i386/tcg/seg_helper.c: In function ‘switch_tss_ra’:
>> ../target/i386/tcg/seg_helper.c:344:22: warning: declaration of ‘ptr’
>> shadows a previous local [-Wshadow=compatible-local]
>>   344 |         target_ulong ptr;
>>       |                      ^~~
>> ../target/i386/tcg/seg_helper.c:245:18: note: shadowed declaration is here
>>   245 |     target_ulong ptr;
>>       |                  ^~~
>> ../target/i386/tcg/seg_helper.c:345:18: warning: declaration of ‘e2’
>> shadows a parameter [-Wshadow=compatible-local]
>>   345 |         uint32_t e2;
>>       |                  ^~
>> ../target/i386/tcg/seg_helper.c:235:48: note: shadowed declaration is here
>>   235 |                          uint32_t e1, uint32_t e2, int source,
>>       |                                       ~~~~~~~~~^~
>> ../target/i386/tcg/seg_helper.c:402:22: warning: declaration of ‘ptr’
>> shadows a previous local [-Wshadow=compatible-local]
>>   402 |         target_ulong ptr;
>>       |                      ^~~
>> ../target/i386/tcg/seg_helper.c:245:18: note: shadowed declaration is here
>>   245 |     target_ulong ptr;
>>       |                  ^~~
>> ../target/i386/tcg/seg_helper.c:403:18: warning: declaration of ‘e2’
>> shadows a parameter [-Wshadow=compatible-local]
>>   403 |         uint32_t e2;
>>       |                  ^~
>> ../target/i386/tcg/seg_helper.c:235:48: note: shadowed declaration is here
>>   235 |                          uint32_t e1, uint32_t e2, int source,
>>       |                                       ~~~~~~~~~^~
>>
>
> There's another seg_helper patch. 8)

Ah, missed it, because it doesn't have "shadow" in the subject.  Added
to my collection now.  Thanks!



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-26 14:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-25 14:49 [PATCH] target/i386/seg_helper: remove shadowed variable Paolo Bonzini
2023-09-26 13:16 ` Markus Armbruster
2023-09-26 14:33   ` Paolo Bonzini
2023-09-26 14:53     ` Markus Armbruster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.