Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* processor.h: FRV processor definitions |
2 | * | |
3 | * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. | |
4 | * Written by David Howells (dhowells@redhat.com) | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version | |
9 | * 2 of the License, or (at your option) any later version. | |
10 | */ | |
11 | ||
12 | #ifndef _ASM_PROCESSOR_H | |
13 | #define _ASM_PROCESSOR_H | |
14 | ||
1da177e4 LT |
15 | #include <asm/mem-layout.h> |
16 | ||
17 | #ifndef __ASSEMBLY__ | |
18 | /* | |
19 | * Default implementation of macro that returns current | |
20 | * instruction pointer ("program counter"). | |
21 | */ | |
22 | #define current_text_addr() ({ __label__ _l; _l: &&_l;}) | |
23 | ||
24 | #include <linux/linkage.h> | |
25 | #include <asm/sections.h> | |
26 | #include <asm/segment.h> | |
27 | #include <asm/fpu.h> | |
28 | #include <asm/registers.h> | |
29 | #include <asm/ptrace.h> | |
30 | #include <asm/current.h> | |
31 | #include <asm/cache.h> | |
32 | ||
33 | /* Forward declaration, a strange C thing */ | |
34 | struct task_struct; | |
35 | ||
36 | /* | |
37 | * CPU type and hardware bug flags. Kept separately for each CPU. | |
38 | */ | |
39 | struct cpuinfo_frv { | |
40 | #ifdef CONFIG_MMU | |
41 | unsigned long *pgd_quick; | |
42 | unsigned long *pte_quick; | |
43 | unsigned long pgtable_cache_sz; | |
44 | #endif | |
45 | } __cacheline_aligned; | |
46 | ||
47 | extern struct cpuinfo_frv __nongprelbss boot_cpu_data; | |
48 | ||
49 | #define cpu_data (&boot_cpu_data) | |
50 | #define current_cpu_data boot_cpu_data | |
51 | ||
52 | /* | |
53 | * Bus types | |
54 | */ | |
55 | #define EISA_bus 0 | |
56 | #define MCA_bus 0 | |
57 | ||
58 | struct thread_struct { | |
59 | struct pt_regs *frame; /* [GR28] exception frame ptr for this thread */ | |
60 | struct task_struct *curr; /* [GR29] current pointer for this thread */ | |
61 | unsigned long sp; /* [GR1 ] kernel stack pointer */ | |
62 | unsigned long fp; /* [GR2 ] kernel frame pointer */ | |
63 | unsigned long lr; /* link register */ | |
64 | unsigned long pc; /* program counter */ | |
65 | unsigned long gr[12]; /* [GR16-GR27] */ | |
66 | unsigned long sched_lr; /* LR from schedule() */ | |
67 | ||
68 | union { | |
69 | struct pt_regs *frame0; /* top (user) stack frame */ | |
70 | struct user_context *user; /* userspace context */ | |
71 | }; | |
72 | } __attribute__((aligned(8))); | |
73 | ||
74 | extern struct pt_regs *__kernel_frame0_ptr; | |
75 | extern struct task_struct *__kernel_current_task; | |
76 | ||
77 | #endif | |
78 | ||
79 | #ifndef __ASSEMBLY__ | |
80 | #define INIT_THREAD_FRAME0 \ | |
81 | ((struct pt_regs *) \ | |
82 | (sizeof(init_stack) + (unsigned long) init_stack - sizeof(struct user_context))) | |
83 | ||
84 | #define INIT_THREAD { \ | |
85 | NULL, \ | |
86 | (struct task_struct *) init_stack, \ | |
87 | 0, 0, 0, 0, \ | |
88 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, \ | |
89 | 0, \ | |
90 | { INIT_THREAD_FRAME0 }, \ | |
91 | } | |
92 | ||
93 | /* | |
94 | * do necessary setup to start up a newly executed thread. | |
95 | * - need to discard the frame stacked by init() invoking the execve syscall | |
96 | */ | |
97 | #define start_thread(_regs, _pc, _usp) \ | |
98 | do { \ | |
99 | set_fs(USER_DS); /* reads from user space */ \ | |
100 | __frame = __kernel_frame0_ptr; \ | |
101 | __frame->pc = (_pc); \ | |
102 | __frame->psr &= ~PSR_S; \ | |
103 | __frame->sp = (_usp); \ | |
104 | } while(0) | |
105 | ||
106 | extern void prepare_to_copy(struct task_struct *tsk); | |
107 | ||
108 | /* Free all resources held by a thread. */ | |
109 | static inline void release_thread(struct task_struct *dead_task) | |
110 | { | |
111 | } | |
112 | ||
113 | extern asmlinkage int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | |
114 | extern asmlinkage void save_user_regs(struct user_context *target); | |
115 | extern asmlinkage void *restore_user_regs(const struct user_context *target, ...); | |
116 | ||
117 | #define copy_segments(tsk, mm) do { } while (0) | |
118 | #define release_segments(mm) do { } while (0) | |
119 | #define forget_segments() do { } while (0) | |
120 | ||
121 | /* | |
122 | * Free current thread data structures etc.. | |
123 | */ | |
124 | static inline void exit_thread(void) | |
125 | { | |
126 | } | |
127 | ||
128 | /* | |
129 | * Return saved PC of a blocked thread. | |
130 | */ | |
131 | extern unsigned long thread_saved_pc(struct task_struct *tsk); | |
132 | ||
133 | unsigned long get_wchan(struct task_struct *p); | |
134 | ||
135 | #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) | |
136 | #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) | |
137 | ||
138 | /* Allocation and freeing of basic task resources. */ | |
139 | extern struct task_struct *alloc_task_struct(void); | |
140 | extern void free_task_struct(struct task_struct *p); | |
141 | ||
142 | #define cpu_relax() do { } while (0) | |
143 | ||
144 | /* data cache prefetch */ | |
145 | #define ARCH_HAS_PREFETCH | |
146 | static inline void prefetch(const void *x) | |
147 | { | |
148 | asm volatile("dcpl %0,gr0,#0" : : "r"(x)); | |
149 | } | |
150 | ||
151 | #endif /* __ASSEMBLY__ */ | |
152 | #endif /* _ASM_PROCESSOR_H */ |