patch-2.1.34 linux/include/asm-sparc64/processor.h

Next file: linux/include/asm-sparc64/psrcompat.h
Previous file: linux/include/asm-sparc64/posix_types.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.33/linux/include/asm-sparc64/processor.h linux/include/asm-sparc64/processor.h
@@ -1,4 +1,4 @@
-/* $Id: processor.h,v 1.10 1997/03/14 21:05:39 jj Exp $
+/* $Id: processor.h,v 1.20 1997/04/11 22:34:54 davem Exp $
  * include/asm-sparc64/processor.h
  *
  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -10,7 +10,6 @@
 #include <asm/a.out.h>
 #include <asm/pstate.h>
 #include <asm/ptrace.h>
-#include <asm/head.h>
 #include <asm/signal.h>
 #include <asm/segment.h>
 
@@ -24,19 +23,11 @@
 #define wp_works_ok 1
 #define wp_works_ok__is_a_macro /* for versions in ksyms.c */
 
-/* Whee, this is STACK_TOP + PAGE_SIZE and the lowest kernel address too... 
- * That one page is used to protect kernel from intruders, so that
- * we can make our access_ok test faster
- */
-#define TASK_SIZE	(0xFFFFF80000000000UL)
+/* User lives in his very own context, and cannot reference us. */
+#define TASK_SIZE	((1UL << (PAGE_SHIFT - 3)) * PGDIR_SIZE)
 
 #ifndef __ASSEMBLY__
 
-struct fpq {
-	unsigned long *insn_addr;
-	unsigned long insn;
-};
-
 #define NSWINS		8
 
 /* The Sparc processor specific thread struct. */
@@ -48,12 +39,9 @@
 	   is multiplied by 512 to get the amount of wasted kernel memory. */
 	unsigned int    float_regs[64] __attribute__ ((aligned (64)));
 	unsigned long   fsr;
-	unsigned long   fpqdepth;
-	struct fpq	fpqueue[16];
 	
 	/* Context switch saved kernel state. */
-	unsigned long user_globals[8];		/* performance hack */
-	unsigned long ksp, kpc;
+	unsigned long ksp, kpc, wstate, cwp;
 
 	/* Storage for windows when user stack is bogus. */
 	struct reg_window reg_window[NSWINS] __attribute__ ((aligned (16)));
@@ -82,7 +70,7 @@
 #define SPARC_FLAG_NEWSIGNALS   0x4    /* task wants new-style signals */
 #define SPARC_FLAG_32BIT        0x8    /* task is older 32-bit binary */
 
-#define INIT_MMAP { &init_mm, 0xfffff80000000000, 0xfffffe00000, \
+#define INIT_MMAP { &init_mm, 0xfffff80000000000, 0xfffff80001000000, \
 		    PAGE_SHARED , VM_READ | VM_WRITE | VM_EXEC }
 
 #define INIT_TSS  {							\
@@ -90,12 +78,10 @@
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	\
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	\
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },	\
-/* FPU status, FPU qdepth, FPU queue */ 				\
-   0,          0,          { { 0, 0, }, }, 				\
-/* user_globals */ 							\
-   { 0, 0, 0, 0, 0, 0, 0, 0 }, 						\
-/* ksp, kpc */ 								\
-   0,   0, 								\
+/* FPU status */ 							\
+   0, 									\
+/* ksp, kpc, wstate, cwp */ 						\
+   0,   0,   0,	     0,							\
 /* reg_window */							\
 { { { 0, }, { 0, } }, }, 						\
 /* rwbuf_stkptrs */							\
@@ -123,79 +109,85 @@
 }
 
 /* Do necessary setup to start up a newly executed thread. */
-extern __inline__ void start_thread(struct pt_regs *regs, unsigned long pc,
-				    unsigned long sp)
-{
-	regs->tstate = (regs->tstate & (TSTATE_CWP)) | TSTATE_IE;
-	regs->tpc = ((pc & (~3)) - 4);
-	regs->tnpc = regs->tpc + 4;
-	regs->y = 0;
-	__asm__ __volatile__("
-		stx		%%g0, [%0 + %2 + 0x00]
-		stx		%%g0, [%0 + %2 + 0x08]
-		stx		%%g0, [%0 + %2 + 0x10]
-		stx		%%g0, [%0 + %2 + 0x18]
-		stx		%%g0, [%0 + %2 + 0x20]
-		stx		%%g0, [%0 + %2 + 0x28]
-		stx		%%g0, [%0 + %2 + 0x30]
-		stx		%%g0, [%0 + %2 + 0x38]
-		stx		%%g0, [%0 + %2 + 0x40]
-		stx		%%g0, [%0 + %2 + 0x48]
-		stx		%%g0, [%0 + %2 + 0x50]
-		stx		%%g0, [%0 + %2 + 0x58]
-		stx		%%g0, [%0 + %2 + 0x60]
-		stx		%%g0, [%0 + %2 + 0x68]
-		stx		%1,   [%0 + %2 + 0x70]
-		stx		%%g0, [%0 + %2 + 0x78]
-		" : : "r" (regs), "r" (sp - REGWIN_SZ),
-		      "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0])));
-}
-
-extern __inline__ void start_thread32(struct pt_regs *regs, unsigned long pc,
-				      unsigned long sp)
-{
-	register unsigned int zero asm("g1");
-
-	pc &= 0x00000000ffffffffUL;
-	sp &= 0x00000000ffffffffUL;
-
-	regs->tstate = (regs->tstate & (TSTATE_CWP)) | (TSTATE_IE | TSTATE_AM);
-	regs->tpc = ((pc & (~3)) - 4);
-	regs->tnpc = regs->tpc + 4;
-	regs->y = 0;
-	zero = 0;
-	__asm__ __volatile__("
-		stx		%%g0, [%0 + %2 + 0x00]
-		stx		%%g0, [%0 + %2 + 0x08]
-		stx		%%g0, [%0 + %2 + 0x10]
-		stx		%%g0, [%0 + %2 + 0x18]
-		stx		%%g0, [%0 + %2 + 0x20]
-		stx		%%g0, [%0 + %2 + 0x28]
-		stx		%%g0, [%0 + %2 + 0x30]
-		stx		%%g0, [%0 + %2 + 0x38]
-		stx		%%g0, [%0 + %2 + 0x40]
-		stx		%%g0, [%0 + %2 + 0x48]
-		stx		%%g0, [%0 + %2 + 0x50]
-		stx		%%g0, [%0 + %2 + 0x58]
-		stx		%%g0, [%0 + %2 + 0x60]
-		stx		%%g0, [%0 + %2 + 0x68]
-		stx		%1,   [%0 + %2 + 0x70]
-		stx		%%g0, [%0 + %2 + 0x78]
-		" : : "r" (regs), "r" (sp - REGWIN32_SZ),
-		      "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0])),
-		      "r" (zero));
-}
+#define start_thread(regs, pc, sp) \
+do { \
+	regs->tstate = (regs->tstate & (TSTATE_CWP)) | TSTATE_IE; \
+	regs->tpc = ((pc & (~3)) - 4); \
+	regs->tnpc = regs->tpc + 4; \
+	regs->y = 0; \
+	__asm__ __volatile__( \
+	"stx		%%g0, [%0 + %2 + 0x00]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x08]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x10]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x18]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x20]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x28]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x30]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x38]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x40]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x48]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x50]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x58]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x60]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x68]\n\t" \
+	"stx		%1,   [%0 + %2 + 0x70]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x78]\n\t" \
+	: \
+	: "r" (regs), "r" (sp - REGWIN_SZ), \
+	  "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \
+} while(0)
+
+#define start_thread32(regs, pc, sp) \
+do { \
+	register unsigned int zero asm("g1"); \
+\
+	pc &= 0x00000000ffffffffUL; \
+	sp &= 0x00000000ffffffffUL; \
+\
+	regs->tstate = (regs->tstate & (TSTATE_CWP)) | (TSTATE_IE | TSTATE_AM); \
+	regs->tpc = ((pc & (~3)) - 4); \
+	regs->tnpc = regs->tpc + 4; \
+	regs->y = 0; \
+	current->tss.flags |= SPARC_FLAG_32BIT; \
+	zero = 0; \
+	__asm__ __volatile__( \
+	"stx		%%g0, [%0 + %2 + 0x00]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x08]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x10]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x18]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x20]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x28]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x30]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x38]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x40]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x48]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x50]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x58]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x60]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x68]\n\t" \
+	"stx		%1,   [%0 + %2 + 0x70]\n\t" \
+	"stx		%%g0, [%0 + %2 + 0x78]\n\t" \
+	: \
+	: "r" (regs), "r" (sp - REGWIN32_SZ), \
+	  "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0])), \
+	  "r" (zero)); \
+} while(0)
 
 /* Free all resources held by a thread. */
 #define release_thread(tsk)		do { } while(0)
 
 #ifdef __KERNEL__
 /* Allocation and freeing of basic task resources. */
+
+/* XXX FIXME For task_struct must use SLAB or something other than
+ * XXX kmalloc() as FPU registers in TSS require that entire structure
+ * XXX be 64-byte aligned as well.
+ */
 #define alloc_kernel_stack(tsk)		__get_free_page(GFP_KERNEL)
 #define free_kernel_stack(stack)	free_page(stack)
 #define alloc_task_struct()		kmalloc(sizeof(struct task_struct), GFP_KERNEL)
 #define free_task_struct(tsk)		kfree(tsk)
-#endif
+#endif /* __KERNEL__ */
 
 #endif /* !(__ASSEMBLY__) */
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov