2 * linux/include/asm-arm/proc-armo/processor.h
4 * Copyright (C) 1996 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 * 27-06-1996 RMK Created
12 * 10-10-1996 RMK Brought up to date with SA110
13 * 26-09-1996 RMK Added 'EXTRA_THREAD_STRUCT*'
14 * 28-09-1996 RMK Moved start_thread into the processor dependencies
15 * 11-01-1998 RMK Added new uaccess_t
16 * 09-09-1998 PJB Delete redundant `wp_works_ok'
17 * 30-05-1999 PJB Save sl across context switches
19 #ifndef __ASM_PROC_PROCESSOR_H
20 #define __ASM_PROC_PROCESSOR_H
22 #include <linux/string.h>
24 #define KERNEL_STACK_SIZE 4096
26 struct context_save_struct {
38 #define INIT_CSS (struct context_save_struct){ 0, 0, 0, 0, 0, 0, 0, 0, SVC26_MODE }
41 void (*put_byte)(void); /* Special calling convention */
42 void (*get_byte)(void); /* Special calling convention */
43 void (*put_half)(void); /* Special calling convention */
44 void (*get_half)(void); /* Special calling convention */
45 void (*put_word)(void); /* Special calling convention */
46 void (*get_word)(void); /* Special calling convention */
47 unsigned long (*copy_from_user)(void *to, const void *from, unsigned long sz);
48 unsigned long (*copy_to_user)(void *to, const void *from, unsigned long sz);
49 unsigned long (*clear_user)(void *addr, unsigned long sz);
50 unsigned long (*strncpy_from_user)(char *to, const char *from, unsigned long sz);
51 unsigned long (*strnlen_user)(const char *s, long n);
54 extern uaccess_t uaccess_user, uaccess_kernel;
56 #define EXTRA_THREAD_STRUCT \
57 uaccess_t *uaccess; /* User access functions*/
59 #define EXTRA_THREAD_STRUCT_INIT \
60 .uaccess = &uaccess_kernel,
62 #define start_thread(regs,pc,sp) \
64 unsigned long *stack = (unsigned long *)sp; \
66 memzero(regs->uregs, sizeof (regs->uregs)); \
67 regs->ARM_pc = pc; /* pc */ \
68 regs->ARM_sp = sp; /* sp */ \
69 regs->ARM_r2 = stack[2]; /* r2 (envp) */ \
70 regs->ARM_r1 = stack[1]; /* r1 (argv) */ \
71 regs->ARM_r0 = stack[0]; /* r0 (argc) */ \
74 #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1020])
75 #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1018])
77 /* Allocation and freeing of basic task resources. */
79 * NOTE! The task struct and the stack go together
81 extern unsigned long get_page_8k(int priority);
82 extern void free_page_8k(unsigned long page);
84 #define ll_alloc_task_struct() ((struct task_struct *)get_page_8k(GFP_KERNEL))
85 #define ll_free_task_struct(p) free_page_8k((unsigned long)(p))