1 /* asmmacro.h: Assembler macros.
3 * Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu)
6 #ifndef _SPARC_ASMMACRO_H
7 #define _SPARC_ASMMACRO_H
9 #include <linux/config.h>
10 #include <asm/btfixup.h>
13 #define GET_PROCESSOR4M_ID(reg) \
18 #define GET_PROCESSOR4D_ID(reg) \
19 lda [%g0] ASI_M_VIKING_TMP1, %reg;
22 #define GET_PROCESSOR_ID(reg) \
23 sethi %hi(___b_smp_processor_id), %reg; \
24 sethi %hi(boot_cpu_id), %reg; \
25 ldub [%reg + %lo(boot_cpu_id)], %reg;
27 #define GET_PROCESSOR_MID(reg, tmp) \
29 sethi %hi(C_LABEL(mid_xlate)), %tmp; \
31 or %tmp, %lo(C_LABEL(mid_xlate)), %tmp; \
33 ldub [%tmp + %reg], %reg;
35 #define GET_PROCESSOR_OFFSET(reg, tmp) \
36 GET_PROCESSOR_ID(reg) \
37 sethi %hi(C_LABEL(cpu_offset)), %tmp; \
39 or %tmp, %lo(C_LABEL(cpu_offset)), %tmp; \
40 ld [%tmp + %reg], %reg;
42 #define GET_PAGE_OFFSET(reg) \
43 sethi BTFIXUP_SETHI_INIT(page_offset,0xf0000000), %reg;
45 /* All trap entry points _must_ begin with this macro or else you
46 * lose. It makes sure the kernel has a proper window so that
47 * c-code can be called.
49 #define SAVE_ALL_HEAD \
50 sethi %hi(trap_setup), %l4; \
51 jmpl %l4 + %lo(trap_setup), %l6;
56 /* All traps low-level code here must end with this macro. */
57 #define RESTORE_ALL b ret_trap_entry; clr %l6;
59 /* sun4 probably wants half word accesses to ASI_SEGMAP, while sun4c+
60 likes byte accesses. These are to avoid ifdef mania. */
70 #endif /* !(_SPARC_ASMMACRO_H) */