lowcore.h 6.3 KB

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