1 |
1276 |
phoenix |
/*
|
2 |
|
|
* linux/include/asm-arm/proc-armo/processor.h
|
3 |
|
|
*
|
4 |
|
|
* Copyright (C) 1996 Russell King.
|
5 |
|
|
*
|
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.
|
9 |
|
|
*
|
10 |
|
|
* Changelog:
|
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
|
18 |
|
|
*/
|
19 |
|
|
#ifndef __ASM_PROC_PROCESSOR_H
|
20 |
|
|
#define __ASM_PROC_PROCESSOR_H
|
21 |
|
|
|
22 |
|
|
#include <linux/string.h>
|
23 |
|
|
|
24 |
|
|
#define KERNEL_STACK_SIZE 4096
|
25 |
|
|
|
26 |
|
|
struct context_save_struct {
|
27 |
|
|
unsigned long r4;
|
28 |
|
|
unsigned long r5;
|
29 |
|
|
unsigned long r6;
|
30 |
|
|
unsigned long r7;
|
31 |
|
|
unsigned long r8;
|
32 |
|
|
unsigned long r9;
|
33 |
|
|
unsigned long sl;
|
34 |
|
|
unsigned long fp;
|
35 |
|
|
unsigned long pc;
|
36 |
|
|
};
|
37 |
|
|
|
38 |
|
|
#define INIT_CSS (struct context_save_struct){ 0, 0, 0, 0, 0, 0, 0, 0, SVC26_MODE }
|
39 |
|
|
|
40 |
|
|
typedef struct {
|
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);
|
52 |
|
|
} uaccess_t;
|
53 |
|
|
|
54 |
|
|
extern uaccess_t uaccess_user, uaccess_kernel;
|
55 |
|
|
|
56 |
|
|
#define EXTRA_THREAD_STRUCT \
|
57 |
|
|
uaccess_t *uaccess; /* User access functions*/
|
58 |
|
|
|
59 |
|
|
#define EXTRA_THREAD_STRUCT_INIT \
|
60 |
|
|
.uaccess = &uaccess_kernel,
|
61 |
|
|
|
62 |
|
|
#define start_thread(regs,pc,sp) \
|
63 |
|
|
({ \
|
64 |
|
|
unsigned long *stack = (unsigned long *)sp; \
|
65 |
|
|
set_fs(USER_DS); \
|
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) */ \
|
72 |
|
|
})
|
73 |
|
|
|
74 |
|
|
#define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1020])
|
75 |
|
|
#define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1018])
|
76 |
|
|
|
77 |
|
|
/* Allocation and freeing of basic task resources. */
|
78 |
|
|
/*
|
79 |
|
|
* NOTE! The task struct and the stack go together
|
80 |
|
|
*/
|
81 |
|
|
extern unsigned long get_page_8k(int priority);
|
82 |
|
|
extern void free_page_8k(unsigned long page);
|
83 |
|
|
|
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))
|
86 |
|
|
|
87 |
|
|
#endif
|