1 /* $Id: processor.h,v 1.83 2001/10/08 09:32:13 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 * Sparc32 implementation of macro that returns current
12 * instruction pointer ("program counter").
14 #define current_text_addr() ({ void *pc; __asm__("sethi %%hi(1f), %0; or %0, %%lo(1f), %0;\n1:" : "=r" (pc)); pc; })
16 #include <linux/a.out.h>
19 #include <asm/ptrace.h>
21 #include <asm/signal.h>
22 #include <asm/btfixup.h>
26 * The sparc has no problems with write protection
29 #define wp_works_ok__is_a_macro /* for versions in ksyms.c */
31 /* Whee, this is STACK_TOP + PAGE_SIZE and the lowest kernel address too...
32 * That one page is used to protect kernel from intruders, so that
33 * we can make our access_ok test faster
35 #define TASK_SIZE PAGE_OFFSET
41 unsigned long *insn_addr;
50 /* The Sparc processor specific thread struct. */
51 struct thread_struct {
52 struct pt_regs *kregs;
55 /* Special child fork kpsr/kwim values. */
56 unsigned long fork_kpsr __attribute__ ((aligned (8)));
57 unsigned long fork_kwim;
59 /* Floating point regs */
60 unsigned long float_regs[32] __attribute__ ((aligned (8)));
62 unsigned long fpqdepth;
63 struct fpq fpqueue[16];
65 mm_segment_t current_ds;
66 struct exec core_exec; /* just what it says. */
70 #define SPARC_FLAG_KTHREAD 0x1 /* task is a kernel thread */
71 #define SPARC_FLAG_UNALIGNED 0x2 /* is allowed to do unaligned accesses */
73 #define INIT_THREAD { \
74 .flags = SPARC_FLAG_KTHREAD, \
75 .current_ds = KERNEL_DS, \
78 /* Return saved PC of a blocked thread. */
79 extern unsigned long thread_saved_pc(struct task_struct *t);
81 /* Do necessary setup to start up a newly executed thread. */
82 static inline void start_thread(struct pt_regs * regs, unsigned long pc,
85 register unsigned long zero asm("g1");
87 regs->psr = (regs->psr & (PSR_CWP)) | PSR_S;
88 regs->pc = ((pc & (~3)) - 4);
89 regs->npc = regs->pc + 4;
92 __asm__ __volatile__("std\t%%g0, [%0 + %3 + 0x00]\n\t"
93 "std\t%%g0, [%0 + %3 + 0x08]\n\t"
94 "std\t%%g0, [%0 + %3 + 0x10]\n\t"
95 "std\t%%g0, [%0 + %3 + 0x18]\n\t"
96 "std\t%%g0, [%0 + %3 + 0x20]\n\t"
97 "std\t%%g0, [%0 + %3 + 0x28]\n\t"
98 "std\t%%g0, [%0 + %3 + 0x30]\n\t"
99 "st\t%1, [%0 + %3 + 0x38]\n\t"
100 "st\t%%g0, [%0 + %3 + 0x3c]"
103 "r" (sp - sizeof(struct reg_window)),
105 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))
109 /* Free all resources held by a thread. */
110 #define release_thread(tsk) do { } while(0)
111 extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
113 /* Prepare to copy thread state - unlazy all lazy status */
114 #define prepare_to_copy(tsk) do { } while (0)
116 extern unsigned long get_wchan(struct task_struct *);
118 #define KSTK_EIP(tsk) ((tsk)->thread.kregs->pc)
119 #define KSTK_ESP(tsk) ((tsk)->thread.kregs->u_regs[UREG_FP])
123 extern struct task_struct *last_task_used_math;
125 #define cpu_relax() barrier()
129 #endif /* __ASM_SPARC_PROCESSOR_H */