Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/ia64/ia64 Add more code from FreeBSD, still needs work



details:   https://anonhg.NetBSD.org/src/rev/c5a2c0b74b9d
branches:  trunk
changeset: 450991:c5a2c0b74b9d
user:      scole <scole%NetBSD.org@localhost>
date:      Thu May 02 17:34:01 2019 +0000

description:
Add more code from FreeBSD, still needs work

diffstat:

 sys/arch/ia64/ia64/syscall_stubs.S |  505 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 503 insertions(+), 2 deletions(-)

diffs (truncated from 521 to 300 lines):

diff -r 3c9888967d9d -r c5a2c0b74b9d sys/arch/ia64/ia64/syscall_stubs.S
--- a/sys/arch/ia64/ia64/syscall_stubs.S        Thu May 02 17:31:56 2019 +0000
+++ b/sys/arch/ia64/ia64/syscall_stubs.S        Thu May 02 17:34:01 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syscall_stubs.S,v 1.5 2019/01/09 18:03:34 scole Exp $  */
+/*     $NetBSD: syscall_stubs.S,v 1.6 2019/05/02 17:34:01 scole Exp $  */
 
 /*-
  * Copyright (c) 2002, 2003 Marcel Moolenaar
@@ -74,9 +74,510 @@
  * information they need and we have the freedom to move code around.
  */
 
+/* XXX fix */  
+#define syscall                0       
+#define SYS_sigreturn  0
+       
        .section        .text.gateway, "ax"
        .align          PAGE_SIZE
        .global         ia64_gateway_page
 ia64_gateway_page:
-#warning this is a stub!!!
+{       .mmb
+        mov             r14=ar.k7               // Memory stack
+        mov             r15=ar.k6               // Register stack
+        epc
+        ;;
+}
+{       .mlx
+        mov             r11=psr
+        movl            r31=epc_syscall
+        ;;
+}
+{       .mib
+        rum             psr.be
+        mov             b7=r31
+        br              b7
+        ;;
+}
+gw_ret:
+{       .mmi
+        mov             ar.rnat=r22
+        ;;
+        mov             ar.rsc=r24
+        mov             ar.pfs=r20
+}
+{       .mib
+        mov             ar.fpsr=r25
+        mov             b0=r18
+        br.sptk         b6
+        ;;
+}
+gw_ret_ia32:
+{       .mmi
+        flushrs
+        nop             0
+        nop             0
+        ;;
+}
+{       .mib
+        nop             0
+        nop             0
+        br.ia.sptk      b6
+        ;;
+}
+
+
+ENTRY_NOPROFILE(break_sigtramp, 0)
+{       .mib
+        mov             ar.rsc=0
+        cmp.ne          p15,p0=0,gp
+        cover
+        ;;
+}
+{       .mmi
+        flushrs
+(p15)   invala
+        add             r16=16+UC_MCONTEXT+MC_SPECIAL,sp
+        ;;
+}
+{       .mmi
+        mov             r17=ar.bsp
+        mov             r18=ar.rnat
+        add             r14=40,r16
+        ;;
+}
+{       .mmi
+        st8             [r14]=r17,64            // bspstore
+(p15)   mov             ar.bspstore=gp
+        add             r15=48,r16
+        ;;
+}
+{       .mmi
+        st8             [r15]=r18               // rnat
+        st8             [r14]=r0                // ndirty
+        nop             0
+        ;;
+}
+{       .mmi
+        alloc           r14=ar.pfs, 0, 0, 3, 0
+        mov             ar.rsc=15
+        mov             out0=r8
+        ;;
+}
+{       .mmi
+        ld8             r16=[r10],8             // function address
+        ;;
+        ld8             gp=[r10]                // function's gp value
+        mov             b7=r16
+        ;;
+}
+{       .mib
+        mov             out1=r9
+        add             out2=16,sp
+        br.call.sptk    rp=b7
+        ;;
+}
+{       .mmi
+        mov             r15=SYS_sigreturn
+        add             out0=16,sp
+        break           0x100000
+        ;;
+}
+{       .mmi
+        mov             r15=SYS_exit
+        mov             out0=ret0
+        break           0x100000
+        ;;
+}
+END(break_sigtramp)
+
+ENTRY_NOPROFILE(epc_sigtramp, 0)
+{       .mmi
+        ld8             r16=[r10],8             // function address
+        mov             ar.rsc=0
+        cmp.ne          p15,p0=0,gp
+        ;;
+}
+{       .mmi
+(p15)   invala
+(p15)   mov             ar.bspstore=gp
+        mov             b7=r16
+        ;;
+}
+{       .mmi
+        alloc           r14=ar.pfs, 0, 0, 3, 0
+        mov             ar.rsc=15
+        nop             0
+        ;;
+}
+{       .mii
+        ld8             gp=[r10]                // function's gp value
+        mov             out0=r8
+        mov             out1=r9
+}
+{       .mib
+        add             out2=16,sp
+        nop             0
+        br.call.sptk    rp=b7
+        ;;
+}
+        add             out0=16,sp
+/* XXX fix */  
+#if 0
+        CALLSYS_NOERROR(sigreturn)
+        mov             out0=ret0
+        CALLSYS_NOERROR(exit)
+#endif 
+END(epc_sigtramp)
+
+        .align          PAGE_SIZE
+
+        .text
 
+ENTRY_NOPROFILE(epc_syscall, 8)
+        .prologue
+        .unwabi         @svr4, 'E'
+        .save           rp, r0
+        .body
+{       .mmi
+        mov             r16=ar.rsc
+        mov             ar.rsc=0
+        nop             0
+        ;;
+}
+{       .mmi
+        mov             r18=ar.bspstore
+        ;;
+        mov             r19=ar.rnat
+        dep             r15=r18,r15,0,9
+        ;;
+}
+{       .mmi
+        mov             r21=ar.unat
+        add             r30=-SIZEOF_TRAPFRAME,r14
+        mov             r20=sp
+        ;;
+}
+{       .mii
+        mov             r17=r13
+        dep             r30=0,r30,0,10
+        ;;
+        add             sp=-16,r30
+        ;;
+}
+{       .mmi
+        mov             ar.bspstore=r15
+        ;;
+        mov             ar.rnat=r19
+        add             r31=8,r30
+        ;;
+}
+{       .mmi
+        mov             r13=ar.k4
+        mov             r22=ar.fpsr
+        sub             r29=r14,r30
+}
+{       .mmi
+        mov             r23=ar.bsp
+        mov             ar.rsc=3
+        add             r28=FRAME_SYSCALL,r0
+        ;;
+}
+{       .mmi
+        st8             [r30]=r29,16            // tf_length
+        st8             [r31]=r28,16            // tf_flags
+        mov             r24=rp
+        ;;
+}
+{       .mmi
+        st8             [r30]=r20,16            // sp
+        st8             [r31]=r21,16            // unat
+        mov             r25=pr
+        ;;
+}
+{       .mmi
+        st8             [r30]=r10,16            // rp (syscall caller)
+        st8             [r31]=r25,16            // pr
+        mov             r26=ar.pfs
+        ;;
+}
+{       .mmi
+        st8             [r30]=r9,16             // pfs (syscall caller)
+        st8             [r31]=r18,16            // bspstore
+        sub             r27=r23,r15
+        ;;
+}
+{       .mmi
+        st8             [r30]=r19,16            // rnat
+        st8             [r31]=r0,16             // __spare
+        dep             r11=-1,r11,44,1         // Set psr.bn=1
+        ;;
+}
+{       .mmi
+        st8             [r30]=r17,16            // tp
+        st8             [r31]=r16,16            // rsc
+        dep             r11=-1,r11,32,2         // Set psr.cpl=3
+        ;;
+}
+{       .mmi
+        st8             [r30]=r22,16            // fpsr
+        st8             [r31]=r11,16            // psr
+        nop             0
+        ;;
+}
+{       .mmi
+        st8             [r30]=r1,16             // gp
+        st8             [r31]=r27,16            // ndirty
+        nop             0
+        ;;
+}
+{       .mmi
+        st8             [r30]=r26,16            // pfs (syscall stub)
+        st8             [r31]=r24,16            // rp (syscall stub)
+        nop             0
+        ;;
+}
+{       .mmi
+        st8             [r30]=r0,80             // ifa
+        st8             [r31]=r0,80             // isr
+        nop             0
+        ;;
+}
+{       .mmi
+        alloc           r14=ar.pfs,0,0,8,0
+        st8             [r30]=r8,16             // syscall number (=r15)
+        nop             0
+        ;;
+}
+{       .mmi
+        .mem.offset     0,0
+        st8.spill       [r31]=r32,16            // arg0 (=r16)
+        .mem.offset     8,0
+        st8.spill       [r30]=r33,16            // arg1 (=r17)
+        nop             0
+        ;;
+}
+{       .mmi
+        .mem.offset     16,0
+        st8.spill       [r31]=r34,16            // arg2 (=r18)



Home | Main Index | Thread Index | Old Index