lowcore.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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. #ifdef CONFIG_32BIT
  14. #define LC_ORDER 0
  15. #define LC_PAGES 1
  16. struct save_area {
  17. u32 ext_save;
  18. u64 timer;
  19. u64 clk_cmp;
  20. u8 pad1[24];
  21. u8 psw[8];
  22. u32 pref_reg;
  23. u8 pad2[20];
  24. u32 acc_regs[16];
  25. u64 fp_regs[4];
  26. u32 gp_regs[16];
  27. u32 ctrl_regs[16];
  28. } __packed;
  29. struct save_area_ext {
  30. struct save_area sa;
  31. __vector128 vx_regs[32];
  32. };
  33. struct _lowcore {
  34. psw_t restart_psw; /* 0x0000 */
  35. psw_t restart_old_psw; /* 0x0008 */
  36. __u8 pad_0x0010[0x0014-0x0010]; /* 0x0010 */
  37. __u32 ipl_parmblock_ptr; /* 0x0014 */
  38. psw_t external_old_psw; /* 0x0018 */
  39. psw_t svc_old_psw; /* 0x0020 */
  40. psw_t program_old_psw; /* 0x0028 */
  41. psw_t mcck_old_psw; /* 0x0030 */
  42. psw_t io_old_psw; /* 0x0038 */
  43. __u8 pad_0x0040[0x0058-0x0040]; /* 0x0040 */
  44. psw_t external_new_psw; /* 0x0058 */
  45. psw_t svc_new_psw; /* 0x0060 */
  46. psw_t program_new_psw; /* 0x0068 */
  47. psw_t mcck_new_psw; /* 0x0070 */
  48. psw_t io_new_psw; /* 0x0078 */
  49. __u32 ext_params; /* 0x0080 */
  50. __u16 ext_cpu_addr; /* 0x0084 */
  51. __u16 ext_int_code; /* 0x0086 */
  52. __u16 svc_ilc; /* 0x0088 */
  53. __u16 svc_code; /* 0x008a */
  54. __u16 pgm_ilc; /* 0x008c */
  55. __u16 pgm_code; /* 0x008e */
  56. __u32 trans_exc_code; /* 0x0090 */
  57. __u16 mon_class_num; /* 0x0094 */
  58. __u8 per_code; /* 0x0096 */
  59. __u8 per_atmid; /* 0x0097 */
  60. __u32 per_address; /* 0x0098 */
  61. __u32 monitor_code; /* 0x009c */
  62. __u8 exc_access_id; /* 0x00a0 */
  63. __u8 per_access_id; /* 0x00a1 */
  64. __u8 op_access_id; /* 0x00a2 */
  65. __u8 ar_mode_id; /* 0x00a3 */
  66. __u8 pad_0x00a4[0x00b8-0x00a4]; /* 0x00a4 */
  67. __u16 subchannel_id; /* 0x00b8 */
  68. __u16 subchannel_nr; /* 0x00ba */
  69. __u32 io_int_parm; /* 0x00bc */
  70. __u32 io_int_word; /* 0x00c0 */
  71. __u8 pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */
  72. __u32 stfl_fac_list; /* 0x00c8 */
  73. __u8 pad_0x00cc[0x00d4-0x00cc]; /* 0x00cc */
  74. __u32 extended_save_area_addr; /* 0x00d4 */
  75. __u32 cpu_timer_save_area[2]; /* 0x00d8 */
  76. __u32 clock_comp_save_area[2]; /* 0x00e0 */
  77. __u32 mcck_interruption_code[2]; /* 0x00e8 */
  78. __u8 pad_0x00f0[0x00f4-0x00f0]; /* 0x00f0 */
  79. __u32 external_damage_code; /* 0x00f4 */
  80. __u32 failing_storage_address; /* 0x00f8 */
  81. __u8 pad_0x00fc[0x0100-0x00fc]; /* 0x00fc */
  82. psw_t psw_save_area; /* 0x0100 */
  83. __u32 prefixreg_save_area; /* 0x0108 */
  84. __u8 pad_0x010c[0x0120-0x010c]; /* 0x010c */
  85. /* CPU register save area: defined by architecture */
  86. __u32 access_regs_save_area[16]; /* 0x0120 */
  87. __u32 floating_pt_save_area[8]; /* 0x0160 */
  88. __u32 gpregs_save_area[16]; /* 0x0180 */
  89. __u32 cregs_save_area[16]; /* 0x01c0 */
  90. /* Save areas. */
  91. __u32 save_area_sync[8]; /* 0x0200 */
  92. __u32 save_area_async[8]; /* 0x0220 */
  93. __u32 save_area_restart[1]; /* 0x0240 */
  94. /* CPU flags. */
  95. __u32 cpu_flags; /* 0x0244 */
  96. /* Return psws. */
  97. psw_t return_psw; /* 0x0248 */
  98. psw_t return_mcck_psw; /* 0x0250 */
  99. /* CPU time accounting values */
  100. __u64 sync_enter_timer; /* 0x0258 */
  101. __u64 async_enter_timer; /* 0x0260 */
  102. __u64 mcck_enter_timer; /* 0x0268 */
  103. __u64 exit_timer; /* 0x0270 */
  104. __u64 user_timer; /* 0x0278 */
  105. __u64 system_timer; /* 0x0280 */
  106. __u64 steal_timer; /* 0x0288 */
  107. __u64 last_update_timer; /* 0x0290 */
  108. __u64 last_update_clock; /* 0x0298 */
  109. __u64 int_clock; /* 0x02a0 */
  110. __u64 mcck_clock; /* 0x02a8 */
  111. __u64 clock_comparator; /* 0x02b0 */
  112. /* Current process. */
  113. __u32 current_task; /* 0x02b8 */
  114. __u32 thread_info; /* 0x02bc */
  115. __u32 kernel_stack; /* 0x02c0 */
  116. /* Interrupt, panic and restart stack. */
  117. __u32 async_stack; /* 0x02c4 */
  118. __u32 panic_stack; /* 0x02c8 */
  119. __u32 restart_stack; /* 0x02cc */
  120. /* Restart function and parameter. */
  121. __u32 restart_fn; /* 0x02d0 */
  122. __u32 restart_data; /* 0x02d4 */
  123. __u32 restart_source; /* 0x02d8 */
  124. /* Address space pointer. */
  125. __u32 kernel_asce; /* 0x02dc */
  126. __u32 user_asce; /* 0x02e0 */
  127. __u32 current_pid; /* 0x02e4 */
  128. /* SMP info area */
  129. __u32 cpu_nr; /* 0x02e8 */
  130. __u32 softirq_pending; /* 0x02ec */
  131. __u32 percpu_offset; /* 0x02f0 */
  132. __u32 machine_flags; /* 0x02f4 */
  133. __u8 pad_0x02f8[0x02fc-0x02f8]; /* 0x02f8 */
  134. __u32 spinlock_lockval; /* 0x02fc */
  135. __u8 pad_0x0300[0x0e00-0x0300]; /* 0x0300 */
  136. /*
  137. * 0xe00 contains the address of the IPL Parameter Information
  138. * block. Dump tools need IPIB for IPL after dump.
  139. * Note: do not change the position of any fields in 0x0e00-0x0f00
  140. */
  141. __u32 ipib; /* 0x0e00 */
  142. __u32 ipib_checksum; /* 0x0e04 */
  143. __u32 vmcore_info; /* 0x0e08 */
  144. __u8 pad_0x0e0c[0x0e18-0x0e0c]; /* 0x0e0c */
  145. __u32 os_info; /* 0x0e18 */
  146. __u8 pad_0x0e1c[0x0f00-0x0e1c]; /* 0x0e1c */
  147. /* Extended facility list */
  148. __u64 stfle_fac_list[32]; /* 0x0f00 */
  149. } __packed;
  150. #else /* CONFIG_32BIT */
  151. #define LC_ORDER 1
  152. #define LC_PAGES 2
  153. struct save_area {
  154. u64 fp_regs[16];
  155. u64 gp_regs[16];
  156. u8 psw[16];
  157. u8 pad1[8];
  158. u32 pref_reg;
  159. u32 fp_ctrl_reg;
  160. u8 pad2[4];
  161. u32 tod_reg;
  162. u64 timer;
  163. u64 clk_cmp;
  164. u8 pad3[8];
  165. u32 acc_regs[16];
  166. u64 ctrl_regs[16];
  167. } __packed;
  168. struct save_area_ext {
  169. struct save_area sa;
  170. __vector128 vx_regs[32];
  171. };
  172. struct _lowcore {
  173. __u8 pad_0x0000[0x0014-0x0000]; /* 0x0000 */
  174. __u32 ipl_parmblock_ptr; /* 0x0014 */
  175. __u8 pad_0x0018[0x0080-0x0018]; /* 0x0018 */
  176. __u32 ext_params; /* 0x0080 */
  177. __u16 ext_cpu_addr; /* 0x0084 */
  178. __u16 ext_int_code; /* 0x0086 */
  179. __u16 svc_ilc; /* 0x0088 */
  180. __u16 svc_code; /* 0x008a */
  181. __u16 pgm_ilc; /* 0x008c */
  182. __u16 pgm_code; /* 0x008e */
  183. __u32 data_exc_code; /* 0x0090 */
  184. __u16 mon_class_num; /* 0x0094 */
  185. __u8 per_code; /* 0x0096 */
  186. __u8 per_atmid; /* 0x0097 */
  187. __u64 per_address; /* 0x0098 */
  188. __u8 exc_access_id; /* 0x00a0 */
  189. __u8 per_access_id; /* 0x00a1 */
  190. __u8 op_access_id; /* 0x00a2 */
  191. __u8 ar_mode_id; /* 0x00a3 */
  192. __u8 pad_0x00a4[0x00a8-0x00a4]; /* 0x00a4 */
  193. __u64 trans_exc_code; /* 0x00a8 */
  194. __u64 monitor_code; /* 0x00b0 */
  195. __u16 subchannel_id; /* 0x00b8 */
  196. __u16 subchannel_nr; /* 0x00ba */
  197. __u32 io_int_parm; /* 0x00bc */
  198. __u32 io_int_word; /* 0x00c0 */
  199. __u8 pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */
  200. __u32 stfl_fac_list; /* 0x00c8 */
  201. __u8 pad_0x00cc[0x00e8-0x00cc]; /* 0x00cc */
  202. __u32 mcck_interruption_code[2]; /* 0x00e8 */
  203. __u8 pad_0x00f0[0x00f4-0x00f0]; /* 0x00f0 */
  204. __u32 external_damage_code; /* 0x00f4 */
  205. __u64 failing_storage_address; /* 0x00f8 */
  206. __u8 pad_0x0100[0x0110-0x0100]; /* 0x0100 */
  207. __u64 breaking_event_addr; /* 0x0110 */
  208. __u8 pad_0x0118[0x0120-0x0118]; /* 0x0118 */
  209. psw_t restart_old_psw; /* 0x0120 */
  210. psw_t external_old_psw; /* 0x0130 */
  211. psw_t svc_old_psw; /* 0x0140 */
  212. psw_t program_old_psw; /* 0x0150 */
  213. psw_t mcck_old_psw; /* 0x0160 */
  214. psw_t io_old_psw; /* 0x0170 */
  215. __u8 pad_0x0180[0x01a0-0x0180]; /* 0x0180 */
  216. psw_t restart_psw; /* 0x01a0 */
  217. psw_t external_new_psw; /* 0x01b0 */
  218. psw_t svc_new_psw; /* 0x01c0 */
  219. psw_t program_new_psw; /* 0x01d0 */
  220. psw_t mcck_new_psw; /* 0x01e0 */
  221. psw_t io_new_psw; /* 0x01f0 */
  222. /* Save areas. */
  223. __u64 save_area_sync[8]; /* 0x0200 */
  224. __u64 save_area_async[8]; /* 0x0240 */
  225. __u64 save_area_restart[1]; /* 0x0280 */
  226. /* CPU flags. */
  227. __u64 cpu_flags; /* 0x0288 */
  228. /* Return psws. */
  229. psw_t return_psw; /* 0x0290 */
  230. psw_t return_mcck_psw; /* 0x02a0 */
  231. /* CPU accounting and timing values. */
  232. __u64 sync_enter_timer; /* 0x02b0 */
  233. __u64 async_enter_timer; /* 0x02b8 */
  234. __u64 mcck_enter_timer; /* 0x02c0 */
  235. __u64 exit_timer; /* 0x02c8 */
  236. __u64 user_timer; /* 0x02d0 */
  237. __u64 system_timer; /* 0x02d8 */
  238. __u64 steal_timer; /* 0x02e0 */
  239. __u64 last_update_timer; /* 0x02e8 */
  240. __u64 last_update_clock; /* 0x02f0 */
  241. __u64 int_clock; /* 0x02f8 */
  242. __u64 mcck_clock; /* 0x0300 */
  243. __u64 clock_comparator; /* 0x0308 */
  244. /* Current process. */
  245. __u64 current_task; /* 0x0310 */
  246. __u64 thread_info; /* 0x0318 */
  247. __u64 kernel_stack; /* 0x0320 */
  248. /* Interrupt, panic and restart stack. */
  249. __u64 async_stack; /* 0x0328 */
  250. __u64 panic_stack; /* 0x0330 */
  251. __u64 restart_stack; /* 0x0338 */
  252. /* Restart function and parameter. */
  253. __u64 restart_fn; /* 0x0340 */
  254. __u64 restart_data; /* 0x0348 */
  255. __u64 restart_source; /* 0x0350 */
  256. /* Address space pointer. */
  257. __u64 kernel_asce; /* 0x0358 */
  258. __u64 user_asce; /* 0x0360 */
  259. __u64 current_pid; /* 0x0368 */
  260. /* SMP info area */
  261. __u32 cpu_nr; /* 0x0370 */
  262. __u32 softirq_pending; /* 0x0374 */
  263. __u64 percpu_offset; /* 0x0378 */
  264. __u64 vdso_per_cpu_data; /* 0x0380 */
  265. __u64 machine_flags; /* 0x0388 */
  266. __u8 pad_0x0390[0x0398-0x0390]; /* 0x0390 */
  267. __u64 gmap; /* 0x0398 */
  268. __u32 spinlock_lockval; /* 0x03a0 */
  269. __u8 pad_0x03a0[0x0400-0x03a4]; /* 0x03a4 */
  270. /* Per cpu primary space access list */
  271. __u32 paste[16]; /* 0x0400 */
  272. __u8 pad_0x04c0[0x0e00-0x0440]; /* 0x0440 */
  273. /*
  274. * 0xe00 contains the address of the IPL Parameter Information
  275. * block. Dump tools need IPIB for IPL after dump.
  276. * Note: do not change the position of any fields in 0x0e00-0x0f00
  277. */
  278. __u64 ipib; /* 0x0e00 */
  279. __u32 ipib_checksum; /* 0x0e08 */
  280. __u64 vmcore_info; /* 0x0e0c */
  281. __u8 pad_0x0e14[0x0e18-0x0e14]; /* 0x0e14 */
  282. __u64 os_info; /* 0x0e18 */
  283. __u8 pad_0x0e20[0x0f00-0x0e20]; /* 0x0e20 */
  284. /* Extended facility list */
  285. __u64 stfle_fac_list[32]; /* 0x0f00 */
  286. __u8 pad_0x1000[0x11b0-0x1000]; /* 0x1000 */
  287. /* Pointer to vector register save area */
  288. __u64 vector_save_area_addr; /* 0x11b0 */
  289. /* 64 bit extparam used for pfault/diag 250: defined by architecture */
  290. __u64 ext_params2; /* 0x11B8 */
  291. __u8 pad_0x11c0[0x1200-0x11C0]; /* 0x11C0 */
  292. /* CPU register save area: defined by architecture */
  293. __u64 floating_pt_save_area[16]; /* 0x1200 */
  294. __u64 gpregs_save_area[16]; /* 0x1280 */
  295. psw_t psw_save_area; /* 0x1300 */
  296. __u8 pad_0x1310[0x1318-0x1310]; /* 0x1310 */
  297. __u32 prefixreg_save_area; /* 0x1318 */
  298. __u32 fpt_creg_save_area; /* 0x131c */
  299. __u8 pad_0x1320[0x1324-0x1320]; /* 0x1320 */
  300. __u32 tod_progreg_save_area; /* 0x1324 */
  301. __u32 cpu_timer_save_area[2]; /* 0x1328 */
  302. __u32 clock_comp_save_area[2]; /* 0x1330 */
  303. __u8 pad_0x1338[0x1340-0x1338]; /* 0x1338 */
  304. __u32 access_regs_save_area[16]; /* 0x1340 */
  305. __u64 cregs_save_area[16]; /* 0x1380 */
  306. __u8 pad_0x1400[0x1800-0x1400]; /* 0x1400 */
  307. /* Transaction abort diagnostic block */
  308. __u8 pgm_tdb[256]; /* 0x1800 */
  309. __u8 pad_0x1900[0x1c00-0x1900]; /* 0x1900 */
  310. /* Software defined save area for vector registers */
  311. __u8 vector_save_area[1024]; /* 0x1c00 */
  312. } __packed;
  313. #endif /* CONFIG_32BIT */
  314. #define S390_lowcore (*((struct _lowcore *) 0))
  315. extern struct _lowcore *lowcore_ptr[];
  316. static inline void set_prefix(__u32 address)
  317. {
  318. asm volatile("spx %0" : : "m" (address) : "memory");
  319. }
  320. static inline __u32 store_prefix(void)
  321. {
  322. __u32 address;
  323. asm volatile("stpx %0" : "=m" (address));
  324. return address;
  325. }
  326. #endif /* _ASM_S390_LOWCORE_H */