ttable.h

来自「linux 内核源代码」· C头文件 代码 · 共 671 行 · 第 1/2 页

H
671
字号
/* $Id: ttable.h,v 1.18 2002/02/09 19:49:32 davem Exp $ */#ifndef _SPARC64_TTABLE_H#define _SPARC64_TTABLE_H#include <asm/utrap.h>#ifdef __ASSEMBLY__#include <asm/thread_info.h>#endif#define BOOT_KERNEL b sparc64_boot; nop; nop; nop; nop; nop; nop; nop;/* We need a "cleaned" instruction... */#define CLEAN_WINDOW							\	rdpr	%cleanwin, %l0;		add	%l0, 1, %l0;		\	wrpr	%l0, 0x0, %cleanwin;					\	clr	%o0;	clr	%o1;	clr	%o2;	clr	%o3;	\	clr	%o4;	clr	%o5;	clr	%o6;	clr	%o7;	\	clr	%l0;	clr	%l1;	clr	%l2;	clr	%l3;	\	clr	%l4;	clr	%l5;	clr	%l6;	clr	%l7;	\	retry;								\	nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;#define TRAP(routine)					\	sethi	%hi(109f), %g7;				\	ba,pt	%xcc, etrap;				\109:	 or	%g7, %lo(109b), %g7;			\	call	routine;				\	 add	%sp, PTREGS_OFF, %o0;			\	ba,pt	%xcc, rtrap;				\	 clr	%l6;					\	nop;#define TRAP_7INSNS(routine)				\	sethi	%hi(109f), %g7;				\	ba,pt	%xcc, etrap;				\109:	 or	%g7, %lo(109b), %g7;			\	call	routine;				\	 add	%sp, PTREGS_OFF, %o0;			\	ba,pt	%xcc, rtrap;				\	 clr	%l6;#define TRAP_SAVEFPU(routine)				\	sethi	%hi(109f), %g7;				\	ba,pt	%xcc, do_fptrap;			\109:	 or	%g7, %lo(109b), %g7;			\	call	routine;				\	 add	%sp, PTREGS_OFF, %o0;			\	ba,pt	%xcc, rtrap;				\	 clr	%l6;					\	nop;#define TRAP_NOSAVE(routine)				\	ba,pt	%xcc, routine;				\	 nop;						\	nop; nop; nop; nop; nop; nop;	#define TRAP_NOSAVE_7INSNS(routine)			\	ba,pt	%xcc, routine;				\	 nop;						\	nop; nop; nop; nop; nop;	#define TRAPTL1(routine)				\	sethi	%hi(109f), %g7;				\	ba,pt	%xcc, etraptl1;				\109:	 or	%g7, %lo(109b), %g7;			\	call	routine;				\	 add	%sp, PTREGS_OFF, %o0;			\	ba,pt	%xcc, rtrap;				\	 clr	%l6;					\	nop;	#define TRAP_ARG(routine, arg)				\	sethi	%hi(109f), %g7;				\	ba,pt	%xcc, etrap;				\109:	 or	%g7, %lo(109b), %g7;			\	add	%sp, PTREGS_OFF, %o0;			\	call	routine;				\	 mov	arg, %o1;				\	ba,pt	%xcc, rtrap;				\	 clr	%l6;	#define TRAPTL1_ARG(routine, arg)			\	sethi	%hi(109f), %g7;				\	ba,pt	%xcc, etraptl1;				\109:	 or	%g7, %lo(109b), %g7;			\	add	%sp, PTREGS_OFF, %o0;			\	call	routine;				\	 mov	arg, %o1;				\	ba,pt	%xcc, rtrap;				\	 clr	%l6;	#define SYSCALL_TRAP(routine, systbl)			\	sethi	%hi(109f), %g7;				\	ba,pt	%xcc, etrap;				\109:	 or	%g7, %lo(109b), %g7;			\	sethi	%hi(systbl), %l7;			\	ba,pt	%xcc, routine;				\	 or	%l7, %lo(systbl), %l7;			\	nop; nop;	#define INDIRECT_SOLARIS_SYSCALL(num)			\	sethi	%hi(109f), %g7;				\	ba,pt	%xcc, etrap;				\109:	 or	%g7, %lo(109b), %g7;			\	ba,pt	%xcc, tl0_solaris + 0xc;		\	 mov	num, %g1;				\	nop;nop;nop;	#define TRAP_UTRAP(handler,lvl)				\	mov	handler, %g3;				\	ba,pt	%xcc, utrap_trap;			\	 mov	lvl, %g4;				\	nop;						\	nop;						\	nop;						\	nop;						\	nop;#ifdef CONFIG_SUNOS_EMUL#define SUNOS_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sunos_sys_table)#else#define SUNOS_SYSCALL_TRAP TRAP(sunos_syscall)#endif#ifdef CONFIG_COMPAT#define	LINUX_32BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sys_call_table32)#else#define	LINUX_32BIT_SYSCALL_TRAP BTRAP(0x110)#endif#define LINUX_64BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table64)#define GETCC_TRAP TRAP(getcc)#define SETCC_TRAP TRAP(setcc)#ifdef CONFIG_SOLARIS_EMUL#define SOLARIS_SYSCALL_TRAP TRAP(solaris_sparc_syscall)#else#define SOLARIS_SYSCALL_TRAP TRAP(solaris_syscall)#endif#define BREAKPOINT_TRAP TRAP(breakpoint_trap)#ifdef CONFIG_TRACE_IRQFLAGS#define TRAP_IRQ(routine, level)			\	rdpr	%pil, %g2;				\	wrpr	%g0, 15, %pil;				\	sethi	%hi(1f-4), %g7;				\	ba,pt	%xcc, etrap_irq;			\	 or	%g7, %lo(1f-4), %g7;			\	nop;						\	nop;						\	nop;						\	.subsection	2;				\1:	call	trace_hardirqs_off;			\	 nop;						\	mov	level, %o0;				\	call	routine;				\	 add	%sp, PTREGS_OFF, %o1;			\	ba,a,pt	%xcc, rtrap_irq;			\	.previous;#else#define TRAP_IRQ(routine, level)			\	rdpr	%pil, %g2;				\	wrpr	%g0, 15, %pil;				\	ba,pt	%xcc, etrap_irq;			\	 rd	%pc, %g7;				\	mov	level, %o0;				\	call	routine;				\	 add	%sp, PTREGS_OFF, %o1;			\	ba,a,pt	%xcc, rtrap_irq;	#endif#define TRAP_IVEC TRAP_NOSAVE(do_ivec)#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl)#define BTRAPTL1(lvl) TRAPTL1_ARG(bad_trap_tl1, lvl)#define FLUSH_WINDOW_TRAP						\	ba,pt	%xcc, etrap;						\	 rd	%pc, %g7;						\	flushw;								\	ldx	[%sp + PTREGS_OFF + PT_V9_TNPC], %l1;			\	add	%l1, 4, %l2;						\	stx	%l1, [%sp + PTREGS_OFF + PT_V9_TPC];			\	ba,pt	%xcc, rtrap_clr_l6;					\	 stx	%l2, [%sp + PTREGS_OFF + PT_V9_TNPC];	        #ifdef CONFIG_KPROBES#define KPROBES_TRAP(lvl) TRAP_IRQ(kprobe_trap, lvl)#else#define KPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl)#endif#define SUN4V_ITSB_MISS					\	ldxa	[%g0] ASI_SCRATCHPAD, %g2;		\	ldx	[%g2 + HV_FAULT_I_ADDR_OFFSET], %g4;	\	ldx	[%g2 + HV_FAULT_I_CTX_OFFSET], %g5;	\	srlx	%g4, 22, %g6;				\	ba,pt	%xcc, sun4v_itsb_miss;			\	 nop;						\	nop;						\	nop;#define SUN4V_DTSB_MISS					\	ldxa	[%g0] ASI_SCRATCHPAD, %g2;		\	ldx	[%g2 + HV_FAULT_D_ADDR_OFFSET], %g4;	\	ldx	[%g2 + HV_FAULT_D_CTX_OFFSET], %g5;	\	srlx	%g4, 22, %g6;				\	ba,pt	%xcc, sun4v_dtsb_miss;			\	 nop;						\	nop;						\	nop;/* Before touching these macros, you owe it to yourself to go and * see how arch/sparc64/kernel/winfixup.S works... -DaveM * * For the user cases we used to use the %asi register, but * it turns out that the "wr xxx, %asi" costs ~5 cycles, so * now we use immediate ASI loads and stores instead.  Kudos * to Greg Onufer for pointing out this performance anomaly. * * Further note that we cannot use the g2, g4, g5, and g7 alternate * globals in the spill routines, check out the save instruction in * arch/sparc64/kernel/etrap.S to see what I mean about g2, and * g4/g5 are the globals which are preserved by etrap processing * for the caller of it.  The g7 register is the return pc for * etrap.  Finally, g6 is the current thread register so we cannot * us it in the spill handlers either.  Most of these rules do not * apply to fill processing, only g6 is not usable. *//* Normal kernel spill */#define SPILL_0_NORMAL					\	stx	%l0, [%sp + STACK_BIAS + 0x00];		\	stx	%l1, [%sp + STACK_BIAS + 0x08];		\	stx	%l2, [%sp + STACK_BIAS + 0x10];		\	stx	%l3, [%sp + STACK_BIAS + 0x18];		\	stx	%l4, [%sp + STACK_BIAS + 0x20];		\	stx	%l5, [%sp + STACK_BIAS + 0x28];		\	stx	%l6, [%sp + STACK_BIAS + 0x30];		\	stx	%l7, [%sp + STACK_BIAS + 0x38];		\	stx	%i0, [%sp + STACK_BIAS + 0x40];		\	stx	%i1, [%sp + STACK_BIAS + 0x48];		\	stx	%i2, [%sp + STACK_BIAS + 0x50];		\	stx	%i3, [%sp + STACK_BIAS + 0x58];		\	stx	%i4, [%sp + STACK_BIAS + 0x60];		\	stx	%i5, [%sp + STACK_BIAS + 0x68];		\	stx	%i6, [%sp + STACK_BIAS + 0x70];		\	stx	%i7, [%sp + STACK_BIAS + 0x78];		\	saved; retry; nop; nop; nop; nop; nop; nop;	\	nop; nop; nop; nop; nop; nop; nop; nop;#define SPILL_0_NORMAL_ETRAP				\etrap_kernel_spill:					\	stx	%l0, [%sp + STACK_BIAS + 0x00];		\	stx	%l1, [%sp + STACK_BIAS + 0x08];		\	stx	%l2, [%sp + STACK_BIAS + 0x10];		\	stx	%l3, [%sp + STACK_BIAS + 0x18];		\	stx	%l4, [%sp + STACK_BIAS + 0x20];		\	stx	%l5, [%sp + STACK_BIAS + 0x28];		\	stx	%l6, [%sp + STACK_BIAS + 0x30];		\	stx	%l7, [%sp + STACK_BIAS + 0x38];		\	stx	%i0, [%sp + STACK_BIAS + 0x40];		\	stx	%i1, [%sp + STACK_BIAS + 0x48];		\	stx	%i2, [%sp + STACK_BIAS + 0x50];		\	stx	%i3, [%sp + STACK_BIAS + 0x58];		\	stx	%i4, [%sp + STACK_BIAS + 0x60];		\	stx	%i5, [%sp + STACK_BIAS + 0x68];		\	stx	%i6, [%sp + STACK_BIAS + 0x70];		\	stx	%i7, [%sp + STACK_BIAS + 0x78];		\	saved;						\	sub	%g1, 2, %g1;				\	ba,pt	%xcc, etrap_save;			\	wrpr	%g1, %cwp;				\	nop; nop; nop; nop; nop; nop; nop; nop;		\	nop; nop; nop; nop;/* Normal 64bit spill */#define SPILL_1_GENERIC(ASI)				\	add	%sp, STACK_BIAS + 0x00, %g1;		\	stxa	%l0, [%g1 + %g0] ASI;			\	mov	0x08, %g3;				\	stxa	%l1, [%g1 + %g3] ASI;			\	add	%g1, 0x10, %g1;				\	stxa	%l2, [%g1 + %g0] ASI;			\	stxa	%l3, [%g1 + %g3] ASI;			\	add	%g1, 0x10, %g1;				\	stxa	%l4, [%g1 + %g0] ASI;			\	stxa	%l5, [%g1 + %g3] ASI;			\	add	%g1, 0x10, %g1;				\	stxa	%l6, [%g1 + %g0] ASI;			\	stxa	%l7, [%g1 + %g3] ASI;			\	add	%g1, 0x10, %g1;				\	stxa	%i0, [%g1 + %g0] ASI;			\	stxa	%i1, [%g1 + %g3] ASI;			\	add	%g1, 0x10, %g1;				\	stxa	%i2, [%g1 + %g0] ASI;			\	stxa	%i3, [%g1 + %g3] ASI;			\	add	%g1, 0x10, %g1;				\	stxa	%i4, [%g1 + %g0] ASI;			\	stxa	%i5, [%g1 + %g3] ASI;			\	add	%g1, 0x10, %g1;				\	stxa	%i6, [%g1 + %g0] ASI;			\	stxa	%i7, [%g1 + %g3] ASI;			\	saved;						\	retry; nop; nop;				\	b,a,pt	%xcc, spill_fixup_dax;			\	b,a,pt	%xcc, spill_fixup_mna;			\	b,a,pt	%xcc, spill_fixup;#define SPILL_1_GENERIC_ETRAP				\etrap_user_spill_64bit:					\	stxa	%l0, [%sp + STACK_BIAS + 0x00] %asi;	\	stxa	%l1, [%sp + STACK_BIAS + 0x08] %asi;	\	stxa	%l2, [%sp + STACK_BIAS + 0x10] %asi;	\	stxa	%l3, [%sp + STACK_BIAS + 0x18] %asi;	\	stxa	%l4, [%sp + STACK_BIAS + 0x20] %asi;	\	stxa	%l5, [%sp + STACK_BIAS + 0x28] %asi;	\	stxa	%l6, [%sp + STACK_BIAS + 0x30] %asi;	\	stxa	%l7, [%sp + STACK_BIAS + 0x38] %asi;	\	stxa	%i0, [%sp + STACK_BIAS + 0x40] %asi;	\	stxa	%i1, [%sp + STACK_BIAS + 0x48] %asi;	\	stxa	%i2, [%sp + STACK_BIAS + 0x50] %asi;	\	stxa	%i3, [%sp + STACK_BIAS + 0x58] %asi;	\	stxa	%i4, [%sp + STACK_BIAS + 0x60] %asi;	\	stxa	%i5, [%sp + STACK_BIAS + 0x68] %asi;	\	stxa	%i6, [%sp + STACK_BIAS + 0x70] %asi;	\	stxa	%i7, [%sp + STACK_BIAS + 0x78] %asi;	\	saved;						\	sub	%g1, 2, %g1;				\	ba,pt	%xcc, etrap_save;			\	 wrpr	%g1, %cwp;				\	nop; nop; nop; nop; nop;			\	nop; nop; nop; nop;				\

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?