2 * linux/include/asm-arm/proc-armv/processor.h
4 * Copyright (C) 1996-1999 Russell King.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 * 20-09-1996 RMK Created
12 * 26-09-1996 RMK Added 'EXTRA_THREAD_STRUCT*'
13 * 28-09-1996 RMK Moved start_thread into the processor dependencies
14 * 09-09-1998 PJB Delete redundant `wp_works_ok'
15 * 30-05-1999 PJB Save sl across context switches
16 * 31-07-1999 RMK Added 'domain' stuff
18 #ifndef __ASM_PROC_PROCESSOR_H
19 #define __ASM_PROC_PROCESSOR_H
21 #include <asm/proc/domain.h>
23 #define KERNEL_STACK_SIZE PAGE_SIZE
25 struct context_save_struct {
38 #define INIT_CSS (struct context_save_struct){ SVC_MODE, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
40 #define EXTRA_THREAD_STRUCT \
43 #define EXTRA_THREAD_STRUCT_INIT \
44 domain: domain_val(DOMAIN_USER, DOMAIN_CLIENT) | \
45 domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \
46 domain_val(DOMAIN_IO, DOMAIN_CLIENT)
48 #define start_thread(regs,pc,sp) \
50 unsigned long *stack = (unsigned long *)sp; \
52 memzero(regs->uregs, sizeof(regs->uregs)); \
53 if (current->personality & ADDR_LIMIT_32BIT) \
54 regs->ARM_cpsr = USR_MODE; \
56 regs->ARM_cpsr = USR26_MODE; \
57 regs->ARM_pc = pc; /* pc */ \
58 regs->ARM_sp = sp; /* sp */ \
59 regs->ARM_r2 = stack[2]; /* r2 (envp) */ \
60 regs->ARM_r1 = stack[1]; /* r1 (argv) */ \
61 regs->ARM_r0 = stack[0]; /* r0 (argc) */ \
64 #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019])
65 #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1017])
67 /* Allocation and freeing of basic task resources. */
69 * NOTE! The task struct and the stack go together
71 #define ll_alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
72 #define ll_free_task_struct(p) free_pages((unsigned long)(p),1)