Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
[pv_ops_mirror.git] / include / asm-h8300 / processor.h
blob49fc886a623278249302edf3c169c883526e8313
1 /*
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
9 */
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/compiler.h>
21 #include <asm/segment.h>
22 #include <asm/fpu.h>
23 #include <asm/ptrace.h>
24 #include <asm/current.h>
26 static inline unsigned long rdusp(void) {
27 extern unsigned int sw_usp;
28 return(sw_usp);
31 static inline void wrusp(unsigned long usp) {
32 extern unsigned int sw_usp;
33 sw_usp = 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
48 struct thread_struct {
49 unsigned long ksp; /* kernel stack pointer */
50 unsigned long usp; /* user stack pointer */
51 unsigned long ccr; /* saved status register */
52 unsigned long esp0; /* points to SR of stack frame */
53 struct {
54 unsigned short *addr;
55 unsigned short inst;
56 } breakinfo;
59 #define INIT_THREAD { \
60 .ksp = sizeof(init_stack) + (unsigned long)init_stack, \
61 .usp = 0, \
62 .ccr = PS_S, \
63 .esp0 = 0, \
64 .breakinfo = { \
65 .addr = (unsigned short *)-1, \
66 .inst = 0 \
67 } \
71 * Do necessary setup to start up a newly executed thread.
73 * pass the data segment into user programs if it exists,
74 * it can't hurt anything as far as I can tell
76 #if defined(__H8300H__)
77 #define start_thread(_regs, _pc, _usp) \
78 do { \
79 set_fs(USER_DS); /* reads from user space */ \
80 (_regs)->pc = (_pc); \
81 (_regs)->ccr = 0x00; /* clear all flags */ \
82 (_regs)->er5 = current->mm->start_data; /* GOT base */ \
83 wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3); \
84 } while(0)
85 #endif
86 #if defined(__H8300S__)
87 #define start_thread(_regs, _pc, _usp) \
88 do { \
89 set_fs(USER_DS); /* reads from user space */ \
90 (_regs)->pc = (_pc); \
91 (_regs)->ccr = 0x00; /* clear kernel flag */ \
92 (_regs)->exr = 0x78; /* enable all interrupts */ \
93 (_regs)->er5 = current->mm->start_data; /* GOT base */ \
94 /* 14 = space for retaddr(4), vector(4), er0(4) and ext(2) on stack */ \
95 wrusp(((unsigned long)(_usp)) - 14); \
96 } while(0)
97 #endif
99 /* Forward declaration, a strange C thing */
100 struct task_struct;
102 /* Free all resources held by a thread. */
103 static inline void release_thread(struct task_struct *dead_task)
107 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
109 #define prepare_to_copy(tsk) do { } while (0)
112 * Free current thread data structures etc..
114 static inline void exit_thread(void)
119 * Return saved PC of a blocked thread.
121 unsigned long thread_saved_pc(struct task_struct *tsk);
122 unsigned long get_wchan(struct task_struct *p);
124 #define KSTK_EIP(tsk) \
125 ({ \
126 unsigned long eip = 0; \
127 if ((tsk)->thread.esp0 > PAGE_SIZE && \
128 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
129 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
130 eip; })
131 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
133 #define cpu_relax() barrier()
135 #endif