Print this page
8609 want a position independent CRT

@@ -22,24 +22,17 @@
 /*
  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-        .ident  "%Z%%M% %I%     %E% SMI"
+#include <sys/asm_linkage.h>
 
         .file   "fsr.s"
 
         .section        .data
         .align 4
 
-        .weak   __fsr_init_value
-
-__fsr_init_value_ptr:
-        .4byte  __fsr_init_value
-        .type   __fsr_init_value_ptr,@object
-        .size   __fsr_init_value_ptr,4
-
 /*
  * The following table maps trap enable bits in __fsr_init_value
  * (after shifting right one bit):
  *
  * bit 0 - inexact trap

@@ -92,33 +85,35 @@
         .byte   0b11100010
         .byte   0b11000010
 
         .size   trap_table,32
 
-        .section        .text
-        .align  4
-
-        .globl  __fsr
-        .type   __fsr,@function
-__fsr:
+ENTRY_NP(__fsr)
         pushl   %ebp
         movl    %esp,%ebp
         pushl   %edx
         pushl   %ecx
+        pushl   %ebx
         subl    $4,%esp
 
-        lea     __fsr_init_value_ptr, %ecx
-        movl    (%ecx),%ecx             /* get the value set by CG */
+        /* Setup PIC */
+        call    9f
+9:      popl    %ebx
+        addl    $_GLOBAL_OFFSET_TABLE_ + [. - 9b], %ebx
+
+        movl    8(%ebp), %ecx           /* the value set by CG is passed in */
         shrl    $1,%ecx                 /* get rid of fns bit */
         cmpl    $0,%ecx                 /* if remaining bits are zero */
         je      3f                      /*   there's nothing to do */
 
         fstcw   0(%esp)                 /* store the control word */
 
         movl    %ecx,%edx
         andl    $0x1f,%edx              /* get the trap enable bits */
-        movb    trap_table(%edx),%al
+        movl    trap_table@GOT(%ebx), %eax
+        addl    %eax,%edx
+        movb    (%edx),%al
         andb    %al,0(%esp)     /* unmask the corresponding exceptions */
 
         testl   $0x200,%ecx             /* test denormal trap enable */
         jz      1f                      /* skip if zero */
 

@@ -149,11 +144,11 @@
 1:
         fldcw   0(%esp)                 /* load the modified control word */
 
 3:
         addl    $4,%esp
+        popl    %ebx
         popl    %ecx
         popl    %edx
         popl    %ebp
         ret
-
-        .size   __fsr,[.-__fsr]
+SET_SIZE(__fsr)