PERFORCE change 30562 for review
Marcel Moolenaar
marcel at FreeBSD.org
Sun May 4 17:04:08 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=30562
Change 30562 by marcel at marcel_nfs on 2003/05/04 17:03:54
Cleanup context.s: remove most of the _get_* and _set_*
functions as they were unused. Rename _{g|s}et_callee_saved
and _{g|s{et)_callee_saved_fp to {save|restore}_callee_saved
and {save|restore}_sallee_saved_fp (resp) and expose them
in _regset.h. They come in handy for proper signal handling.
Affected files ...
.. //depot/projects/ia64_epc/sys/ia64/ia64/context.s#15 edit
.. //depot/projects/ia64_epc/sys/ia64/include/_regset.h#10 edit
Differences ...
==== //depot/projects/ia64_epc/sys/ia64/ia64/context.s#15 (text+ko) ====
@@ -305,283 +305,67 @@
END(swapctx)
/*
- * _getcontext(ucontext_t *ucp)
+ * save_callee_saved(struct _callee_saved *)
*/
-ENTRY(_getcontext, 1)
+ENTRY(save_callee_saved, 1)
{ .mii
-1: nop 0
- mov r17=ip
- add r16=UC_MCONTEXT+MC_SPECIAL,r32
- ;;
-}
-{ .mfb
- add r17=2f-1b,r17
nop 0
- br.sptk _get_special_sync
- ;;
-}
-{ .mmi
-2: alloc loc0=ar.pfs,1,2,1,0
- ;;
- add in0=UC_MCONTEXT,in0
- mov loc1=rp
- ;;
-}
-{ .mmb
- st8 [in0]=r0
- add out0=MC_PRESERVED,in0
- br.call.sptk rp=_get_callee_saved
- ;;
-}
-{ .mib
- add out0=MC_PRESERVED_FP,in0
- add in0=8,in0
- br.call.sptk rp=_get_callee_saved_fp
- ;;
-}
-{ .mii
- st8 [in0]=r0
- mov ar.pfs=loc0
- mov rp=loc1
- ;;
-}
-{ .mfb
- nop 0
- nop 0
- br.ret.sptk rp
+ add r14=8,r32
+ add r15=16,r32
;;
}
-END(_getcontext)
-
-/*
- * _setcontext(ucontext_t *ucp)
- */
-ENTRY(_setcontext, 1)
{ .mmi
- alloc loc0=ar.pfs,1,2,1,0
- ;;
- nop 0
- mov loc1=rp
- ;;
-}
-{ .mib
- nop 0
- add out0=UC_MCONTEXT+MC_PRESERVED_FP,in0
- br.call.sptk rp=_set_callee_saved_fp
- ;;
-}
-{ .mib
- nop 0
- add out0=UC_MCONTEXT+MC_PRESERVED,in0
- br.call.sptk rp=_set_callee_saved
- ;;
-}
-{ .mib
- nop 0
- add r16=UC_MCONTEXT+MC_SPECIAL,in0
- br.sptk _set_special_sync
- ;;
-}
-END(_setcontext)
-
-/*
- * _{get|set}_special_sync
- * Does not follow runtime convention!
- *
- * inputs: r16 struct _special
- * r17 return address
- */
-ENTRY(_get_special_sync, 0)
-{ .mii
- flushrs
- mov b6=r17
- add r17=8,r16
- ;;
-}
-{ .mmi
- st8 [r16]=r1,16 // gp
- st8 [r17]=r12,16 // sp
- mov r18=b0
- ;;
-}
-{ .mmi
- st8 [r16]=r13,16 // tp
- mov r19=ar.rsc
- mov r20=pr
- ;;
-}
-{ .mmi
- st8 [r17]=r18,16 // rp
- mov ar.rsc=0
- mov r21=ar.pfs
- ;;
-}
-{ .mmb
- st8 [r16]=r20,16 // pr
- st8 [r17]=r19,16 // ar.rsc
- nop 0
- ;;
-}
-{ .mmi
- st8 [r16]=r21,16 // ar.pfs
- mov r22=ar.bsp
- nop 1
- ;;
-}
-{ .mmb
- st8 [r17]=r22,16 // ar.bspstore
- mov r23=ar.rnat
- nop 2
- ;;
-}
-{ .mmi
- st8 [r16]=r23 // ar.rnat
- mov r24=ar.fpsr
- nop 3
- ;;
-}
-{ .mmb
- st8 [r17]=r24 // ar.fpsr
- mov ar.rsc=r19
- br.sptk b6
- ;;
-}
-END(_get_special_sync)
-
-/*
- * inputs: r16 struct _special
- */
-ENTRY(_set_special_sync, 0)
-{ .mmi
- invala
- mov ar.rsc=0
- add r17=8,r16
- ;;
-}
-{ .mmb
- ld8 r1=[r16],16 // gp
- ld8 r12=[r17],16 // sp
- nop 0
- ;;
-}
-{ .mmb
- ld8 r13=[r16],16 // tp
- ld8 r18=[r17],16 // rp
- nop 1
- ;;
-}
-{ .mmi
- ld8 r19=[r16],16 // pr
- ld8 r20=[r17],16 // ar.rsc
- mov b0=r18
- ;;
-}
-{ .mmi
- loadrs
- ld8 r21=[r16],16 // ar.pfs
- mov pr=r19,0x1fffe
- ;;
-}
-{ .mmi
- ld8 r22=[r17],16 // ar.bspstore
- ld8 r23=[r16] // ar.rnat
- mov ar.pfs=r21
- ;;
-}
-{ .mmb
- ld8 r24=[r17] // ar.fpsr
- mov ar.bspstore=r22
- nop 2
- ;;
-}
-{ .mmb
- mov ar.rnat=r23
- mov ar.rsc=r20
- nop 3
- ;;
-}
-{ .mib
- mov ar.fpsr=r24
- nop 4
- br.ret.sptk rp
- ;;
-}
-END(_set_special_sync)
-
-/*
- * General register sets:
- * _get_callee_saved - Save preserved registers.
- * _set_callee_saved - Restore preserved registers.
- * _get_caller_saved - Save scratch registers.
- * _set_caller_saved - Restore scratch registers.
- */
-
-/*
- * _get_callee_saved
- *
- * clobbers: r2,r3,r26-r31
- */
-ENTRY(_get_callee_saved, 1)
-{ .mii
- mov r31=ar.unat
- add r2=8,r32
- add r3=16,r32
- ;;
-}
-{ .mmi
.mem.offset 8,0
- st8.spill [r2]=r4,16 // r4
+ st8.spill [r14]=r4,16 // r4
.mem.offset 16,0
- st8.spill [r3]=r5,16 // r5
- mov r29=b1
+ st8.spill [r15]=r5,16 // r5
+ mov r16=b1
;;
}
{ .mmi
.mem.offset 24,0
- st8.spill [r2]=r6,16 // r6
+ st8.spill [r14]=r6,16 // r6
.mem.offset 32,0
- st8.spill [r3]=r7,16 // r7
- mov r28=b2
+ st8.spill [r15]=r7,16 // r7
+ mov r17=b2
;;
}
{ .mmi
- st8 [r2]=r31,16 // unat (before)
- mov r30=ar.unat
- mov r27=b3
+ st8 [r14]=r16,16 // b1
+ mov r18=ar.unat
+ mov r19=b3
;;
}
{ .mmi
- st8 [r32]=r30 // nat (after)
- st8 [r3]=r29,16 // b1
- mov r26=b4
+ st8 [r32]=r18 // nat (after)
+ st8 [r15]=r17,16 // b2
+ mov r16=b4
;;
}
{ .mmi
- st8 [r2]=r28,16 // b2
- st8 [r3]=r27,16 // b3
- mov r29=b5
+ st8 [r14]=r19,16 // b3
+ st8 [r15]=r16,16 // b4
+ mov r17=b5
;;
}
-{ .mmi
- st8 [r2]=r26,16 // b4
- st8 [r3]=r29 // b5
- mov r31=ar.lc
+{ .mfi
+ st8 [r14]=r17,16 // b5
+ nop 0
+ mov r16=ar.lc
;;
}
-{ .mfb
- st8 [r2]=r31 // ar.lc
- nop 0
+{ .mmb
+ st8 [r15]=r16 // ar.lc
+ st8 [r14]=r0 // __spare
br.ret.sptk rp
;;
}
-END(_get_callee_saved)
+END(save_callee_saved)
/*
- * _set_callee_saved
- *
- * clobbers: r27-r32
+ * restore_callee_saved(struct _callee_saved *)
*/
-ENTRY(_set_callee_saved, 1)
+ENTRY(restore_callee_saved, 1)
{ .mmi
ld8 r30=[r32],16 // nat (after)
;;
@@ -598,343 +382,45 @@
{ .mmb
ld8.fill r6=[r31],16 // r6
ld8.fill r7=[r32],16 // r7
- nop 1
+ nop 0
;;
}
{ .mmi
- ld8 r29=[r32],16 // b1
+ ld8 r30=[r31],16 // b1
+ ld8 r29=[r32],16 // b2
+ nop 0
;;
- ld8 r30=[r31],16 // unat (before)
- mov b1=r29
- ;;
}
{ .mmi
- ld8 r29=[r31],16 // b2
+ ld8 r28=[r31],16 // b3
+ ld8 r27=[r32],16 // b4
+ mov b1=r30
;;
- ld8 r28=[r32],16 // b3
+}
+{ .mii
+ ld8 r26=[r31] // b5
mov b2=r29
- ;;
-}
-{ .mmi
- ld8 r29=[r31],16 // b4
- ld8 r27=[r32] // b5
mov b3=r28
;;
}
{ .mii
- ld8 r28=[r31] // ar.lc
- mov b4=r29
- mov b5=r27
+ ld8 r25=[r32] // lc
+ mov b4=r27
+ mov b5=r26
;;
}
{ .mib
- mov ar.unat=r30
- mov ar.lc=r28
- br.ret.sptk rp
- ;;
-}
-END(_set_callee_saved)
-
-/*
- * _get_caller_saved
- *
- * Does not follow runtime specification:
- * inputs: r16 = pointer to struct _caller_saved
- * r17 = return address (no call/ret semantics)
- * precondition: Must be called with register bank 0 selected,
- *
- * postcondition: Will return with register bank 1 selected.
- */
-ENTRY(_get_caller_saved, 0)
- mov r18=ar.unat
- mov r19=r2
- add r2=8,r16
- mov r20=r3
- add r3=16,r16
- mov r21=r8
- ;;
-{ .mmi
- .mem.offset 8,0
- st8.spill [r2]=r19,16 // r2
- .mem.offset 16,0
- st8.spill [r3]=r20,16 // r3
- mov r8=r16
- ;;
-}
-{ .mmi
- .mem.offset 24,0
- st8.spill [r2]=r21,16 // r8
- .mem.offset 32,0
- st8.spill [r3]=r9,16 // r9
- mov r9=r17
- ;;
-}
-{ .mmi
- .mem.offset 40,0
- st8.spill [r2]=r10,16 // r10
- .mem.offset 48,0
- st8.spill [r3]=r11,16 // r11
- mov r10=r18
- ;;
-}
-{ .mmb
- .mem.offset 56,0
- st8.spill [r2]=r14,16 // r14
- .mem.offset 64,0
- st8.spill [r3]=r15,16 // r15
- bsw.1
- ;;
-}
- /* We're using register bank 1 now. */
-{ .mmi
- .mem.offset 72,0
- st8.spill [r2]=r16,16 // r16
- .mem.offset 80,0
- st8.spill [r3]=r17,16 // r17
- mov r14=b6
- ;;
-}
-{ .mmi
- .mem.offset 88,0
- st8.spill [r2]=r18,16 // r18
- .mem.offset 96,0
- st8.spill [r3]=r19,16 // r19
- mov r15=b7
- ;;
-}
-{ .mmi
- .mem.offset 104,0
- st8.spill [r2]=r20,16 // r20
- .mem.offset 112,0
- st8.spill [r3]=r21,16 // r21
- mov b6=r9
- ;;
-}
-{ .mmb
- .mem.offset 120,0
- st8.spill [r2]=r22,16 // r22
- .mem.offset 128,0
- st8.spill [r3]=r23,16 // r23
nop 0
- ;;
-}
-{ .mmi
- .mem.offset 136,0
- st8.spill [r2]=r24,16 // r24
- .mem.offset 144,0
- st8.spill [r3]=r25,16 // r25
- nop 1
- ;;
-}
-{ .mmb
- .mem.offset 152,0
- st8.spill [r2]=r26,16 // r26
- .mem.offset 160,0
- st8.spill [r3]=r27,16 // r27
- nop 2
- ;;
-}
-{ .mmi
- .mem.offset 168,0
- st8.spill [r2]=r28,16 // r28
- .mem.offset 176,0
- st8.spill [r3]=r29,16 // r29
- nop 3
- ;;
-}
-{ .mmb
- .mem.offset 184,0
- st8.spill [r2]=r30,16 // r30
- .mem.offset 192,0
- st8.spill [r3]=r31,16 // r31
- nop 4
- ;;
-}
-{ .mmi
- st8 [r2]=r10,16 // unat (before)
- mov r9=ar.unat
- nop 5
- ;;
-}
-{ .mmb
- st8 [r3]=r14,16 // b6
- st8 [r2]=r15,16 // b7
- nop 6
- ;;
-}
-{ .mmi
- st8 [r8]=r9,16 // nat (after)
- mov r10=ar.ccv
- nop 7
- ;;
-}
-{ .mmb
- st8 [r3]=r10,16 // ccv
- mov r9=ar.csd
- nop 8
- ;;
-}
-{ .mmi
- st8 [r2]=r9,16 // csd
- mov r10=ar.ssd
- nop 9
- ;;
-}
-{ .mmb
- st8 [r3]=r10 // ssd
- st8 [r2]=r0 // __spare
- br.sptk b6
- ;;
-}
-END(_get_caller_saved)
-
-/*
- * _set_caller_saved
- *
- * Does not follow runtime specification:
- * inputs: r16 = pointer to struct _caller_saved
- * r17 = return address (no call/ret semantics)
- * precondition: Must be called with register bank 1 selected,
- *
- * postcondition: Will return with register bank 0 selected.
- */
-ENTRY(_set_caller_saved, 0)
-{ .mii
- ld8 r8=[r16] // nat (after)
- add r2=40,r16
- add r3=48,r16
- ;;
-}
-{ .mmi
- mov ar.unat=r8
- mov r8=r16
- mov r9=r17
- ;;
-}
-{ .mmi
- ld8.fill r10=[r2],16 // r10
- ld8.fill r11=[r3],16 // r11
- nop 0
- ;;
-}
-{ .mmb
- ld8.fill r14=[r2],16 // r14
- ld8.fill r15=[r3],16 // r15
- nop 1
- ;;
-}
-{ .mmi
- ld8.fill r16=[r2],16 // r16
- ld8.fill r17=[r3],16 // r17
- nop 2
- ;;
-}
-{ .mmb
- ld8.fill r18=[r2],16 // r18
- ld8.fill r19=[r3],16 // r19
- nop 3
- ;;
-}
-{ .mmi
- ld8.fill r20=[r2],16 // r20
- ld8.fill r21=[r3],16 // r21
- nop 4
- ;;
-}
-{ .mmb
- ld8.fill r22=[r2],16 // r22
- ld8.fill r23=[r3],16 // r23
- nop 5
- ;;
-}
-{ .mmi
- ld8.fill r24=[r2],16 // r24
- ld8.fill r25=[r3],16 // r25
- nop 6
- ;;
-}
-{ .mmb
- ld8.fill r26=[r2],16 // r26
- ld8.fill r27=[r3],16 // r27
- nop 7
- ;;
-}
-{ .mmi
- ld8.fill r28=[r2],16 // r28
- ld8.fill r29=[r3],16 // r29
- nop 8
- ;;
-}
-{ .mmb
- ld8.fill r30=[r2],16 // r30
- ld8.fill r31=[r3],16 // r31
- bsw.0
- ;;
-}
- /* We're using register bank 0 now. */
-{ .mii
- ld8 r18=[r2] // unat (before)
- add r16=8,r8
- add r17=16,r8
-}
-{ .mii
- ld8 r19=[r3] // b6
- add r20=16,r2
- add r21=16,r3
- ;;
-}
-{ .mmi
- ld8.fill r2=[r16],16 // r2
- ld8.fill r3=[r17],16 // r3
- mov rp=r9
- ;;
-}
-{ .mmi
- ld8 r22=[r20],16 // b7
- ld8 r23=[r21],16 // ccv
- mov b6=r19
- ;;
-}
-{ .mmi
- ld8.fill r8=[r16] // r8
- ld8.fill r9=[r17] // r9
- mov b7=r16
- ;;
-}
-{ .mmb
- ld8 r19=[r20] // csd
- mov ar.unat=r18
- nop 9
- ;;
-}
-{ .mmi
- ld8 r18=[r21] // ssd
- mov ar.ccv=r17
- nop 10
- ;;
-}
-{ .mmb
- mov ar.csd=r19
- mov ar.ssd=r18
+ mov ar.lc=r25
br.ret.sptk rp
;;
}
-END(_get_called_saved)
+END(restore_callee_saved)
/*
- * Floating point register sets:
- * _get_callee_saved_fp - Save preserved FP registers.
- * _set_callee_saved_fp - Restore preserved FP registers.
- * _get_caller_saved_fp - Save scratch FP registers.
- * _set_caller_saved_fp - Restore scratch FP registers.
- * save_high_fp - Save high FP registers (scratch).
- * restore_high_fp - Restore high FP registers (scratch).
+ * save_callee_saved_fp(struct _callee_saved_fp *)
*/
-
-/*
- * _get_callee_saved_fp
- */
-ENTRY(_get_callee_saved_fp, 1)
+ENTRY(save_callee_saved_fp, 1)
add r31=16,r32
stf.spill [r32]=f2,32
;;
@@ -968,12 +454,12 @@
stf.spill [r31]=f31
br.ret.sptk rp
;;
-END(_get_callee_saved_fp)
+END(save_callee_saved_fp)
/*
- * _set_callee_saved_fp
+ * restore_callee_saved_fp(struct _callee_saved_fp *)
*/
-ENTRY(_set_callee_saved_fp, 1)
+ENTRY(restore_callee_saved_fp, 1)
add r31=16,r32
ldf.fill f2=[r32],32
;;
@@ -1007,59 +493,11 @@
ldf.fill f31=[r31]
br.ret.sptk rp
;;
-END(_set_callee_saved_fp)
+END(restore_callee_saved_fp)
/*
- * _get_caller_saved_fp
+ * save_high_fp(struct _high_fp *)
*/
-ENTRY(_get_caller_saved_fp, 1)
- add r31=16,r32
- stf.spill [r32]=f6,32
- ;;
- stf.spill [r31]=f7,32
- stf.spill [r32]=f8,32
- ;;
- stf.spill [r31]=f9,32
- stf.spill [r32]=f10,32
- ;;
- stf.spill [r31]=f11,32
- stf.spill [r32]=f12,32
- ;;
- stf.spill [r31]=f13,32
- stf.spill [r32]=f14
- ;;
- stf.spill [r31]=f15
- br.ret.sptk rp
- ;;
-END(_get_caller_saved_fp)
-
-/*
- * _set_caller_saved_fp
- */
-ENTRY(_set_caller_saved_fp, 1)
- add r31=16,r32
- ldf.fill f6=[r32],32
- ;;
- ldf.fill f7=[r31],32
- ldf.fill f8=[r32],32
- ;;
- ldf.fill f9=[r31],32
- ldf.fill f10=[r32],32
- ;;
- ldf.fill f11=[r31],32
- ldf.fill f12=[r32],32
- ;;
- ldf.fill f13=[r31],32
- ldf.fill f14=[r32]
- ;;
- ldf.fill f15=[r31]
- br.ret.sptk rp
- ;;
-END(_set_caller_saved_fp)
-
-/*
- * save_high_fp
- */
ENTRY(save_high_fp, 1)
add r31=16,r32
stf.spill [r32]=f32,32
@@ -1211,7 +649,7 @@
END(save_high_fp)
/*
- * restore_high_fp
+ * restore_high_fp(struct _high_fp *)
*/
ENTRY(restore_high_fp, 1)
add r31=16,r32
==== //depot/projects/ia64_epc/sys/ia64/include/_regset.h#10 (text+ko) ====
@@ -169,7 +169,11 @@
};
#ifdef _KERNEL
+void restore_callee_saved(struct _callee_saved *);
+void restore_callee_saved_fp(struct _callee_saved_fp *);
void restore_high_fp(struct _high_fp *);
+void save_callee_saved(struct _callee_saved *);
+void save_callee_saved_fp(struct _callee_saved_fp *);
void save_high_fp(struct _high_fp *);
#endif
More information about the p4-projects
mailing list