1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * Copyright (C) 2012 Regents of the University of California 4 * Copyright (C) 2017 SiFive 5 */ 6 7 #define GENERATING_ASM_OFFSETS 8 9 #include <linux/kbuild.h> 10 #include <linux/mm.h> 11 #include <linux/sched.h> 12 #include <linux/ftrace.h> 13 #include <linux/suspend.h> 14 #include <asm/kvm_host.h> 15 #include <asm/thread_info.h> 16 #include <asm/ptrace.h> 17 #include <asm/cpu_ops_sbi.h> 18 #include <asm/stacktrace.h> 19 #include <asm/suspend.h> 20 21 void asm_offsets(void); 22 23 void asm_offsets(void) 24 { 25 OFFSET(TASK_THREAD_RA, task_struct, thread.ra); 26 OFFSET(TASK_THREAD_SP, task_struct, thread.sp); 27 OFFSET(TASK_THREAD_S0, task_struct, thread.s[0]); 28 OFFSET(TASK_THREAD_S1, task_struct, thread.s[1]); 29 OFFSET(TASK_THREAD_S2, task_struct, thread.s[2]); 30 OFFSET(TASK_THREAD_S3, task_struct, thread.s[3]); 31 OFFSET(TASK_THREAD_S4, task_struct, thread.s[4]); 32 OFFSET(TASK_THREAD_S5, task_struct, thread.s[5]); 33 OFFSET(TASK_THREAD_S6, task_struct, thread.s[6]); 34 OFFSET(TASK_THREAD_S7, task_struct, thread.s[7]); 35 OFFSET(TASK_THREAD_S8, task_struct, thread.s[8]); 36 OFFSET(TASK_THREAD_S9, task_struct, thread.s[9]); 37 OFFSET(TASK_THREAD_S10, task_struct, thread.s[10]); 38 OFFSET(TASK_THREAD_S11, task_struct, thread.s[11]); 39 40 OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu); 41 OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags); 42 OFFSET(TASK_TI_PREEMPT_COUNT, task_struct, thread_info.preempt_count); 43 OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp); 44 OFFSET(TASK_TI_USER_SP, task_struct, thread_info.user_sp); 45 #ifdef CONFIG_SHADOW_CALL_STACK 46 OFFSET(TASK_TI_SCS_SP, task_struct, thread_info.scs_sp); 47 #endif 48 #ifdef CONFIG_64BIT 49 OFFSET(TASK_TI_A0, task_struct, thread_info.a0); 50 OFFSET(TASK_TI_A1, task_struct, thread_info.a1); 51 OFFSET(TASK_TI_A2, task_struct, thread_info.a2); 52 #endif 53 54 OFFSET(TASK_TI_CPU_NUM, task_struct, thread_info.cpu); 55 OFFSET(TASK_THREAD_F0, task_struct, thread.fstate.f[0]); 56 OFFSET(TASK_THREAD_F1, task_struct, thread.fstate.f[1]); 57 OFFSET(TASK_THREAD_F2, task_struct, thread.fstate.f[2]); 58 OFFSET(TASK_THREAD_F3, task_struct, thread.fstate.f[3]); 59 OFFSET(TASK_THREAD_F4, task_struct, thread.fstate.f[4]); 60 OFFSET(TASK_THREAD_F5, task_struct, thread.fstate.f[5]); 61 OFFSET(TASK_THREAD_F6, task_struct, thread.fstate.f[6]); 62 OFFSET(TASK_THREAD_F7, task_struct, thread.fstate.f[7]); 63 OFFSET(TASK_THREAD_F8, task_struct, thread.fstate.f[8]); 64 OFFSET(TASK_THREAD_F9, task_struct, thread.fstate.f[9]); 65 OFFSET(TASK_THREAD_F10, task_struct, thread.fstate.f[10]); 66 OFFSET(TASK_THREAD_F11, task_struct, thread.fstate.f[11]); 67 OFFSET(TASK_THREAD_F12, task_struct, thread.fstate.f[12]); 68 OFFSET(TASK_THREAD_F13, task_struct, thread.fstate.f[13]); 69 OFFSET(TASK_THREAD_F14, task_struct, thread.fstate.f[14]); 70 OFFSET(TASK_THREAD_F15, task_struct, thread.fstate.f[15]); 71 OFFSET(TASK_THREAD_F16, task_struct, thread.fstate.f[16]); 72 OFFSET(TASK_THREAD_F17, task_struct, thread.fstate.f[17]); 73 OFFSET(TASK_THREAD_F18, task_struct, thread.fstate.f[18]); 74 OFFSET(TASK_THREAD_F19, task_struct, thread.fstate.f[19]); 75 OFFSET(TASK_THREAD_F20, task_struct, thread.fstate.f[20]); 76 OFFSET(TASK_THREAD_F21, task_struct, thread.fstate.f[21]); 77 OFFSET(TASK_THREAD_F22, task_struct, thread.fstate.f[22]); 78 OFFSET(TASK_THREAD_F23, task_struct, thread.fstate.f[23]); 79 OFFSET(TASK_THREAD_F24, task_struct, thread.fstate.f[24]); 80 OFFSET(TASK_THREAD_F25, task_struct, thread.fstate.f[25]); 81 OFFSET(TASK_THREAD_F26, task_struct, thread.fstate.f[26]); 82 OFFSET(TASK_THREAD_F27, task_struct, thread.fstate.f[27]); 83 OFFSET(TASK_THREAD_F28, task_struct, thread.fstate.f[28]); 84 OFFSET(TASK_THREAD_F29, task_struct, thread.fstate.f[29]); 85 OFFSET(TASK_THREAD_F30, task_struct, thread.fstate.f[30]); 86 OFFSET(TASK_THREAD_F31, task_struct, thread.fstate.f[31]); 87 OFFSET(TASK_THREAD_FCSR, task_struct, thread.fstate.fcsr); 88 #ifdef CONFIG_STACKPROTECTOR 89 OFFSET(TSK_STACK_CANARY, task_struct, stack_canary); 90 #endif 91 92 DEFINE(PT_SIZE, sizeof(struct pt_regs)); 93 OFFSET(PT_EPC, pt_regs, epc); 94 OFFSET(PT_RA, pt_regs, ra); 95 OFFSET(PT_FP, pt_regs, s0); 96 OFFSET(PT_S0, pt_regs, s0); 97 OFFSET(PT_S1, pt_regs, s1); 98 OFFSET(PT_S2, pt_regs, s2); 99 OFFSET(PT_S3, pt_regs, s3); 100 OFFSET(PT_S4, pt_regs, s4); 101 OFFSET(PT_S5, pt_regs, s5); 102 OFFSET(PT_S6, pt_regs, s6); 103 OFFSET(PT_S7, pt_regs, s7); 104 OFFSET(PT_S8, pt_regs, s8); 105 OFFSET(PT_S9, pt_regs, s9); 106 OFFSET(PT_S10, pt_regs, s10); 107 OFFSET(PT_S11, pt_regs, s11); 108 OFFSET(PT_SP, pt_regs, sp); 109 OFFSET(PT_TP, pt_regs, tp); 110 OFFSET(PT_A0, pt_regs, a0); 111 OFFSET(PT_A1, pt_regs, a1); 112 OFFSET(PT_A2, pt_regs, a2); 113 OFFSET(PT_A3, pt_regs, a3); 114 OFFSET(PT_A4, pt_regs, a4); 115 OFFSET(PT_A5, pt_regs, a5); 116 OFFSET(PT_A6, pt_regs, a6); 117 OFFSET(PT_A7, pt_regs, a7); 118 OFFSET(PT_T0, pt_regs, t0); 119 OFFSET(PT_T1, pt_regs, t1); 120 OFFSET(PT_T2, pt_regs, t2); 121 OFFSET(PT_T3, pt_regs, t3); 122 OFFSET(PT_T4, pt_regs, t4); 123 OFFSET(PT_T5, pt_regs, t5); 124 OFFSET(PT_T6, pt_regs, t6); 125 OFFSET(PT_GP, pt_regs, gp); 126 OFFSET(PT_ORIG_A0, pt_regs, orig_a0); 127 OFFSET(PT_STATUS, pt_regs, status); 128 OFFSET(PT_BADADDR, pt_regs, badaddr); 129 OFFSET(PT_CAUSE, pt_regs, cause); 130 131 OFFSET(SUSPEND_CONTEXT_REGS, suspend_context, regs); 132 133 OFFSET(HIBERN_PBE_ADDR, pbe, address); 134 OFFSET(HIBERN_PBE_ORIG, pbe, orig_address); 135 OFFSET(HIBERN_PBE_NEXT, pbe, next); 136 137 OFFSET(KVM_ARCH_GUEST_ZERO, kvm_vcpu_arch, guest_context.zero); 138 OFFSET(KVM_ARCH_GUEST_RA, kvm_vcpu_arch, guest_context.ra); 139 OFFSET(KVM_ARCH_GUEST_SP, kvm_vcpu_arch, guest_context.sp); 140 OFFSET(KVM_ARCH_GUEST_GP, kvm_vcpu_arch, guest_context.gp); 141 OFFSET(KVM_ARCH_GUEST_TP, kvm_vcpu_arch, guest_context.tp); 142 OFFSET(KVM_ARCH_GUEST_T0, kvm_vcpu_arch, guest_context.t0); 143 OFFSET(KVM_ARCH_GUEST_T1, kvm_vcpu_arch, guest_context.t1); 144 OFFSET(KVM_ARCH_GUEST_T2, kvm_vcpu_arch, guest_context.t2); 145 OFFSET(KVM_ARCH_GUEST_S0, kvm_vcpu_arch, guest_context.s0); 146 OFFSET(KVM_ARCH_GUEST_S1, kvm_vcpu_arch, guest_context.s1); 147 OFFSET(KVM_ARCH_GUEST_A0, kvm_vcpu_arch, guest_context.a0); 148 OFFSET(KVM_ARCH_GUEST_A1, kvm_vcpu_arch, guest_context.a1); 149 OFFSET(KVM_ARCH_GUEST_A2, kvm_vcpu_arch, guest_context.a2); 150 OFFSET(KVM_ARCH_GUEST_A3, kvm_vcpu_arch, guest_context.a3); 151 OFFSET(KVM_ARCH_GUEST_A4, kvm_vcpu_arch, guest_context.a4); 152 OFFSET(KVM_ARCH_GUEST_A5, kvm_vcpu_arch, guest_context.a5); 153 OFFSET(KVM_ARCH_GUEST_A6, kvm_vcpu_arch, guest_context.a6); 154 OFFSET(KVM_ARCH_GUEST_A7, kvm_vcpu_arch, guest_context.a7); 155 OFFSET(KVM_ARCH_GUEST_S2, kvm_vcpu_arch, guest_context.s2); 156 OFFSET(KVM_ARCH_GUEST_S3, kvm_vcpu_arch, guest_context.s3); 157 OFFSET(KVM_ARCH_GUEST_S4, kvm_vcpu_arch, guest_context.s4); 158 OFFSET(KVM_ARCH_GUEST_S5, kvm_vcpu_arch, guest_context.s5); 159 OFFSET(KVM_ARCH_GUEST_S6, kvm_vcpu_arch, guest_context.s6); 160 OFFSET(KVM_ARCH_GUEST_S7, kvm_vcpu_arch, guest_context.s7); 161 OFFSET(KVM_ARCH_GUEST_S8, kvm_vcpu_arch, guest_context.s8); 162 OFFSET(KVM_ARCH_GUEST_S9, kvm_vcpu_arch, guest_context.s9); 163 OFFSET(KVM_ARCH_GUEST_S10, kvm_vcpu_arch, guest_context.s10); 164 OFFSET(KVM_ARCH_GUEST_S11, kvm_vcpu_arch, guest_context.s11); 165 OFFSET(KVM_ARCH_GUEST_T3, kvm_vcpu_arch, guest_context.t3); 166 OFFSET(KVM_ARCH_GUEST_T4, kvm_vcpu_arch, guest_context.t4); 167 OFFSET(KVM_ARCH_GUEST_T5, kvm_vcpu_arch, guest_context.t5); 168 OFFSET(KVM_ARCH_GUEST_T6, kvm_vcpu_arch, guest_context.t6); 169 OFFSET(KVM_ARCH_GUEST_SEPC, kvm_vcpu_arch, guest_context.sepc); 170 OFFSET(KVM_ARCH_GUEST_SSTATUS, kvm_vcpu_arch, guest_context.sstatus); 171 OFFSET(KVM_ARCH_GUEST_HSTATUS, kvm_vcpu_arch, guest_context.hstatus); 172 OFFSET(KVM_ARCH_GUEST_SCOUNTEREN, kvm_vcpu_arch, guest_csr.scounteren); 173 174 OFFSET(KVM_ARCH_HOST_ZERO, kvm_vcpu_arch, host_context.zero); 175 OFFSET(KVM_ARCH_HOST_RA, kvm_vcpu_arch, host_context.ra); 176 OFFSET(KVM_ARCH_HOST_SP, kvm_vcpu_arch, host_context.sp); 177 OFFSET(KVM_ARCH_HOST_GP, kvm_vcpu_arch, host_context.gp); 178 OFFSET(KVM_ARCH_HOST_TP, kvm_vcpu_arch, host_context.tp); 179 OFFSET(KVM_ARCH_HOST_T0, kvm_vcpu_arch, host_context.t0); 180 OFFSET(KVM_ARCH_HOST_T1, kvm_vcpu_arch, host_context.t1); 181 OFFSET(KVM_ARCH_HOST_T2, kvm_vcpu_arch, host_context.t2); 182 OFFSET(KVM_ARCH_HOST_S0, kvm_vcpu_arch, host_context.s0); 183 OFFSET(KVM_ARCH_HOST_S1, kvm_vcpu_arch, host_context.s1); 184 OFFSET(KVM_ARCH_HOST_A0, kvm_vcpu_arch, host_context.a0); 185 OFFSET(KVM_ARCH_HOST_A1, kvm_vcpu_arch, host_context.a1); 186 OFFSET(KVM_ARCH_HOST_A2, kvm_vcpu_arch, host_context.a2); 187 OFFSET(KVM_ARCH_HOST_A3, kvm_vcpu_arch, host_context.a3); 188 OFFSET(KVM_ARCH_HOST_A4, kvm_vcpu_arch, host_context.a4); 189 OFFSET(KVM_ARCH_HOST_A5, kvm_vcpu_arch, host_context.a5); 190 OFFSET(KVM_ARCH_HOST_A6, kvm_vcpu_arch, host_context.a6); 191 OFFSET(KVM_ARCH_HOST_A7, kvm_vcpu_arch, host_context.a7); 192 OFFSET(KVM_ARCH_HOST_S2, kvm_vcpu_arch, host_context.s2); 193 OFFSET(KVM_ARCH_HOST_S3, kvm_vcpu_arch, host_context.s3); 194 OFFSET(KVM_ARCH_HOST_S4, kvm_vcpu_arch, host_context.s4); 195 OFFSET(KVM_ARCH_HOST_S5, kvm_vcpu_arch, host_context.s5); 196 OFFSET(KVM_ARCH_HOST_S6, kvm_vcpu_arch, host_context.s6); 197 OFFSET(KVM_ARCH_HOST_S7, kvm_vcpu_arch, host_context.s7); 198 OFFSET(KVM_ARCH_HOST_S8, kvm_vcpu_arch, host_context.s8); 199 OFFSET(KVM_ARCH_HOST_S9, kvm_vcpu_arch, host_context.s9); 200 OFFSET(KVM_ARCH_HOST_S10, kvm_vcpu_arch, host_context.s10); 201 OFFSET(KVM_ARCH_HOST_S11, kvm_vcpu_arch, host_context.s11); 202 OFFSET(KVM_ARCH_HOST_T3, kvm_vcpu_arch, host_context.t3); 203 OFFSET(KVM_ARCH_HOST_T4, kvm_vcpu_arch, host_context.t4); 204 OFFSET(KVM_ARCH_HOST_T5, kvm_vcpu_arch, host_context.t5); 205 OFFSET(KVM_ARCH_HOST_T6, kvm_vcpu_arch, host_context.t6); 206 OFFSET(KVM_ARCH_HOST_SEPC, kvm_vcpu_arch, host_context.sepc); 207 OFFSET(KVM_ARCH_HOST_SSTATUS, kvm_vcpu_arch, host_context.sstatus); 208 OFFSET(KVM_ARCH_HOST_HSTATUS, kvm_vcpu_arch, host_context.hstatus); 209 OFFSET(KVM_ARCH_HOST_SSCRATCH, kvm_vcpu_arch, host_sscratch); 210 OFFSET(KVM_ARCH_HOST_STVEC, kvm_vcpu_arch, host_stvec); 211 OFFSET(KVM_ARCH_HOST_SCOUNTEREN, kvm_vcpu_arch, host_scounteren); 212 213 OFFSET(KVM_ARCH_TRAP_SEPC, kvm_cpu_trap, sepc); 214 OFFSET(KVM_ARCH_TRAP_SCAUSE, kvm_cpu_trap, scause); 215 OFFSET(KVM_ARCH_TRAP_STVAL, kvm_cpu_trap, stval); 216 OFFSET(KVM_ARCH_TRAP_HTVAL, kvm_cpu_trap, htval); 217 OFFSET(KVM_ARCH_TRAP_HTINST, kvm_cpu_trap, htinst); 218 219 /* F extension */ 220 221 OFFSET(KVM_ARCH_FP_F_F0, kvm_cpu_context, fp.f.f[0]); 222 OFFSET(KVM_ARCH_FP_F_F1, kvm_cpu_context, fp.f.f[1]); 223 OFFSET(KVM_ARCH_FP_F_F2, kvm_cpu_context, fp.f.f[2]); 224 OFFSET(KVM_ARCH_FP_F_F3, kvm_cpu_context, fp.f.f[3]); 225 OFFSET(KVM_ARCH_FP_F_F4, kvm_cpu_context, fp.f.f[4]); 226 OFFSET(KVM_ARCH_FP_F_F5, kvm_cpu_context, fp.f.f[5]); 227 OFFSET(KVM_ARCH_FP_F_F6, kvm_cpu_context, fp.f.f[6]); 228 OFFSET(KVM_ARCH_FP_F_F7, kvm_cpu_context, fp.f.f[7]); 229 OFFSET(KVM_ARCH_FP_F_F8, kvm_cpu_context, fp.f.f[8]); 230 OFFSET(KVM_ARCH_FP_F_F9, kvm_cpu_context, fp.f.f[9]); 231 OFFSET(KVM_ARCH_FP_F_F10, kvm_cpu_context, fp.f.f[10]); 232 OFFSET(KVM_ARCH_FP_F_F11, kvm_cpu_context, fp.f.f[11]); 233 OFFSET(KVM_ARCH_FP_F_F12, kvm_cpu_context, fp.f.f[12]); 234 OFFSET(KVM_ARCH_FP_F_F13, kvm_cpu_context, fp.f.f[13]); 235 OFFSET(KVM_ARCH_FP_F_F14, kvm_cpu_context, fp.f.f[14]); 236 OFFSET(KVM_ARCH_FP_F_F15, kvm_cpu_context, fp.f.f[15]); 237 OFFSET(KVM_ARCH_FP_F_F16, kvm_cpu_context, fp.f.f[16]); 238 OFFSET(KVM_ARCH_FP_F_F17, kvm_cpu_context, fp.f.f[17]); 239 OFFSET(KVM_ARCH_FP_F_F18, kvm_cpu_context, fp.f.f[18]); 240 OFFSET(KVM_ARCH_FP_F_F19, kvm_cpu_context, fp.f.f[19]); 241 OFFSET(KVM_ARCH_FP_F_F20, kvm_cpu_context, fp.f.f[20]); 242 OFFSET(KVM_ARCH_FP_F_F21, kvm_cpu_context, fp.f.f[21]); 243 OFFSET(KVM_ARCH_FP_F_F22, kvm_cpu_context, fp.f.f[22]); 244 OFFSET(KVM_ARCH_FP_F_F23, kvm_cpu_context, fp.f.f[23]); 245 OFFSET(KVM_ARCH_FP_F_F24, kvm_cpu_context, fp.f.f[24]); 246 OFFSET(KVM_ARCH_FP_F_F25, kvm_cpu_context, fp.f.f[25]); 247 OFFSET(KVM_ARCH_FP_F_F26, kvm_cpu_context, fp.f.f[26]); 248 OFFSET(KVM_ARCH_FP_F_F27, kvm_cpu_context, fp.f.f[27]); 249 OFFSET(KVM_ARCH_FP_F_F28, kvm_cpu_context, fp.f.f[28]); 250 OFFSET(KVM_ARCH_FP_F_F29, kvm_cpu_context, fp.f.f[29]); 251 OFFSET(KVM_ARCH_FP_F_F30, kvm_cpu_context, fp.f.f[30]); 252 OFFSET(KVM_ARCH_FP_F_F31, kvm_cpu_context, fp.f.f[31]); 253 OFFSET(KVM_ARCH_FP_F_FCSR, kvm_cpu_context, fp.f.fcsr); 254 255 /* D extension */ 256 257 OFFSET(KVM_ARCH_FP_D_F0, kvm_cpu_context, fp.d.f[0]); 258 OFFSET(KVM_ARCH_FP_D_F1, kvm_cpu_context, fp.d.f[1]); 259 OFFSET(KVM_ARCH_FP_D_F2, kvm_cpu_context, fp.d.f[2]); 260 OFFSET(KVM_ARCH_FP_D_F3, kvm_cpu_context, fp.d.f[3]); 261 OFFSET(KVM_ARCH_FP_D_F4, kvm_cpu_context, fp.d.f[4]); 262 OFFSET(KVM_ARCH_FP_D_F5, kvm_cpu_context, fp.d.f[5]); 263 OFFSET(KVM_ARCH_FP_D_F6, kvm_cpu_context, fp.d.f[6]); 264 OFFSET(KVM_ARCH_FP_D_F7, kvm_cpu_context, fp.d.f[7]); 265 OFFSET(KVM_ARCH_FP_D_F8, kvm_cpu_context, fp.d.f[8]); 266 OFFSET(KVM_ARCH_FP_D_F9, kvm_cpu_context, fp.d.f[9]); 267 OFFSET(KVM_ARCH_FP_D_F10, kvm_cpu_context, fp.d.f[10]); 268 OFFSET(KVM_ARCH_FP_D_F11, kvm_cpu_context, fp.d.f[11]); 269 OFFSET(KVM_ARCH_FP_D_F12, kvm_cpu_context, fp.d.f[12]); 270 OFFSET(KVM_ARCH_FP_D_F13, kvm_cpu_context, fp.d.f[13]); 271 OFFSET(KVM_ARCH_FP_D_F14, kvm_cpu_context, fp.d.f[14]); 272 OFFSET(KVM_ARCH_FP_D_F15, kvm_cpu_context, fp.d.f[15]); 273 OFFSET(KVM_ARCH_FP_D_F16, kvm_cpu_context, fp.d.f[16]); 274 OFFSET(KVM_ARCH_FP_D_F17, kvm_cpu_context, fp.d.f[17]); 275 OFFSET(KVM_ARCH_FP_D_F18, kvm_cpu_context, fp.d.f[18]); 276 OFFSET(KVM_ARCH_FP_D_F19, kvm_cpu_context, fp.d.f[19]); 277 OFFSET(KVM_ARCH_FP_D_F20, kvm_cpu_context, fp.d.f[20]); 278 OFFSET(KVM_ARCH_FP_D_F21, kvm_cpu_context, fp.d.f[21]); 279 OFFSET(KVM_ARCH_FP_D_F22, kvm_cpu_context, fp.d.f[22]); 280 OFFSET(KVM_ARCH_FP_D_F23, kvm_cpu_context, fp.d.f[23]); 281 OFFSET(KVM_ARCH_FP_D_F24, kvm_cpu_context, fp.d.f[24]); 282 OFFSET(KVM_ARCH_FP_D_F25, kvm_cpu_context, fp.d.f[25]); 283 OFFSET(KVM_ARCH_FP_D_F26, kvm_cpu_context, fp.d.f[26]); 284 OFFSET(KVM_ARCH_FP_D_F27, kvm_cpu_context, fp.d.f[27]); 285 OFFSET(KVM_ARCH_FP_D_F28, kvm_cpu_context, fp.d.f[28]); 286 OFFSET(KVM_ARCH_FP_D_F29, kvm_cpu_context, fp.d.f[29]); 287 OFFSET(KVM_ARCH_FP_D_F30, kvm_cpu_context, fp.d.f[30]); 288 OFFSET(KVM_ARCH_FP_D_F31, kvm_cpu_context, fp.d.f[31]); 289 OFFSET(KVM_ARCH_FP_D_FCSR, kvm_cpu_context, fp.d.fcsr); 290 291 /* 292 * THREAD_{F,X}* might be larger than a S-type offset can handle, but 293 * these are used in performance-sensitive assembly so we can't resort 294 * to loading the long immediate every time. 295 */ 296 DEFINE(TASK_THREAD_RA_RA, 297 offsetof(struct task_struct, thread.ra) 298 - offsetof(struct task_struct, thread.ra) 299 ); 300 DEFINE(TASK_THREAD_SP_RA, 301 offsetof(struct task_struct, thread.sp) 302 - offsetof(struct task_struct, thread.ra) 303 ); 304 DEFINE(TASK_THREAD_S0_RA, 305 offsetof(struct task_struct, thread.s[0]) 306 - offsetof(struct task_struct, thread.ra) 307 ); 308 DEFINE(TASK_THREAD_S1_RA, 309 offsetof(struct task_struct, thread.s[1]) 310 - offsetof(struct task_struct, thread.ra) 311 ); 312 DEFINE(TASK_THREAD_S2_RA, 313 offsetof(struct task_struct, thread.s[2]) 314 - offsetof(struct task_struct, thread.ra) 315 ); 316 DEFINE(TASK_THREAD_S3_RA, 317 offsetof(struct task_struct, thread.s[3]) 318 - offsetof(struct task_struct, thread.ra) 319 ); 320 DEFINE(TASK_THREAD_S4_RA, 321 offsetof(struct task_struct, thread.s[4]) 322 - offsetof(struct task_struct, thread.ra) 323 ); 324 DEFINE(TASK_THREAD_S5_RA, 325 offsetof(struct task_struct, thread.s[5]) 326 - offsetof(struct task_struct, thread.ra) 327 ); 328 DEFINE(TASK_THREAD_S6_RA, 329 offsetof(struct task_struct, thread.s[6]) 330 - offsetof(struct task_struct, thread.ra) 331 ); 332 DEFINE(TASK_THREAD_S7_RA, 333 offsetof(struct task_struct, thread.s[7]) 334 - offsetof(struct task_struct, thread.ra) 335 ); 336 DEFINE(TASK_THREAD_S8_RA, 337 offsetof(struct task_struct, thread.s[8]) 338 - offsetof(struct task_struct, thread.ra) 339 ); 340 DEFINE(TASK_THREAD_S9_RA, 341 offsetof(struct task_struct, thread.s[9]) 342 - offsetof(struct task_struct, thread.ra) 343 ); 344 DEFINE(TASK_THREAD_S10_RA, 345 offsetof(struct task_struct, thread.s[10]) 346 - offsetof(struct task_struct, thread.ra) 347 ); 348 DEFINE(TASK_THREAD_S11_RA, 349 offsetof(struct task_struct, thread.s[11]) 350 - offsetof(struct task_struct, thread.ra) 351 ); 352 353 DEFINE(TASK_THREAD_F0_F0, 354 offsetof(struct task_struct, thread.fstate.f[0]) 355 - offsetof(struct task_struct, thread.fstate.f[0]) 356 ); 357 DEFINE(TASK_THREAD_F1_F0, 358 offsetof(struct task_struct, thread.fstate.f[1]) 359 - offsetof(struct task_struct, thread.fstate.f[0]) 360 ); 361 DEFINE(TASK_THREAD_F2_F0, 362 offsetof(struct task_struct, thread.fstate.f[2]) 363 - offsetof(struct task_struct, thread.fstate.f[0]) 364 ); 365 DEFINE(TASK_THREAD_F3_F0, 366 offsetof(struct task_struct, thread.fstate.f[3]) 367 - offsetof(struct task_struct, thread.fstate.f[0]) 368 ); 369 DEFINE(TASK_THREAD_F4_F0, 370 offsetof(struct task_struct, thread.fstate.f[4]) 371 - offsetof(struct task_struct, thread.fstate.f[0]) 372 ); 373 DEFINE(TASK_THREAD_F5_F0, 374 offsetof(struct task_struct, thread.fstate.f[5]) 375 - offsetof(struct task_struct, thread.fstate.f[0]) 376 ); 377 DEFINE(TASK_THREAD_F6_F0, 378 offsetof(struct task_struct, thread.fstate.f[6]) 379 - offsetof(struct task_struct, thread.fstate.f[0]) 380 ); 381 DEFINE(TASK_THREAD_F7_F0, 382 offsetof(struct task_struct, thread.fstate.f[7]) 383 - offsetof(struct task_struct, thread.fstate.f[0]) 384 ); 385 DEFINE(TASK_THREAD_F8_F0, 386 offsetof(struct task_struct, thread.fstate.f[8]) 387 - offsetof(struct task_struct, thread.fstate.f[0]) 388 ); 389 DEFINE(TASK_THREAD_F9_F0, 390 offsetof(struct task_struct, thread.fstate.f[9]) 391 - offsetof(struct task_struct, thread.fstate.f[0]) 392 ); 393 DEFINE(TASK_THREAD_F10_F0, 394 offsetof(struct task_struct, thread.fstate.f[10]) 395 - offsetof(struct task_struct, thread.fstate.f[0]) 396 ); 397 DEFINE(TASK_THREAD_F11_F0, 398 offsetof(struct task_struct, thread.fstate.f[11]) 399 - offsetof(struct task_struct, thread.fstate.f[0]) 400 ); 401 DEFINE(TASK_THREAD_F12_F0, 402 offsetof(struct task_struct, thread.fstate.f[12]) 403 - offsetof(struct task_struct, thread.fstate.f[0]) 404 ); 405 DEFINE(TASK_THREAD_F13_F0, 406 offsetof(struct task_struct, thread.fstate.f[13]) 407 - offsetof(struct task_struct, thread.fstate.f[0]) 408 ); 409 DEFINE(TASK_THREAD_F14_F0, 410 offsetof(struct task_struct, thread.fstate.f[14]) 411 - offsetof(struct task_struct, thread.fstate.f[0]) 412 ); 413 DEFINE(TASK_THREAD_F15_F0, 414 offsetof(struct task_struct, thread.fstate.f[15]) 415 - offsetof(struct task_struct, thread.fstate.f[0]) 416 ); 417 DEFINE(TASK_THREAD_F16_F0, 418 offsetof(struct task_struct, thread.fstate.f[16]) 419 - offsetof(struct task_struct, thread.fstate.f[0]) 420 ); 421 DEFINE(TASK_THREAD_F17_F0, 422 offsetof(struct task_struct, thread.fstate.f[17]) 423 - offsetof(struct task_struct, thread.fstate.f[0]) 424 ); 425 DEFINE(TASK_THREAD_F18_F0, 426 offsetof(struct task_struct, thread.fstate.f[18]) 427 - offsetof(struct task_struct, thread.fstate.f[0]) 428 ); 429 DEFINE(TASK_THREAD_F19_F0, 430 offsetof(struct task_struct, thread.fstate.f[19]) 431 - offsetof(struct task_struct, thread.fstate.f[0]) 432 ); 433 DEFINE(TASK_THREAD_F20_F0, 434 offsetof(struct task_struct, thread.fstate.f[20]) 435 - offsetof(struct task_struct, thread.fstate.f[0]) 436 ); 437 DEFINE(TASK_THREAD_F21_F0, 438 offsetof(struct task_struct, thread.fstate.f[21]) 439 - offsetof(struct task_struct, thread.fstate.f[0]) 440 ); 441 DEFINE(TASK_THREAD_F22_F0, 442 offsetof(struct task_struct, thread.fstate.f[22]) 443 - offsetof(struct task_struct, thread.fstate.f[0]) 444 ); 445 DEFINE(TASK_THREAD_F23_F0, 446 offsetof(struct task_struct, thread.fstate.f[23]) 447 - offsetof(struct task_struct, thread.fstate.f[0]) 448 ); 449 DEFINE(TASK_THREAD_F24_F0, 450 offsetof(struct task_struct, thread.fstate.f[24]) 451 - offsetof(struct task_struct, thread.fstate.f[0]) 452 ); 453 DEFINE(TASK_THREAD_F25_F0, 454 offsetof(struct task_struct, thread.fstate.f[25]) 455 - offsetof(struct task_struct, thread.fstate.f[0]) 456 ); 457 DEFINE(TASK_THREAD_F26_F0, 458 offsetof(struct task_struct, thread.fstate.f[26]) 459 - offsetof(struct task_struct, thread.fstate.f[0]) 460 ); 461 DEFINE(TASK_THREAD_F27_F0, 462 offsetof(struct task_struct, thread.fstate.f[27]) 463 - offsetof(struct task_struct, thread.fstate.f[0]) 464 ); 465 DEFINE(TASK_THREAD_F28_F0, 466 offsetof(struct task_struct, thread.fstate.f[28]) 467 - offsetof(struct task_struct, thread.fstate.f[0]) 468 ); 469 DEFINE(TASK_THREAD_F29_F0, 470 offsetof(struct task_struct, thread.fstate.f[29]) 471 - offsetof(struct task_struct, thread.fstate.f[0]) 472 ); 473 DEFINE(TASK_THREAD_F30_F0, 474 offsetof(struct task_struct, thread.fstate.f[30]) 475 - offsetof(struct task_struct, thread.fstate.f[0]) 476 ); 477 DEFINE(TASK_THREAD_F31_F0, 478 offsetof(struct task_struct, thread.fstate.f[31]) 479 - offsetof(struct task_struct, thread.fstate.f[0]) 480 ); 481 DEFINE(TASK_THREAD_FCSR_F0, 482 offsetof(struct task_struct, thread.fstate.fcsr) 483 - offsetof(struct task_struct, thread.fstate.f[0]) 484 ); 485 486 /* 487 * We allocate a pt_regs on the stack when entering the kernel. This 488 * ensures the alignment is sane. 489 */ 490 DEFINE(PT_SIZE_ON_STACK, ALIGN(sizeof(struct pt_regs), STACK_ALIGN)); 491 492 OFFSET(KERNEL_MAP_VIRT_ADDR, kernel_mapping, virt_addr); 493 OFFSET(SBI_HART_BOOT_TASK_PTR_OFFSET, sbi_hart_boot_data, task_ptr); 494 OFFSET(SBI_HART_BOOT_STACK_PTR_OFFSET, sbi_hart_boot_data, stack_ptr); 495 496 DEFINE(STACKFRAME_SIZE_ON_STACK, ALIGN(sizeof(struct stackframe), STACK_ALIGN)); 497 OFFSET(STACKFRAME_FP, stackframe, fp); 498 OFFSET(STACKFRAME_RA, stackframe, ra); 499 500 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_ARGS 501 DEFINE(FREGS_SIZE_ON_STACK, ALIGN(sizeof(struct ftrace_regs), STACK_ALIGN)); 502 DEFINE(FREGS_EPC, offsetof(struct ftrace_regs, epc)); 503 DEFINE(FREGS_RA, offsetof(struct ftrace_regs, ra)); 504 DEFINE(FREGS_SP, offsetof(struct ftrace_regs, sp)); 505 DEFINE(FREGS_S0, offsetof(struct ftrace_regs, s0)); 506 DEFINE(FREGS_T1, offsetof(struct ftrace_regs, t1)); 507 DEFINE(FREGS_A0, offsetof(struct ftrace_regs, a0)); 508 DEFINE(FREGS_A1, offsetof(struct ftrace_regs, a1)); 509 DEFINE(FREGS_A2, offsetof(struct ftrace_regs, a2)); 510 DEFINE(FREGS_A3, offsetof(struct ftrace_regs, a3)); 511 DEFINE(FREGS_A4, offsetof(struct ftrace_regs, a4)); 512 DEFINE(FREGS_A5, offsetof(struct ftrace_regs, a5)); 513 DEFINE(FREGS_A6, offsetof(struct ftrace_regs, a6)); 514 DEFINE(FREGS_A7, offsetof(struct ftrace_regs, a7)); 515 #endif 516 } 517