Linux 5.7.6
[linux/fpc-iii.git] / arch / hexagon / include / asm / processor.h
blob9f0cc99420bee39f8e97139da5f0c6a9844f6ba4
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Process/processor support for the Hexagon architecture
5 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
6 */
8 #ifndef _ASM_PROCESSOR_H
9 #define _ASM_PROCESSOR_H
11 #ifndef __ASSEMBLY__
13 #include <asm/mem-layout.h>
14 #include <asm/registers.h>
15 #include <asm/hexagon_vm.h>
17 /* task_struct, defined elsewhere, is the "process descriptor" */
18 struct task_struct;
20 extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
23 * thread_struct is supposed to be for context switch data.
24 * Specifically, to hold the state necessary to perform switch_to...
26 struct thread_struct {
27 void *switch_sp;
31 * initializes thread_struct
32 * The only thing we have in there is switch_sp
33 * which doesn't really need to be initialized.
36 #define INIT_THREAD { \
39 #define cpu_relax() __vmyield()
42 * Decides where the kernel will search for a free chunk of vm space during
43 * mmaps.
44 * See also arch_get_unmapped_area.
45 * Doesn't affect if you have MAX_FIXED in the page flags set though...
47 * Apparently the convention is that ld.so will ask for "unmapped" private
48 * memory to be allocated SOMEWHERE, but it also asks for memory explicitly
49 * via MAP_FIXED at the lower * addresses starting at VA=0x0.
51 * If the two requests collide, you get authentic segfaulting action, so
52 * you have to kick the "unmapped" base requests higher up.
54 #define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE/3))
57 #define task_pt_regs(task) \
58 ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1)
60 #define KSTK_EIP(tsk) (pt_elr(task_pt_regs(tsk)))
61 #define KSTK_ESP(tsk) (pt_psp(task_pt_regs(tsk)))
63 /* Free all resources held by a thread; defined in process.c */
64 extern void release_thread(struct task_struct *dead_task);
66 /* Get wait channel for task P. */
67 extern unsigned long get_wchan(struct task_struct *p);
69 /* The following stuff is pretty HEXAGON specific. */
71 /* This is really just here for __switch_to.
72 Offsets are pulled via asm-offsets.c */
75 * No real reason why VM and native switch stacks should be different.
76 * Ultimately this should merge. Note that Rev C. ABI called out only
77 * R24-27 as callee saved GPRs needing explicit attention (R29-31 being
78 * dealt with automagically by allocframe), but the current ABI has
79 * more, R16-R27. By saving more, the worst case is that we waste some
80 * cycles if building with the old compilers.
83 struct hexagon_switch_stack {
84 union {
85 struct {
86 unsigned long r16;
87 unsigned long r17;
89 unsigned long long r1716;
91 union {
92 struct {
93 unsigned long r18;
94 unsigned long r19;
96 unsigned long long r1918;
98 union {
99 struct {
100 unsigned long r20;
101 unsigned long r21;
103 unsigned long long r2120;
105 union {
106 struct {
107 unsigned long r22;
108 unsigned long r23;
110 unsigned long long r2322;
112 union {
113 struct {
114 unsigned long r24;
115 unsigned long r25;
117 unsigned long long r2524;
119 union {
120 struct {
121 unsigned long r26;
122 unsigned long r27;
124 unsigned long long r2726;
127 unsigned long fp;
128 unsigned long lr;
131 #endif /* !__ASSEMBLY__ */
133 #endif