1 /* include/asm-sparc/processor.h 2 * 3 * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) 4 */ 5
6 #ifndef__ASM_SPARC_PROCESSOR_H 7 #define__ASM_SPARC_PROCESSOR_H 8
9 #include <linux/sched.h> /* For intr_count */ 10
11 #include <asm/ptrace.h> /* For pt_regs declaration */ 12
13 /* 14 * Bus types 15 */ 16 #defineEISA_bus 0
17 #defineEISA_bus__is_a_macro/* for versions in ksyms.c */ 18 #defineMCA_bus 0
19 #defineMCA_bus__is_a_macro/* for versions in ksyms.c */ 20
21 /* 22 * Write Protection works right in supervisor mode on the Sparc 23 */ 24 #if 0 /* Let's try this out ;) */ 25 #definewp_works_ok 1
26 #definewp_works_ok__is_a_macro/* for versions in ksyms.c */ 27 #else 28 externcharwp_works_ok;
29 #endif 30
31 /* 32 * User space process size: 3GB. This is hardcoded into a few places, 33 * so don't change it unless you know what you are doing. 34 * 35 * With the way identity mapping works on the sun4c, this is the best 36 * value to use. 37 * 38 * This has to be looked into for a unified sun4c/sun4m task size. 39 */ 40 #defineTASK_SIZE (0xC000000UL)
41
42 /* 43 * Size of io_bitmap in longwords: 32 is ports 0-0x3ff. 44 */ 45 #defineIO_BITMAP_SIZE 32
46
47 /* The first four entries here MUST be the first four. This allows me to 48 * do %lo(offset) loads and stores in entry.S. See TRAP_WIN_CLEAN to see 49 * why. 50 */ 51
52 structthread_struct{ 53 unsignedlong uwindows; /* how many user windows are in the set */ 54 unsignedlong wim; /* user's window invalid mask */ 55 unsignedlong w_saved; /* how many windows saved in reg_window[] */ 56 unsignedlongksp; /* kernel stack pointer */ 57 unsignedlongusp; /* user's sp, throw reg windows here */ 58 unsignedlongpsr; /* save for condition codes */ 59 unsignedlongpc; /* program counter */ 60 unsignedlongnpc; /* next program counter */ 61 unsignedlong yreg;
62 unsignedlongalign; /* to get 8-byte alignment XXX */ 63 unsignedlong reg_window[16];
64 unsignedlongpgd_ptr;
65 intcontext; /* The context allocated to this thread */ 66
67 /* 8 local registers + 8 in registers * 24 register windows. 68 * Most sparcs I know of only have 7 or 8 windows implemented, 69 * we determine how many at boot time and store that value 70 * in nwindows. 71 */ 72 unsignedlong float_regs[64]; /* V8 and below have 32, V9 has 64 */ 73 };
74
75 #defineINIT_MMAP{ &init_task, (PAGE_OFFSET), (0xff000000UL), \
76 0x0 , VM_READ | VM_WRITE | VM_EXEC} 77
78 #defineINIT_TSS{ \
79 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
80 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, \
81 (long) &swapper_pg_dir, -1, \
82 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
83 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
84 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
85 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, \
86 } 87
88 /* The thread_frame is what needs to be set up in certain circumstances 89 * upon entry to a trap. It is also loaded sometimes during a window 90 * spill if things don't go right (bad user stack pointer). In reality 91 * it is not per-process per se, it just sits in the kernel stack while 92 * the current process is in a handler then it is basically forgotten 93 * about the next time flow control goes back to that process. 94 */ 95
96 /* Sparc stack save area allocated for each save, not very exciting. */ 97 struct sparc_save_stack { 98 unsignedint locals[8];
99 unsignedintins[8];
100 unsignedint padd[8];
101 };
102
103 /* 104 * These are the "cli()" and "sti()" for software interrupts 105 * They work by increasing/decreasing the "intr_count" value, 106 * and as such can be nested arbitrarily. 107 */ 108 externinlinevoidstart_bh_atomic(void)
/* */ 109 { 110 __asm____volatile__("rd %%psr, %%g2\n\t"
111 "wr %%g2, 0x20, %%psr\n\t" /* disable traps */ 112 "ld %0,%%g3\n\t"
113 "add %%g3,1,%%g3\n\t"
114 "st %%g3,%0\n\t"
115 "wr %%g2, 0x0, %%psr\n\t" /* enable traps */ 116 : "=m" (intr_count)
117 : : "g2", "g3", "memory");
118 } 119
120 externinlinevoidend_bh_atomic(void)
/* */ 121 { 122 __asm____volatile__("rd %%psr, %%g2\n\t"
123 "wr %%g2, 0x20, %%psr\n\t"
124 "ld %0,%%g3\n\t"
125 "sub %%g3,1,%%g3\n\t"
126 "st %%g3,%0\n\t"
127 "wr %%g2, 0x0, %%psr\n\t"
128 : "=m" (intr_count)
129 : : "g2", "g3", "memory");
130 } 131
132 /* 133 * Do necessary setup to start up a newly executed thread. 134 */ 135 staticinlinevoidstart_thread(structpt_regs * regs, unsignedlongsp,
/* */ 136 unsignedlongfp)
137 { 138 printk("start_thread called, halting..n");
139 halt();
140 } 141
142 #endif/* __ASM_SPARC_PROCESSOR_H */ 143