Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | /* * include/asm-parisc/processor.h * * Copyright (C) 1994 Linus Torvalds */ #ifndef __ASM_PARISC_PROCESSOR_H #define __ASM_PARISC_PROCESSOR_H #ifndef __ASSEMBLY__ #include <linux/threads.h> #include <asm/hardware.h> #include <asm/page.h> #include <asm/pdc.h> #include <asm/ptrace.h> #include <asm/types.h> #endif /* __ASSEMBLY__ */ /* * Default implementation of macro that returns current * instruction pointer ("program counter"). */ /* We cannot use MFIA as it was added for PA2.0 - prumpf At one point there were no "0f/0b" type local symbols in gas for PA-RISC. This is no longer true, but this still seems like the nicest way to implement this. */ #define current_text_addr() ({ void *pc; __asm__("\n\tblr 0,%0\n\tnop":"=r" (pc)); pc; }) #define TASK_SIZE (PAGE_OFFSET) #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) #ifndef __ASSEMBLY__ /* ** Data detected about CPUs at boot time which is the same for all CPU's. ** HP boxes are SMP - ie identical processors. ** ** FIXME: some CPU rev info may be processor specific... */ struct system_cpuinfo_parisc { unsigned int cpu_count; unsigned int cpu_hz; unsigned int hversion; unsigned int sversion; enum cpu_type cpu_type; struct { struct pdc_model model; struct pdc_model_cpuid /* ARGH */ versions; struct pdc_model_cpuid cpuid; #if 0 struct pdc_model_caps caps; #endif char sys_model_name[81]; /* PDC-ROM returnes this model name */ } pdc; char *model_name; char *cpu_name; char *family_name; }; /* ** Per CPU data structure - ie varies per CPU. */ struct cpuinfo_parisc { unsigned cpuid; struct irq_region *region; unsigned long it_value; /* Interval Timer value at last timer interrupt */ unsigned long it_delta; /* Interval Timer delta (tic_10ms / HZ * 100) */ unsigned long hpa; /* Host Physical address */ unsigned long txn_addr; /* External Interrupt Register or id_eid */ unsigned long bh_count; /* number of times bh was invoked */ unsigned long irq_count; /* number of IRQ's since boot */ unsigned long irq_max_cr16; /* longest time to handle a single IRQ */ }; extern struct system_cpuinfo_parisc boot_cpu_data; extern struct cpuinfo_parisc cpu_data[NR_CPUS]; #define current_cpu_data cpu_data[smp_processor_id()] extern void identify_cpu(struct cpuinfo_parisc *); #define EISA_bus 0 /* we don't have ISA support yet */ #define EISA_bus__is_a_macro /* for versions in ksyms.c */ #define MCA_bus 0 #define MCA_bus__is_a_macro /* for versions in ksyms.c */ typedef struct { int seg; } mm_segment_t; struct thread_struct { struct pt_regs regs; unsigned long pg_tables; unsigned long flags; }; /* Thread struct flags. */ #define PARISC_KERNEL_DEATH (1UL << 31) /* see die_if_kernel()... */ #define INIT_MMAP { &init_mm, 0, 0, NULL, PAGE_SHARED, \ VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } #define INIT_THREAD { { \ { 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, \ 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 \ }, __pa((unsigned long) swapper_pg_dir) } /* * Return saved PC of a blocked thread. This is used by ps mostly. */ extern inline unsigned long thread_saved_pc(struct thread_struct *t) { return 0xabcdef; } /* * Start user thread in another space. * * Note that we set both the iaoq and r31 to the new pc. When * the kernel initially calls execve it will return through an * rfi path that will use the values in the iaoq. The execve * syscall path will return through the gateway page, and * that uses r31 to branch to. * * For ELF we clear r23, because the dynamic linker uses it to pass * the address of the finalizer function. * * We also initialize sr3 to an illegal value (illegal for our * implementation, not for the architecture). */ /* The ELF abi wants things done a "wee bit" differently than * som does. Supporting this behavior here avoids * having our own version of create_elf_tables. * * Oh, and yes, that is not a typo, we are really passing argc in r25 * and argv in r24 (rather than r26 and r25). This is because that's * where __libc_start_main wants them. * * Duplicated from dl-machine.h for the benefit of readers: * * Our initial stack layout is rather different from everyone else's * due to the unique PA-RISC ABI. As far as I know it looks like * this: ----------------------------------- (user startup code creates this frame) | 32 bytes of magic | |---------------------------------| | 32 bytes argument/sp save area | |---------------------------------| ((current->mm->env_end) + 63 & ~63) | N bytes of slack | |---------------------------------| | envvar and arg strings | |---------------------------------| | ELF auxiliary info | | (up to 28 words) | |---------------------------------| | Environment variable pointers | | upwards to NULL | |---------------------------------| | Argument pointers | | upwards to NULL | |---------------------------------| | argc (1 word) | ----------------------------------- * The pleasant part of this is that if we need to skip arguments we * can just decrement argc and move argv, because the stack pointer * is utterly unrelated to the location of the environment and * argument vectors. * * Note that the S/390 people took the easy way out and hacked their * GCC to make the stack grow downwards. */ #define start_thread_som(regs, new_pc, new_sp) do { \ unsigned long *sp = (unsigned long *)new_sp; \ __u32 spaceid = (__u32)current->mm->context; \ unsigned long pc = (unsigned long)new_pc; \ /* offset pc for priv. level */ \ pc |= 3; \ \ set_fs(USER_DS); \ regs->iasq[0] = spaceid; \ regs->iasq[1] = spaceid; \ regs->iaoq[0] = pc; \ regs->iaoq[1] = pc; \ regs->sr[2] = LINUX_GATEWAY_SPACE; \ regs->sr[3] = 0xffff; \ regs->sr[4] = spaceid; \ regs->sr[5] = spaceid; \ regs->sr[6] = spaceid; \ regs->sr[7] = spaceid; \ regs->gr[ 0] = USER_INIT_PSW; \ regs->gr[30] = ((new_sp)+63)&~63; \ regs->gr[31] = pc; \ \ get_user(regs->gr[26],&sp[0]); \ get_user(regs->gr[25],&sp[-1]); \ get_user(regs->gr[24],&sp[-2]); \ get_user(regs->gr[23],&sp[-3]); \ \ regs->cr30 = (u32) current; \ } while(0) #define start_thread(regs, new_pc, new_sp) do { \ unsigned long *sp = (unsigned long *)new_sp; \ __u32 spaceid = (__u32)current->mm->context; \ unsigned long pc = (unsigned long)new_pc; \ /* offset pc for priv. level */ \ pc |= 3; \ \ \ set_fs(USER_DS); \ regs->iasq[0] = spaceid; \ regs->iasq[1] = spaceid; \ regs->iaoq[0] = pc; \ regs->iaoq[1] = pc; \ regs->sr[2] = LINUX_GATEWAY_SPACE; \ regs->sr[3] = 0xffff; \ regs->sr[4] = spaceid; \ regs->sr[5] = spaceid; \ regs->sr[6] = spaceid; \ regs->sr[7] = spaceid; \ regs->gr[ 0] = USER_INIT_PSW; \ regs->fr[ 0] = 0LL; \ regs->fr[ 1] = 0LL; \ regs->fr[ 2] = 0LL; \ regs->fr[ 3] = 0LL; \ regs->gr[30] = ((current->mm->env_end)+63)&~63; \ regs->gr[31] = pc; \ \ get_user(regs->gr[25],&sp[0]); \ regs->gr[24] = (unsigned long) &sp[1]; \ regs->gr[23] = 0; \ \ regs->cr30 = (u32) current; \ } while(0) #ifdef __LP64__ /* * For 64 bit kernels we need a version of start thread for 32 bit * elf files. * * FIXME: It should be possible to not duplicate the above code * by playing games with concatenation to form both * macros at compile time. The only difference between * this macro and the above is the name and the types * for sp and pc. */ #define start_thread32(regs, new_pc, new_sp) do { \ __u32 *sp = (__u32 *)new_sp; \ __u32 spaceid = (__u32)current->mm->context; \ __u32 pc = (__u32)new_pc; \ /* offset pc for priv. level */ \ pc |= 3; \ \ set_fs(USER_DS); \ regs->iasq[0] = spaceid; \ regs->iasq[1] = spaceid; \ regs->iaoq[0] = pc; \ regs->iaoq[1] = pc; \ regs->sr[2] = LINUX_GATEWAY_SPACE; \ regs->sr[3] = 0xffff; \ regs->sr[4] = spaceid; \ regs->sr[5] = spaceid; \ regs->sr[6] = spaceid; \ regs->sr[7] = spaceid; \ regs->gr[ 0] = USER_INIT_PSW; \ regs->fr[ 0] = 0LL; \ regs->fr[ 1] = 0LL; \ regs->fr[ 2] = 0LL; \ regs->fr[ 3] = 0LL; \ regs->gr[30] = ((current->mm->env_end)+63)&~63; \ regs->gr[31] = pc; \ \ get_user(regs->gr[25],&sp[0]); \ regs->gr[24] = (unsigned long) &sp[1]; \ regs->gr[23] = 0; \ \ regs->cr30 = (u32) current; \ } while(0) #endif struct task_struct; /* Free all resources held by a thread. */ extern void release_thread(struct task_struct *); extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) extern inline unsigned long get_wchan(struct task_struct *p) { return 0xdeadbeef; /* XXX */ } #define KSTK_EIP(tsk) (0xdeadbeef) #define KSTK_ESP(tsk) (0xdeadbeef) /* Be sure to hunt all references to this down when you change the size of * the kernel stack */ #endif /* __ASSEMBLY__ */ #define THREAD_SIZE (4*PAGE_SIZE) #define alloc_task_struct() \ ((struct task_struct *) __get_free_pages(GFP_KERNEL,2)) #define free_task_struct(p) free_pages((unsigned long)(p),2) #define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count) #define init_task (init_task_union.task) #define init_stack (init_task_union.stack) #endif /* __ASM_PARISC_PROCESSOR_H */ |