Linux Audio

Check our new training course

Loading...
v4.17
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/* include/asm/processor.h
  3 *
  4 * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
  5 */
  6
  7#ifndef __ASM_SPARC_PROCESSOR_H
  8#define __ASM_SPARC_PROCESSOR_H
  9
 10/*
 11 * Sparc32 implementation of macro that returns current
 12 * instruction pointer ("program counter").
 13 */
 14#define current_text_addr() ({ void *pc; __asm__("sethi %%hi(1f), %0; or %0, %%lo(1f), %0;\n1:" : "=r" (pc)); pc; })
 15
 16#include <asm/psr.h>
 17#include <asm/ptrace.h>
 18#include <asm/head.h>
 19#include <asm/signal.h>
 20#include <asm/page.h>
 21
 
 
 
 
 
 
 22/* Whee, this is STACK_TOP + PAGE_SIZE and the lowest kernel address too...
 23 * That one page is used to protect kernel from intruders, so that
 24 * we can make our access_ok test faster
 25 */
 26#define TASK_SIZE	PAGE_OFFSET
 27#ifdef __KERNEL__
 28#define STACK_TOP	(PAGE_OFFSET - PAGE_SIZE)
 29#define STACK_TOP_MAX	STACK_TOP
 30#endif /* __KERNEL__ */
 31
 32struct task_struct;
 33
 34#ifdef __KERNEL__
 35struct fpq {
 36	unsigned long *insn_addr;
 37	unsigned long insn;
 38};
 39#endif
 40
 41typedef struct {
 42	int seg;
 43} mm_segment_t;
 44
 45/* The Sparc processor specific thread struct. */
 46struct thread_struct {
 47	struct pt_regs *kregs;
 48	unsigned int _pad1;
 49
 50	/* Special child fork kpsr/kwim values. */
 51	unsigned long fork_kpsr __attribute__ ((aligned (8)));
 52	unsigned long fork_kwim;
 53
 54	/* Floating point regs */
 55	unsigned long   float_regs[32] __attribute__ ((aligned (8)));
 56	unsigned long   fsr;
 57	unsigned long   fpqdepth;
 58	struct fpq	fpqueue[16];
 59	unsigned long flags;
 60	mm_segment_t current_ds;
 61};
 62
 63#define SPARC_FLAG_KTHREAD      0x1    /* task is a kernel thread */
 64#define SPARC_FLAG_UNALIGNED    0x2    /* is allowed to do unaligned accesses */
 65
 66#define INIT_THREAD  { \
 67	.flags = SPARC_FLAG_KTHREAD, \
 68	.current_ds = KERNEL_DS, \
 69}
 
 
 
 70
 71/* Do necessary setup to start up a newly executed thread. */
 72static inline void start_thread(struct pt_regs * regs, unsigned long pc,
 73				    unsigned long sp)
 74{
 75	register unsigned long zero asm("g1");
 76
 77	regs->psr = (regs->psr & (PSR_CWP)) | PSR_S;
 78	regs->pc = ((pc & (~3)) - 4);
 79	regs->npc = regs->pc + 4;
 80	regs->y = 0;
 81	zero = 0;
 82	__asm__ __volatile__("std\t%%g0, [%0 + %3 + 0x00]\n\t"
 83			     "std\t%%g0, [%0 + %3 + 0x08]\n\t"
 84			     "std\t%%g0, [%0 + %3 + 0x10]\n\t"
 85			     "std\t%%g0, [%0 + %3 + 0x18]\n\t"
 86			     "std\t%%g0, [%0 + %3 + 0x20]\n\t"
 87			     "std\t%%g0, [%0 + %3 + 0x28]\n\t"
 88			     "std\t%%g0, [%0 + %3 + 0x30]\n\t"
 89			     "st\t%1, [%0 + %3 + 0x38]\n\t"
 90			     "st\t%%g0, [%0 + %3 + 0x3c]"
 91			     : /* no outputs */
 92			     : "r" (regs),
 93			       "r" (sp - sizeof(struct reg_window32)),
 94			       "r" (zero),
 95			       "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))
 96			     : "memory");
 97}
 98
 99/* Free all resources held by a thread. */
100#define release_thread(tsk)		do { } while(0)
101
102unsigned long get_wchan(struct task_struct *);
103
104#define task_pt_regs(tsk) ((tsk)->thread.kregs)
105#define KSTK_EIP(tsk)  ((tsk)->thread.kregs->pc)
106#define KSTK_ESP(tsk)  ((tsk)->thread.kregs->u_regs[UREG_FP])
107
108#ifdef __KERNEL__
109
110extern struct task_struct *last_task_used_math;
111int do_mathemu(struct pt_regs *regs, struct task_struct *fpt);
112
113#define cpu_relax()	barrier()
114
115extern void (*sparc_idle)(void);
116
117#endif
118
119#endif /* __ASM_SPARC_PROCESSOR_H */
v4.10.11
 
  1/* include/asm/processor.h
  2 *
  3 * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
  4 */
  5
  6#ifndef __ASM_SPARC_PROCESSOR_H
  7#define __ASM_SPARC_PROCESSOR_H
  8
  9/*
 10 * Sparc32 implementation of macro that returns current
 11 * instruction pointer ("program counter").
 12 */
 13#define current_text_addr() ({ void *pc; __asm__("sethi %%hi(1f), %0; or %0, %%lo(1f), %0;\n1:" : "=r" (pc)); pc; })
 14
 15#include <asm/psr.h>
 16#include <asm/ptrace.h>
 17#include <asm/head.h>
 18#include <asm/signal.h>
 19#include <asm/page.h>
 20
 21/*
 22 * The sparc has no problems with write protection
 23 */
 24#define wp_works_ok 1
 25#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
 26
 27/* Whee, this is STACK_TOP + PAGE_SIZE and the lowest kernel address too...
 28 * That one page is used to protect kernel from intruders, so that
 29 * we can make our access_ok test faster
 30 */
 31#define TASK_SIZE	PAGE_OFFSET
 32#ifdef __KERNEL__
 33#define STACK_TOP	(PAGE_OFFSET - PAGE_SIZE)
 34#define STACK_TOP_MAX	STACK_TOP
 35#endif /* __KERNEL__ */
 36
 37struct task_struct;
 38
 39#ifdef __KERNEL__
 40struct fpq {
 41	unsigned long *insn_addr;
 42	unsigned long insn;
 43};
 44#endif
 45
 46typedef struct {
 47	int seg;
 48} mm_segment_t;
 49
 50/* The Sparc processor specific thread struct. */
 51struct thread_struct {
 52	struct pt_regs *kregs;
 53	unsigned int _pad1;
 54
 55	/* Special child fork kpsr/kwim values. */
 56	unsigned long fork_kpsr __attribute__ ((aligned (8)));
 57	unsigned long fork_kwim;
 58
 59	/* Floating point regs */
 60	unsigned long   float_regs[32] __attribute__ ((aligned (8)));
 61	unsigned long   fsr;
 62	unsigned long   fpqdepth;
 63	struct fpq	fpqueue[16];
 64	unsigned long flags;
 65	mm_segment_t current_ds;
 66};
 67
 68#define SPARC_FLAG_KTHREAD      0x1    /* task is a kernel thread */
 69#define SPARC_FLAG_UNALIGNED    0x2    /* is allowed to do unaligned accesses */
 70
 71#define INIT_THREAD  { \
 72	.flags = SPARC_FLAG_KTHREAD, \
 73	.current_ds = KERNEL_DS, \
 74}
 75
 76/* Return saved PC of a blocked thread. */
 77unsigned long thread_saved_pc(struct task_struct *t);
 78
 79/* Do necessary setup to start up a newly executed thread. */
 80static inline void start_thread(struct pt_regs * regs, unsigned long pc,
 81				    unsigned long sp)
 82{
 83	register unsigned long zero asm("g1");
 84
 85	regs->psr = (regs->psr & (PSR_CWP)) | PSR_S;
 86	regs->pc = ((pc & (~3)) - 4);
 87	regs->npc = regs->pc + 4;
 88	regs->y = 0;
 89	zero = 0;
 90	__asm__ __volatile__("std\t%%g0, [%0 + %3 + 0x00]\n\t"
 91			     "std\t%%g0, [%0 + %3 + 0x08]\n\t"
 92			     "std\t%%g0, [%0 + %3 + 0x10]\n\t"
 93			     "std\t%%g0, [%0 + %3 + 0x18]\n\t"
 94			     "std\t%%g0, [%0 + %3 + 0x20]\n\t"
 95			     "std\t%%g0, [%0 + %3 + 0x28]\n\t"
 96			     "std\t%%g0, [%0 + %3 + 0x30]\n\t"
 97			     "st\t%1, [%0 + %3 + 0x38]\n\t"
 98			     "st\t%%g0, [%0 + %3 + 0x3c]"
 99			     : /* no outputs */
100			     : "r" (regs),
101			       "r" (sp - sizeof(struct reg_window32)),
102			       "r" (zero),
103			       "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))
104			     : "memory");
105}
106
107/* Free all resources held by a thread. */
108#define release_thread(tsk)		do { } while(0)
109
110unsigned long get_wchan(struct task_struct *);
111
112#define task_pt_regs(tsk) ((tsk)->thread.kregs)
113#define KSTK_EIP(tsk)  ((tsk)->thread.kregs->pc)
114#define KSTK_ESP(tsk)  ((tsk)->thread.kregs->u_regs[UREG_FP])
115
116#ifdef __KERNEL__
117
118extern struct task_struct *last_task_used_math;
119int do_mathemu(struct pt_regs *regs, struct task_struct *fpt);
120
121#define cpu_relax()	barrier()
122
123extern void (*sparc_idle)(void);
124
125#endif
126
127#endif /* __ASM_SPARC_PROCESSOR_H */