diff options
author | Richard Kuo <rkuo@codeaurora.org> | 2011-10-31 19:36:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-01 10:34:18 -0400 |
commit | 99a70aa051d2aef6a91761c2230264cfcf20ae74 (patch) | |
tree | 3944c62bdd83d6360f8e5198296a68489526e7f4 /arch/hexagon/include/asm/processor.h | |
parent | b9398a84590be3a828c168ed25bf1fd3d637988a (diff) |
Hexagon: Add processor and system headers
Signed-off-by: Richard Kuo <rkuo@codeaurora.org>
Signed-off-by: Linas Vepstas <linas@codeaurora.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/hexagon/include/asm/processor.h')
-rw-r--r-- | arch/hexagon/include/asm/processor.h | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h new file mode 100644 index 000000000000..20c5ddabbd8b --- /dev/null +++ b/arch/hexagon/include/asm/processor.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * Process/processor support for the Hexagon architecture | ||
3 | * | ||
4 | * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. | ||
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 and | ||
8 | * only version 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
18 | * 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _ASM_PROCESSOR_H | ||
22 | #define _ASM_PROCESSOR_H | ||
23 | |||
24 | #ifndef __ASSEMBLY__ | ||
25 | |||
26 | #include <asm/mem-layout.h> | ||
27 | #include <asm/registers.h> | ||
28 | #include <asm/hexagon_vm.h> | ||
29 | |||
30 | /* must be a macro */ | ||
31 | #define current_text_addr() ({ __label__ _l; _l: &&_l; }) | ||
32 | |||
33 | /* task_struct, defined elsewhere, is the "process descriptor" */ | ||
34 | struct task_struct; | ||
35 | |||
36 | /* this is defined in arch/process.c */ | ||
37 | extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
38 | extern unsigned long thread_saved_pc(struct task_struct *tsk); | ||
39 | |||
40 | extern void start_thread(struct pt_regs *, unsigned long, unsigned long); | ||
41 | |||
42 | /* | ||
43 | * thread_struct is supposed to be for context switch data. | ||
44 | * Specifically, to hold the state necessary to perform switch_to... | ||
45 | */ | ||
46 | struct thread_struct { | ||
47 | void *switch_sp; | ||
48 | }; | ||
49 | |||
50 | /* | ||
51 | * initializes thread_struct | ||
52 | * The only thing we have in there is switch_sp | ||
53 | * which doesn't really need to be initialized. | ||
54 | */ | ||
55 | |||
56 | #define INIT_THREAD { \ | ||
57 | } | ||
58 | |||
59 | #define cpu_relax() __vmyield() | ||
60 | |||
61 | /* | ||
62 | * "Unlazying all lazy status" occurs here. | ||
63 | */ | ||
64 | static inline void prepare_to_copy(struct task_struct *tsk) | ||
65 | { | ||
66 | } | ||
67 | |||
68 | /* | ||
69 | * Decides where the kernel will search for a free chunk of vm space during | ||
70 | * mmaps. | ||
71 | * See also arch_get_unmapped_area. | ||
72 | * Doesn't affect if you have MAX_FIXED in the page flags set though... | ||
73 | * | ||
74 | * Apparently the convention is that ld.so will ask for "unmapped" private | ||
75 | * memory to be allocated SOMEWHERE, but it also asks for memory explicitly | ||
76 | * via MAP_FIXED at the lower * addresses starting at VA=0x0. | ||
77 | * | ||
78 | * If the two requests collide, you get authentic segfaulting action, so | ||
79 | * you have to kick the "unmapped" base requests higher up. | ||
80 | */ | ||
81 | #define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE/3)) | ||
82 | |||
83 | |||
84 | #define task_pt_regs(task) \ | ||
85 | ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1) | ||
86 | |||
87 | #define KSTK_EIP(tsk) (pt_elr(task_pt_regs(tsk))) | ||
88 | #define KSTK_ESP(tsk) (pt_psp(task_pt_regs(tsk))) | ||
89 | |||
90 | /* Free all resources held by a thread; defined in process.c */ | ||
91 | extern void release_thread(struct task_struct *dead_task); | ||
92 | |||
93 | /* Get wait channel for task P. */ | ||
94 | extern unsigned long get_wchan(struct task_struct *p); | ||
95 | |||
96 | /* The following stuff is pretty HEXAGON specific. */ | ||
97 | |||
98 | /* This is really just here for __switch_to. | ||
99 | Offsets are pulled via asm-offsets.c */ | ||
100 | |||
101 | /* | ||
102 | * No real reason why VM and native switch stacks should be different. | ||
103 | * Ultimately this should merge. Note that Rev C. ABI called out only | ||
104 | * R24-27 as callee saved GPRs needing explicit attention (R29-31 being | ||
105 | * dealt with automagically by allocframe), but the current ABI has | ||
106 | * more, R16-R27. By saving more, the worst case is that we waste some | ||
107 | * cycles if building with the old compilers. | ||
108 | */ | ||
109 | |||
110 | struct hexagon_switch_stack { | ||
111 | unsigned long long r1716; | ||
112 | unsigned long long r1918; | ||
113 | unsigned long long r2120; | ||
114 | unsigned long long r2322; | ||
115 | unsigned long long r2524; | ||
116 | unsigned long long r2726; | ||
117 | unsigned long fp; | ||
118 | unsigned long lr; | ||
119 | }; | ||
120 | |||
121 | #endif /* !__ASSEMBLY__ */ | ||
122 | |||
123 | #endif | ||