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

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

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

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp