patch-2.4.15 linux/arch/ia64/kernel/gate.S
Next file: linux/arch/ia64/kernel/head.S
Previous file: linux/arch/ia64/kernel/fw-emu.c
Back to the patch index
Back to the overall index
- Lines: 156
- Date:
Fri Nov 9 14:26:17 2001
- Orig file:
v2.4.14/linux/arch/ia64/kernel/gate.S
- Orig date:
Sun Aug 12 13:27:58 2001
diff -u --recursive --new-file v2.4.14/linux/arch/ia64/kernel/gate.S linux/arch/ia64/kernel/gate.S
@@ -3,7 +3,7 @@
* region. For now, it contains the signal trampoline code only.
*
* Copyright (C) 1999-2001 Hewlett-Packard Co
- * Copyright (C) 1999-2001 David Mosberger-Tang <davidm@hpl.hp.com>
+ * David Mosberger-Tang <davidm@hpl.hp.com>
*/
#include <asm/asmmacro.h>
@@ -18,7 +18,6 @@
# define ARG0_OFF (16 + IA64_SIGFRAME_ARG0_OFFSET)
# define ARG1_OFF (16 + IA64_SIGFRAME_ARG1_OFFSET)
# define ARG2_OFF (16 + IA64_SIGFRAME_ARG2_OFFSET)
-# define RBS_BASE_OFF (16 + IA64_SIGFRAME_RBS_BASE_OFFSET)
# define SIGHANDLER_OFF (16 + IA64_SIGFRAME_HANDLER_OFFSET)
# define SIGCONTEXT_OFF (16 + IA64_SIGFRAME_SIGCONTEXT_OFFSET)
@@ -32,6 +31,8 @@
# define PR_OFF IA64_SIGCONTEXT_PR_OFFSET
# define RP_OFF IA64_SIGCONTEXT_B0_OFFSET
# define SP_OFF IA64_SIGCONTEXT_R12_OFFSET
+# define RBS_BASE_OFF IA64_SIGCONTEXT_RBS_BASE_OFFSET
+# define LOADRS_OFF IA64_SIGCONTEXT_LOADRS_OFFSET
# define base0 r2
# define base1 r3
/*
@@ -73,34 +74,37 @@
.vframesp SP_OFF+SIGCONTEXT_OFF
.body
- .prologue
+ .label_state 1
+
adds base0=SIGHANDLER_OFF,sp
- adds base1=RBS_BASE_OFF,sp
+ adds base1=RBS_BASE_OFF+SIGCONTEXT_OFF,sp
br.call.sptk.many rp=1f
1:
ld8 r17=[base0],(ARG0_OFF-SIGHANDLER_OFF) // get pointer to signal handler's plabel
- ld8 r15=[base1],(ARG1_OFF-RBS_BASE_OFF) // get address of new RBS base (or NULL)
+ ld8 r15=[base1] // get address of new RBS base (or NULL)
cover // push args in interrupted frame onto backing store
;;
+ cmp.ne p8,p0=r15,r0 // do we need to switch the rbs?
+ mov.m r9=ar.bsp // fetch ar.bsp
+ .spillsp.p p8, ar.rnat, RNAT_OFF+SIGCONTEXT_OFF
+(p8) br.cond.spnt setup_rbs // yup -> (clobbers r14, r15, and r16)
+back_from_setup_rbs:
+
.save ar.pfs, r8
alloc r8=ar.pfs,0,0,3,0 // get CFM0, EC0, and CPL0 into r8
ld8 out0=[base0],16 // load arg0 (signum)
+ adds base1=(ARG1_OFF-(RBS_BASE_OFF+SIGCONTEXT_OFF)),base1
;;
ld8 out1=[base1] // load arg1 (siginfop)
ld8 r10=[r17],8 // get signal handler entry point
;;
ld8 out2=[base0] // load arg2 (sigcontextp)
ld8 gp=[r17] // get signal handler's global pointer
- cmp.ne p8,p0=r15,r0 // do we need to switch the rbs?
- mov.m r17=ar.bsp // fetch ar.bsp
- .spillsp.p p8, ar.rnat, RNAT_OFF+SIGCONTEXT_OFF
-(p8) br.cond.spnt.few setup_rbs // yup -> (clobbers r14 and r16)
-back_from_setup_rbs:
adds base0=(BSP_OFF+SIGCONTEXT_OFF),sp
;;
.spillsp ar.bsp, BSP_OFF+SIGCONTEXT_OFF
- st8 [base0]=r17,(CFM_OFF-BSP_OFF) // save sc_ar_bsp
+ st8 [base0]=r9,(CFM_OFF-BSP_OFF) // save sc_ar_bsp
dep r8=0,r8,38,26 // clear EC0, CPL0 and reserved bits
adds base1=(FR6_OFF+16+SIGCONTEXT_OFF),sp
;;
@@ -123,7 +127,7 @@
;;
stf.spill [base0]=f14,32
stf.spill [base1]=f15,32
- br.call.sptk.few rp=b6 // call the signal handler
+ br.call.sptk.many rp=b6 // call the signal handler
.ret0: adds base0=(BSP_OFF+SIGCONTEXT_OFF),sp
;;
ld8 r15=[base0],(CFM_OFF-BSP_OFF) // fetch sc_ar_bsp and advance to CFM_OFF
@@ -131,7 +135,7 @@
;;
ld8 r8=[base0] // restore (perhaps modified) CFM0, EC0, and CPL0
cmp.ne p8,p0=r14,r15 // do we need to restore the rbs?
-(p8) br.cond.spnt.few restore_rbs // yup -> (clobbers r14 and r16)
+(p8) br.cond.spnt restore_rbs // yup -> (clobbers r14 and r16)
;;
back_from_restore_rbs:
adds base0=(FR6_OFF+SIGCONTEXT_OFF),sp
@@ -154,30 +158,52 @@
mov r15=__NR_rt_sigreturn
break __BREAK_SYSCALL
+ .body
+ .copy_state 1
setup_rbs:
- flushrs // must be first in insn
mov ar.rsc=0 // put RSE into enforced lazy mode
- adds r16=(RNAT_OFF+SIGCONTEXT_OFF),sp
;;
- mov r14=ar.rnat // get rnat as updated by flushrs
- mov ar.bspstore=r15 // set new register backing store area
+ .save ar.rnat, r16
+ mov r16=ar.rnat // save RNaT before switching backing store area
+ adds r14=(RNAT_OFF+SIGCONTEXT_OFF),sp
+
+ mov ar.bspstore=r15 // switch over to new register backing store area
;;
.spillsp ar.rnat, RNAT_OFF+SIGCONTEXT_OFF
- st8 [r16]=r14 // save sc_ar_rnat
+ st8 [r14]=r16 // save sc_ar_rnat
+ adds r14=(LOADRS_OFF+SIGCONTEXT_OFF),sp
+
+ mov.m r16=ar.bsp // sc_loadrs <- (new bsp - new bspstore) << 16
+ ;;
+ invala
+ sub r15=r16,r15
+ ;;
+ shl r15=r15,16
+ ;;
+ st8 [r14]=r15 // save sc_loadrs
mov ar.rsc=0xf // set RSE into eager mode, pl 3
- invala // invalidate ALAT
- br.cond.sptk.many back_from_setup_rbs
+ br.cond.sptk back_from_setup_rbs
+ .prologue
+ .copy_state 1
+ .spillsp ar.rnat, RNAT_OFF+SIGCONTEXT_OFF
+ .body
restore_rbs:
- flushrs
- mov ar.rsc=0 // put RSE into enforced lazy mode
+ alloc r2=ar.pfs,0,0,0,0 // alloc null frame
+ adds r16=(LOADRS_OFF+SIGCONTEXT_OFF),sp
+ ;;
+ ld8 r14=[r16]
adds r16=(RNAT_OFF+SIGCONTEXT_OFF),sp
;;
+ mov ar.rsc=r14 // put RSE into enforced lazy mode
ld8 r14=[r16] // get new rnat
- mov ar.bspstore=r15 // set old register backing store area
;;
- mov ar.rnat=r14 // establish new rnat
+ loadrs // restore dirty partition
+ ;;
+ mov ar.bspstore=r15 // switch back to old register backing store area
+ ;;
+ mov ar.rnat=r14 // restore RNaT
mov ar.rsc=0xf // (will be restored later on from sc_ar_rsc)
// invala not necessary as that will happen when returning to user-mode
- br.cond.sptk.many back_from_restore_rbs
+ br.cond.sptk back_from_restore_rbs
END(ia64_sigtramp)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)