2 * include/asm-h8300/processor.h
4 * Copyright (C) 2002 Yoshinori Sato
6 * Based on: linux/asm-m68nommu/processor.h
8 * Copyright (C) 1995 Hamish Macdonald
11 #ifndef __ASM_H8300_PROCESSOR_H
12 #define __ASM_H8300_PROCESSOR_H
15 * Default implementation of macro that returns current
16 * instruction pointer ("program counter").
18 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
20 #include <linux/config.h>
21 #include <asm/segment.h>
23 #include <asm/ptrace.h>
24 #include <asm/current.h>
26 extern inline unsigned long rdusp(void) {
27 extern unsigned int sw_usp
;
31 extern inline void wrusp(unsigned long usp
) {
32 extern unsigned int sw_usp
;
37 * User space process size: 3.75GB. This is hardcoded into a few places,
38 * so don't change it unless you know what you are doing.
40 #define TASK_SIZE (0xFFFFFFFFUL)
43 * This decides where the kernel will search for a free chunk of vm
44 * space during mmap's. We won't be using it
46 #define TASK_UNMAPPED_BASE 0
54 struct thread_struct
{
55 unsigned long ksp
; /* kernel stack pointer */
56 unsigned long usp
; /* user stack pointer */
57 unsigned short ccr
; /* saved status register */
58 unsigned long esp0
; /* points to SR of stack frame */
59 unsigned long vfork_ret
;
60 unsigned long debugreg
[8]; /* debug info */
61 } __attribute__((aligned(2),packed
));
63 #define INIT_THREAD { \
64 sizeof(init_stack) + (unsigned long) init_stack, 0, \
69 * Do necessary setup to start up a newly executed thread.
71 * pass the data segment into user programs if it exists,
72 * it can't hurt anything as far as I can tell
74 #define start_thread(_regs, _pc, _usp) \
76 (_regs)->pc = (_pc); \
77 (_regs)->ccr &= ~0x10; \
78 *((unsigned long *)(_usp)-1) = _pc; \
79 wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3); \
82 /* Forward declaration, a strange C thing */
85 /* Free all resources held by a thread. */
86 static inline void release_thread(struct task_struct
*dead_task
)
90 extern int kernel_thread(int (*fn
)(void *), void * arg
, unsigned long flags
);
92 #define prepare_to_copy(tsk) do { } while (0)
95 * Free current thread data structures etc..
97 static inline void exit_thread(void)
102 * Return saved PC of a blocked thread.
104 unsigned long thread_saved_pc(struct task_struct
*tsk
);
105 unsigned long get_wchan(struct task_struct
*p
);
107 #define KSTK_EIP(tsk) \
109 unsigned long eip = 0; \
110 if ((tsk)->thread.esp0 > PAGE_SIZE && \
111 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
112 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
114 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
116 #define cpu_relax() do { } while (0)