2 * include/asm-v850/processor.h
4 * Copyright (C) 2001,02,03 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this
9 * archive for more details.
11 * Written by Miles Bader <miles@gnu.org>
14 #ifndef __V850_PROCESSOR_H__
15 #define __V850_PROCESSOR_H__
17 #include <linux/config.h>
18 #ifndef __ASSEMBLY__ /* <linux/thread_info.h> is not asm-safe. */
19 #include <linux/thread_info.h>
22 #include <asm/ptrace.h>
23 #include <asm/entry.h>
25 /* Some code expects `segment' stuff to be defined here. */
26 #include <asm/segment.h>
30 * The only places this is used seem to be horrible bletcherous kludges,
31 * so we just define it to be as large as possible.
33 #define TASK_SIZE (0xFFFFFFFF)
36 * This decides where the kernel will search for a free chunk of vm
37 * space during mmap's. We won't be using it.
39 #define TASK_UNMAPPED_BASE 0
46 * Default implementation of macro that returns current
47 * instruction pointer ("program counter").
49 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
56 #define MCA_bus__is_a_macro /* for versions in ksyms.c */
58 /* If you change this, you must change the associated assembly-languages
59 constants defined below, THREAD_*. */
60 struct thread_struct {
61 /* kernel stack pointer (must be first field in structure) */
65 #define INIT_THREAD { sizeof init_stack + (unsigned long)init_stack }
68 /* Do necessary setup to start up a newly executed thread. */
69 extern inline void start_thread (struct pt_regs *regs,
70 unsigned long pc, unsigned long usp)
73 regs->gpr[GPR_SP] = usp;
74 regs->kernel_mode = 0;
77 /* Free all resources held by a thread. */
78 extern inline void release_thread (struct task_struct *dead_task)
82 /* Prepare to copy thread state - unlazy all lazy status */
83 #define prepare_to_copy(tsk) do { } while (0)
85 extern int kernel_thread (int (*fn)(void *), void * arg, unsigned long flags);
87 /* Free current thread data structures etc. */
88 static inline void exit_thread (void)
93 /* Return the registers saved during context-switch by the currently
94 not-running thread T. Note that this only includes some registers!
95 See entry.S for details. */
96 #define thread_saved_regs(t) \
97 ((struct pt_regs*)((t)->thread.ksp + STATE_SAVE_PT_OFFSET))
98 /* Return saved (kernel) PC of a blocked thread. Actually, we return the
99 LP register, because the thread is actually blocked in switch_thread,
100 and we're interested in the PC it will _return_ to. */
101 #define thread_saved_pc(t) (thread_saved_regs(t)->gpr[GPR_LP])
104 unsigned long get_wchan (struct task_struct *p);
107 /* Return some info about the user process TASK. */
108 #define task_tos(task) ((unsigned long)(task)->thread_info + THREAD_SIZE)
109 #define task_regs(task) ((struct pt_regs *)task_tos (task) - 1)
110 #define task_sp(task) (task_regs (task)->gpr[GPR_SP])
111 #define task_pc(task) (task_regs (task)->pc)
112 /* Grotty old names for some. */
113 #define KSTK_EIP(task) task_pc (task)
114 #define KSTK_ESP(task) task_sp (task)
117 #define cpu_relax() ((void)0)
120 #else /* __ASSEMBLY__ */
124 #endif /* !__ASSEMBLY__ */
127 #endif /* __V850_PROCESSOR_H__ */