lowcore.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright IBM Corp. 1999, 2012
  4. * Author(s): Hartmut Penner <hp@de.ibm.com>,
  5. * Martin Schwidefsky <schwidefsky@de.ibm.com>,
  6. * Denis Joseph Barrow,
  7. */
  8. #ifndef _ASM_S390_LOWCORE_H
  9. #define _ASM_S390_LOWCORE_H
  10. #include <linux/types.h>
  11. #include <asm/ptrace.h>
  12. #include <asm/cpu.h>
  13. #include <asm/types.h>
  14. #define LC_ORDER 1
  15. #define LC_PAGES 2
  16. struct lowcore {
  17. __u8 pad_0x0000[0x0014-0x0000]; /* 0x0000 */
  18. __u32 ipl_parmblock_ptr; /* 0x0014 */
  19. __u8 pad_0x0018[0x0080-0x0018]; /* 0x0018 */
  20. __u32 ext_params; /* 0x0080 */
  21. __u16 ext_cpu_addr; /* 0x0084 */
  22. __u16 ext_int_code; /* 0x0086 */
  23. __u16 svc_ilc; /* 0x0088 */
  24. __u16 svc_code; /* 0x008a */
  25. __u16 pgm_ilc; /* 0x008c */
  26. __u16 pgm_code; /* 0x008e */
  27. __u32 data_exc_code; /* 0x0090 */
  28. __u16 mon_class_num; /* 0x0094 */
  29. __u8 per_code; /* 0x0096 */
  30. __u8 per_atmid; /* 0x0097 */
  31. __u64 per_address; /* 0x0098 */
  32. __u8 exc_access_id; /* 0x00a0 */
  33. __u8 per_access_id; /* 0x00a1 */
  34. __u8 op_access_id; /* 0x00a2 */
  35. __u8 ar_mode_id; /* 0x00a3 */
  36. __u8 pad_0x00a4[0x00a8-0x00a4]; /* 0x00a4 */
  37. __u64 trans_exc_code; /* 0x00a8 */
  38. __u64 monitor_code; /* 0x00b0 */
  39. __u16 subchannel_id; /* 0x00b8 */
  40. __u16 subchannel_nr; /* 0x00ba */
  41. __u32 io_int_parm; /* 0x00bc */
  42. __u32 io_int_word; /* 0x00c0 */
  43. __u8 pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */
  44. __u32 stfl_fac_list; /* 0x00c8 */
  45. __u8 pad_0x00cc[0x00e8-0x00cc]; /* 0x00cc */
  46. __u64 mcck_interruption_code; /* 0x00e8 */
  47. __u8 pad_0x00f0[0x00f4-0x00f0]; /* 0x00f0 */
  48. __u32 external_damage_code; /* 0x00f4 */
  49. __u64 failing_storage_address; /* 0x00f8 */
  50. __u8 pad_0x0100[0x0110-0x0100]; /* 0x0100 */
  51. __u64 breaking_event_addr; /* 0x0110 */
  52. __u8 pad_0x0118[0x0120-0x0118]; /* 0x0118 */
  53. psw_t restart_old_psw; /* 0x0120 */
  54. psw_t external_old_psw; /* 0x0130 */
  55. psw_t svc_old_psw; /* 0x0140 */
  56. psw_t program_old_psw; /* 0x0150 */
  57. psw_t mcck_old_psw; /* 0x0160 */
  58. psw_t io_old_psw; /* 0x0170 */
  59. __u8 pad_0x0180[0x01a0-0x0180]; /* 0x0180 */
  60. psw_t restart_psw; /* 0x01a0 */
  61. psw_t external_new_psw; /* 0x01b0 */
  62. psw_t svc_new_psw; /* 0x01c0 */
  63. psw_t program_new_psw; /* 0x01d0 */
  64. psw_t mcck_new_psw; /* 0x01e0 */
  65. psw_t io_new_psw; /* 0x01f0 */
  66. /* Save areas. */
  67. __u64 save_area_sync[8]; /* 0x0200 */
  68. __u64 save_area_async[8]; /* 0x0240 */
  69. __u64 save_area_restart[1]; /* 0x0280 */
  70. /* CPU flags. */
  71. __u64 cpu_flags; /* 0x0288 */
  72. /* Return psws. */
  73. psw_t return_psw; /* 0x0290 */
  74. psw_t return_mcck_psw; /* 0x02a0 */
  75. /* CPU accounting and timing values. */
  76. __u64 sync_enter_timer; /* 0x02b0 */
  77. __u64 async_enter_timer; /* 0x02b8 */
  78. __u64 mcck_enter_timer; /* 0x02c0 */
  79. __u64 exit_timer; /* 0x02c8 */
  80. __u64 user_timer; /* 0x02d0 */
  81. __u64 guest_timer; /* 0x02d8 */
  82. __u64 system_timer; /* 0x02e0 */
  83. __u64 hardirq_timer; /* 0x02e8 */
  84. __u64 softirq_timer; /* 0x02f0 */
  85. __u64 steal_timer; /* 0x02f8 */
  86. __u64 last_update_timer; /* 0x0300 */
  87. __u64 last_update_clock; /* 0x0308 */
  88. __u64 int_clock; /* 0x0310 */
  89. __u64 mcck_clock; /* 0x0318 */
  90. __u64 clock_comparator; /* 0x0320 */
  91. __u64 boot_clock[2]; /* 0x0328 */
  92. /* Current process. */
  93. __u64 current_task; /* 0x0338 */
  94. __u64 kernel_stack; /* 0x0340 */
  95. /* Interrupt, panic and restart stack. */
  96. __u64 async_stack; /* 0x0348 */
  97. __u64 panic_stack; /* 0x0350 */
  98. __u64 restart_stack; /* 0x0358 */
  99. /* Restart function and parameter. */
  100. __u64 restart_fn; /* 0x0360 */
  101. __u64 restart_data; /* 0x0368 */
  102. __u64 restart_source; /* 0x0370 */
  103. /* Address space pointer. */
  104. __u64 kernel_asce; /* 0x0378 */
  105. __u64 user_asce; /* 0x0380 */
  106. __u64 vdso_asce; /* 0x0388 */
  107. /*
  108. * The lpp and current_pid fields form a
  109. * 64-bit value that is set as program
  110. * parameter with the LPP instruction.
  111. */
  112. __u32 lpp; /* 0x0390 */
  113. __u32 current_pid; /* 0x0394 */
  114. /* SMP info area */
  115. __u32 cpu_nr; /* 0x0398 */
  116. __u32 softirq_pending; /* 0x039c */
  117. __u32 preempt_count; /* 0x03a0 */
  118. __u32 spinlock_lockval; /* 0x03a4 */
  119. __u32 spinlock_index; /* 0x03a8 */
  120. __u32 fpu_flags; /* 0x03ac */
  121. __u64 percpu_offset; /* 0x03b0 */
  122. __u64 vdso_per_cpu_data; /* 0x03b8 */
  123. __u64 machine_flags; /* 0x03c0 */
  124. __u64 gmap; /* 0x03c8 */
  125. __u8 pad_0x03d0[0x0400-0x03d0]; /* 0x03d0 */
  126. /* br %r1 trampoline */
  127. __u16 br_r1_trampoline; /* 0x0400 */
  128. __u8 pad_0x0402[0x0e00-0x0402]; /* 0x0402 */
  129. /*
  130. * 0xe00 contains the address of the IPL Parameter Information
  131. * block. Dump tools need IPIB for IPL after dump.
  132. * Note: do not change the position of any fields in 0x0e00-0x0f00
  133. */
  134. __u64 ipib; /* 0x0e00 */
  135. __u32 ipib_checksum; /* 0x0e08 */
  136. __u64 vmcore_info; /* 0x0e0c */
  137. __u8 pad_0x0e14[0x0e18-0x0e14]; /* 0x0e14 */
  138. __u64 os_info; /* 0x0e18 */
  139. __u8 pad_0x0e20[0x0f00-0x0e20]; /* 0x0e20 */
  140. /* Extended facility list */
  141. __u64 stfle_fac_list[16]; /* 0x0f00 */
  142. __u64 alt_stfle_fac_list[16]; /* 0x0f80 */
  143. __u8 pad_0x1000[0x11b0-0x1000]; /* 0x1000 */
  144. /* Pointer to the machine check extended save area */
  145. __u64 mcesad; /* 0x11b0 */
  146. /* 64 bit extparam used for pfault/diag 250: defined by architecture */
  147. __u64 ext_params2; /* 0x11B8 */
  148. __u8 pad_0x11c0[0x1200-0x11C0]; /* 0x11C0 */
  149. /* CPU register save area: defined by architecture */
  150. __u64 floating_pt_save_area[16]; /* 0x1200 */
  151. __u64 gpregs_save_area[16]; /* 0x1280 */
  152. psw_t psw_save_area; /* 0x1300 */
  153. __u8 pad_0x1310[0x1318-0x1310]; /* 0x1310 */
  154. __u32 prefixreg_save_area; /* 0x1318 */
  155. __u32 fpt_creg_save_area; /* 0x131c */
  156. __u8 pad_0x1320[0x1324-0x1320]; /* 0x1320 */
  157. __u32 tod_progreg_save_area; /* 0x1324 */
  158. __u32 cpu_timer_save_area[2]; /* 0x1328 */
  159. __u32 clock_comp_save_area[2]; /* 0x1330 */
  160. __u8 pad_0x1338[0x1340-0x1338]; /* 0x1338 */
  161. __u32 access_regs_save_area[16]; /* 0x1340 */
  162. __u64 cregs_save_area[16]; /* 0x1380 */
  163. __u8 pad_0x1400[0x1800-0x1400]; /* 0x1400 */
  164. /* Transaction abort diagnostic block */
  165. __u8 pgm_tdb[256]; /* 0x1800 */
  166. __u8 pad_0x1900[0x2000-0x1900]; /* 0x1900 */
  167. } __packed __aligned(8192);
  168. #define S390_lowcore (*((struct lowcore *) 0))
  169. extern struct lowcore *lowcore_ptr[];
  170. static inline void set_prefix(__u32 address)
  171. {
  172. asm volatile("spx %0" : : "Q" (address) : "memory");
  173. }
  174. static inline __u32 store_prefix(void)
  175. {
  176. __u32 address;
  177. asm volatile("stpx %0" : "=Q" (address));
  178. return address;
  179. }
  180. #endif /* _ASM_S390_LOWCORE_H */