diff options
Diffstat (limited to 'lib9')
| -rw-r--r-- | lib9/getcallerpc-AIX-power.c | 12 | ||||
| -rw-r--r-- | lib9/getcallerpc-NetBSD-386.S | 7 | ||||
| -rw-r--r-- | lib9/getcallerpc-NetBSD-power.S | 6 | ||||
| -rw-r--r-- | lib9/setfcr-AIX-power.c | 39 | ||||
| -rw-r--r-- | lib9/setfcr-Linux-power.S | 4 | ||||
| -rw-r--r-- | lib9/setfcr-NetBSD-386.S | 15 | ||||
| -rw-r--r-- | lib9/setfcr-NetBSD-power.S | 33 | ||||
| -rw-r--r-- | lib9/setfcr-OpenBSD-386.S | 34 |
8 files changed, 138 insertions, 12 deletions
diff --git a/lib9/getcallerpc-AIX-power.c b/lib9/getcallerpc-AIX-power.c new file mode 100644 index 00000000..4a4e4fb5 --- /dev/null +++ b/lib9/getcallerpc-AIX-power.c @@ -0,0 +1,12 @@ +#include <lib9.h> + +ulong +getcallerpc(void *x) +{ +ulong *lp; + + lp = x; + + return lp[-1]; +} + diff --git a/lib9/getcallerpc-NetBSD-386.S b/lib9/getcallerpc-NetBSD-386.S index 09148627..08ea057e 100644 --- a/lib9/getcallerpc-NetBSD-386.S +++ b/lib9/getcallerpc-NetBSD-386.S @@ -1,8 +1,7 @@ - .file "getcallerpc-NetBSD-386.S" +#include <machine/asm.h> - .type getcallerpc,@function - .global getcallerpc -getcallerpc: +NENTRY(getcallerpc) movl 4(%esp), %eax movl -4(%eax), %eax ret + END(getcallerpc) diff --git a/lib9/getcallerpc-NetBSD-power.S b/lib9/getcallerpc-NetBSD-power.S new file mode 100644 index 00000000..cacbbc11 --- /dev/null +++ b/lib9/getcallerpc-NetBSD-power.S @@ -0,0 +1,6 @@ +#include <machine/asm.h> + +ENTRY_NOPROFILE(getcallerpc) + mflr %r3 + blr + END(getcallerpc) diff --git a/lib9/setfcr-AIX-power.c b/lib9/setfcr-AIX-power.c new file mode 100644 index 00000000..60939a27 --- /dev/null +++ b/lib9/setfcr-AIX-power.c @@ -0,0 +1,39 @@ +#include "lib9.h" + +ulong +getfcr(void) +{ + double fpscr; + + fpscr = __readflm(); + return ((ulong*)&fpscr)[1]; +} + +ulong +getfsr(void) +{ + double fpscr; + + fpscr = __readflm(); + return ((ulong*)&fpscr)[1]; +} + +void +setfsr(ulong fsr) +{ + double fpscr; + + fpscr = __readflm(); + (((ulong*)&fpscr)[1]) = fsr; + __setflm(fpscr); +} + +void +setfcr(ulong fcr) +{ + double fpscr; + + fpscr = __readflm(); + (((ulong*)&fpscr)[1]) = fcr; + __setflm(fpscr); +} diff --git a/lib9/setfcr-Linux-power.S b/lib9/setfcr-Linux-power.S index 6a2acfa0..f6bd7433 100644 --- a/lib9/setfcr-Linux-power.S +++ b/lib9/setfcr-Linux-power.S @@ -3,13 +3,13 @@ FN(getfcr): mffs %f0 - stfdu %f0,-16(%r1) + stfd %f0,-16(%r1) lw %r3,-12(%r1) blr FN(getfsr): mffs %f0 - stfdu %f0,-16(%r1) + stfd %f0,-16(%r1) lw %r3,-12(%r1) blr diff --git a/lib9/setfcr-NetBSD-386.S b/lib9/setfcr-NetBSD-386.S index d981f36a..06a6b78d 100644 --- a/lib9/setfcr-NetBSD-386.S +++ b/lib9/setfcr-NetBSD-386.S @@ -1,18 +1,18 @@ +#include <machine/asm.h> -#define FN(x) .type x,@function; .global x; x #define ENT subl $16, %esp #define RET addl $16, %esp; ret - .file "setfcr-Linux-386.S" -FN(setfcr): +NENTRY(setfcr) ENT xorb $0x3f, %al movl %eax, (%esp) fwait fldcw (%esp) RET + END(setfcr) -FN(getfcr): +NENTRY(getfcr) ENT fwait fstcw (%esp) @@ -20,15 +20,18 @@ FN(getfcr): andl $0xffff, %eax xorb $0x3f, %al RET + END(getfcr) -FN(getfsr): +NENTRY(getfsr) ENT fwait fstsw (%esp) movw (%esp), %ax andl $0xffff, %eax RET + END(getfsr) -FN(setfsr): +NENTRY(setfsr) fclex ret + END(setfsr) diff --git a/lib9/setfcr-NetBSD-power.S b/lib9/setfcr-NetBSD-power.S new file mode 100644 index 00000000..820fb29f --- /dev/null +++ b/lib9/setfcr-NetBSD-power.S @@ -0,0 +1,33 @@ +#include <machine/asm.h> + +ENTRY_NOPROFILE(getfcr) + mffs %f0 + stfd %f0,-16(%r1) + lwz %r3,-12(%r1) + blr + END(getfcr) + +ENTRY_NOPROFILE(getfsr) + mffs %f0 + stfd %f0,-16(%r1) + lwz %r3,-12(%r1) + blr + END(getfsr) + +ENTRY_NOPROFILE(setfsr) + sync + stw %r3,-12(%r1) + lfd %f0,-16(%r1) + mtfsf 0xff, %f0 + isync + blr + END(setfsr) + +ENTRY_NOPROFILE(setfcr) + sync + stw %r3,-12(%r1) + lfd %f0,-16(%r1) + mtfsf 0xff, %f0 + isync + blr + END(setfcr) diff --git a/lib9/setfcr-OpenBSD-386.S b/lib9/setfcr-OpenBSD-386.S new file mode 100644 index 00000000..d981f36a --- /dev/null +++ b/lib9/setfcr-OpenBSD-386.S @@ -0,0 +1,34 @@ + +#define FN(x) .type x,@function; .global x; x +#define ENT subl $16, %esp +#define RET addl $16, %esp; ret + + .file "setfcr-Linux-386.S" +FN(setfcr): + ENT + xorb $0x3f, %al + movl %eax, (%esp) + fwait + fldcw (%esp) + RET + +FN(getfcr): + ENT + fwait + fstcw (%esp) + movw (%esp), %ax + andl $0xffff, %eax + xorb $0x3f, %al + RET + +FN(getfsr): + ENT + fwait + fstsw (%esp) + movw (%esp), %ax + andl $0xffff, %eax + RET + +FN(setfsr): + fclex + ret |
