Commit | Line | Data |
---|---|---|
4511ec15 | 1 | /* |
5233806d MS |
2 | * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu> |
3 | * Copyright (C) 2008-2009 PetaLogix | |
4511ec15 MS |
4 | * Copyright (C) 2006 Atmark Techno, Inc. |
5 | * | |
6 | * This file is subject to the terms and conditions of the GNU General Public | |
7 | * License. See the file "COPYING" in the main directory of this archive | |
8 | * for more details. | |
9 | */ | |
10 | ||
11 | #ifndef _ASM_MICROBLAZE_PROCESSOR_H | |
12 | #define _ASM_MICROBLAZE_PROCESSOR_H | |
13 | ||
14 | #include <asm/ptrace.h> | |
15 | #include <asm/setup.h> | |
16 | #include <asm/registers.h> | |
2921e2bd MS |
17 | #include <asm/entry.h> |
18 | #include <asm/current.h> | |
4511ec15 MS |
19 | |
20 | # ifndef __ASSEMBLY__ | |
21 | /* from kernel/cpu/mb.c */ | |
22 | extern const struct seq_operations cpuinfo_op; | |
23 | ||
24 | # define cpu_relax() barrier() | |
25 | # define cpu_sleep() do {} while (0) | |
26 | # define prepare_to_copy(tsk) do {} while (0) | |
27 | ||
2eba318e MS |
28 | #define task_pt_regs(tsk) \ |
29 | (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1) | |
30 | ||
e1c4bd08 MS |
31 | /* Do necessary setup to start up a newly executed thread. */ |
32 | void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp); | |
33 | ||
5233806d MS |
34 | # endif /* __ASSEMBLY__ */ |
35 | ||
36 | # ifndef CONFIG_MMU | |
4511ec15 MS |
37 | /* |
38 | * User space process size: memory size | |
39 | * | |
40 | * TASK_SIZE on MMU cpu is usually 1GB. However, on no-MMU arch, both | |
41 | * user processes and the kernel is on the same memory region. They | |
42 | * both share the memory space and that is limited by the amount of | |
43 | * physical memory. thus, we set TASK_SIZE == amount of total memory. | |
44 | */ | |
45 | # define TASK_SIZE (0x81000000 - 0x80000000) | |
46 | ||
47 | /* | |
48 | * Default implementation of macro that returns current | |
49 | * instruction pointer ("program counter"). | |
50 | */ | |
51 | # define current_text_addr() ({ __label__ _l; _l: &&_l; }) | |
52 | ||
53 | /* | |
54 | * This decides where the kernel will search for a free chunk of vm | |
55 | * space during mmap's. We won't be using it | |
56 | */ | |
57 | # define TASK_UNMAPPED_BASE 0 | |
58 | ||
59 | /* definition in include/linux/sched.h */ | |
60 | struct task_struct; | |
61 | ||
62 | /* thread_struct is gone. use thread_info instead. */ | |
63 | struct thread_struct { }; | |
64 | # define INIT_THREAD { } | |
65 | ||
4511ec15 MS |
66 | /* Free all resources held by a thread. */ |
67 | static inline void release_thread(struct task_struct *dead_task) | |
68 | { | |
69 | } | |
70 | ||
71 | /* Free all resources held by a thread. */ | |
72 | static inline void exit_thread(void) | |
73 | { | |
74 | } | |
75 | ||
76 | extern unsigned long thread_saved_pc(struct task_struct *t); | |
77 | ||
78 | extern unsigned long get_wchan(struct task_struct *p); | |
79 | ||
80 | /* | |
81 | * create a kernel thread without removing it from tasklists | |
82 | */ | |
83 | extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | |
84 | ||
4511ec15 MS |
85 | # define KSTK_EIP(tsk) (0) |
86 | # define KSTK_ESP(tsk) (0) | |
87 | ||
5233806d MS |
88 | # else /* CONFIG_MMU */ |
89 | ||
90 | /* | |
91 | * This is used to define STACK_TOP, and with MMU it must be below | |
92 | * kernel base to select the correct PGD when handling MMU exceptions. | |
93 | */ | |
94 | # define TASK_SIZE (CONFIG_KERNEL_START) | |
95 | ||
96 | /* | |
97 | * This decides where the kernel will search for a free chunk of vm | |
98 | * space during mmap's. | |
99 | */ | |
100 | # define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3) | |
101 | ||
102 | # define THREAD_KSP 0 | |
103 | ||
104 | # ifndef __ASSEMBLY__ | |
105 | ||
106 | /* | |
107 | * Default implementation of macro that returns current | |
108 | * instruction pointer ("program counter"). | |
109 | */ | |
110 | # define current_text_addr() ({ __label__ _l; _l: &&_l; }) | |
111 | ||
112 | /* If you change this, you must change the associated assembly-languages | |
113 | * constants defined below, THREAD_*. | |
114 | */ | |
115 | struct thread_struct { | |
116 | /* kernel stack pointer (must be first field in structure) */ | |
117 | unsigned long ksp; | |
118 | unsigned long ksp_limit; /* if ksp <= ksp_limit stack overflow */ | |
119 | void *pgdir; /* root of page-table tree */ | |
120 | struct pt_regs *regs; /* Pointer to saved register state */ | |
121 | }; | |
122 | ||
123 | # define INIT_THREAD { \ | |
124 | .ksp = sizeof init_stack + (unsigned long)init_stack, \ | |
125 | .pgdir = swapper_pg_dir, \ | |
126 | } | |
127 | ||
128 | /* Do necessary setup to start up a newly executed thread. */ | |
129 | void start_thread(struct pt_regs *regs, | |
130 | unsigned long pc, unsigned long usp); | |
131 | ||
132 | /* Free all resources held by a thread. */ | |
133 | extern inline void release_thread(struct task_struct *dead_task) | |
134 | { | |
135 | } | |
136 | ||
137 | extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | |
138 | ||
139 | /* Free current thread data structures etc. */ | |
140 | static inline void exit_thread(void) | |
141 | { | |
142 | } | |
143 | ||
144 | /* Return saved (kernel) PC of a blocked thread. */ | |
145 | # define thread_saved_pc(tsk) \ | |
146 | ((tsk)->thread.regs ? (tsk)->thread.regs->r15 : 0) | |
147 | ||
148 | unsigned long get_wchan(struct task_struct *p); | |
149 | ||
150 | /* The size allocated for kernel stacks. This _must_ be a power of two! */ | |
151 | # define KERNEL_STACK_SIZE 0x2000 | |
152 | ||
153 | /* Return some info about the user process TASK. */ | |
154 | # define task_tos(task) ((unsigned long)(task) + KERNEL_STACK_SIZE) | |
155 | # define task_regs(task) ((struct pt_regs *)task_tos(task) - 1) | |
156 | ||
157 | # define task_pt_regs_plus_args(tsk) \ | |
158 | (((void *)task_pt_regs(tsk)) - STATE_SAVE_ARG_SPACE) | |
159 | ||
160 | # define task_sp(task) (task_regs(task)->r1) | |
161 | # define task_pc(task) (task_regs(task)->pc) | |
162 | /* Grotty old names for some. */ | |
163 | # define KSTK_EIP(task) (task_pc(task)) | |
164 | # define KSTK_ESP(task) (task_sp(task)) | |
165 | ||
166 | /* FIXME */ | |
167 | # define deactivate_mm(tsk, mm) do { } while (0) | |
168 | ||
169 | # define STACK_TOP TASK_SIZE | |
170 | # define STACK_TOP_MAX STACK_TOP | |
171 | ||
172 | # endif /* __ASSEMBLY__ */ | |
173 | # endif /* CONFIG_MMU */ | |
4511ec15 | 174 | #endif /* _ASM_MICROBLAZE_PROCESSOR_H */ |