2 * include/asm-m68k/processor.h
4 * Copyright (C) 1995 Hamish Macdonald
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/threads.h>
17 #include <asm/types.h>
18 #include <asm/segment.h>
20 #include <asm/ptrace.h>
21 #include <asm/current.h>
23 static inline unsigned long rdusp(void)
25 #ifdef CONFIG_COLDFIRE
26 extern unsigned int sw_usp
;
30 __asm__
__volatile__("move %/usp,%0" : "=a" (usp
));
35 static inline void wrusp(unsigned long usp
)
37 #ifdef CONFIG_COLDFIRE
38 extern unsigned int sw_usp
;
41 __asm__
__volatile__("move %0,%/usp" : : "a" (usp
));
46 * User space process size: 3.75GB. This is hardcoded into a few places,
47 * so don't change it unless you know what you are doing.
49 #define TASK_SIZE (0xF0000000UL)
52 * This decides where the kernel will search for a free chunk of vm
53 * space during mmap's. We won't be using it
55 #define TASK_UNMAPPED_BASE 0
58 * if you change this structure, you must change the code and offsets
62 struct thread_struct
{
63 unsigned long ksp
; /* kernel stack pointer */
64 unsigned long usp
; /* user stack pointer */
65 unsigned short sr
; /* saved status register */
66 unsigned short fs
; /* saved fs (sfc, dfc) */
67 unsigned long crp
[2]; /* cpu root pointer */
68 unsigned long esp0
; /* points to SR of stack frame */
69 unsigned long fp
[8*3];
70 unsigned long fpcntl
[3]; /* fp control regs */
71 unsigned char fpstate
[FPSTATESIZE
]; /* floating point state */
74 #define INIT_THREAD { \
75 sizeof(init_stack) + (unsigned long) init_stack, 0, \
77 {0, 0}, 0, {0,}, {0, 0, 0}, {0,}, \
81 * Do necessary setup to start up a newly executed thread.
83 * pass the data segment into user programs if it exists,
84 * it can't hurt anything as far as I can tell
86 #define start_thread(_regs, _pc, _usp) \
88 set_fs(USER_DS); /* reads from user space */ \
89 (_regs)->pc = (_pc); \
91 (_regs)->d5 = current->mm->start_data; \
92 (_regs)->sr &= ~0x2000; \
96 /* Forward declaration, a strange C thing */
99 /* Free all resources held by a thread. */
100 static inline void release_thread(struct task_struct
*dead_task
)
104 /* Prepare to copy thread state - unlazy all lazy status */
105 #define prepare_to_copy(tsk) do { } while (0)
107 extern int kernel_thread(int (*fn
)(void *), void * arg
, unsigned long flags
);
110 * Free current thread data structures etc..
112 static inline void exit_thread(void)
116 unsigned long thread_saved_pc(struct task_struct
*tsk
);
117 unsigned long get_wchan(struct task_struct
*p
);
119 #define KSTK_EIP(tsk) \
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; \
126 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
128 #define cpu_relax() do { } while (0)