Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Sep 2013 16:35:18 +0200
From:      Warner Losh <imp@bsdimp.com>
To:        "freebsd-mips@FreeBSD.org" <mips@freebsd.org>
Subject:   Minor cleanup
Message-ID:  <768FD7A4-CC9B-4034-8FAF-2C98A2095B6C@bsdimp.com>

next in thread | raw e-mail | index | archive | help

--Apple-Mail-4-578676191
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Greetings,

Looking for someone to review this minor cleanup on mips. I've moved a =
few little things from asm.h, where they don't belong, into pcb.h where =
they do. I've also moved a little duplication out of swtch.S and =
exception.S into pcb.h.

http://people.freebsd.org/~imp/mips-1.diff

Warner


--Apple-Mail-4-578676191
Content-Disposition: attachment;
	filename=mips-1.diff
Content-Type: application/octet-stream;
	name="mips-1.diff"
Content-Transfer-Encoding: 7bit

Index: sys/mips/include/asm.h
===================================================================
--- sys/mips/include/asm.h	(revision 255930)
+++ sys/mips/include/asm.h	(working copy)
@@ -262,38 +262,6 @@
 	.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)
Index: sys/mips/include/pcb.h
===================================================================
--- sys/mips/include/pcb.h	(revision 255930)
+++ sys/mips/include/pcb.h	(working copy)
@@ -79,6 +79,56 @@
 
 void makectx(struct trapframe *, struct pcb *);
 int savectx(struct pcb *) __returns_twice;
+
+/*
+ * 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)
+
 #endif
 #endif
 
Index: sys/mips/mips/exception.S
===================================================================
--- sys/mips/mips/exception.S	(revision 255930)
+++ sys/mips/mips/exception.S	(working copy)
@@ -61,6 +61,7 @@
 #include <machine/regnum.h>
 #include <machine/cpuregs.h>
 #include <machine/pte.h>
+#include <machine/pcb.h>
 
 #include "assym.s"
 
@@ -411,12 +412,6 @@
 END(MipsKernGenException)
 
 
-#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)
-
 /*----------------------------------------------------------------------------
  *
  * MipsUserGenException --
Index: sys/mips/mips/swtch.S
===================================================================
--- sys/mips/mips/swtch.S	(revision 255930)
+++ sys/mips/mips/swtch.S	(working copy)
@@ -68,31 +68,6 @@
 
 	.set	noreorder			# Noreorder is default style!
 
-#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)
-
-
 /*
  * Setup for and return to user.
  */

--Apple-Mail-4-578676191--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?768FD7A4-CC9B-4034-8FAF-2C98A2095B6C>