aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/include/asm
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2009-04-22 21:03:20 -0400
committerGreg Ungerer <gerg@uclinux.org>2009-09-15 19:43:36 -0400
commit633ea5d78b8b01ba903aeaae10297033830a52dd (patch)
tree8163ccf61b8fd3d1a22ce8150ed4c3a987a94fb1 /arch/m68k/include/asm
parentd668bf0a0d73daea4eaaf748435752f52cc077aa (diff)
m68k: merge mmu and non-mmu versions of processor.h
The mmu and non-mmu versions of processor.h have a lot of common code. This is a strait forward merge. start_thread() could be improved, but that is not quite as strait forward, leaving for a follow on change. Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68k/include/asm')
-rw-r--r--arch/m68k/include/asm/processor.h171
-rw-r--r--arch/m68k/include/asm/processor_mm.h130
-rw-r--r--arch/m68k/include/asm/processor_no.h143
3 files changed, 168 insertions, 276 deletions
diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h
index fc3f2c22f2b8..74fd674b15ad 100644
--- a/arch/m68k/include/asm/processor.h
+++ b/arch/m68k/include/asm/processor.h
@@ -1,5 +1,170 @@
1#ifdef __uClinux__ 1/*
2#include "processor_no.h" 2 * include/asm-m68k/processor.h
3 *
4 * Copyright (C) 1995 Hamish Macdonald
5 */
6
7#ifndef __ASM_M68K_PROCESSOR_H
8#define __ASM_M68K_PROCESSOR_H
9
10/*
11 * Default implementation of macro that returns current
12 * instruction pointer ("program counter").
13 */
14#define current_text_addr() ({ __label__ _l; _l: &&_l;})
15
16#include <linux/thread_info.h>
17#include <asm/segment.h>
18#include <asm/fpu.h>
19#include <asm/ptrace.h>
20
21static inline unsigned long rdusp(void)
22{
23#ifdef CONFIG_COLDFIRE
24 extern unsigned int sw_usp;
25 return sw_usp;
3#else 26#else
4#include "processor_mm.h" 27 unsigned long usp;
28 __asm__ __volatile__("move %/usp,%0" : "=a" (usp));
29 return usp;
30#endif
31}
32
33static inline void wrusp(unsigned long usp)
34{
35#ifdef CONFIG_COLDFIRE
36 extern unsigned int sw_usp;
37 sw_usp = usp;
38#else
39 __asm__ __volatile__("move %0,%/usp" : : "a" (usp));
40#endif
41}
42
43/*
44 * User space process size: 3.75GB. This is hardcoded into a few places,
45 * so don't change it unless you know what you are doing.
46 */
47#ifndef CONFIG_SUN3
48#define TASK_SIZE (0xF0000000UL)
49#else
50#define TASK_SIZE (0x0E000000UL)
51#endif
52
53#ifdef __KERNEL__
54#define STACK_TOP TASK_SIZE
55#define STACK_TOP_MAX STACK_TOP
56#endif
57
58/* This decides where the kernel will search for a free chunk of vm
59 * space during mmap's.
60 */
61#ifdef CONFIG_MMU
62#ifndef CONFIG_SUN3
63#define TASK_UNMAPPED_BASE 0xC0000000UL
64#else
65#define TASK_UNMAPPED_BASE 0x0A000000UL
66#endif
67#define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr)
68#else
69#define TASK_UNMAPPED_BASE 0
70#endif
71
72struct thread_struct {
73 unsigned long ksp; /* kernel stack pointer */
74 unsigned long usp; /* user stack pointer */
75 unsigned short sr; /* saved status register */
76 unsigned short fs; /* saved fs (sfc, dfc) */
77 unsigned long crp[2]; /* cpu root pointer */
78 unsigned long esp0; /* points to SR of stack frame */
79 unsigned long faddr; /* info about last fault */
80 int signo, code;
81 unsigned long fp[8*3];
82 unsigned long fpcntl[3]; /* fp control regs */
83 unsigned char fpstate[FPSTATESIZE]; /* floating point state */
84 struct thread_info info;
85};
86
87#define INIT_THREAD { \
88 .ksp = sizeof(init_stack) + (unsigned long) init_stack, \
89 .sr = PS_S, \
90 .fs = __KERNEL_DS, \
91 .info = INIT_THREAD_INFO(init_task), \
92}
93
94#ifdef CONFIG_MMU
95/*
96 * Do necessary setup to start up a newly executed thread.
97 */
98static inline void start_thread(struct pt_regs * regs, unsigned long pc,
99 unsigned long usp)
100{
101 /* reads from user space */
102 set_fs(USER_DS);
103
104 regs->pc = pc;
105 regs->sr &= ~0x2000;
106 wrusp(usp);
107}
108
109#else
110
111/*
112 * Coldfire stacks need to be re-aligned on trap exit, conventional
113 * 68k can handle this case cleanly.
114 */
115#ifdef CONFIG_COLDFIRE
116#define reformat(_regs) do { (_regs)->format = 0x4; } while(0)
117#else
118#define reformat(_regs) do { } while (0)
119#endif
120
121#define start_thread(_regs, _pc, _usp) \
122do { \
123 set_fs(USER_DS); /* reads from user space */ \
124 (_regs)->pc = (_pc); \
125 ((struct switch_stack *)(_regs))[-1].a6 = 0; \
126 reformat(_regs); \
127 if (current->mm) \
128 (_regs)->d5 = current->mm->start_data; \
129 (_regs)->sr &= ~0x2000; \
130 wrusp(_usp); \
131} while(0)
132
133#endif
134
135/* Forward declaration, a strange C thing */
136struct task_struct;
137
138/* Free all resources held by a thread. */
139static inline void release_thread(struct task_struct *dead_task)
140{
141}
142
143/* Prepare to copy thread state - unlazy all lazy status */
144#define prepare_to_copy(tsk) do { } while (0)
145
146extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
147
148/*
149 * Free current thread data structures etc..
150 */
151static inline void exit_thread(void)
152{
153}
154
155extern unsigned long thread_saved_pc(struct task_struct *tsk);
156
157unsigned long get_wchan(struct task_struct *p);
158
159#define KSTK_EIP(tsk) \
160 ({ \
161 unsigned long eip = 0; \
162 if ((tsk)->thread.esp0 > PAGE_SIZE && \
163 (virt_addr_valid((tsk)->thread.esp0))) \
164 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
165 eip; })
166#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
167
168#define cpu_relax() barrier()
169
5#endif 170#endif
diff --git a/arch/m68k/include/asm/processor_mm.h b/arch/m68k/include/asm/processor_mm.h
deleted file mode 100644
index 1f61ef53f0e0..000000000000
--- a/arch/m68k/include/asm/processor_mm.h
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 * include/asm-m68k/processor.h
3 *
4 * Copyright (C) 1995 Hamish Macdonald
5 */
6
7#ifndef __ASM_M68K_PROCESSOR_H
8#define __ASM_M68K_PROCESSOR_H
9
10/*
11 * Default implementation of macro that returns current
12 * instruction pointer ("program counter").
13 */
14#define current_text_addr() ({ __label__ _l; _l: &&_l;})
15
16#include <linux/thread_info.h>
17#include <asm/segment.h>
18#include <asm/fpu.h>
19#include <asm/ptrace.h>
20
21static inline unsigned long rdusp(void)
22{
23 unsigned long usp;
24
25 __asm__ __volatile__("move %/usp,%0" : "=a" (usp));
26 return usp;
27}
28
29static inline void wrusp(unsigned long usp)
30{
31 __asm__ __volatile__("move %0,%/usp" : : "a" (usp));
32}
33
34/*
35 * User space process size: 3.75GB. This is hardcoded into a few places,
36 * so don't change it unless you know what you are doing.
37 */
38#ifndef CONFIG_SUN3
39#define TASK_SIZE (0xF0000000UL)
40#else
41#define TASK_SIZE (0x0E000000UL)
42#endif
43
44#ifdef __KERNEL__
45#define STACK_TOP TASK_SIZE
46#define STACK_TOP_MAX STACK_TOP
47#endif
48
49/* This decides where the kernel will search for a free chunk of vm
50 * space during mmap's.
51 */
52#ifndef CONFIG_SUN3
53#define TASK_UNMAPPED_BASE 0xC0000000UL
54#else
55#define TASK_UNMAPPED_BASE 0x0A000000UL
56#endif
57#define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr)
58
59struct thread_struct {
60 unsigned long ksp; /* kernel stack pointer */
61 unsigned long usp; /* user stack pointer */
62 unsigned short sr; /* saved status register */
63 unsigned short fs; /* saved fs (sfc, dfc) */
64 unsigned long crp[2]; /* cpu root pointer */
65 unsigned long esp0; /* points to SR of stack frame */
66 unsigned long faddr; /* info about last fault */
67 int signo, code;
68 unsigned long fp[8*3];
69 unsigned long fpcntl[3]; /* fp control regs */
70 unsigned char fpstate[FPSTATESIZE]; /* floating point state */
71 struct thread_info info;
72};
73
74#define INIT_THREAD { \
75 .ksp = sizeof(init_stack) + (unsigned long) init_stack, \
76 .sr = PS_S, \
77 .fs = __KERNEL_DS, \
78 .info = INIT_THREAD_INFO(init_task), \
79}
80
81/*
82 * Do necessary setup to start up a newly executed thread.
83 */
84static inline void start_thread(struct pt_regs * regs, unsigned long pc,
85 unsigned long usp)
86{
87 /* reads from user space */
88 set_fs(USER_DS);
89
90 regs->pc = pc;
91 regs->sr &= ~0x2000;
92 wrusp(usp);
93}
94
95/* Forward declaration, a strange C thing */
96struct task_struct;
97
98/* Free all resources held by a thread. */
99static inline void release_thread(struct task_struct *dead_task)
100{
101}
102
103/* Prepare to copy thread state - unlazy all lazy status */
104#define prepare_to_copy(tsk) do { } while (0)
105
106extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
107
108/*
109 * Free current thread data structures etc..
110 */
111static inline void exit_thread(void)
112{
113}
114
115extern unsigned long thread_saved_pc(struct task_struct *tsk);
116
117unsigned long get_wchan(struct task_struct *p);
118
119#define KSTK_EIP(tsk) \
120 ({ \
121 unsigned long eip = 0; \
122 if ((tsk)->thread.esp0 > PAGE_SIZE && \
123 (virt_addr_valid((tsk)->thread.esp0))) \
124 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
125 eip; })
126#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
127
128#define cpu_relax() barrier()
129
130#endif
diff --git a/arch/m68k/include/asm/processor_no.h b/arch/m68k/include/asm/processor_no.h
deleted file mode 100644
index 7a1e0ba35f5a..000000000000
--- a/arch/m68k/include/asm/processor_no.h
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2 * include/asm-m68knommu/processor.h
3 *
4 * Copyright (C) 1995 Hamish Macdonald
5 */
6
7#ifndef __ASM_M68K_PROCESSOR_H
8#define __ASM_M68K_PROCESSOR_H
9
10/*
11 * Default implementation of macro that returns current
12 * instruction pointer ("program counter").
13 */
14#define current_text_addr() ({ __label__ _l; _l: &&_l;})
15
16#include <linux/compiler.h>
17#include <linux/threads.h>
18#include <asm/types.h>
19#include <asm/segment.h>
20#include <asm/fpu.h>
21#include <asm/ptrace.h>
22#include <asm/current.h>
23
24static inline unsigned long rdusp(void)
25{
26#ifdef CONFIG_COLDFIRE
27 extern unsigned int sw_usp;
28 return(sw_usp);
29#else
30 unsigned long usp;
31 __asm__ __volatile__("move %/usp,%0" : "=a" (usp));
32 return usp;
33#endif
34}
35
36static inline void wrusp(unsigned long usp)
37{
38#ifdef CONFIG_COLDFIRE
39 extern unsigned int sw_usp;
40 sw_usp = usp;
41#else
42 __asm__ __volatile__("move %0,%/usp" : : "a" (usp));
43#endif
44}
45
46/*
47 * User space process size: 3.75GB. This is hardcoded into a few places,
48 * so don't change it unless you know what you are doing.
49 */
50#define TASK_SIZE (0xF0000000UL)
51
52/*
53 * This decides where the kernel will search for a free chunk of vm
54 * space during mmap's. We won't be using it
55 */
56#define TASK_UNMAPPED_BASE 0
57
58/*
59 * if you change this structure, you must change the code and offsets
60 * in m68k/machasm.S
61 */
62
63struct thread_struct {
64 unsigned long ksp; /* kernel stack pointer */
65 unsigned long usp; /* user stack pointer */
66 unsigned short sr; /* saved status register */
67 unsigned short fs; /* saved fs (sfc, dfc) */
68 unsigned long crp[2]; /* cpu root pointer */
69 unsigned long esp0; /* points to SR of stack frame */
70 unsigned long fp[8*3];
71 unsigned long fpcntl[3]; /* fp control regs */
72 unsigned char fpstate[FPSTATESIZE]; /* floating point state */
73};
74
75#define INIT_THREAD { \
76 .ksp = sizeof(init_stack) + (unsigned long) init_stack, \
77 .sr = PS_S, \
78 .fs = __KERNEL_DS, \
79}
80
81/*
82 * Coldfire stacks need to be re-aligned on trap exit, conventional
83 * 68k can handle this case cleanly.
84 */
85#if defined(CONFIG_COLDFIRE)
86#define reformat(_regs) do { (_regs)->format = 0x4; } while(0)
87#else
88#define reformat(_regs) do { } while (0)
89#endif
90
91/*
92 * Do necessary setup to start up a newly executed thread.
93 *
94 * pass the data segment into user programs if it exists,
95 * it can't hurt anything as far as I can tell
96 */
97#define start_thread(_regs, _pc, _usp) \
98do { \
99 set_fs(USER_DS); /* reads from user space */ \
100 (_regs)->pc = (_pc); \
101 ((struct switch_stack *)(_regs))[-1].a6 = 0; \
102 reformat(_regs); \
103 if (current->mm) \
104 (_regs)->d5 = current->mm->start_data; \
105 (_regs)->sr &= ~0x2000; \
106 wrusp(_usp); \
107} while(0)
108
109/* Forward declaration, a strange C thing */
110struct task_struct;
111
112/* Free all resources held by a thread. */
113static inline void release_thread(struct task_struct *dead_task)
114{
115}
116
117/* Prepare to copy thread state - unlazy all lazy status */
118#define prepare_to_copy(tsk) do { } while (0)
119
120extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
121
122/*
123 * Free current thread data structures etc..
124 */
125static inline void exit_thread(void)
126{
127}
128
129unsigned long thread_saved_pc(struct task_struct *tsk);
130unsigned long get_wchan(struct task_struct *p);
131
132#define KSTK_EIP(tsk) \
133 ({ \
134 unsigned long eip = 0; \
135 if ((tsk)->thread.esp0 > PAGE_SIZE && \
136 (virt_addr_valid((tsk)->thread.esp0))) \
137 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
138 eip; })
139#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
140
141#define cpu_relax() barrier()
142
143#endif