Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* include/asm/processor.h
0003  *
0004  * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
0005  */
0006 
0007 #ifndef __ASM_SPARC_PROCESSOR_H
0008 #define __ASM_SPARC_PROCESSOR_H
0009 
0010 #include <asm/psr.h>
0011 #include <asm/ptrace.h>
0012 #include <asm/head.h>
0013 #include <asm/signal.h>
0014 #include <asm/page.h>
0015 
0016 /* Whee, this is STACK_TOP + PAGE_SIZE and the lowest kernel address too...
0017  * That one page is used to protect kernel from intruders, so that
0018  * we can make our access_ok test faster
0019  */
0020 #define TASK_SIZE   PAGE_OFFSET
0021 #ifdef __KERNEL__
0022 #define STACK_TOP   (PAGE_OFFSET - PAGE_SIZE)
0023 #define STACK_TOP_MAX   STACK_TOP
0024 #endif /* __KERNEL__ */
0025 
0026 struct task_struct;
0027 
0028 #ifdef __KERNEL__
0029 struct fpq {
0030     unsigned long *insn_addr;
0031     unsigned long insn;
0032 };
0033 #endif
0034 
0035 /* The Sparc processor specific thread struct. */
0036 struct thread_struct {
0037     struct pt_regs *kregs;
0038     unsigned int _pad1;
0039 
0040     /* Special child fork kpsr/kwim values. */
0041     unsigned long fork_kpsr __attribute__ ((aligned (8)));
0042     unsigned long fork_kwim;
0043 
0044     /* Floating point regs */
0045     unsigned long   float_regs[32] __attribute__ ((aligned (8)));
0046     unsigned long   fsr;
0047     unsigned long   fpqdepth;
0048     struct fpq  fpqueue[16];
0049 };
0050 
0051 #define INIT_THREAD  { \
0052     .kregs = (struct pt_regs *)(init_stack+THREAD_SIZE)-1 \
0053 }
0054 
0055 /* Do necessary setup to start up a newly executed thread. */
0056 static inline void start_thread(struct pt_regs * regs, unsigned long pc,
0057                     unsigned long sp)
0058 {
0059     register unsigned long zero asm("g1");
0060 
0061     regs->psr = (regs->psr & (PSR_CWP)) | PSR_S;
0062     regs->pc = ((pc & (~3)) - 4);
0063     regs->npc = regs->pc + 4;
0064     regs->y = 0;
0065     zero = 0;
0066     __asm__ __volatile__("std\t%%g0, [%0 + %3 + 0x00]\n\t"
0067                  "std\t%%g0, [%0 + %3 + 0x08]\n\t"
0068                  "std\t%%g0, [%0 + %3 + 0x10]\n\t"
0069                  "std\t%%g0, [%0 + %3 + 0x18]\n\t"
0070                  "std\t%%g0, [%0 + %3 + 0x20]\n\t"
0071                  "std\t%%g0, [%0 + %3 + 0x28]\n\t"
0072                  "std\t%%g0, [%0 + %3 + 0x30]\n\t"
0073                  "st\t%1, [%0 + %3 + 0x38]\n\t"
0074                  "st\t%%g0, [%0 + %3 + 0x3c]"
0075                  : /* no outputs */
0076                  : "r" (regs),
0077                    "r" (sp - sizeof(struct reg_window32)),
0078                    "r" (zero),
0079                    "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))
0080                  : "memory");
0081 }
0082 
0083 /* Free all resources held by a thread. */
0084 #define release_thread(tsk)     do { } while(0)
0085 
0086 unsigned long __get_wchan(struct task_struct *);
0087 
0088 #define task_pt_regs(tsk) ((tsk)->thread.kregs)
0089 #define KSTK_EIP(tsk)  ((tsk)->thread.kregs->pc)
0090 #define KSTK_ESP(tsk)  ((tsk)->thread.kregs->u_regs[UREG_FP])
0091 
0092 #ifdef __KERNEL__
0093 
0094 extern struct task_struct *last_task_used_math;
0095 int do_mathemu(struct pt_regs *regs, struct task_struct *fpt);
0096 
0097 #define cpu_relax() barrier()
0098 
0099 extern void (*sparc_idle)(void);
0100 
0101 #endif
0102 
0103 #endif /* __ASM_SPARC_PROCESSOR_H */