patch-2.1.4 linux/arch/i386/math-emu/reg_ld_str.c

Next file: linux/arch/i386/mm/fault.c
Previous file: linux/arch/i386/math-emu/load_store.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.3/linux/arch/i386/math-emu/reg_ld_str.c linux/arch/i386/math-emu/reg_ld_str.c
@@ -48,9 +48,9 @@
 
   RE_ENTRANT_CHECK_OFF;
   FPU_verify_area(VERIFY_READ, s, 10);
-  sigl = get_fs_long((unsigned long *) s);
-  sigh = get_fs_long(1 + (unsigned long *) s);
-  exp = get_fs_word(4 + (unsigned short *) s);
+  get_user(sigl, (unsigned long *) s);
+  get_user(sigh, 1 + (unsigned long *) s);
+  get_user(exp, 4 + (unsigned short *) s);
   RE_ENTRANT_CHECK_ON;
 
   loaded_data->tag = TW_Valid;   /* Default */
@@ -144,8 +144,8 @@
 
   RE_ENTRANT_CHECK_OFF;
   FPU_verify_area(VERIFY_READ, dfloat, 8);
-  m64 = get_fs_long(1 + (unsigned long *) dfloat);
-  l64 = get_fs_long((unsigned long *) dfloat);
+  get_user(m64, 1 + (unsigned long *) dfloat);
+  get_user(l64, (unsigned long *) dfloat);
   RE_ENTRANT_CHECK_ON;
 
   if (m64 & 0x80000000)
@@ -221,7 +221,7 @@
 
   RE_ENTRANT_CHECK_OFF;
   FPU_verify_area(VERIFY_READ, single, 4);
-  m32 = get_fs_long((unsigned long *) single);
+  get_user(m32, (unsigned long *) single);
   RE_ENTRANT_CHECK_ON;
 
   if (m32 & 0x80000000)
@@ -289,8 +289,7 @@
 
   RE_ENTRANT_CHECK_OFF;
   FPU_verify_area(VERIFY_READ, _s, 8);
-  ((unsigned long *)&s)[0] = get_fs_long((unsigned long *) _s);
-  ((unsigned long *)&s)[1] = get_fs_long(1 + (unsigned long *) _s);
+  copy_from_user(&s,_s,8);
   RE_ENTRANT_CHECK_ON;
 
   if (s == 0)
@@ -320,7 +319,7 @@
 
   RE_ENTRANT_CHECK_OFF;
   FPU_verify_area(VERIFY_READ, _s, 4);
-  s = (long)get_fs_long((unsigned long *) _s);
+  get_user(s, _s);
   RE_ENTRANT_CHECK_ON;
 
   if (s == 0)
@@ -351,7 +350,7 @@
   RE_ENTRANT_CHECK_OFF;
   FPU_verify_area(VERIFY_READ, _s, 2);
   /* Cast as short to get the sign extended. */
-  s = (short)get_fs_word((unsigned short *) _s);
+  get_user(s, _s);
   RE_ENTRANT_CHECK_ON;
 
   if (s == 0)
@@ -389,7 +388,7 @@
     {
       l *= 10;
       RE_ENTRANT_CHECK_OFF;
-      bcd = (unsigned char)get_fs_byte((unsigned char *) s+pos);
+      get_user(bcd, (unsigned char *) s+pos);
       RE_ENTRANT_CHECK_ON;
       l += bcd >> 4;
       l *= 10;
@@ -397,9 +396,11 @@
     }
  
   RE_ENTRANT_CHECK_OFF;
-  loaded_data->sign =
-    ((unsigned char)get_fs_byte((unsigned char *) s+9)) & 0x80 ?
-      SIGN_NEG : SIGN_POS;
+  {
+    unsigned char sign;
+    get_user(sign, (unsigned char *) s+9);
+    loaded_data->sign = (sign & 0x80) ? SIGN_NEG : SIGN_POS;
+  }
   RE_ENTRANT_CHECK_ON;
 
   if (l == 0)
@@ -445,9 +446,9 @@
       /* Put out the QNaN indefinite */
       RE_ENTRANT_CHECK_OFF;
       FPU_verify_area(VERIFY_WRITE,d,10);
-      put_fs_long(0, (unsigned long *) d);
-      put_fs_long(0xc0000000, 1 + (unsigned long *) d);
-      put_fs_word(0xffff, 4 + (short *) d);
+      put_user(0, (unsigned long *) d);
+      put_user(0xc0000000, 1 + (unsigned long *) d);
+      put_user(0xffff, 4 + (short *) d);
       RE_ENTRANT_CHECK_ON;
       return 1;
     }
@@ -636,8 +637,8 @@
 	  /* Put out the QNaN indefinite */
 	  RE_ENTRANT_CHECK_OFF;
 	  FPU_verify_area(VERIFY_WRITE,(void *)dfloat,8);
-	  put_fs_long(0, (unsigned long *) dfloat);
-	  put_fs_long(0xfff80000, 1 + (unsigned long *) dfloat);
+	  put_user(0, (unsigned long *) dfloat);
+	  put_user(0xfff80000, 1 + (unsigned long *) dfloat);
 	  RE_ENTRANT_CHECK_ON;
 	  return 1;
 	}
@@ -649,8 +650,8 @@
 
   RE_ENTRANT_CHECK_OFF;
   FPU_verify_area(VERIFY_WRITE,(void *)dfloat,8);
-  put_fs_long(l[0], (unsigned long *)dfloat);
-  put_fs_long(l[1], 1 + (unsigned long *)dfloat);
+  put_user(l[0], (unsigned long *)dfloat);
+  put_user(l[1], 1 + (unsigned long *)dfloat);
   RE_ENTRANT_CHECK_ON;
 
   return 1;
@@ -829,7 +830,7 @@
 	  /* Put out the QNaN indefinite */
 	  RE_ENTRANT_CHECK_OFF;
 	  FPU_verify_area(VERIFY_WRITE,(void *)single,4);
-	  put_fs_long(0xffc00000, (unsigned long *) single);
+	  put_user(0xffc00000, (unsigned long *) single);
 	  RE_ENTRANT_CHECK_ON;
 	  return 1;
 	}
@@ -848,7 +849,7 @@
 
   RE_ENTRANT_CHECK_OFF;
   FPU_verify_area(VERIFY_WRITE,(void *)single,4);
-  put_fs_long(templ,(unsigned long *) single);
+  put_user(templ,(unsigned long *) single);
   RE_ENTRANT_CHECK_ON;
 
   return 1;
@@ -906,8 +907,7 @@
 
   RE_ENTRANT_CHECK_OFF;
   FPU_verify_area(VERIFY_WRITE,(void *)d,8);
-  put_fs_long(((long *)&tll)[0],(unsigned long *) d);
-  put_fs_long(((long *)&tll)[1],1 + (unsigned long *) d);
+  copy_to_user(d, &tll, 8);
   RE_ENTRANT_CHECK_ON;
 
   return 1;
@@ -961,7 +961,7 @@
 
   RE_ENTRANT_CHECK_OFF;
   FPU_verify_area(VERIFY_WRITE,d,4);
-  put_fs_long(t.sigl, (unsigned long *) d);
+  put_user(t.sigl, (unsigned long *) d);
   RE_ENTRANT_CHECK_ON;
 
   return 1;
@@ -1015,7 +1015,7 @@
 
   RE_ENTRANT_CHECK_OFF;
   FPU_verify_area(VERIFY_WRITE,d,2);
-  put_fs_word((short)t.sigl,(short *) d);
+  put_user((short)t.sigl,(short *) d);
   RE_ENTRANT_CHECK_ON;
 
   return 1;
@@ -1056,10 +1056,10 @@
 	  RE_ENTRANT_CHECK_OFF;
 	  FPU_verify_area(VERIFY_WRITE,d,10);
 	  for ( i = 0; i < 7; i++)
-	    put_fs_byte(0, (unsigned char *) d+i); /* These bytes "undefined" */
-	  put_fs_byte(0xc0, (unsigned char *) d+7); /* This byte "undefined" */
-	  put_fs_byte(0xff, (unsigned char *) d+8);
-	  put_fs_byte(0xff, (unsigned char *) d+9);
+	    put_user(0, (unsigned char *) d+i); /* These bytes "undefined" */
+	  put_user(0xc0, (unsigned char *) d+7); /* This byte "undefined" */
+	  put_user(0xff, (unsigned char *) d+8);
+	  put_user(0xff, (unsigned char *) d+9);
 	  RE_ENTRANT_CHECK_ON;
 	  return 1;
 	}
@@ -1080,11 +1080,11 @@
       b = div_small(&ll, 10);
       b |= (div_small(&ll, 10)) << 4;
       RE_ENTRANT_CHECK_OFF;
-      put_fs_byte(b,(unsigned char *) d+i);
+      put_user(b,(unsigned char *) d+i);
       RE_ENTRANT_CHECK_ON;
     }
   RE_ENTRANT_CHECK_OFF;
-  put_fs_byte(sign,(unsigned char *) d+9);
+  put_user(sign,(unsigned char *) d+9);
   RE_ENTRANT_CHECK_ON;
 
   return 1;
@@ -1172,13 +1172,13 @@
     {
       RE_ENTRANT_CHECK_OFF;
       FPU_verify_area(VERIFY_READ, s, 0x0e);
-      control_word = get_fs_word((unsigned short *) s);
-      partial_status = get_fs_word((unsigned short *) (s+2));
-      tag_word = get_fs_word((unsigned short *) (s+4));
-      instruction_address.offset = get_fs_word((unsigned short *) (s+6));
-      instruction_address.selector = get_fs_word((unsigned short *) (s+8));
-      operand_address.offset = get_fs_word((unsigned short *) (s+0x0a));
-      operand_address.selector = get_fs_word((unsigned short *) (s+0x0c));
+      get_user(control_word, (unsigned short *) s);
+      get_user(partial_status, (unsigned short *) (s+2));
+      get_user(tag_word, (unsigned short *) (s+4));
+      get_user(instruction_address.offset, (unsigned short *) (s+6));
+      get_user(instruction_address.selector, (unsigned short *) (s+8));
+      get_user(operand_address.offset, (unsigned short *) (s+0x0a));
+      get_user(operand_address.selector, (unsigned short *) (s+0x0c));
       RE_ENTRANT_CHECK_ON;
       s += 0x0e;
       if ( addr_modes.default_mode == VM86 )
@@ -1192,14 +1192,14 @@
     {
       RE_ENTRANT_CHECK_OFF;
       FPU_verify_area(VERIFY_READ, s, 0x1c);
-      control_word = get_fs_word((unsigned short *) s);
-      partial_status = get_fs_word((unsigned short *) (s+4));
-      tag_word = get_fs_word((unsigned short *) (s+8));
-      instruction_address.offset = get_fs_long((unsigned long *) (s+0x0c));
-      instruction_address.selector = get_fs_word((unsigned short *) (s+0x10));
-      instruction_address.opcode = get_fs_word((unsigned short *) (s+0x12));
-      operand_address.offset = get_fs_long((unsigned long *) (s+0x14));
-      operand_address.selector = get_fs_long((unsigned long *) (s+0x18));
+      get_user(control_word, (unsigned short *) s);
+      get_user(partial_status, (unsigned short *) (s+4));
+      get_user(tag_word, (unsigned short *) (s+8));
+      get_user(instruction_address.offset, (unsigned long *) (s+0x0c));
+      get_user(instruction_address.selector, (unsigned short *) (s+0x10));
+      get_user(instruction_address.opcode, (unsigned short *) (s+0x12));
+      get_user(operand_address.offset, (unsigned long *) (s+0x14));
+      get_user(operand_address.selector, (unsigned long *) (s+0x18));
       RE_ENTRANT_CHECK_ON;
       s += 0x1c;
     }
@@ -1310,25 +1310,25 @@
       RE_ENTRANT_CHECK_OFF;
       FPU_verify_area(VERIFY_WRITE,d,14);
 #ifdef PECULIAR_486
-      put_fs_long(control_word & ~0xe080, (unsigned short *) d);
+      put_user(control_word & ~0xe080, (unsigned long *) d);
 #else
-      put_fs_word(control_word, (unsigned short *) d);
+      put_user(control_word, (unsigned short *) d);
 #endif PECULIAR_486
-      put_fs_word(status_word(), (unsigned short *) (d+2));
-      put_fs_word(tag_word(), (unsigned short *) (d+4));
-      put_fs_word(instruction_address.offset, (unsigned short *) (d+6));
-      put_fs_word(operand_address.offset, (unsigned short *) (d+0x0a));
+      put_user(status_word(), (unsigned short *) (d+2));
+      put_user(tag_word(), (unsigned short *) (d+4));
+      put_user(instruction_address.offset, (unsigned short *) (d+6));
+      put_user(operand_address.offset, (unsigned short *) (d+0x0a));
       if ( addr_modes.default_mode == VM86 )
 	{
-	  put_fs_word((instruction_address.offset & 0xf0000) >> 4,
+	  put_user((instruction_address.offset & 0xf0000) >> 4,
 		      (unsigned short *) (d+8));
-	  put_fs_word((operand_address.offset & 0xf0000) >> 4,
+	  put_user((operand_address.offset & 0xf0000) >> 4,
 		      (unsigned short *) (d+0x0c));
 	}
       else
 	{
-	  put_fs_word(instruction_address.selector, (unsigned short *) (d+8));
-	  put_fs_word(operand_address.selector, (unsigned short *) (d+0x0c));
+	  put_user(instruction_address.selector, (unsigned short *) (d+8));
+	  put_user(operand_address.selector, (unsigned short *) (d+0x0c));
 	}
       RE_ENTRANT_CHECK_ON;
       d += 0x0e;
@@ -1339,24 +1339,24 @@
       FPU_verify_area(VERIFY_WRITE,d,28);
 #ifdef PECULIAR_486
       /* An 80486 sets all the reserved bits to 1. */
-      put_fs_long(0xffff0040 | (control_word & ~0xe080), (unsigned long *) d);
-      put_fs_long(0xffff0000 | status_word(), (unsigned long *) (d+4));
-      put_fs_long(0xffff0000 | tag_word(), (unsigned long *) (d+8));
+      put_user(0xffff0040 | (control_word & ~0xe080), (unsigned long *) d);
+      put_user(0xffff0000 | status_word(), (unsigned long *) (d+4));
+      put_user(0xffff0000 | tag_word(), (unsigned long *) (d+8));
 #else
-      put_fs_word(control_word, (unsigned short *) d);
-      put_fs_word(status_word(), (unsigned short *) (d+4));
-      put_fs_word(tag_word(), (unsigned short *) (d+8));
+      put_user(control_word, (unsigned short *) d);
+      put_user(status_word(), (unsigned short *) (d+4));
+      put_user(tag_word(), (unsigned short *) (d+8));
 #endif PECULIAR_486
-      put_fs_long(instruction_address.offset, (unsigned long *) (d+0x0c));
-      put_fs_word(instruction_address.selector, (unsigned short *) (d+0x10));
-      put_fs_word(instruction_address.opcode, (unsigned short *) (d+0x12));
-      put_fs_long(operand_address.offset, (unsigned long *) (d+0x14));
+      put_user(instruction_address.offset, (unsigned long *) (d+0x0c));
+      put_user(instruction_address.selector, (unsigned short *) (d+0x10));
+      put_user(instruction_address.opcode, (unsigned short *) (d+0x12));
+      put_user(operand_address.offset, (unsigned long *) (d+0x14));
 #ifdef PECULIAR_486
       /* An 80486 sets all the reserved bits to 1. */
-      put_fs_word(operand_address.selector, (unsigned short *) (d+0x18));
-      put_fs_word(0xffff, (unsigned short *) (d+0x1a));
+      put_user(operand_address.selector, (unsigned short *) (d+0x18));
+      put_user(0xffff, (unsigned short *) (d+0x1a));
 #else
-      put_fs_long(operand_address.selector, (unsigned long *) (d+0x18));
+      put_user(operand_address.selector, (unsigned long *) (d+0x18));
 #endif PECULIAR_486
       RE_ENTRANT_CHECK_ON;
       d += 0x1c;
@@ -1425,8 +1425,8 @@
     {
       /* just copy the reg */
       RE_ENTRANT_CHECK_OFF;
-      put_fs_long(rp->sigl, (unsigned long *) d);
-      put_fs_long(rp->sigh, (unsigned long *) (d + 4));
+      put_user(rp->sigl, (unsigned long *) d);
+      put_user(rp->sigh, (unsigned long *) (d + 4));
       RE_ENTRANT_CHECK_ON;
     }
   else
@@ -1441,12 +1441,12 @@
       round_to_int(&tmp);
       e = 0;
       RE_ENTRANT_CHECK_OFF;
-      put_fs_long(tmp.sigl, (unsigned long *) d);
-      put_fs_long(tmp.sigh, (unsigned long *) (d + 4));
+      put_user(tmp.sigl, (unsigned long *) d);
+      put_user(tmp.sigh, (unsigned long *) (d + 4));
       RE_ENTRANT_CHECK_ON;
     }
   e |= rp->sign == SIGN_POS ? 0 : 0x8000;
   RE_ENTRANT_CHECK_OFF;
-  put_fs_word(e, (unsigned short *) (d + 8));
+  put_user(e, (unsigned short *) (d + 8));
   RE_ENTRANT_CHECK_ON;
 }

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