diff options
Diffstat (limited to 'arch/openrisc/include/asm/processor.h')
-rw-r--r-- | arch/openrisc/include/asm/processor.h | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/arch/openrisc/include/asm/processor.h b/arch/openrisc/include/asm/processor.h new file mode 100644 index 000000000000..bb54c97b9783 --- /dev/null +++ b/arch/openrisc/include/asm/processor.h | |||
@@ -0,0 +1,113 @@ | |||
1 | /* | ||
2 | * OpenRISC Linux | ||
3 | * | ||
4 | * Linux architectural port borrowing liberally from similar works of | ||
5 | * others. All original copyrights apply as per the original source | ||
6 | * declaration. | ||
7 | * | ||
8 | * OpenRISC implementation: | ||
9 | * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com> | ||
10 | * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> | ||
11 | * et al. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | */ | ||
18 | |||
19 | #ifndef __ASM_OPENRISC_PROCESSOR_H | ||
20 | #define __ASM_OPENRISC_PROCESSOR_H | ||
21 | |||
22 | #include <asm/spr_defs.h> | ||
23 | #include <asm/page.h> | ||
24 | #include <asm/ptrace.h> | ||
25 | |||
26 | #define STACK_TOP TASK_SIZE | ||
27 | #define STACK_TOP_MAX STACK_TOP | ||
28 | /* Kernel and user SR register setting */ | ||
29 | #define KERNEL_SR (SPR_SR_DME | SPR_SR_IME | SPR_SR_ICE \ | ||
30 | | SPR_SR_DCE | SPR_SR_SM) | ||
31 | #define USER_SR (SPR_SR_DME | SPR_SR_IME | SPR_SR_ICE \ | ||
32 | | SPR_SR_DCE | SPR_SR_IEE | SPR_SR_TEE) | ||
33 | /* | ||
34 | * Default implementation of macro that returns current | ||
35 | * instruction pointer ("program counter"). | ||
36 | */ | ||
37 | #define current_text_addr() ({ __label__ _l; _l: &&_l; }) | ||
38 | |||
39 | /* | ||
40 | * User space process size. This is hardcoded into a few places, | ||
41 | * so don't change it unless you know what you are doing. | ||
42 | */ | ||
43 | |||
44 | #define TASK_SIZE (0x80000000UL) | ||
45 | |||
46 | /* This decides where the kernel will search for a free chunk of vm | ||
47 | * space during mmap's. | ||
48 | */ | ||
49 | #define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3) | ||
50 | |||
51 | #ifndef __ASSEMBLY__ | ||
52 | |||
53 | struct task_struct; | ||
54 | |||
55 | struct thread_struct { | ||
56 | }; | ||
57 | |||
58 | /* | ||
59 | * At user->kernel entry, the pt_regs struct is stacked on the top of the | ||
60 | * kernel-stack. This macro allows us to find those regs for a task. | ||
61 | * Notice that subsequent pt_regs stackings, like recursive interrupts | ||
62 | * occurring while we're in the kernel, won't affect this - only the first | ||
63 | * user->kernel transition registers are reached by this (i.e. not regs | ||
64 | * for running signal handler) | ||
65 | */ | ||
66 | #define user_regs(thread_info) (((struct pt_regs *)((unsigned long)(thread_info) + THREAD_SIZE - STACK_FRAME_OVERHEAD)) - 1) | ||
67 | |||
68 | /* | ||
69 | * Dito but for the currently running task | ||
70 | */ | ||
71 | |||
72 | #define task_pt_regs(task) user_regs(task_thread_info(task)) | ||
73 | #define current_regs() user_regs(current_thread_info()) | ||
74 | |||
75 | extern inline void prepare_to_copy(struct task_struct *tsk) | ||
76 | { | ||
77 | } | ||
78 | |||
79 | #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack) | ||
80 | |||
81 | #define INIT_THREAD { } | ||
82 | |||
83 | |||
84 | #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc); | ||
85 | #define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp); | ||
86 | |||
87 | |||
88 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
89 | |||
90 | void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp); | ||
91 | void release_thread(struct task_struct *); | ||
92 | unsigned long get_wchan(struct task_struct *p); | ||
93 | |||
94 | /* | ||
95 | * Free current thread data structures etc.. | ||
96 | */ | ||
97 | |||
98 | extern inline void exit_thread(void) | ||
99 | { | ||
100 | /* Nothing needs to be done. */ | ||
101 | } | ||
102 | |||
103 | /* | ||
104 | * Return saved PC of a blocked thread. For now, this is the "user" PC | ||
105 | */ | ||
106 | extern unsigned long thread_saved_pc(struct task_struct *t); | ||
107 | |||
108 | #define init_stack (init_thread_union.stack) | ||
109 | |||
110 | #define cpu_relax() do { } while (0) | ||
111 | |||
112 | #endif /* __ASSEMBLY__ */ | ||
113 | #endif /* __ASM_OPENRISC_PROCESSOR_H */ | ||