patch-2.1.82 linux/arch/i386/math-emu/get_address.c

Next file: linux/arch/i386/math-emu/reg_ld_str.c
Previous file: linux/arch/i386/math-emu/fpu_entry.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.81/linux/arch/i386/math-emu/get_address.c linux/arch/i386/math-emu/get_address.c
@@ -134,8 +134,8 @@
 
 
 static unsigned long vm86_segment(u_char segment,
-				  unsigned short *selector)
-{ 
+				  struct address *addr)
+{
   segment--;
 #ifdef PARANOID
   if ( segment > PREFIX_SS_ )
@@ -144,14 +144,14 @@
       math_abort(FPU_info,SIGSEGV);
     }
 #endif PARANOID
-  *selector = VM86_REG_(segment);
+  addr->selector = VM86_REG_(segment);
   return (unsigned long)VM86_REG_(segment) << 4;
 }
 
 
 /* This should work for 16 and 32 bit protected mode. */
 static long pm_address(u_char FPU_modrm, u_char segment,
-		       unsigned short *selector, long offset)
+		       struct address *addr, long offset)
 { 
   struct desc_struct descriptor;
   unsigned long base_address, limit, address, seg_top;
@@ -172,13 +172,17 @@
       /* fs and gs aren't used by the kernel, so they still have their
 	 user-space values. */
     case PREFIX_FS_-1:
-      __asm__("mov %%fs,%0":"=r" (*selector));
+      /* The cast is needed here to get gcc 2.8.0 to use a 16 bit register
+	 in the assembler statement. */
+      __asm__("mov %%fs,%0":"=r" ((unsigned short)addr->selector));
       break;
     case PREFIX_GS_-1:
-      __asm__("mov %%gs,%0":"=r" (*selector));
+      /* The cast is needed here to get gcc 2.8.0 to use a 16 bit register
+	 in the assembler statement. */
+      __asm__("mov %%gs,%0":"=r" ((unsigned short)addr->selector));
       break;
     default:
-      *selector = PM_REG_(segment);
+      addr->selector = PM_REG_(segment);
     }
 
   descriptor = LDT_DESCRIPTOR(PM_REG_(segment));
@@ -312,13 +316,12 @@
     case 0:
       break;
     case VM86:
-      address += vm86_segment(addr_modes.override.segment,
-			      (unsigned short *)&(addr->selector));
+      address += vm86_segment(addr_modes.override.segment, addr);
       break;
     case PM16:
     case SEG32:
       address = pm_address(FPU_modrm, addr_modes.override.segment,
-			   (unsigned short *)&(addr->selector), address);
+			   addr, address);
       break;
     default:
       EXCEPTION(EX_INTERNAL|0x133);
@@ -427,13 +430,12 @@
     case 0:
       break;
     case VM86:
-      address += vm86_segment(addr_modes.override.segment,
-			      (unsigned short *)&(addr->selector));
+      address += vm86_segment(addr_modes.override.segment, addr);
       break;
     case PM16:
     case SEG32:
       address = pm_address(FPU_modrm, addr_modes.override.segment,
-			   (unsigned short *)&(addr->selector), address);
+			   addr, address);
       break;
     default:
       EXCEPTION(EX_INTERNAL|0x131);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov