Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Oct 2013 04:36:35 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r256494 - head/sys/mips/include
Message-ID:  <201310150436.r9F4aZA0091464@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Tue Oct 15 04:36:34 2013
New Revision: 256494
URL: http://svnweb.freebsd.org/changeset/base/256494

Log:
  Move DO_AST into pcb.h where it should have been all along. Move some
  common macros for saving/restoring registers into pcb.h as well.

Modified:
  head/sys/mips/include/asm.h
  head/sys/mips/include/pcb.h

Modified: head/sys/mips/include/asm.h
==============================================================================
--- head/sys/mips/include/asm.h	Tue Oct 15 04:32:06 2013	(r256493)
+++ head/sys/mips/include/asm.h	Tue Oct 15 04:36:34 2013	(r256494)
@@ -262,38 +262,6 @@ _C_LABEL(x):
 	.align	3
 
 /*
- * Call ast if required
- *
- * XXX Do we really need to disable interrupts?
- */
-#define DO_AST				             \
-44:				                     \
-	mfc0	t0, MIPS_COP_0_STATUS               ;\
-	and	a0, t0, MIPS_SR_INT_IE              ;\
-	xor	t0, a0, t0                          ;\
-	mtc0	t0, MIPS_COP_0_STATUS               ;\
-	COP0_SYNC                                   ;\
-	GET_CPU_PCPU(s1)                            ;\
-	PTR_L	s3, PC_CURPCB(s1)                   ;\
-	PTR_L	s1, PC_CURTHREAD(s1)                ;\
-	lw	s2, TD_FLAGS(s1)                    ;\
-	li	s0, TDF_ASTPENDING | TDF_NEEDRESCHED;\
-	and	s2, s0                              ;\
-	mfc0	t0, MIPS_COP_0_STATUS               ;\
-	or	t0, a0, t0                          ;\
-	mtc0	t0, MIPS_COP_0_STATUS               ;\
-	COP0_SYNC                                   ;\
-	beq	s2, zero, 4f                        ;\
-	nop                                         ;\
-	PTR_LA	s0, _C_LABEL(ast)                   ;\
-	jalr	s0                                  ;\
-	PTR_ADDU a0, s3, U_PCB_REGS                 ;\
-	j	44b		                    ;\
-        nop                                         ;\
-4:
-
-
-/*
  * XXX retain dialects XXX
  */
 #define	ALEAF(x)			XLEAF(x)

Modified: head/sys/mips/include/pcb.h
==============================================================================
--- head/sys/mips/include/pcb.h	Tue Oct 15 04:32:06 2013	(r256493)
+++ head/sys/mips/include/pcb.h	Tue Oct 15 04:36:34 2013	(r256494)
@@ -60,6 +60,61 @@
 #define	PCB_REG_GP	12
 #define	PCB_REG_PC	13
 
+/*
+ * Call ast if required
+ *
+ * XXX Do we really need to disable interrupts?
+ */
+#define DO_AST				             \
+44:				                     \
+	mfc0	t0, MIPS_COP_0_STATUS               ;\
+	and	a0, t0, MIPS_SR_INT_IE              ;\
+	xor	t0, a0, t0                          ;\
+	mtc0	t0, MIPS_COP_0_STATUS               ;\
+	COP0_SYNC                                   ;\
+	GET_CPU_PCPU(s1)                            ;\
+	PTR_L	s3, PC_CURPCB(s1)                   ;\
+	PTR_L	s1, PC_CURTHREAD(s1)                ;\
+	lw	s2, TD_FLAGS(s1)                    ;\
+	li	s0, TDF_ASTPENDING | TDF_NEEDRESCHED;\
+	and	s2, s0                              ;\
+	mfc0	t0, MIPS_COP_0_STATUS               ;\
+	or	t0, a0, t0                          ;\
+	mtc0	t0, MIPS_COP_0_STATUS               ;\
+	COP0_SYNC                                   ;\
+	beq	s2, zero, 4f                        ;\
+	nop                                         ;\
+	PTR_LA	s0, _C_LABEL(ast)                   ;\
+	jalr	s0                                  ;\
+	PTR_ADDU a0, s3, U_PCB_REGS                 ;\
+	j	44b		                    ;\
+        nop                                         ;\
+4:
+
+#define	SAVE_U_PCB_REG(reg, offs, base) \
+	REG_S	reg, U_PCB_REGS + (SZREG * offs) (base)
+
+#define	RESTORE_U_PCB_REG(reg, offs, base) \
+	REG_L	reg, U_PCB_REGS + (SZREG * offs) (base)
+
+#define	SAVE_U_PCB_FPREG(reg, offs, base) \
+	FP_S	reg, U_PCB_FPREGS + (SZFPREG * offs) (base)
+
+#define	RESTORE_U_PCB_FPREG(reg, offs, base) \
+	FP_L	reg, U_PCB_FPREGS + (SZFPREG * offs) (base)
+
+#define	SAVE_U_PCB_FPSR(reg, offs, base) \
+	REG_S	reg, U_PCB_FPREGS + (SZFPREG * offs) (base)
+
+#define	RESTORE_U_PCB_FPSR(reg, offs, base) \
+	REG_L	reg, U_PCB_FPREGS + (SZFPREG * offs) (base)
+
+#define	SAVE_U_PCB_CONTEXT(reg, offs, base) \
+	REG_S	reg, U_PCB_CONTEXT + (SZREG * offs) (base)
+
+#define	RESTORE_U_PCB_CONTEXT(reg, offs, base) \
+	REG_L	reg, U_PCB_CONTEXT + (SZREG * offs) (base)
+
 #ifndef LOCORE
 #include <machine/frame.h>
 
@@ -79,6 +134,7 @@ extern struct pcb *curpcb;		/* the curre
 
 void makectx(struct trapframe *, struct pcb *);
 int savectx(struct pcb *) __returns_twice;
+
 #endif
 #endif
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310150436.r9F4aZA0091464>