~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/parisc/include/asm/processor.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * include/asm-parisc/processor.h
  4  *
  5  * Copyright (C) 1994 Linus Torvalds
  6  * Copyright (C) 2001 Grant Grundler
  7  */
  8 
  9 #ifndef __ASM_PARISC_PROCESSOR_H
 10 #define __ASM_PARISC_PROCESSOR_H
 11 
 12 #ifndef __ASSEMBLY__
 13 #include <linux/threads.h>
 14 #include <linux/irqreturn.h>
 15 
 16 #include <asm/assembly.h>
 17 #include <asm/prefetch.h>
 18 #include <asm/hardware.h>
 19 #include <asm/pdc.h>
 20 #include <asm/ptrace.h>
 21 #include <asm/types.h>
 22 #include <asm/percpu.h>
 23 #endif /* __ASSEMBLY__ */
 24 
 25 #define HAVE_ARCH_PICK_MMAP_LAYOUT
 26 
 27 #define TASK_SIZE_OF(tsk)       ((tsk)->thread.task_size)
 28 #define TASK_SIZE               TASK_SIZE_OF(current)
 29 #define TASK_UNMAPPED_BASE      (current->thread.map_base)
 30 
 31 #define DEFAULT_TASK_SIZE32     (0xFFF00000UL)
 32 #define DEFAULT_MAP_BASE32      (0x40000000UL)
 33 
 34 #ifdef CONFIG_64BIT
 35 #define DEFAULT_TASK_SIZE       (MAX_ADDRESS-0xf000000)
 36 #define DEFAULT_MAP_BASE        (0x200000000UL)
 37 #else
 38 #define DEFAULT_TASK_SIZE       DEFAULT_TASK_SIZE32
 39 #define DEFAULT_MAP_BASE        DEFAULT_MAP_BASE32
 40 #endif
 41 
 42 /* XXX: STACK_TOP actually should be STACK_BOTTOM for parisc.
 43  * prumpf */
 44 
 45 #define STACK_TOP       TASK_SIZE
 46 #define STACK_TOP_MAX   DEFAULT_TASK_SIZE
 47 
 48 #ifndef __ASSEMBLY__
 49 
 50 struct rlimit;
 51 unsigned long mmap_upper_limit(struct rlimit *rlim_stack);
 52 unsigned long calc_max_stack_size(unsigned long stack_max);
 53 
 54 /*
 55  * Data detected about CPUs at boot time which is the same for all CPU's.
 56  * HP boxes are SMP - ie identical processors.
 57  *
 58  * FIXME: some CPU rev info may be processor specific...
 59  */
 60 struct system_cpuinfo_parisc {
 61         unsigned int    cpu_count;
 62         unsigned int    cpu_hz;
 63         unsigned int    hversion;
 64         unsigned int    sversion;
 65         enum cpu_type   cpu_type;
 66 
 67         struct {
 68                 struct pdc_model model;
 69                 unsigned long versions;
 70                 unsigned long cpuid;
 71                 unsigned long capabilities;
 72                 char   sys_model_name[81]; /* PDC-ROM returnes this model name */
 73         } pdc;
 74 
 75         const char      *cpu_name;      /* e.g. "PA7300LC (PCX-L2)" */
 76         const char      *family_name;   /* e.g. "1.1e" */
 77 };
 78 
 79 
 80 /* Per CPU data structure - ie varies per CPU.  */
 81 struct cpuinfo_parisc {
 82         unsigned long it_value;     /* Interval Timer at last timer Intr */
 83         unsigned long irq_count;    /* number of IRQ's since boot */
 84         unsigned long cpuid;        /* aka slot_number or set to NO_PROC_ID */
 85         unsigned long hpa;          /* Host Physical address */
 86         unsigned long txn_addr;     /* MMIO addr of EIR or id_eid */
 87 #ifdef CONFIG_SMP
 88         unsigned long pending_ipi;  /* bitmap of type ipi_message_type */
 89 #endif
 90         unsigned long bh_count;     /* number of times bh was invoked */
 91         unsigned long fp_rev;
 92         unsigned long fp_model;
 93         unsigned long cpu_num;      /* CPU number from PAT firmware */
 94         unsigned long cpu_loc;      /* CPU location from PAT firmware */
 95         unsigned int state;
 96         struct parisc_device *dev;
 97 };
 98 
 99 extern struct system_cpuinfo_parisc boot_cpu_data;
100 DECLARE_PER_CPU(struct cpuinfo_parisc, cpu_data);
101 extern int time_keeper_id;              /* CPU used for timekeeping */
102 
103 #define CPU_HVERSION ((boot_cpu_data.hversion >> 4) & 0x0FFF)
104 
105 struct thread_struct {
106         struct pt_regs regs;
107         unsigned long  task_size;
108         unsigned long  map_base;
109         unsigned long  flags;
110 }; 
111 
112 #define task_pt_regs(tsk) ((struct pt_regs *)&((tsk)->thread.regs))
113 
114 /* Thread struct flags. */
115 #define PARISC_UAC_NOPRINT      (1UL << 0)      /* see prctl and unaligned.c */
116 #define PARISC_UAC_SIGBUS       (1UL << 1)
117 #define PARISC_KERNEL_DEATH     (1UL << 31)     /* see die_if_kernel()... */
118 
119 #define PARISC_UAC_SHIFT        0
120 #define PARISC_UAC_MASK         (PARISC_UAC_NOPRINT|PARISC_UAC_SIGBUS)
121 
122 #define SET_UNALIGN_CTL(task,value)                                       \
123         ({                                                                \
124         (task)->thread.flags = (((task)->thread.flags & ~PARISC_UAC_MASK) \
125                                 | (((value) << PARISC_UAC_SHIFT) &        \
126                                    PARISC_UAC_MASK));                     \
127         0;                                                                \
128         })
129 
130 #define GET_UNALIGN_CTL(task,addr)                                        \
131         ({                                                                \
132         put_user(((task)->thread.flags & PARISC_UAC_MASK)                 \
133                  >> PARISC_UAC_SHIFT, (int __user *) (addr));             \
134         })
135 
136 #define INIT_THREAD { \
137         .regs = {       .gr     = { 0, }, \
138                         .fr     = { 0, }, \
139                         .sr     = { 0, }, \
140                         .iasq   = { 0, }, \
141                         .iaoq   = { 0, }, \
142                         .cr27   = 0, \
143                 }, \
144         .task_size      = DEFAULT_TASK_SIZE, \
145         .map_base       = DEFAULT_MAP_BASE, \
146         .flags          = 0 \
147         }
148 
149 struct task_struct;
150 void show_trace(struct task_struct *task, unsigned long *stack);
151 
152 /*
153  * Start user thread in another space.
154  *
155  * Note that we set both the iaoq and r31 to the new pc. When
156  * the kernel initially calls execve it will return through an
157  * rfi path that will use the values in the iaoq. The execve
158  * syscall path will return through the gateway page, and
159  * that uses r31 to branch to.
160  *
161  * For ELF we clear r23, because the dynamic linker uses it to pass
162  * the address of the finalizer function.
163  *
164  * We also initialize sr3 to an illegal value (illegal for our
165  * implementation, not for the architecture).
166  */
167 typedef unsigned int elf_caddr_t;
168 
169 /* The ELF abi wants things done a "wee bit" differently than
170  * som does.  Supporting this behavior here avoids
171  * having our own version of create_elf_tables.
172  *
173  * Oh, and yes, that is not a typo, we are really passing argc in r25
174  * and argv in r24 (rather than r26 and r25).  This is because that's
175  * where __libc_start_main wants them.
176  *
177  * Duplicated from dl-machine.h for the benefit of readers:
178  *
179  *  Our initial stack layout is rather different from everyone else's
180  *  due to the unique PA-RISC ABI.  As far as I know it looks like
181  *  this:
182 
183    -----------------------------------  (user startup code creates this frame)
184    |         32 bytes of magic       |
185    |---------------------------------|
186    | 32 bytes argument/sp save area  |
187    |---------------------------------| (bprm->p)
188    |        ELF auxiliary info       |
189    |         (up to 28 words)        |
190    |---------------------------------|
191    |               NULL              |
192    |---------------------------------|
193    |       Environment pointers      |
194    |---------------------------------|
195    |               NULL              |
196    |---------------------------------|
197    |        Argument pointers        |
198    |---------------------------------| <- argv
199    |          argc (1 word)          |
200    |---------------------------------| <- bprm->exec (HACK!)
201    |         N bytes of slack        |
202    |---------------------------------|
203    |    filename passed to execve    |
204    |---------------------------------| (mm->env_end)
205    |           env strings           |
206    |---------------------------------| (mm->env_start, mm->arg_end)
207    |           arg strings           |
208    |---------------------------------|
209    | additional faked arg strings if |
210    | we're invoked via binfmt_script |
211    |---------------------------------| (mm->arg_start)
212    stack base is at TASK_SIZE - rlim_max.
213 
214 on downward growing arches, it looks like this:
215    stack base at TASK_SIZE
216    | filename passed to execve
217    | env strings
218    | arg strings
219    | faked arg strings
220    | slack
221    | ELF
222    | envps
223    | argvs
224    | argc
225 
226  *  The pleasant part of this is that if we need to skip arguments we
227  *  can just decrement argc and move argv, because the stack pointer
228  *  is utterly unrelated to the location of the environment and
229  *  argument vectors.
230  *
231  * Note that the S/390 people took the easy way out and hacked their
232  * GCC to make the stack grow downwards.
233  *
234  * Final Note: For entry from syscall, the W (wide) bit of the PSW
235  * is stuffed into the lowest bit of the user sp (%r30), so we fill
236  * it in here from the current->personality
237  */
238 
239 #define USER_WIDE_MODE  (!is_32bit_task())
240 
241 #define start_thread(regs, new_pc, new_sp) do {         \
242         elf_addr_t *sp = (elf_addr_t *)new_sp;          \
243         __u32 spaceid = (__u32)current->mm->context.space_id;   \
244         elf_addr_t pc = (elf_addr_t)new_pc | 3;         \
245         elf_caddr_t *argv = (elf_caddr_t *)bprm->exec + 1;      \
246                                                         \
247         regs->iasq[0] = spaceid;                        \
248         regs->iasq[1] = spaceid;                        \
249         regs->iaoq[0] = pc;                             \
250         regs->iaoq[1] = pc + 4;                         \
251         regs->sr[2] = LINUX_GATEWAY_SPACE;              \
252         regs->sr[3] = 0xffff;                           \
253         regs->sr[4] = spaceid;                          \
254         regs->sr[5] = spaceid;                          \
255         regs->sr[6] = spaceid;                          \
256         regs->sr[7] = spaceid;                          \
257         regs->gr[ 0] = USER_PSW | (USER_WIDE_MODE ? PSW_W : 0); \
258         regs->fr[ 0] = 0LL;                             \
259         regs->fr[ 1] = 0LL;                             \
260         regs->fr[ 2] = 0LL;                             \
261         regs->fr[ 3] = 0LL;                             \
262         regs->gr[30] = (((unsigned long)sp + 63) &~ 63) | (USER_WIDE_MODE ? 1 : 0); \
263         regs->gr[31] = pc;                              \
264                                                         \
265         get_user(regs->gr[25], (argv - 1));             \
266         regs->gr[24] = (long) argv;                     \
267         regs->gr[23] = 0;                               \
268 } while(0)
269 
270 struct mm_struct;
271 
272 extern unsigned long __get_wchan(struct task_struct *p);
273 
274 #define KSTK_EIP(tsk)   ((tsk)->thread.regs.iaoq[0])
275 #define KSTK_ESP(tsk)   ((tsk)->thread.regs.gr[30])
276 
277 #define cpu_relax()     barrier()
278 
279 /*
280  * parisc_requires_coherency() is used to identify the combined VIPT/PIPT
281  * cached CPUs which require a guarantee of coherency (no inequivalent aliases
282  * with different data, whether clean or not) to operate
283  */
284 #ifdef CONFIG_PA8X00
285 extern int _parisc_requires_coherency;
286 #define parisc_requires_coherency()     _parisc_requires_coherency
287 #else
288 #define parisc_requires_coherency()     (0)
289 #endif
290 
291 extern int running_on_qemu;
292 extern int parisc_narrow_firmware;
293 
294 extern void __noreturn toc_intr(struct pt_regs *regs);
295 extern void toc_handler(void);
296 extern unsigned int toc_handler_size;
297 extern unsigned int toc_handler_csum;
298 extern void do_cpu_irq_mask(struct pt_regs *);
299 extern irqreturn_t timer_interrupt(int, void *);
300 extern irqreturn_t ipi_interrupt(int, void *);
301 extern void start_cpu_itimer(void);
302 extern void handle_interruption(int, struct pt_regs *);
303 
304 /* called from assembly code: */
305 extern void start_parisc(void);
306 extern void smp_callin(unsigned long);
307 extern void sys_rt_sigreturn(struct pt_regs *, int);
308 extern void do_notify_resume(struct pt_regs *, long);
309 extern long do_syscall_trace_enter(struct pt_regs *);
310 extern void do_syscall_trace_exit(struct pt_regs *);
311 
312 /* CPU startup and info */
313 struct seq_file;
314 extern void early_trap_init(void);
315 extern void collect_boot_cpu_data(void);
316 extern void btlb_init_per_cpu(void);
317 extern int show_cpuinfo (struct seq_file *m, void *v);
318 
319 /* driver code in driver/parisc */
320 extern void processor_init(void);
321 struct parisc_device;
322 struct resource;
323 extern void sba_distributed_lmmio(struct parisc_device *, struct resource *);
324 extern void sba_directed_lmmio(struct parisc_device *, struct resource *);
325 extern void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask);
326 extern void ccio_cujo20_fixup(struct parisc_device *dev, u32 iovp);
327 
328 #endif /* __ASSEMBLY__ */
329 
330 #endif /* __ASM_PARISC_PROCESSOR_H */
331 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php