Implement mcount trampoline (untested).
This commit is contained in:
parent
3749c9e54d
commit
b4cc6db2df
@ -34,126 +34,76 @@
|
|||||||
|
|
||||||
typedef u_long fptrdiff_t;
|
typedef u_long fptrdiff_t;
|
||||||
|
|
||||||
#if 0
|
#define MCOUNT __asm (" \n\
|
||||||
/*
|
.globl _mcount \n\
|
||||||
* XXX The definition of MCOUNT below is really the following code, run
|
.proc _mcount \n\
|
||||||
* XXX through cpp, since the inline assembly isn't preprocessed.
|
_mcount: \n\
|
||||||
*/
|
alloc loc0=ar.pfs,8,7,2,0 // space to save r8-r11,rp,b7 \n\
|
||||||
#define OFFSET_AT 0
|
add sp=-8*16,sp // space to save f8-f15 \n\
|
||||||
#define OFFSET_V0 8
|
mov loc1=rp // caller's return address \n\
|
||||||
#define OFFSET_T0 16
|
mov loc2=b7 // our return back to caller \n\
|
||||||
#define OFFSET_T1 24
|
;; \n\
|
||||||
#define OFFSET_T2 32
|
add r17=16,sp // leave 16 bytes for mcount \n\
|
||||||
#define OFFSET_T3 40
|
add r18=32,sp \n\
|
||||||
#define OFFSET_T4 48
|
;; \n\
|
||||||
#define OFFSET_T5 56
|
mov loc3=r8 // structure return address \n\
|
||||||
#define OFFSET_T6 64
|
mov loc4=r9 // language specific \n\
|
||||||
#define OFFSET_T7 72
|
mov loc5=r10 // language specific \n\
|
||||||
#define OFFSET_S6 80
|
mov loc6=r11 // language specific \n\
|
||||||
#define OFFSET_A0 88
|
;; \n\
|
||||||
#define OFFSET_A1 96
|
stf.spill [r17]=f8,32 // save float arguments \n\
|
||||||
#define OFFSET_A2 104
|
stf.spill [r18]=f9,32 \n\
|
||||||
#define OFFSET_A3 112
|
mov out0=rp // frompc \n\
|
||||||
#define OFFSET_A4 120
|
;; \n\
|
||||||
#define OFFSET_A5 128
|
stf.spill [r17]=f10,32 \n\
|
||||||
#define OFFSET_T8 136
|
stf.spill [r18]=f11,32 \n\
|
||||||
#define OFFSET_T9 144
|
mov out1=b7 // selfpc \n\
|
||||||
#define OFFSET_T10 152
|
;; \n\
|
||||||
#define OFFSET_T11 160
|
stf.spill [r17]=f12,32 \n\
|
||||||
#define OFFSET_RA 168
|
stf.spill [r18]=f13,32 \n\
|
||||||
#define OFFSET_T12 176
|
;; \n\
|
||||||
#define OFFSET_GP 184
|
stf.spill [r17]=f14,32 \n\
|
||||||
#define FRAME_SIZE 192
|
stf.spill [r18]=f15,32 \n\
|
||||||
|
;; \n\
|
||||||
LEAF(_mcount,0) /* XXX */
|
br.call.sptk.many rp=mcount \n\
|
||||||
.set noat
|
;; \n\
|
||||||
.set noreorder
|
add r17=16,sp \n\
|
||||||
|
add r18=32,sp \n\
|
||||||
lda sp, -FRAME_SIZE(sp)
|
;; \n\
|
||||||
|
ldf.fill f8=[r17],32 \n\
|
||||||
stq at_reg, OFFSET_AT(sp)
|
ldf.fill f9=[r18],32 \n\
|
||||||
stq v0, OFFSET_V0(sp)
|
mov r8=loc3 // restore structure pointer \n\
|
||||||
stq t0, OFFSET_T0(sp)
|
;; \n\
|
||||||
stq t1, OFFSET_T1(sp)
|
ldf.fill f10=[r17],32 // restore float arguments \n\
|
||||||
stq t2, OFFSET_T2(sp)
|
ldf.fill f11=[r18],32 \n\
|
||||||
stq t3, OFFSET_T3(sp)
|
mov r9=loc4 \n\
|
||||||
stq t4, OFFSET_T4(sp)
|
;; \n\
|
||||||
stq t5, OFFSET_T5(sp)
|
ldf.fill f12=[r17],32 // etc. \n\
|
||||||
stq t6, OFFSET_T6(sp)
|
ldf.fill f13=[r18],32 \n\
|
||||||
stq t7, OFFSET_T7(sp)
|
mov r10=loc5 \n\
|
||||||
stq s6, OFFSET_S6(sp) /* XXX because run _after_ prologue. */
|
;; \n\
|
||||||
stq a0, OFFSET_A0(sp)
|
ldf.fill f14=[r17],32 \n\
|
||||||
stq a1, OFFSET_A1(sp)
|
ldf.fill f15=[r18],32 \n\
|
||||||
stq a2, OFFSET_A2(sp)
|
mov r11=loc6 \n\
|
||||||
stq a3, OFFSET_A3(sp)
|
;; \n\
|
||||||
stq a4, OFFSET_A4(sp)
|
mov b7=loc2 // clean up \n\
|
||||||
stq a5, OFFSET_A5(sp)
|
mov rp=loc1 \n\
|
||||||
stq t8, OFFSET_T8(sp)
|
mov ar.pfs=loc0 \n\
|
||||||
stq t9, OFFSET_T9(sp)
|
;; \n\
|
||||||
stq t10, OFFSET_T10(sp)
|
alloc r14=ar.pfs,0,0,8,0 // drop our register frame \n\
|
||||||
stq t11, OFFSET_T11(sp)
|
br.sptk.many b7 // back to caller \n\
|
||||||
stq ra, OFFSET_RA(sp)
|
\n\
|
||||||
stq t12, OFFSET_T12(sp)
|
|
||||||
stq gp, OFFSET_GP(sp)
|
|
||||||
|
|
||||||
br pv, LX99
|
|
||||||
LX99: SETGP(pv)
|
|
||||||
mov ra, a0
|
|
||||||
mov at_reg, a1
|
|
||||||
CALL(mcount)
|
|
||||||
|
|
||||||
ldq v0, OFFSET_V0(sp)
|
|
||||||
ldq t0, OFFSET_T0(sp)
|
|
||||||
ldq t1, OFFSET_T1(sp)
|
|
||||||
ldq t2, OFFSET_T2(sp)
|
|
||||||
ldq t3, OFFSET_T3(sp)
|
|
||||||
ldq t4, OFFSET_T4(sp)
|
|
||||||
ldq t5, OFFSET_T5(sp)
|
|
||||||
ldq t6, OFFSET_T6(sp)
|
|
||||||
ldq t7, OFFSET_T7(sp)
|
|
||||||
ldq s6, OFFSET_S6(sp) /* XXX because run _after_ prologue. */
|
|
||||||
ldq a0, OFFSET_A0(sp)
|
|
||||||
ldq a1, OFFSET_A1(sp)
|
|
||||||
ldq a2, OFFSET_A2(sp)
|
|
||||||
ldq a3, OFFSET_A3(sp)
|
|
||||||
ldq a4, OFFSET_A4(sp)
|
|
||||||
ldq a5, OFFSET_A5(sp)
|
|
||||||
ldq t8, OFFSET_T8(sp)
|
|
||||||
ldq t9, OFFSET_T9(sp)
|
|
||||||
ldq t10, OFFSET_T10(sp)
|
|
||||||
ldq t11, OFFSET_T11(sp)
|
|
||||||
ldq ra, OFFSET_RA(sp)
|
|
||||||
stq t12, OFFSET_T12(sp)
|
|
||||||
ldq gp, OFFSET_GP(sp)
|
|
||||||
|
|
||||||
ldq at_reg, OFFSET_AT(sp)
|
|
||||||
|
|
||||||
lda sp, FRAME_SIZE(sp)
|
|
||||||
ret zero, (at_reg), 1
|
|
||||||
|
|
||||||
END(_mcount)
|
|
||||||
#endif /* 0 */
|
|
||||||
|
|
||||||
#define MCOUNT __asm (" \
|
|
||||||
.globl _mcount; \
|
|
||||||
.proc _mcount; \
|
|
||||||
_mcount:; \
|
|
||||||
\
|
|
||||||
.end _mcount");
|
.end _mcount");
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
/*
|
/*
|
||||||
* The following two macros do splhigh and splx respectively.
|
* The following two macros do splhigh and splx respectively.
|
||||||
* _alpha_pal_swpipl is a special version of alpha_pal_swpipl which
|
|
||||||
* doesn't include profiling support.
|
|
||||||
*
|
|
||||||
* XXX These macros should probably use inline assembly.
|
|
||||||
*/
|
*/
|
||||||
#define MCOUNT_ENTER(s) \
|
#define MCOUNT_ENTER(s) \n\
|
||||||
s = _alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH)
|
_c = critical_enter()
|
||||||
#define MCOUNT_EXIT(s) \
|
#define MCOUNT_EXIT(s) \n\
|
||||||
(void)_alpha_pal_swpipl(s);
|
(void)critical_exit(_c)
|
||||||
#define MCOUNT_DECL(s) u_long s;
|
#define MCOUNT_DECL(s) critical_t c;
|
||||||
#ifdef GUPROF
|
#ifdef GUPROF
|
||||||
struct gmonparam;
|
struct gmonparam;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user