Inline several things from pal.s:
- alpha_rpcc(), alpha_mb(), alpha_wmb() -- these are instructions, and we win by inlining them: rpcc is generally used for profiling, and the memory barriers really should execute as quickly as possible with minimal side-effects (like additional loads/stores required to call the functions!) - alpha_pal_imb(), alpha_pal_rdps(), alpha_pal_swpipl(), alpha_pal_tbi(), alpha_pal_whami() -- these are PALcode ops. We must specify some register clobbers for these. We have a very decent size savings as a result. My test system: text data bss dec hex filename 2671724 235848 377016 3284588 321e6c /netbsd.bak 2617708 235736 377016 3230460 314afc /netbsd Most of this comes from fewer register saves/restores around spl*() calls (now that alpha_pal_rdps() and alpha_pal_swpipl() are inlined). Note that alpha_pal_rdps() and alpha_pal_swpipl() remain in pal.s to maintain binary compatibility with LKMs that may use spl*() functions.
This commit is contained in:
parent
871b54b6d2
commit
89ae0bf93c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pal.s,v 1.12 1998/02/27 03:44:53 thorpej Exp $ */
|
||||
/* $NetBSD: pal.s,v 1.13 1999/11/30 00:42:46 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
|
@ -39,37 +39,9 @@
|
|||
* and Richard T. Witek.
|
||||
*/
|
||||
|
||||
__KERNEL_RCSID(1, "$NetBSD: pal.s,v 1.12 1998/02/27 03:44:53 thorpej Exp $");
|
||||
__KERNEL_RCSID(1, "$NetBSD: pal.s,v 1.13 1999/11/30 00:42:46 thorpej Exp $");
|
||||
|
||||
inc2: .stabs __FILE__,132,0,0,inc2; .loc 1 __LINE__
|
||||
/*
|
||||
* alpha_rpcc: read process cycle counter (XXX INSTRUCTION, NOT PALcode OP)
|
||||
*/
|
||||
.text
|
||||
LEAF(alpha_rpcc,1)
|
||||
rpcc v0
|
||||
RET
|
||||
END(alpha_rpcc)
|
||||
|
||||
/*
|
||||
* alpha_mb: memory barrier (XXX INSTRUCTION, NOT PALcode OP)
|
||||
*/
|
||||
.text
|
||||
LEAF(alpha_mb,0)
|
||||
mb
|
||||
RET
|
||||
END(alpha_mb)
|
||||
|
||||
/*
|
||||
* alpha_wmb: write memory barrier (XXX INSTRUCTION, NOT PALcode OP)
|
||||
*/
|
||||
.text
|
||||
LEAF(alpha_wmb,0)
|
||||
/* wmb XXX */
|
||||
mb /* XXX */
|
||||
RET
|
||||
END(alpha_wmb)
|
||||
|
||||
/*
|
||||
* alpha_amask: read architecture features (XXX INSTRUCTION, NOT PALcode OP)
|
||||
*
|
||||
|
@ -101,16 +73,6 @@ LEAF(alpha_implver,0)
|
|||
RET
|
||||
END(alpha_implver)
|
||||
|
||||
/*
|
||||
* alpha_pal_imb: I-Stream memory barrier. [UNPRIVILEGED]
|
||||
* (Makes instruction stream coherent with data stream.)
|
||||
*/
|
||||
.text
|
||||
LEAF(alpha_pal_imb,0)
|
||||
call_pal PAL_imb
|
||||
RET
|
||||
END(alpha_pal_imb)
|
||||
|
||||
/*
|
||||
* alpha_pal_cflush: Cache flush [PRIVILEGED]
|
||||
*
|
||||
|
@ -217,31 +179,6 @@ LEAF_NOPROFILE(_alpha_pal_swpipl,1)
|
|||
RET
|
||||
END(_alpha_pal_swpipl)
|
||||
|
||||
/*
|
||||
* alpha_pal_tbi: Translation buffer invalidate. [PRIVILEGED]
|
||||
*
|
||||
* Arguments:
|
||||
* a0 operation selector
|
||||
* a1 address to operate on (if necessary)
|
||||
*/
|
||||
.text
|
||||
LEAF(alpha_pal_tbi,2)
|
||||
call_pal PAL_OSF1_tbi
|
||||
RET
|
||||
END(alpha_pal_tbi)
|
||||
|
||||
/*
|
||||
* alpha_pal_whami: Who am I? [PRIVILEGED]
|
||||
*
|
||||
* Return:
|
||||
* v0 processor number
|
||||
*/
|
||||
.text
|
||||
LEAF(alpha_pal_whami,0)
|
||||
call_pal PAL_OSF1_whami
|
||||
RET
|
||||
END(alpha_pal_whami)
|
||||
|
||||
/*
|
||||
* alpha_pal_wrent: Write system entry address. [PRIVILEGED]
|
||||
*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: alpha_cpu.h,v 1.31 1999/11/28 19:47:14 thorpej Exp $ */
|
||||
/* $NetBSD: alpha_cpu.h,v 1.32 1999/11/30 00:42:47 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Carnegie-Mellon University.
|
||||
|
@ -313,9 +313,21 @@ const char *alpha_dsr_sysname __P((void));
|
|||
*/
|
||||
unsigned long alpha_amask __P((unsigned long));
|
||||
unsigned long alpha_implver __P((void));
|
||||
unsigned long alpha_rpcc __P((void));
|
||||
void alpha_mb __P((void));
|
||||
void alpha_wmb __P((void));
|
||||
|
||||
static __inline unsigned long alpha_rpcc __P((void))
|
||||
__attribute__((__unused__));
|
||||
|
||||
static __inline unsigned long
|
||||
alpha_rpcc()
|
||||
{
|
||||
unsigned long v0;
|
||||
|
||||
__asm __volatile("rpcc %0" : "=r" (v0));
|
||||
return (v0);
|
||||
}
|
||||
|
||||
#define alpha_mb() __asm __volatile("mb")
|
||||
#define alpha_wmb() __asm __volatile("mb") /* XXX */
|
||||
|
||||
u_int8_t alpha_ldbu __P((volatile u_int8_t *));
|
||||
u_int16_t alpha_ldwu __P((volatile u_int16_t *));
|
||||
|
@ -338,19 +350,14 @@ void alpha_atomic_sub_q __P((unsigned long *, unsigned long));
|
|||
/*
|
||||
* Stubs for OSF/1 PALcode operations.
|
||||
*/
|
||||
void alpha_pal_imb __P((void));
|
||||
void alpha_pal_cflush __P((unsigned long));
|
||||
void alpha_pal_draina __P((void));
|
||||
void alpha_pal_halt __P((void)) __attribute__((__noreturn__));
|
||||
unsigned long alpha_pal_rdmces __P((void));
|
||||
unsigned long alpha_pal_rdps __P((void));
|
||||
unsigned long alpha_pal_rdusp __P((void));
|
||||
unsigned long alpha_pal_rdval __P((void));
|
||||
unsigned long alpha_pal_swpctx __P((unsigned long));
|
||||
unsigned long alpha_pal_swpipl __P((unsigned long));
|
||||
unsigned long _alpha_pal_swpipl __P((unsigned long)); /* for profiling */
|
||||
void alpha_pal_tbi __P((unsigned long, vaddr_t));
|
||||
unsigned long alpha_pal_whami __P((void));
|
||||
void alpha_pal_wrent __P((void *, unsigned long));
|
||||
void alpha_pal_wrfen __P((unsigned long));
|
||||
void alpha_pal_wripir __P((unsigned long));
|
||||
|
@ -359,4 +366,74 @@ void alpha_pal_wrvptptr __P((unsigned long));
|
|||
void alpha_pal_wrmces __P((unsigned long));
|
||||
void alpha_pal_wrval __P((unsigned long));
|
||||
|
||||
static __inline unsigned long alpha_pal_rdps __P((void))
|
||||
__attribute__((__unused__));
|
||||
static __inline unsigned long alpha_pal_swpipl __P((unsigned long))
|
||||
__attribute__((__unused__));
|
||||
static __inline void alpha_pal_tbi __P((unsigned long, vaddr_t))
|
||||
__attribute__((__unused__));
|
||||
static __inline unsigned long alpha_pal_whami __P((void))
|
||||
__attribute__((__unused__));
|
||||
|
||||
#define alpha_pal_imb() __asm __volatile("call_pal 0x0086")
|
||||
|
||||
static __inline unsigned long
|
||||
alpha_pal_rdps()
|
||||
{
|
||||
register unsigned long v0 __asm("$0");
|
||||
|
||||
__asm __volatile("call_pal 0x0036" /* PAL_OSF1_rdps */
|
||||
: "=r" (v0)
|
||||
:
|
||||
/* clobbers t0, t8..t11 */
|
||||
: "$1", "$22", "$23", "$24", "$25");
|
||||
|
||||
return (v0);
|
||||
}
|
||||
|
||||
static __inline unsigned long
|
||||
alpha_pal_swpipl(ipl)
|
||||
unsigned long ipl;
|
||||
{
|
||||
register unsigned long a0 __asm("$16") = ipl;
|
||||
register unsigned long v0 __asm("$0");
|
||||
|
||||
__asm __volatile("call_pal 0x0035" /* PAL_OSF1_swpipl */
|
||||
: "=r" (v0)
|
||||
: "r" (a0)
|
||||
/* clobbers t0, t8..t11, a0 */
|
||||
: "$1", "$22", "$23", "$24", "$25", "$16");
|
||||
|
||||
return (v0);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
alpha_pal_tbi(op, va)
|
||||
unsigned long op;
|
||||
vaddr_t va;
|
||||
{
|
||||
register unsigned long a0 __asm("$16") = op;
|
||||
register unsigned long a1 __asm("$17") = va;
|
||||
|
||||
__asm __volatile("call_pal 0x0033" /* PAL_OSF1_tbi */
|
||||
:
|
||||
: "r" (a0), "r" (a1)
|
||||
/* clobbers t0, t8..t11, a0, a1 */
|
||||
: "$1", "$22", "$23", "$24", "$25", "$16", "$17");
|
||||
}
|
||||
|
||||
static __inline unsigned long
|
||||
alpha_pal_whami()
|
||||
{
|
||||
register unsigned long v0 __asm("$0");
|
||||
|
||||
__asm __volatile("call_pal 0x003c" /* PAL_OSF1_whami */
|
||||
: "=r" (v0)
|
||||
:
|
||||
/* clobbers t0, t8..t11 */
|
||||
: "$1", "$22", "$23", "$24", "$25");
|
||||
|
||||
return (v0);
|
||||
}
|
||||
|
||||
#endif /* __ALPHA_ALPHA_CPU_H__ */
|
||||
|
|
Loading…
Reference in New Issue