lowcore.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. /*
  2. * include/asm-s390/lowcore.h
  3. *
  4. * S390 version
  5. * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
  6. * Author(s): Hartmut Penner (hp@de.ibm.com),
  7. * Martin Schwidefsky (schwidefsky@de.ibm.com),
  8. * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
  9. */
  10. #ifndef _ASM_S390_LOWCORE_H
  11. #define _ASM_S390_LOWCORE_H
  12. #define __LC_IPL_PARMBLOCK_PTR 0x0014
  13. #define __LC_EXT_PARAMS 0x0080
  14. #define __LC_CPU_ADDRESS 0x0084
  15. #define __LC_EXT_INT_CODE 0x0086
  16. #define __LC_SVC_ILC 0x0088
  17. #define __LC_SVC_INT_CODE 0x008a
  18. #define __LC_PGM_ILC 0x008c
  19. #define __LC_PGM_INT_CODE 0x008e
  20. #define __LC_PER_ATMID 0x0096
  21. #define __LC_PER_ADDRESS 0x0098
  22. #define __LC_PER_ACCESS_ID 0x00a1
  23. #define __LC_AR_MODE_ID 0x00a3
  24. #define __LC_SUBCHANNEL_ID 0x00b8
  25. #define __LC_SUBCHANNEL_NR 0x00ba
  26. #define __LC_IO_INT_PARM 0x00bc
  27. #define __LC_IO_INT_WORD 0x00c0
  28. #define __LC_MCCK_CODE 0x00e8
  29. #define __LC_DUMP_REIPL 0x0e00
  30. #ifndef __s390x__
  31. #define __LC_EXT_OLD_PSW 0x0018
  32. #define __LC_SVC_OLD_PSW 0x0020
  33. #define __LC_PGM_OLD_PSW 0x0028
  34. #define __LC_MCK_OLD_PSW 0x0030
  35. #define __LC_IO_OLD_PSW 0x0038
  36. #define __LC_EXT_NEW_PSW 0x0058
  37. #define __LC_SVC_NEW_PSW 0x0060
  38. #define __LC_PGM_NEW_PSW 0x0068
  39. #define __LC_MCK_NEW_PSW 0x0070
  40. #define __LC_IO_NEW_PSW 0x0078
  41. #define __LC_SAVE_AREA 0x0200
  42. #define __LC_RETURN_PSW 0x0240
  43. #define __LC_RETURN_MCCK_PSW 0x0248
  44. #define __LC_SYNC_ENTER_TIMER 0x0250
  45. #define __LC_ASYNC_ENTER_TIMER 0x0258
  46. #define __LC_EXIT_TIMER 0x0260
  47. #define __LC_USER_TIMER 0x0268
  48. #define __LC_SYSTEM_TIMER 0x0270
  49. #define __LC_STEAL_TIMER 0x0278
  50. #define __LC_LAST_UPDATE_TIMER 0x0280
  51. #define __LC_LAST_UPDATE_CLOCK 0x0288
  52. #define __LC_CURRENT 0x0290
  53. #define __LC_THREAD_INFO 0x0294
  54. #define __LC_KERNEL_STACK 0x0298
  55. #define __LC_ASYNC_STACK 0x029c
  56. #define __LC_PANIC_STACK 0x02a0
  57. #define __LC_KERNEL_ASCE 0x02a4
  58. #define __LC_USER_ASCE 0x02a8
  59. #define __LC_USER_EXEC_ASCE 0x02ac
  60. #define __LC_CPUID 0x02b0
  61. #define __LC_INT_CLOCK 0x02c8
  62. #define __LC_MACHINE_FLAGS 0x02d8
  63. #define __LC_IRB 0x0300
  64. #define __LC_PFAULT_INTPARM 0x0080
  65. #define __LC_CPU_TIMER_SAVE_AREA 0x00d8
  66. #define __LC_CLOCK_COMP_SAVE_AREA 0x00e0
  67. #define __LC_PSW_SAVE_AREA 0x0100
  68. #define __LC_PREFIX_SAVE_AREA 0x0108
  69. #define __LC_AREGS_SAVE_AREA 0x0120
  70. #define __LC_FPREGS_SAVE_AREA 0x0160
  71. #define __LC_GPREGS_SAVE_AREA 0x0180
  72. #define __LC_CREGS_SAVE_AREA 0x01c0
  73. #else /* __s390x__ */
  74. #define __LC_LAST_BREAK 0x0110
  75. #define __LC_EXT_OLD_PSW 0x0130
  76. #define __LC_SVC_OLD_PSW 0x0140
  77. #define __LC_PGM_OLD_PSW 0x0150
  78. #define __LC_MCK_OLD_PSW 0x0160
  79. #define __LC_IO_OLD_PSW 0x0170
  80. #define __LC_EXT_NEW_PSW 0x01b0
  81. #define __LC_SVC_NEW_PSW 0x01c0
  82. #define __LC_PGM_NEW_PSW 0x01d0
  83. #define __LC_MCK_NEW_PSW 0x01e0
  84. #define __LC_IO_NEW_PSW 0x01f0
  85. #define __LC_SAVE_AREA 0x0200
  86. #define __LC_RETURN_PSW 0x0280
  87. #define __LC_RETURN_MCCK_PSW 0x0290
  88. #define __LC_SYNC_ENTER_TIMER 0x02a0
  89. #define __LC_ASYNC_ENTER_TIMER 0x02a8
  90. #define __LC_EXIT_TIMER 0x02b0
  91. #define __LC_USER_TIMER 0x02b8
  92. #define __LC_SYSTEM_TIMER 0x02c0
  93. #define __LC_STEAL_TIMER 0x02c8
  94. #define __LC_LAST_UPDATE_TIMER 0x02d0
  95. #define __LC_LAST_UPDATE_CLOCK 0x02d8
  96. #define __LC_CURRENT 0x02e0
  97. #define __LC_THREAD_INFO 0x02e8
  98. #define __LC_KERNEL_STACK 0x02f0
  99. #define __LC_ASYNC_STACK 0x02f8
  100. #define __LC_PANIC_STACK 0x0300
  101. #define __LC_KERNEL_ASCE 0x0308
  102. #define __LC_USER_ASCE 0x0310
  103. #define __LC_USER_EXEC_ASCE 0x0318
  104. #define __LC_CPUID 0x0320
  105. #define __LC_INT_CLOCK 0x0340
  106. #define __LC_VDSO_PER_CPU 0x0350
  107. #define __LC_MACHINE_FLAGS 0x0358
  108. #define __LC_IRB 0x0380
  109. #define __LC_PASTE 0x03c0
  110. #define __LC_PFAULT_INTPARM 0x11b8
  111. #define __LC_FPREGS_SAVE_AREA 0x1200
  112. #define __LC_GPREGS_SAVE_AREA 0x1280
  113. #define __LC_PSW_SAVE_AREA 0x1300
  114. #define __LC_PREFIX_SAVE_AREA 0x1318
  115. #define __LC_FP_CREG_SAVE_AREA 0x131c
  116. #define __LC_TODREG_SAVE_AREA 0x1324
  117. #define __LC_CPU_TIMER_SAVE_AREA 0x1328
  118. #define __LC_CLOCK_COMP_SAVE_AREA 0x1331
  119. #define __LC_AREGS_SAVE_AREA 0x1340
  120. #define __LC_CREGS_SAVE_AREA 0x1380
  121. #endif /* __s390x__ */
  122. #ifndef __ASSEMBLY__
  123. #include <asm/cpuid.h>
  124. #include <asm/ptrace.h>
  125. #include <linux/types.h>
  126. void restart_int_handler(void);
  127. void ext_int_handler(void);
  128. void system_call(void);
  129. void pgm_check_handler(void);
  130. void mcck_int_handler(void);
  131. void io_int_handler(void);
  132. struct save_area_s390 {
  133. u32 ext_save;
  134. u64 timer;
  135. u64 clk_cmp;
  136. u8 pad1[24];
  137. u8 psw[8];
  138. u32 pref_reg;
  139. u8 pad2[20];
  140. u32 acc_regs[16];
  141. u64 fp_regs[4];
  142. u32 gp_regs[16];
  143. u32 ctrl_regs[16];
  144. } __attribute__((packed));
  145. struct save_area_s390x {
  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. } __attribute__((packed));
  160. union save_area {
  161. struct save_area_s390 s390;
  162. struct save_area_s390x s390x;
  163. };
  164. #define SAVE_AREA_BASE_S390 0xd4
  165. #define SAVE_AREA_BASE_S390X 0x1200
  166. #ifndef __s390x__
  167. #define SAVE_AREA_SIZE sizeof(struct save_area_s390)
  168. #define SAVE_AREA_BASE SAVE_AREA_BASE_S390
  169. #else
  170. #define SAVE_AREA_SIZE sizeof(struct save_area_s390x)
  171. #define SAVE_AREA_BASE SAVE_AREA_BASE_S390X
  172. #endif
  173. struct _lowcore
  174. {
  175. #ifndef __s390x__
  176. /* 0x0000 - 0x01ff: defined by architecture */
  177. psw_t restart_psw; /* 0x0000 */
  178. __u32 ccw2[4]; /* 0x0008 */
  179. psw_t external_old_psw; /* 0x0018 */
  180. psw_t svc_old_psw; /* 0x0020 */
  181. psw_t program_old_psw; /* 0x0028 */
  182. psw_t mcck_old_psw; /* 0x0030 */
  183. psw_t io_old_psw; /* 0x0038 */
  184. __u8 pad_0x0040[0x0058-0x0040]; /* 0x0040 */
  185. psw_t external_new_psw; /* 0x0058 */
  186. psw_t svc_new_psw; /* 0x0060 */
  187. psw_t program_new_psw; /* 0x0068 */
  188. psw_t mcck_new_psw; /* 0x0070 */
  189. psw_t io_new_psw; /* 0x0078 */
  190. __u32 ext_params; /* 0x0080 */
  191. __u16 cpu_addr; /* 0x0084 */
  192. __u16 ext_int_code; /* 0x0086 */
  193. __u16 svc_ilc; /* 0x0088 */
  194. __u16 svc_code; /* 0x008a */
  195. __u16 pgm_ilc; /* 0x008c */
  196. __u16 pgm_code; /* 0x008e */
  197. __u32 trans_exc_code; /* 0x0090 */
  198. __u16 mon_class_num; /* 0x0094 */
  199. __u16 per_perc_atmid; /* 0x0096 */
  200. __u32 per_address; /* 0x0098 */
  201. __u32 monitor_code; /* 0x009c */
  202. __u8 exc_access_id; /* 0x00a0 */
  203. __u8 per_access_id; /* 0x00a1 */
  204. __u8 pad_0x00a2[0x00b8-0x00a2]; /* 0x00a2 */
  205. __u16 subchannel_id; /* 0x00b8 */
  206. __u16 subchannel_nr; /* 0x00ba */
  207. __u32 io_int_parm; /* 0x00bc */
  208. __u32 io_int_word; /* 0x00c0 */
  209. __u8 pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */
  210. __u32 stfl_fac_list; /* 0x00c8 */
  211. __u8 pad_0x00cc[0x00d4-0x00cc]; /* 0x00cc */
  212. __u32 extended_save_area_addr; /* 0x00d4 */
  213. __u32 cpu_timer_save_area[2]; /* 0x00d8 */
  214. __u32 clock_comp_save_area[2]; /* 0x00e0 */
  215. __u32 mcck_interruption_code[2]; /* 0x00e8 */
  216. __u8 pad_0x00f0[0x00f4-0x00f0]; /* 0x00f0 */
  217. __u32 external_damage_code; /* 0x00f4 */
  218. __u32 failing_storage_address; /* 0x00f8 */
  219. __u8 pad_0x00fc[0x0100-0x00fc]; /* 0x00fc */
  220. __u32 st_status_fixed_logout[4]; /* 0x0100 */
  221. __u8 pad_0x0110[0x0120-0x0110]; /* 0x0110 */
  222. /* CPU register save area: defined by architecture */
  223. __u32 access_regs_save_area[16]; /* 0x0120 */
  224. __u32 floating_pt_save_area[8]; /* 0x0160 */
  225. __u32 gpregs_save_area[16]; /* 0x0180 */
  226. __u32 cregs_save_area[16]; /* 0x01c0 */
  227. /* Return psws. */
  228. __u32 save_area[16]; /* 0x0200 */
  229. psw_t return_psw; /* 0x0240 */
  230. psw_t return_mcck_psw; /* 0x0248 */
  231. /* CPU time accounting values */
  232. __u64 sync_enter_timer; /* 0x0250 */
  233. __u64 async_enter_timer; /* 0x0258 */
  234. __u64 exit_timer; /* 0x0260 */
  235. __u64 user_timer; /* 0x0268 */
  236. __u64 system_timer; /* 0x0270 */
  237. __u64 steal_timer; /* 0x0278 */
  238. __u64 last_update_timer; /* 0x0280 */
  239. __u64 last_update_clock; /* 0x0288 */
  240. /* Current process. */
  241. __u32 current_task; /* 0x0290 */
  242. __u32 thread_info; /* 0x0294 */
  243. __u32 kernel_stack; /* 0x0298 */
  244. /* Interrupt and panic stack. */
  245. __u32 async_stack; /* 0x029c */
  246. __u32 panic_stack; /* 0x02a0 */
  247. /* Address space pointer. */
  248. __u32 kernel_asce; /* 0x02a4 */
  249. __u32 user_asce; /* 0x02a8 */
  250. __u32 user_exec_asce; /* 0x02ac */
  251. /* SMP info area */
  252. cpuid_t cpu_id; /* 0x02b0 */
  253. __u32 cpu_nr; /* 0x02b8 */
  254. __u32 softirq_pending; /* 0x02bc */
  255. __u32 percpu_offset; /* 0x02c0 */
  256. __u32 ext_call_fast; /* 0x02c4 */
  257. __u64 int_clock; /* 0x02c8 */
  258. __u64 clock_comparator; /* 0x02d0 */
  259. __u32 machine_flags; /* 0x02d8 */
  260. __u8 pad_0x02dc[0x0300-0x02dc]; /* 0x02dc */
  261. /* Interrupt response block */
  262. __u8 irb[64]; /* 0x0300 */
  263. __u8 pad_0x0400[0x0e00-0x0400]; /* 0x0400 */
  264. /*
  265. * 0xe00 contains the address of the IPL Parameter Information
  266. * block. Dump tools need IPIB for IPL after dump.
  267. * Note: do not change the position of any fields in 0x0e00-0x0f00
  268. */
  269. __u32 ipib; /* 0x0e00 */
  270. __u32 ipib_checksum; /* 0x0e04 */
  271. /* Align to the top 1k of prefix area */
  272. __u8 pad_0x0e08[0x1000-0x0e08]; /* 0x0e08 */
  273. #else /* !__s390x__ */
  274. /* 0x0000 - 0x01ff: defined by architecture */
  275. __u32 ccw1[2]; /* 0x0000 */
  276. __u32 ccw2[4]; /* 0x0008 */
  277. __u8 pad_0x0018[0x0080-0x0018]; /* 0x0018 */
  278. __u32 ext_params; /* 0x0080 */
  279. __u16 cpu_addr; /* 0x0084 */
  280. __u16 ext_int_code; /* 0x0086 */
  281. __u16 svc_ilc; /* 0x0088 */
  282. __u16 svc_code; /* 0x008a */
  283. __u16 pgm_ilc; /* 0x008c */
  284. __u16 pgm_code; /* 0x008e */
  285. __u32 data_exc_code; /* 0x0090 */
  286. __u16 mon_class_num; /* 0x0094 */
  287. __u16 per_perc_atmid; /* 0x0096 */
  288. addr_t per_address; /* 0x0098 */
  289. __u8 exc_access_id; /* 0x00a0 */
  290. __u8 per_access_id; /* 0x00a1 */
  291. __u8 op_access_id; /* 0x00a2 */
  292. __u8 ar_access_id; /* 0x00a3 */
  293. __u8 pad_0x00a4[0x00a8-0x00a4]; /* 0x00a4 */
  294. addr_t trans_exc_code; /* 0x00a8 */
  295. addr_t monitor_code; /* 0x00b0 */
  296. __u16 subchannel_id; /* 0x00b8 */
  297. __u16 subchannel_nr; /* 0x00ba */
  298. __u32 io_int_parm; /* 0x00bc */
  299. __u32 io_int_word; /* 0x00c0 */
  300. __u8 pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */
  301. __u32 stfl_fac_list; /* 0x00c8 */
  302. __u8 pad_0x00cc[0x00e8-0x00cc]; /* 0x00cc */
  303. __u32 mcck_interruption_code[2]; /* 0x00e8 */
  304. __u8 pad_0x00f0[0x00f4-0x00f0]; /* 0x00f0 */
  305. __u32 external_damage_code; /* 0x00f4 */
  306. addr_t failing_storage_address; /* 0x00f8 */
  307. __u8 pad_0x0100[0x0120-0x0100]; /* 0x0100 */
  308. psw_t restart_old_psw; /* 0x0120 */
  309. psw_t external_old_psw; /* 0x0130 */
  310. psw_t svc_old_psw; /* 0x0140 */
  311. psw_t program_old_psw; /* 0x0150 */
  312. psw_t mcck_old_psw; /* 0x0160 */
  313. psw_t io_old_psw; /* 0x0170 */
  314. __u8 pad_0x0180[0x01a0-0x0180]; /* 0x0180 */
  315. psw_t restart_psw; /* 0x01a0 */
  316. psw_t external_new_psw; /* 0x01b0 */
  317. psw_t svc_new_psw; /* 0x01c0 */
  318. psw_t program_new_psw; /* 0x01d0 */
  319. psw_t mcck_new_psw; /* 0x01e0 */
  320. psw_t io_new_psw; /* 0x01f0 */
  321. /* Entry/exit save area & return psws. */
  322. __u64 save_area[16]; /* 0x0200 */
  323. psw_t return_psw; /* 0x0280 */
  324. psw_t return_mcck_psw; /* 0x0290 */
  325. /* CPU accounting and timing values. */
  326. __u64 sync_enter_timer; /* 0x02a0 */
  327. __u64 async_enter_timer; /* 0x02a8 */
  328. __u64 exit_timer; /* 0x02b0 */
  329. __u64 user_timer; /* 0x02b8 */
  330. __u64 system_timer; /* 0x02c0 */
  331. __u64 steal_timer; /* 0x02c8 */
  332. __u64 last_update_timer; /* 0x02d0 */
  333. __u64 last_update_clock; /* 0x02d8 */
  334. /* Current process. */
  335. __u64 current_task; /* 0x02e0 */
  336. __u64 thread_info; /* 0x02e8 */
  337. __u64 kernel_stack; /* 0x02f0 */
  338. /* Interrupt and panic stack. */
  339. __u64 async_stack; /* 0x02f8 */
  340. __u64 panic_stack; /* 0x0300 */
  341. /* Address space pointer. */
  342. __u64 kernel_asce; /* 0x0308 */
  343. __u64 user_asce; /* 0x0310 */
  344. __u64 user_exec_asce; /* 0x0318 */
  345. /* SMP info area */
  346. cpuid_t cpu_id; /* 0x0320 */
  347. __u32 cpu_nr; /* 0x0328 */
  348. __u32 softirq_pending; /* 0x032c */
  349. __u64 percpu_offset; /* 0x0330 */
  350. __u64 ext_call_fast; /* 0x0338 */
  351. __u64 int_clock; /* 0x0340 */
  352. __u64 clock_comparator; /* 0x0348 */
  353. __u64 vdso_per_cpu_data; /* 0x0350 */
  354. __u64 machine_flags; /* 0x0358 */
  355. __u8 pad_0x0360[0x0380-0x0360]; /* 0x0360 */
  356. /* Interrupt response block. */
  357. __u8 irb[64]; /* 0x0380 */
  358. /* Per cpu primary space access list */
  359. __u32 paste[16]; /* 0x03c0 */
  360. __u8 pad_0x0400[0x0e00-0x0400]; /* 0x0400 */
  361. /*
  362. * 0xe00 contains the address of the IPL Parameter Information
  363. * block. Dump tools need IPIB for IPL after dump.
  364. * Note: do not change the position of any fields in 0x0e00-0x0f00
  365. */
  366. __u64 ipib; /* 0x0e00 */
  367. __u32 ipib_checksum; /* 0x0e08 */
  368. __u8 pad_0x0e0c[0x11b8-0x0e0c]; /* 0x0e0c */
  369. /* 64 bit extparam used for pfault/diag 250: defined by architecture */
  370. __u64 ext_params2; /* 0x11B8 */
  371. __u8 pad_0x11c0[0x1200-0x11C0]; /* 0x11C0 */
  372. /* CPU register save area: defined by architecture */
  373. __u64 floating_pt_save_area[16]; /* 0x1200 */
  374. __u64 gpregs_save_area[16]; /* 0x1280 */
  375. __u32 st_status_fixed_logout[4]; /* 0x1300 */
  376. __u8 pad_0x1310[0x1318-0x1310]; /* 0x1310 */
  377. __u32 prefixreg_save_area; /* 0x1318 */
  378. __u32 fpt_creg_save_area; /* 0x131c */
  379. __u8 pad_0x1320[0x1324-0x1320]; /* 0x1320 */
  380. __u32 tod_progreg_save_area; /* 0x1324 */
  381. __u32 cpu_timer_save_area[2]; /* 0x1328 */
  382. __u32 clock_comp_save_area[2]; /* 0x1330 */
  383. __u8 pad_0x1338[0x1340-0x1338]; /* 0x1338 */
  384. __u32 access_regs_save_area[16]; /* 0x1340 */
  385. __u64 cregs_save_area[16]; /* 0x1380 */
  386. /* align to the top of the prefix area */
  387. __u8 pad_0x1400[0x2000-0x1400]; /* 0x1400 */
  388. #endif /* !__s390x__ */
  389. } __attribute__((packed)); /* End structure*/
  390. #define S390_lowcore (*((struct _lowcore *) 0))
  391. extern struct _lowcore *lowcore_ptr[];
  392. static inline void set_prefix(__u32 address)
  393. {
  394. asm volatile("spx %0" : : "m" (address) : "memory");
  395. }
  396. static inline __u32 store_prefix(void)
  397. {
  398. __u32 address;
  399. asm volatile("stpx %0" : "=m" (address));
  400. return address;
  401. }
  402. #endif
  403. #endif