1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* include/asm/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 #include <asm/ptrace.h>
13 #include <asm/signal.h>
16 /* Whee, this is STACK_TOP + PAGE_SIZE and the lowest kernel address too...
17 * That one page is used to protect kernel from intruders, so that
18 * we can make our access_ok test faster
20 #define TASK_SIZE PAGE_OFFSET
22 #define STACK_TOP (PAGE_OFFSET - PAGE_SIZE)
23 #define STACK_TOP_MAX STACK_TOP
24 #endif /* __KERNEL__ */
30 unsigned long *insn_addr
;
35 /* The Sparc processor specific thread struct. */
36 struct thread_struct
{
37 struct pt_regs
*kregs
;
40 /* Special child fork kpsr/kwim values. */
41 unsigned long fork_kpsr
__attribute__ ((aligned (8)));
42 unsigned long fork_kwim
;
44 /* Floating point regs */
45 unsigned long float_regs
[32] __attribute__ ((aligned (8)));
47 unsigned long fpqdepth
;
48 struct fpq fpqueue
[16];
51 #define INIT_THREAD { \
52 .kregs = (struct pt_regs *)(init_stack+THREAD_SIZE)-1 \
55 /* Do necessary setup to start up a newly executed thread. */
56 static inline void start_thread(struct pt_regs
* regs
, unsigned long pc
,
59 register unsigned long zero
asm("g1");
61 regs
->psr
= (regs
->psr
& (PSR_CWP
)) | PSR_S
;
62 regs
->pc
= ((pc
& (~3)) - 4);
63 regs
->npc
= regs
->pc
+ 4;
66 __asm__
__volatile__("std\t%%g0, [%0 + %3 + 0x00]\n\t"
67 "std\t%%g0, [%0 + %3 + 0x08]\n\t"
68 "std\t%%g0, [%0 + %3 + 0x10]\n\t"
69 "std\t%%g0, [%0 + %3 + 0x18]\n\t"
70 "std\t%%g0, [%0 + %3 + 0x20]\n\t"
71 "std\t%%g0, [%0 + %3 + 0x28]\n\t"
72 "std\t%%g0, [%0 + %3 + 0x30]\n\t"
73 "st\t%1, [%0 + %3 + 0x38]\n\t"
74 "st\t%%g0, [%0 + %3 + 0x3c]"
77 "r" (sp
- sizeof(struct reg_window32
)),
79 "i" ((const unsigned long)(&((struct pt_regs
*)0)->u_regs
[0]))
83 unsigned long __get_wchan(struct task_struct
*);
85 #define task_pt_regs(tsk) ((tsk)->thread.kregs)
86 #define KSTK_EIP(tsk) ((tsk)->thread.kregs->pc)
87 #define KSTK_ESP(tsk) ((tsk)->thread.kregs->u_regs[UREG_FP])
91 extern struct task_struct
*last_task_used_math
;
92 int do_mathemu(struct pt_regs
*regs
, struct task_struct
*fpt
);
94 #define cpu_relax() barrier()
96 extern void (*sparc_idle
)(void);
100 #endif /* __ASM_SPARC_PROCESSOR_H */