1 /* $Id: processor.h,v 1.70 1999/03/24 11:42:44 davem Exp $
2 * include/asm-sparc/processor.h
4 * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
7 #ifndef __ASM_SPARC_PROCESSOR_H
8 #define __ASM_SPARC_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/a.out.h>
19 #include <asm/ptrace.h>
21 #include <asm/signal.h>
22 #include <asm/segment.h>
23 #include <asm/btfixup.h>
30 #define EISA_bus__is_a_macro /* for versions in ksyms.c */
32 #define MCA_bus__is_a_macro /* for versions in ksyms.c */
35 * The sparc has no problems with write protection
38 #define wp_works_ok__is_a_macro /* for versions in ksyms.c */
40 /* Whee, this is STACK_TOP + PAGE_SIZE and the lowest kernel address too...
41 * That one page is used to protect kernel from intruders, so that
42 * we can make our access_ok test faster
44 #define TASK_SIZE PAGE_OFFSET
47 unsigned long *insn_addr
;
55 /* The Sparc processor specific thread struct. */
56 struct thread_struct
{
57 unsigned long uwinmask
__attribute__ ((aligned (8)));
58 struct pt_regs
*kregs
;
60 /* For signal handling */
61 unsigned long sig_address
__attribute__ ((aligned (8)));
62 unsigned long sig_desc
;
64 /* Context switch saved kernel state. */
65 unsigned long ksp
__attribute__ ((aligned (8)));
70 /* Special child fork kpsr/kwim values. */
71 unsigned long fork_kpsr
__attribute__ ((aligned (8)));
72 unsigned long fork_kwim
;
74 /* A place to store user windows and stack pointers
75 * when the stack needs inspection.
78 struct reg_window reg_window
[NSWINS
] __attribute__ ((aligned (8)));
79 unsigned long rwbuf_stkptrs
[NSWINS
] __attribute__ ((aligned (8)));
80 unsigned long w_saved
;
82 /* Floating point regs */
83 unsigned long float_regs
[32] __attribute__ ((aligned (8)));
85 unsigned long fpqdepth
;
86 struct fpq fpqueue
[16];
88 mm_segment_t current_ds
;
89 struct exec core_exec
; /* just what it says. */
93 #define SPARC_FLAG_KTHREAD 0x1 /* task is a kernel thread */
94 #define SPARC_FLAG_UNALIGNED 0x2 /* is allowed to do unaligned accesses */
96 #define INIT_MMAP { &init_mm, (0), (0), \
97 NULL, __pgprot(0x0) , VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
100 /* uwinmask, kregs, sig_address, sig_desc, ksp, kpc, kpsr, kwim */ \
101 0, 0, 0, 0, 0, 0, 0, 0, \
102 /* fork_kpsr, fork_kwim */ \
105 { { { 0, }, { 0, } }, }, \
106 /* rwbuf_stkptrs */ \
107 { 0, 0, 0, 0, 0, 0, 0, 0, }, \
110 /* FPU regs */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, \
112 /* FPU status, FPU qdepth, FPU queue */ \
113 0, 0, { { 0, 0, }, }, \
114 /* flags, current_ds, */ \
115 SPARC_FLAG_KTHREAD, KERNEL_DS, \
122 /* Return saved PC of a blocked thread. */
123 extern __inline__
unsigned long thread_saved_pc(struct thread_struct
*t
)
128 /* Do necessary setup to start up a newly executed thread. */
129 extern __inline__
void start_thread(struct pt_regs
* regs
, unsigned long pc
,
132 register unsigned long zero
asm("g1");
134 regs
->psr
= (regs
->psr
& (PSR_CWP
)) | PSR_S
;
135 regs
->pc
= ((pc
& (~3)) - 4);
136 regs
->npc
= regs
->pc
+ 4;
139 __asm__
__volatile__("std\t%%g0, [%0 + %3 + 0x00]\n\t"
140 "std\t%%g0, [%0 + %3 + 0x08]\n\t"
141 "std\t%%g0, [%0 + %3 + 0x10]\n\t"
142 "std\t%%g0, [%0 + %3 + 0x18]\n\t"
143 "std\t%%g0, [%0 + %3 + 0x20]\n\t"
144 "std\t%%g0, [%0 + %3 + 0x28]\n\t"
145 "std\t%%g0, [%0 + %3 + 0x30]\n\t"
146 "st\t%1, [%0 + %3 + 0x38]\n\t"
147 "st\t%%g0, [%0 + %3 + 0x3c]"
148 : : "r" (regs
), "r" (sp
- REGWIN_SZ
), "r" (zero
),
149 "i" ((const unsigned long)(&((struct pt_regs
*)0)->u_regs
[0])));
152 /* Free all resources held by a thread. */
153 #define release_thread(tsk) do { } while(0)
154 extern pid_t
kernel_thread(int (*fn
)(void *), void * arg
, unsigned long flags
);
157 #define copy_segments(__nr, __tsk, __mm) \
158 if((__tsk) == current && \
161 #define release_segments(mm) do { } while (0)
162 #define forget_segments() do { } while (0)
166 extern struct task_struct
*last_task_used_math
;
168 /* Allocation and freeing of basic task resources. */
169 BTFIXUPDEF_CALL(struct task_struct
*, alloc_task_struct
, void)
170 BTFIXUPDEF_CALL(void, free_task_struct
, struct task_struct
*)
172 #define alloc_task_struct() BTFIXUP_CALL(alloc_task_struct)()
173 #define free_task_struct(tsk) BTFIXUP_CALL(free_task_struct)(tsk)
175 #define init_task (init_task_union.task)
176 #define init_stack (init_task_union.stack)
180 #endif /* __ASM_SPARC_PROCESSOR_H */