Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* asmmacro.h: Assembler macros. |
| 2 | * |
| 3 | * Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu) |
| 4 | */ |
| 5 | |
| 6 | #ifndef _SPARC_ASMMACRO_H |
| 7 | #define _SPARC_ASMMACRO_H |
| 8 | |
| 9 | #include <linux/config.h> |
| 10 | #include <asm/btfixup.h> |
| 11 | #include <asm/asi.h> |
| 12 | |
| 13 | #define GET_PROCESSOR4M_ID(reg) \ |
| 14 | rd %tbr, %reg; \ |
| 15 | srl %reg, 12, %reg; \ |
| 16 | and %reg, 3, %reg; |
| 17 | |
| 18 | #define GET_PROCESSOR4D_ID(reg) \ |
| 19 | lda [%g0] ASI_M_VIKING_TMP1, %reg; |
| 20 | |
| 21 | /* All trap entry points _must_ begin with this macro or else you |
| 22 | * lose. It makes sure the kernel has a proper window so that |
| 23 | * c-code can be called. |
| 24 | */ |
| 25 | #define SAVE_ALL_HEAD \ |
| 26 | sethi %hi(trap_setup), %l4; \ |
| 27 | jmpl %l4 + %lo(trap_setup), %l6; |
| 28 | #define SAVE_ALL \ |
| 29 | SAVE_ALL_HEAD \ |
| 30 | nop; |
| 31 | |
| 32 | /* All traps low-level code here must end with this macro. */ |
| 33 | #define RESTORE_ALL b ret_trap_entry; clr %l6; |
| 34 | |
| 35 | /* sun4 probably wants half word accesses to ASI_SEGMAP, while sun4c+ |
| 36 | likes byte accesses. These are to avoid ifdef mania. */ |
| 37 | |
| 38 | #ifdef CONFIG_SUN4 |
| 39 | #define lduXa lduha |
| 40 | #define stXa stha |
| 41 | #else |
| 42 | #define lduXa lduba |
| 43 | #define stXa stba |
| 44 | #endif |
| 45 | |
| 46 | #endif /* !(_SPARC_ASMMACRO_H) */ |