diff options
author | jake <jake@FreeBSD.org> | 2002-01-08 04:34:20 +0000 |
---|---|---|
committer | jake <jake@FreeBSD.org> | 2002-01-08 04:34:20 +0000 |
commit | 36aea0f17e8cfcaae15125fae939402e14518c37 (patch) | |
tree | 05dc137877dbc6f781721d3b6356e5fe57965af6 /sys/sparc64/include/asmacros.h | |
parent | ceb8ef47f25fcc5ace71a4845915718f8d5d3167 (diff) | |
download | FreeBSD-src-36aea0f17e8cfcaae15125fae939402e14518c37.zip FreeBSD-src-36aea0f17e8cfcaae15125fae939402e14518c37.tar.gz |
Update comments and defines to reflect that normal and alternate g6 point
to the current pcb.
Remove interrupt global defines; they use PCPU_REG now.
Move ATOMIC_INC_INT here from exception.s, add ATOMIC_DEC_INT.
Add a KASSERT macro for use in assembler.
Diffstat (limited to 'sys/sparc64/include/asmacros.h')
-rw-r--r-- | sys/sparc64/include/asmacros.h | 74 |
1 files changed, 52 insertions, 22 deletions
diff --git a/sys/sparc64/include/asmacros.h b/sys/sparc64/include/asmacros.h index 2765540..c289149 100644 --- a/sys/sparc64/include/asmacros.h +++ b/sys/sparc64/include/asmacros.h @@ -32,28 +32,46 @@ #ifdef _KERNEL /* - * Normal and alternate %g7 point to per-cpu data. + * Normal and alternate %g6 point to the pcb of the current process. Normal, + & alternate and interrupt %g7 point to per-cpu data. */ +#define PCB_REG %g6 #define PCPU_REG %g7 /* - * Alternate %g5 points to a per-cpu stack for temporarily saving alternate - * globals, alternate %g6 points to the pcb of the current process. + * Alternate %g5 points to a per-cpu panic stack, which is used as a last + * resort, and for temporarily saving alternate globals. */ #define ASP_REG %g5 -#define PCB_REG %g6 /* - * Interrupt %g6 points to a per-cpu interrupt queue, %g7 points to the - * interrupt vector table. + * MMU %g7 points to the user tsb. */ -#define IQ_REG %g6 -#define IV_REG %g7 +#define TSB_REG %g7 + +#ifdef LOCORE /* - * MMU %g7 points to the user tsb. + * Atomically decrement an integer in memory. */ -#define TSB_REG %g7 +#define ATOMIC_DEC_INT(r1, r2, r3) \ + lduw [r1], r2 ; \ +9: sub r2, 1, r3 ; \ + casa [r1] ASI_N, r2, r3 ; \ + cmp r2, r3 ; \ + bne,pn %xcc, 9b ; \ + mov r3, r2 + +/* + * Atomically increment an integer in memory. + */ +#define ATOMIC_INC_INT(r1, r2, r3) \ + lduw [r1], r2 ; \ +9: add r2, 1, r3 ; \ + casa [r1] ASI_N, r2, r3 ; \ + cmp r2, r3 ; \ + bne,pn %xcc, 9b ; \ + mov r3, r2 #define PCPU(member) %g7 + PC_ ## member #define PCPU_ADDR(member, reg) add %g7, PC_ ## member, reg @@ -68,6 +86,16 @@ call panic ; \ nop +#ifdef INVARIANTS +#define KASSERT(r1, msg) \ + brnz r1, 8f ; \ + nop ; \ + PANIC(msg, r1) ; \ +8: +#else +#define KASSERT(r1, msg) +#endif + #define PUTS(msg, r1) \ .sect .rodata ; \ 9: .asciz msg ; \ @@ -76,8 +104,22 @@ call printf ; \ nop +/* + * If the kernel can be located above 4G, setx needs to be used to load + * symbol values, otherwise set is sufficient. + */ +#ifdef HIGH_KERNEL +#define SET(sym, tmp, dst) \ + setx sym, tmp, dst +#else +#define SET(sym, tmp, dst) \ + set sym, dst #endif +#endif /* LOCORE */ + +#endif /* _KERNEL */ + #define DATA(name) \ .data ; \ .globl name ; \ @@ -96,16 +138,4 @@ name ## : #define END(name) \ .size name, . - name -/* - * If the kernel can be located above 4G, setx needs to be used to load - * symbol values, otherwise set is sufficient. - */ -#ifdef HIGH_KERNEL -#define SET(sym, tmp, dst) \ - setx sym, tmp, dst -#else -#define SET(sym, tmp, dst) \ - set sym, dst -#endif - #endif /* !_MACHINE_ASMACROS_H_ */ |