lowcore.h 9.9 KB

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