root/include/asm-sparc/processor.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. thread_saved_pc
  2. start_thread

   1 /* $Id: processor.h,v 1.40 1996/02/03 10:06:01 davem Exp $
   2  * include/asm-sparc/processor.h
   3  *
   4  * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
   5  */
   6 
   7 #ifndef __ASM_SPARC_PROCESSOR_H
   8 #define __ASM_SPARC_PROCESSOR_H
   9 
  10 #include <linux/a.out.h>
  11 
  12 #include <asm/psr.h>
  13 #include <asm/ptrace.h>
  14 #include <asm/head.h>
  15 #include <asm/signal.h>
  16 #include <asm/segment.h>
  17 
  18 /*
  19  * Bus types
  20  */
  21 #define EISA_bus 0
  22 #define EISA_bus__is_a_macro /* for versions in ksyms.c */
  23 #define MCA_bus 0
  24 #define MCA_bus__is_a_macro /* for versions in ksyms.c */
  25 
  26 /*
  27  * Write Protection works right in supervisor mode on the Sparc...
  28  * And then there came the Swift module, which isn't so swift...
  29  */
  30 extern char wp_works_ok;
  31 
  32 /* Whee, this is STACK_TOP and the lowest kernel address too... */
  33 #define TASK_SIZE       (KERNBASE)
  34 
  35 /* The Sparc processor specific thread struct. */
  36 struct thread_struct {
  37         unsigned long uwinmask __attribute__ ((aligned (8)));
  38         struct pt_regs *kregs;
  39 
  40         /* For signal handling */
  41         unsigned long sig_address __attribute__ ((aligned (8)));
  42         unsigned long sig_desc;
  43 
  44         /* Context switch saved kernel state. */
  45         unsigned long ksp __attribute__ ((aligned (8)));
  46         unsigned long kpc;
  47         unsigned long kpsr;
  48         unsigned long kwim;
  49 
  50         /* Special child fork kpsr/kwim values. */
  51         unsigned long fork_kpsr __attribute__ ((aligned (8)));
  52         unsigned long fork_kwim;
  53 
  54         /* A place to store user windows and stack pointers
  55          * when the stack needs inspection.
  56          */
  57 #define NSWINS 8
  58         struct reg_window reg_window[NSWINS] __attribute__ ((aligned (8)));
  59         unsigned long rwbuf_stkptrs[NSWINS] __attribute__ ((aligned (8)));
  60         unsigned long w_saved;
  61 
  62         /* Floating point regs */
  63         unsigned long   float_regs[64] __attribute__ ((aligned (8)));
  64         unsigned long   fsr;
  65         unsigned long   fpqdepth;
  66         struct fpq {
  67                 unsigned long *insn_addr;
  68                 unsigned long insn;
  69         } fpqueue[16];
  70         struct sigstack sstk_info;
  71         unsigned long flags;
  72         int current_ds;
  73         struct exec core_exec;     /* just what it says. */
  74 };
  75 
  76 #define SPARC_FLAG_KTHREAD      0x1    /* task is a kernel thread */
  77 
  78 #define INIT_MMAP { &init_mm, (0), (0), \
  79                     __pgprot(0x0) , VM_READ | VM_WRITE | VM_EXEC }
  80 
  81 #define INIT_TSS  { \
  82 /* uwinmask, kregs, sig_address, sig_desc, ksp, kpc, kpsr, kwim */ \
  83    0,        0,     0,           0,        0,   0,   0,    0, \
  84 /* fork_kpsr, fork_kwim */ \
  85    0,         0, \
  86 /* reg_window */  \
  87 { { { 0, }, { 0, } }, }, \
  88 /* rwbuf_stkptrs */  \
  89 { 0, 0, 0, 0, 0, 0, 0, 0, }, \
  90 /* w_saved */ \
  91    0, \
  92 /* FPU regs */   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  93                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  94                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  95                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, \
  96 /* FPU status, FPU qdepth, FPU queue */ \
  97    0,          0,  { { 0, 0, }, }, \
  98 /* sstk_info */ \
  99 { 0, 0, }, \
 100 /* flags,              current_ds, */ \
 101    SPARC_FLAG_KTHREAD, USER_DS, \
 102 /* core_exec */ \
 103 { 0, }, \
 104 }
 105 
 106 /* Return saved PC of a blocked thread. */
 107 extern inline unsigned long thread_saved_pc(struct thread_struct *t)
     /* [previous][next][first][last][top][bottom][index][help] */
 108 {
 109         return t->kregs->pc;
 110 }
 111 
 112 /*
 113  * Do necessary setup to start up a newly executed thread.
 114  */
 115 extern inline void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
     /* [previous][next][first][last][top][bottom][index][help] */
 116 {
 117         unsigned long saved_psr = (regs->psr & (PSR_CWP)) | PSR_S;
 118         int i;
 119 
 120         for(i = 0; i < 16; i++) regs->u_regs[i] = 0;
 121         regs->y = 0;
 122         regs->pc = ((pc & (~3)) - 4);
 123         regs->npc = regs->pc + 4;
 124         regs->psr = saved_psr;
 125         regs->u_regs[UREG_G1] = sp; /* Base of arg/env stack area */
 126         regs->u_regs[UREG_G2] = regs->u_regs[UREG_G7] = regs->npc;
 127         regs->u_regs[UREG_FP] = (sp - REGWIN_SZ);
 128 }
 129 
 130 extern unsigned long (*alloc_kernel_stack)(struct task_struct *tsk);
 131 extern void (*free_kernel_stack)(unsigned long stack);
 132 extern struct task_struct *(*alloc_task_struct)(void);
 133 extern void (*free_task_struct)(struct task_struct *tsk);
 134 
 135 #endif /* __ASM_SPARC_PROCESSOR_H */

/* [previous][next][first][last][top][bottom][index][help] */