initial commit with v2.6.9
[linux-2.6.9-moxart.git] / include / asm-m68knommu / processor.h
blob736e3192f46444ee19562426a965cc3ac9fad116
1 /*
2 * include/asm-m68k/processor.h
4 * Copyright (C) 1995 Hamish Macdonald
5 */
7 #ifndef __ASM_M68K_PROCESSOR_H
8 #define __ASM_M68K_PROCESSOR_H
11 * Default implementation of macro that returns current
12 * instruction pointer ("program counter").
14 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
16 #include <linux/config.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>
24 extern inline unsigned long rdusp(void)
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
36 extern inline void wrusp(unsigned long usp)
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
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.
50 #define TASK_SIZE (0xF0000000UL)
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
56 #define TASK_UNMAPPED_BASE 0
59 * Bus types
61 #define MCA_bus 0
63 /*
64 * if you change this structure, you must change the code and offsets
65 * in m68k/machasm.S
68 struct thread_struct {
69 unsigned long ksp; /* kernel stack pointer */
70 unsigned long usp; /* user stack pointer */
71 unsigned short sr; /* saved status register */
72 unsigned short fs; /* saved fs (sfc, dfc) */
73 unsigned long crp[2]; /* cpu root pointer */
74 unsigned long esp0; /* points to SR of stack frame */
75 unsigned long fp[8*3];
76 unsigned long fpcntl[3]; /* fp control regs */
77 unsigned char fpstate[FPSTATESIZE]; /* floating point state */
80 #define INIT_THREAD { \
81 sizeof(init_stack) + (unsigned long) init_stack, 0, \
82 PS_S, __KERNEL_DS, \
83 {0, 0}, 0, {0,}, {0, 0, 0}, {0,}, \
87 * Do necessary setup to start up a newly executed thread.
89 * pass the data segment into user programs if it exists,
90 * it can't hurt anything as far as I can tell
92 #define start_thread(_regs, _pc, _usp) \
93 do { \
94 set_fs(USER_DS); /* reads from user space */ \
95 (_regs)->pc = (_pc); \
96 if (current->mm) \
97 (_regs)->d5 = current->mm->start_data; \
98 (_regs)->sr &= ~0x2000; \
99 wrusp(_usp); \
100 } while(0)
102 /* Forward declaration, a strange C thing */
103 struct task_struct;
105 /* Free all resources held by a thread. */
106 static inline void release_thread(struct task_struct *dead_task)
110 /* Prepare to copy thread state - unlazy all lazy status */
111 #define prepare_to_copy(tsk) do { } while (0)
113 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
116 * Free current thread data structures etc..
118 static inline void exit_thread(void)
122 unsigned long thread_saved_pc(struct task_struct *tsk);
123 unsigned long get_wchan(struct task_struct *p);
125 #define KSTK_EIP(tsk) \
126 ({ \
127 unsigned long eip = 0; \
128 if ((tsk)->thread.esp0 > PAGE_SIZE && \
129 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
130 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
131 eip; })
132 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
134 #define cpu_relax() do { } while (0)
136 #endif