diff options
author | imp <imp@FreeBSD.org> | 2013-05-01 06:57:46 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2013-05-01 06:57:46 +0000 |
commit | 9003746e9a613b1a0ca653027e0f881f52cd7027 (patch) | |
tree | 8a58ef57e9a3b181ef83d5970d68b781e01c10b3 | |
parent | 272556ac5338f36ef5b8c69bd5ac3ec763e354fa (diff) | |
download | FreeBSD-src-9003746e9a613b1a0ca653027e0f881f52cd7027.zip FreeBSD-src-9003746e9a613b1a0ca653027e0f881f52cd7027.tar.gz |
Don't include asm.h in non-asm files.
Remove #define to get kludges that asm.h used to define
Move clever macros to access assembler instructions to trap.c
Remove __ASSEMBLER__ ifdefs in regdef.h: they aren't needed anymore.
-rw-r--r-- | sys/mips/include/asm.h | 113 | ||||
-rw-r--r-- | sys/mips/include/regdef.h | 2 | ||||
-rw-r--r-- | sys/mips/mips/db_interface.c | 2 | ||||
-rw-r--r-- | sys/mips/mips/trap.c | 57 |
4 files changed, 55 insertions, 119 deletions
diff --git a/sys/mips/include/asm.h b/sys/mips/include/asm.h index dc05de3..790024f 100644 --- a/sys/mips/include/asm.h +++ b/sys/mips/include/asm.h @@ -56,9 +56,7 @@ #ifndef _MACHINE_ASM_H_ #define _MACHINE_ASM_H_ -#ifndef NO_REG_DEFS #include <machine/regdef.h> -#endif #include <machine/endian.h> #include <machine/cdefs.h> @@ -111,26 +109,6 @@ #define WARN_REFERENCES(_sym,_msg) \ .section .gnu.warning. ## _sym ; .ascii _msg ; .text -/* - * These are temp registers whose names can be used in either the old - * or new ABI, although they map to different physical registers. In - * the old ABI, they map to t4-t7, and in the new ABI, they map to a4-a7. - * - * Because they overlap with the last 4 arg regs in the new ABI, ta0-ta3 - * should be used only when we need more than t0-t3. - */ -#if defined(__mips_n32) || defined(__mips_n64) -#define ta0 $8 -#define ta1 $9 -#define ta2 $10 -#define ta3 $11 -#else -#define ta0 $12 -#define ta1 $13 -#define ta2 $14 -#define ta3 $15 -#endif /* __mips_n32 || __mips_n64 */ - #ifdef __ELF__ # define _C_LABEL(x) x #else @@ -674,97 +652,6 @@ _C_LABEL(x): #define USE_ALT_CP(a) .cplocal a #endif /* __mips_n32 || __mips_n64 */ -#define mfc0_macro(data, spr) \ - __asm __volatile ("mfc0 %0, $%1" \ - : "=r" (data) /* outputs */ \ - : "i" (spr)); /* inputs */ - -#define mtc0_macro(data, spr) \ - __asm __volatile ("mtc0 %0, $%1" \ - : /* outputs */ \ - : "r" (data), "i" (spr)); /* inputs */ - -#define cfc0_macro(data, spr) \ - __asm __volatile ("cfc0 %0, $%1" \ - : "=r" (data) /* outputs */ \ - : "i" (spr)); /* inputs */ - -#define ctc0_macro(data, spr) \ - __asm __volatile ("ctc0 %0, $%1" \ - : /* outputs */ \ - : "r" (data), "i" (spr)); /* inputs */ - - -#define lbu_macro(data, addr) \ - __asm __volatile ("lbu %0, 0x0(%1)" \ - : "=r" (data) /* outputs */ \ - : "r" (addr)); /* inputs */ - -#define lb_macro(data, addr) \ - __asm __volatile ("lb %0, 0x0(%1)" \ - : "=r" (data) /* outputs */ \ - : "r" (addr)); /* inputs */ - -#define lwl_macro(data, addr) \ - __asm __volatile ("lwl %0, 0x0(%1)" \ - : "=r" (data) /* outputs */ \ - : "r" (addr)); /* inputs */ - -#define lwr_macro(data, addr) \ - __asm __volatile ("lwr %0, 0x0(%1)" \ - : "=r" (data) /* outputs */ \ - : "r" (addr)); /* inputs */ - -#define ldl_macro(data, addr) \ - __asm __volatile ("ldl %0, 0x0(%1)" \ - : "=r" (data) /* outputs */ \ - : "r" (addr)); /* inputs */ - -#define ldr_macro(data, addr) \ - __asm __volatile ("ldr %0, 0x0(%1)" \ - : "=r" (data) /* outputs */ \ - : "r" (addr)); /* inputs */ - -#define sb_macro(data, addr) \ - __asm __volatile ("sb %0, 0x0(%1)" \ - : /* outputs */ \ - : "r" (data), "r" (addr)); /* inputs */ - -#define swl_macro(data, addr) \ - __asm __volatile ("swl %0, 0x0(%1)" \ - : /* outputs */ \ - : "r" (data), "r" (addr)); /* inputs */ - -#define swr_macro(data, addr) \ - __asm __volatile ("swr %0, 0x0(%1)" \ - : /* outputs */ \ - : "r" (data), "r" (addr)); /* inputs */ - -#define sdl_macro(data, addr) \ - __asm __volatile ("sdl %0, 0x0(%1)" \ - : /* outputs */ \ - : "r" (data), "r" (addr)); /* inputs */ - -#define sdr_macro(data, addr) \ - __asm __volatile ("sdr %0, 0x0(%1)" \ - : /* outputs */ \ - : "r" (data), "r" (addr)); /* inputs */ - -#define mfgr_macro(data, gr) \ - __asm __volatile ("move %0, $%1" \ - : "=r" (data) /* outputs */ \ - : "i" (gr)); /* inputs */ - -#define dmfc0_macro(data, spr) \ - __asm __volatile ("dmfc0 %0, $%1" \ - : "=r" (data) /* outputs */ \ - : "i" (spr)); /* inputs */ - -#define dmtc0_macro(data, spr, sel) \ - __asm __volatile ("dmtc0 %0, $%1, %2" \ - : /* no outputs */ \ - : "r" (data), "i" (spr), "i" (sel)); /* inputs */ - #define GET_CPU_PCPU(reg) \ PTR_L reg, _C_LABEL(pcpup); diff --git a/sys/mips/include/regdef.h b/sys/mips/include/regdef.h index 4f1c383..b55db56 100644 --- a/sys/mips/include/regdef.h +++ b/sys/mips/include/regdef.h @@ -41,7 +41,6 @@ #include <machine/cdefs.h> /* for API selection */ -#if defined(__ASSEMBLER__) #define zero $0 /* always zero */ #define AT $at /* assembler temporary */ #define v0 $2 /* return value */ @@ -106,5 +105,4 @@ #define ta3 $15 #endif /* __mips_n32 || __mips_n64 */ -#endif /* __ASSEMBLER__ */ #endif /* _MIPS_REGDEF_H */ diff --git a/sys/mips/mips/db_interface.c b/sys/mips/mips/db_interface.c index de7fe18..7feb27e 100644 --- a/sys/mips/mips/db_interface.c +++ b/sys/mips/mips/db_interface.c @@ -55,8 +55,6 @@ __FBSDID("$FreeBSD$"); #include <machine/mips_opcode.h> #include <machine/vmparam.h> #include <machine/md_var.h> -#define NO_REG_DEFS 1 /* Prevent asm.h from including regdef.h */ -#include <machine/asm.h> #include <machine/setjmp.h> #include <ddb/ddb.h> diff --git a/sys/mips/mips/trap.c b/sys/mips/mips/trap.c index f39e04f..9fda4ff 100644 --- a/sys/mips/mips/trap.c +++ b/sys/mips/mips/trap.c @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ktrace.h" #include "opt_kdtrace.h" -#define NO_REG_DEFS 1 /* Prevent asm.h from including regdef.h */ #include <sys/param.h> #include <sys/systm.h> #include <sys/sysent.h> @@ -85,7 +84,6 @@ __FBSDID("$FreeBSD$"); #include <machine/frame.h> #include <machine/regnum.h> #include <machine/tls.h> -#include <machine/asm.h> #ifdef DDB #include <machine/db_machdep.h> @@ -127,6 +125,61 @@ SYSCTL_INT(_machdep, OID_AUTO, trap_debug, CTLFLAG_RW, &trap_debug, 0, "Debug information on all traps"); #endif +#define lbu_macro(data, addr) \ + __asm __volatile ("lbu %0, 0x0(%1)" \ + : "=r" (data) /* outputs */ \ + : "r" (addr)); /* inputs */ + +#define lb_macro(data, addr) \ + __asm __volatile ("lb %0, 0x0(%1)" \ + : "=r" (data) /* outputs */ \ + : "r" (addr)); /* inputs */ + +#define lwl_macro(data, addr) \ + __asm __volatile ("lwl %0, 0x0(%1)" \ + : "=r" (data) /* outputs */ \ + : "r" (addr)); /* inputs */ + +#define lwr_macro(data, addr) \ + __asm __volatile ("lwr %0, 0x0(%1)" \ + : "=r" (data) /* outputs */ \ + : "r" (addr)); /* inputs */ + +#define ldl_macro(data, addr) \ + __asm __volatile ("ldl %0, 0x0(%1)" \ + : "=r" (data) /* outputs */ \ + : "r" (addr)); /* inputs */ + +#define ldr_macro(data, addr) \ + __asm __volatile ("ldr %0, 0x0(%1)" \ + : "=r" (data) /* outputs */ \ + : "r" (addr)); /* inputs */ + +#define sb_macro(data, addr) \ + __asm __volatile ("sb %0, 0x0(%1)" \ + : /* outputs */ \ + : "r" (data), "r" (addr)); /* inputs */ + +#define swl_macro(data, addr) \ + __asm __volatile ("swl %0, 0x0(%1)" \ + : /* outputs */ \ + : "r" (data), "r" (addr)); /* inputs */ + +#define swr_macro(data, addr) \ + __asm __volatile ("swr %0, 0x0(%1)" \ + : /* outputs */ \ + : "r" (data), "r" (addr)); /* inputs */ + +#define sdl_macro(data, addr) \ + __asm __volatile ("sdl %0, 0x0(%1)" \ + : /* outputs */ \ + : "r" (data), "r" (addr)); /* inputs */ + +#define sdr_macro(data, addr) \ + __asm __volatile ("sdr %0, 0x0(%1)" \ + : /* outputs */ \ + : "r" (data), "r" (addr)); /* inputs */ + static void log_illegal_instruction(const char *, struct trapframe *); static void log_bad_page_fault(char *, struct trapframe *, int); static void log_frame_dump(struct trapframe *frame); |