lowcore.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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. #ifndef __s390x__
  13. #define __LC_EXT_OLD_PSW 0x018
  14. #define __LC_SVC_OLD_PSW 0x020
  15. #define __LC_PGM_OLD_PSW 0x028
  16. #define __LC_MCK_OLD_PSW 0x030
  17. #define __LC_IO_OLD_PSW 0x038
  18. #define __LC_EXT_NEW_PSW 0x058
  19. #define __LC_SVC_NEW_PSW 0x060
  20. #define __LC_PGM_NEW_PSW 0x068
  21. #define __LC_MCK_NEW_PSW 0x070
  22. #define __LC_IO_NEW_PSW 0x078
  23. #else /* !__s390x__ */
  24. #define __LC_EXT_OLD_PSW 0x0130
  25. #define __LC_SVC_OLD_PSW 0x0140
  26. #define __LC_PGM_OLD_PSW 0x0150
  27. #define __LC_MCK_OLD_PSW 0x0160
  28. #define __LC_IO_OLD_PSW 0x0170
  29. #define __LC_EXT_NEW_PSW 0x01b0
  30. #define __LC_SVC_NEW_PSW 0x01c0
  31. #define __LC_PGM_NEW_PSW 0x01d0
  32. #define __LC_MCK_NEW_PSW 0x01e0
  33. #define __LC_IO_NEW_PSW 0x01f0
  34. #endif /* !__s390x__ */
  35. #define __LC_IPL_PARMBLOCK_PTR 0x014
  36. #define __LC_EXT_PARAMS 0x080
  37. #define __LC_CPU_ADDRESS 0x084
  38. #define __LC_EXT_INT_CODE 0x086
  39. #define __LC_SVC_ILC 0x088
  40. #define __LC_SVC_INT_CODE 0x08A
  41. #define __LC_PGM_ILC 0x08C
  42. #define __LC_PGM_INT_CODE 0x08E
  43. #define __LC_PER_ATMID 0x096
  44. #define __LC_PER_ADDRESS 0x098
  45. #define __LC_PER_ACCESS_ID 0x0A1
  46. #define __LC_AR_MODE_ID 0x0A3
  47. #define __LC_SUBCHANNEL_ID 0x0B8
  48. #define __LC_SUBCHANNEL_NR 0x0BA
  49. #define __LC_IO_INT_PARM 0x0BC
  50. #define __LC_IO_INT_WORD 0x0C0
  51. #define __LC_MCCK_CODE 0x0E8
  52. #define __LC_LAST_BREAK 0x110
  53. #define __LC_RETURN_PSW 0x200
  54. #define __LC_SAVE_AREA 0xC00
  55. #ifndef __s390x__
  56. #define __LC_IRB 0x208
  57. #define __LC_SYNC_ENTER_TIMER 0x248
  58. #define __LC_ASYNC_ENTER_TIMER 0x250
  59. #define __LC_EXIT_TIMER 0x258
  60. #define __LC_LAST_UPDATE_TIMER 0x260
  61. #define __LC_USER_TIMER 0x268
  62. #define __LC_SYSTEM_TIMER 0x270
  63. #define __LC_LAST_UPDATE_CLOCK 0x278
  64. #define __LC_STEAL_CLOCK 0x280
  65. #define __LC_RETURN_MCCK_PSW 0x288
  66. #define __LC_KERNEL_STACK 0xC40
  67. #define __LC_THREAD_INFO 0xC44
  68. #define __LC_ASYNC_STACK 0xC48
  69. #define __LC_KERNEL_ASCE 0xC4C
  70. #define __LC_USER_ASCE 0xC50
  71. #define __LC_PANIC_STACK 0xC54
  72. #define __LC_CPUID 0xC60
  73. #define __LC_CPUADDR 0xC68
  74. #define __LC_IPLDEV 0xC7C
  75. #define __LC_CURRENT 0xC90
  76. #define __LC_INT_CLOCK 0xC98
  77. #else /* __s390x__ */
  78. #define __LC_IRB 0x210
  79. #define __LC_SYNC_ENTER_TIMER 0x250
  80. #define __LC_ASYNC_ENTER_TIMER 0x258
  81. #define __LC_EXIT_TIMER 0x260
  82. #define __LC_LAST_UPDATE_TIMER 0x268
  83. #define __LC_USER_TIMER 0x270
  84. #define __LC_SYSTEM_TIMER 0x278
  85. #define __LC_LAST_UPDATE_CLOCK 0x280
  86. #define __LC_STEAL_CLOCK 0x288
  87. #define __LC_RETURN_MCCK_PSW 0x290
  88. #define __LC_KERNEL_STACK 0xD40
  89. #define __LC_THREAD_INFO 0xD48
  90. #define __LC_ASYNC_STACK 0xD50
  91. #define __LC_KERNEL_ASCE 0xD58
  92. #define __LC_USER_ASCE 0xD60
  93. #define __LC_PANIC_STACK 0xD68
  94. #define __LC_CPUID 0xD80
  95. #define __LC_CPUADDR 0xD88
  96. #define __LC_IPLDEV 0xDB8
  97. #define __LC_CURRENT 0xDD8
  98. #define __LC_INT_CLOCK 0xDE8
  99. #endif /* __s390x__ */
  100. #define __LC_PANIC_MAGIC 0xE00
  101. #ifndef __s390x__
  102. #define __LC_PFAULT_INTPARM 0x080
  103. #define __LC_CPU_TIMER_SAVE_AREA 0x0D8
  104. #define __LC_CLOCK_COMP_SAVE_AREA 0x0E0
  105. #define __LC_PSW_SAVE_AREA 0x100
  106. #define __LC_PREFIX_SAVE_AREA 0x108
  107. #define __LC_AREGS_SAVE_AREA 0x120
  108. #define __LC_FPREGS_SAVE_AREA 0x160
  109. #define __LC_GPREGS_SAVE_AREA 0x180
  110. #define __LC_CREGS_SAVE_AREA 0x1C0
  111. #else /* __s390x__ */
  112. #define __LC_PFAULT_INTPARM 0x11B8
  113. #define __LC_FPREGS_SAVE_AREA 0x1200
  114. #define __LC_GPREGS_SAVE_AREA 0x1280
  115. #define __LC_PSW_SAVE_AREA 0x1300
  116. #define __LC_PREFIX_SAVE_AREA 0x1318
  117. #define __LC_FP_CREG_SAVE_AREA 0x131C
  118. #define __LC_TODREG_SAVE_AREA 0x1324
  119. #define __LC_CPU_TIMER_SAVE_AREA 0x1328
  120. #define __LC_CLOCK_COMP_SAVE_AREA 0x1331
  121. #define __LC_AREGS_SAVE_AREA 0x1340
  122. #define __LC_CREGS_SAVE_AREA 0x1380
  123. #endif /* __s390x__ */
  124. #ifndef __ASSEMBLY__
  125. #include <asm/processor.h>
  126. #include <linux/types.h>
  127. #include <asm/sigp.h>
  128. void restart_int_handler(void);
  129. void ext_int_handler(void);
  130. void system_call(void);
  131. void pgm_check_handler(void);
  132. void mcck_int_handler(void);
  133. void io_int_handler(void);
  134. struct save_area_s390 {
  135. u32 ext_save;
  136. u64 timer;
  137. u64 clk_cmp;
  138. u8 pad1[24];
  139. u8 psw[8];
  140. u32 pref_reg;
  141. u8 pad2[20];
  142. u32 acc_regs[16];
  143. u64 fp_regs[4];
  144. u32 gp_regs[16];
  145. u32 ctrl_regs[16];
  146. } __attribute__((packed));
  147. struct save_area_s390x {
  148. u64 fp_regs[16];
  149. u64 gp_regs[16];
  150. u8 psw[16];
  151. u8 pad1[8];
  152. u32 pref_reg;
  153. u32 fp_ctrl_reg;
  154. u8 pad2[4];
  155. u32 tod_reg;
  156. u64 timer;
  157. u64 clk_cmp;
  158. u8 pad3[8];
  159. u32 acc_regs[16];
  160. u64 ctrl_regs[16];
  161. } __attribute__((packed));
  162. union save_area {
  163. struct save_area_s390 s390;
  164. struct save_area_s390x s390x;
  165. };
  166. #define SAVE_AREA_BASE_S390 0xd4
  167. #define SAVE_AREA_BASE_S390X 0x1200
  168. #ifndef __s390x__
  169. #define SAVE_AREA_SIZE sizeof(struct save_area_s390)
  170. #define SAVE_AREA_BASE SAVE_AREA_BASE_S390
  171. #else
  172. #define SAVE_AREA_SIZE sizeof(struct save_area_s390x)
  173. #define SAVE_AREA_BASE SAVE_AREA_BASE_S390X
  174. #endif
  175. struct _lowcore
  176. {
  177. #ifndef __s390x__
  178. /* prefix area: defined by architecture */
  179. psw_t restart_psw; /* 0x000 */
  180. __u32 ccw2[4]; /* 0x008 */
  181. psw_t external_old_psw; /* 0x018 */
  182. psw_t svc_old_psw; /* 0x020 */
  183. psw_t program_old_psw; /* 0x028 */
  184. psw_t mcck_old_psw; /* 0x030 */
  185. psw_t io_old_psw; /* 0x038 */
  186. __u8 pad1[0x58-0x40]; /* 0x040 */
  187. psw_t external_new_psw; /* 0x058 */
  188. psw_t svc_new_psw; /* 0x060 */
  189. psw_t program_new_psw; /* 0x068 */
  190. psw_t mcck_new_psw; /* 0x070 */
  191. psw_t io_new_psw; /* 0x078 */
  192. __u32 ext_params; /* 0x080 */
  193. __u16 cpu_addr; /* 0x084 */
  194. __u16 ext_int_code; /* 0x086 */
  195. __u16 svc_ilc; /* 0x088 */
  196. __u16 svc_code; /* 0x08a */
  197. __u16 pgm_ilc; /* 0x08c */
  198. __u16 pgm_code; /* 0x08e */
  199. __u32 trans_exc_code; /* 0x090 */
  200. __u16 mon_class_num; /* 0x094 */
  201. __u16 per_perc_atmid; /* 0x096 */
  202. __u32 per_address; /* 0x098 */
  203. __u32 monitor_code; /* 0x09c */
  204. __u8 exc_access_id; /* 0x0a0 */
  205. __u8 per_access_id; /* 0x0a1 */
  206. __u8 pad2[0xB8-0xA2]; /* 0x0a2 */
  207. __u16 subchannel_id; /* 0x0b8 */
  208. __u16 subchannel_nr; /* 0x0ba */
  209. __u32 io_int_parm; /* 0x0bc */
  210. __u32 io_int_word; /* 0x0c0 */
  211. __u8 pad3[0xc8-0xc4]; /* 0x0c4 */
  212. __u32 stfl_fac_list; /* 0x0c8 */
  213. __u8 pad4[0xd4-0xcc]; /* 0x0cc */
  214. __u32 extended_save_area_addr; /* 0x0d4 */
  215. __u32 cpu_timer_save_area[2]; /* 0x0d8 */
  216. __u32 clock_comp_save_area[2]; /* 0x0e0 */
  217. __u32 mcck_interruption_code[2]; /* 0x0e8 */
  218. __u8 pad5[0xf4-0xf0]; /* 0x0f0 */
  219. __u32 external_damage_code; /* 0x0f4 */
  220. __u32 failing_storage_address; /* 0x0f8 */
  221. __u8 pad6[0x100-0xfc]; /* 0x0fc */
  222. __u32 st_status_fixed_logout[4];/* 0x100 */
  223. __u8 pad7[0x120-0x110]; /* 0x110 */
  224. __u32 access_regs_save_area[16];/* 0x120 */
  225. __u32 floating_pt_save_area[8]; /* 0x160 */
  226. __u32 gpregs_save_area[16]; /* 0x180 */
  227. __u32 cregs_save_area[16]; /* 0x1c0 */
  228. psw_t return_psw; /* 0x200 */
  229. __u8 irb[64]; /* 0x208 */
  230. __u64 sync_enter_timer; /* 0x248 */
  231. __u64 async_enter_timer; /* 0x250 */
  232. __u64 exit_timer; /* 0x258 */
  233. __u64 last_update_timer; /* 0x260 */
  234. __u64 user_timer; /* 0x268 */
  235. __u64 system_timer; /* 0x270 */
  236. __u64 last_update_clock; /* 0x278 */
  237. __u64 steal_clock; /* 0x280 */
  238. psw_t return_mcck_psw; /* 0x288 */
  239. __u8 pad8[0xc00-0x290]; /* 0x290 */
  240. /* System info area */
  241. __u32 save_area[16]; /* 0xc00 */
  242. __u32 kernel_stack; /* 0xc40 */
  243. __u32 thread_info; /* 0xc44 */
  244. __u32 async_stack; /* 0xc48 */
  245. __u32 kernel_asce; /* 0xc4c */
  246. __u32 user_asce; /* 0xc50 */
  247. __u32 panic_stack; /* 0xc54 */
  248. __u32 user_exec_asce; /* 0xc58 */
  249. __u8 pad10[0xc60-0xc5c]; /* 0xc5c */
  250. /* entry.S sensitive area start */
  251. struct cpuinfo_S390 cpu_data; /* 0xc60 */
  252. __u32 ipl_device; /* 0xc7c */
  253. /* entry.S sensitive area end */
  254. /* SMP info area: defined by DJB */
  255. __u64 clock_comparator; /* 0xc80 */
  256. __u32 ext_call_fast; /* 0xc88 */
  257. __u32 percpu_offset; /* 0xc8c */
  258. __u32 current_task; /* 0xc90 */
  259. __u32 softirq_pending; /* 0xc94 */
  260. __u64 int_clock; /* 0xc98 */
  261. __u8 pad11[0xe00-0xca0]; /* 0xca0 */
  262. /* 0xe00 is used as indicator for dump tools */
  263. /* whether the kernel died with panic() or not */
  264. __u32 panic_magic; /* 0xe00 */
  265. /* Align to the top 1k of prefix area */
  266. __u8 pad12[0x1000-0xe04]; /* 0xe04 */
  267. #else /* !__s390x__ */
  268. /* prefix area: defined by architecture */
  269. __u32 ccw1[2]; /* 0x000 */
  270. __u32 ccw2[4]; /* 0x008 */
  271. __u8 pad1[0x80-0x18]; /* 0x018 */
  272. __u32 ext_params; /* 0x080 */
  273. __u16 cpu_addr; /* 0x084 */
  274. __u16 ext_int_code; /* 0x086 */
  275. __u16 svc_ilc; /* 0x088 */
  276. __u16 svc_code; /* 0x08a */
  277. __u16 pgm_ilc; /* 0x08c */
  278. __u16 pgm_code; /* 0x08e */
  279. __u32 data_exc_code; /* 0x090 */
  280. __u16 mon_class_num; /* 0x094 */
  281. __u16 per_perc_atmid; /* 0x096 */
  282. addr_t per_address; /* 0x098 */
  283. __u8 exc_access_id; /* 0x0a0 */
  284. __u8 per_access_id; /* 0x0a1 */
  285. __u8 op_access_id; /* 0x0a2 */
  286. __u8 ar_access_id; /* 0x0a3 */
  287. __u8 pad2[0xA8-0xA4]; /* 0x0a4 */
  288. addr_t trans_exc_code; /* 0x0A0 */
  289. addr_t monitor_code; /* 0x09c */
  290. __u16 subchannel_id; /* 0x0b8 */
  291. __u16 subchannel_nr; /* 0x0ba */
  292. __u32 io_int_parm; /* 0x0bc */
  293. __u32 io_int_word; /* 0x0c0 */
  294. __u8 pad3[0xc8-0xc4]; /* 0x0c4 */
  295. __u32 stfl_fac_list; /* 0x0c8 */
  296. __u8 pad4[0xe8-0xcc]; /* 0x0cc */
  297. __u32 mcck_interruption_code[2]; /* 0x0e8 */
  298. __u8 pad5[0xf4-0xf0]; /* 0x0f0 */
  299. __u32 external_damage_code; /* 0x0f4 */
  300. addr_t failing_storage_address; /* 0x0f8 */
  301. __u8 pad6[0x120-0x100]; /* 0x100 */
  302. psw_t restart_old_psw; /* 0x120 */
  303. psw_t external_old_psw; /* 0x130 */
  304. psw_t svc_old_psw; /* 0x140 */
  305. psw_t program_old_psw; /* 0x150 */
  306. psw_t mcck_old_psw; /* 0x160 */
  307. psw_t io_old_psw; /* 0x170 */
  308. __u8 pad7[0x1a0-0x180]; /* 0x180 */
  309. psw_t restart_psw; /* 0x1a0 */
  310. psw_t external_new_psw; /* 0x1b0 */
  311. psw_t svc_new_psw; /* 0x1c0 */
  312. psw_t program_new_psw; /* 0x1d0 */
  313. psw_t mcck_new_psw; /* 0x1e0 */
  314. psw_t io_new_psw; /* 0x1f0 */
  315. psw_t return_psw; /* 0x200 */
  316. __u8 irb[64]; /* 0x210 */
  317. __u64 sync_enter_timer; /* 0x250 */
  318. __u64 async_enter_timer; /* 0x258 */
  319. __u64 exit_timer; /* 0x260 */
  320. __u64 last_update_timer; /* 0x268 */
  321. __u64 user_timer; /* 0x270 */
  322. __u64 system_timer; /* 0x278 */
  323. __u64 last_update_clock; /* 0x280 */
  324. __u64 steal_clock; /* 0x288 */
  325. psw_t return_mcck_psw; /* 0x290 */
  326. __u8 pad8[0xc00-0x2a0]; /* 0x2a0 */
  327. /* System info area */
  328. __u64 save_area[16]; /* 0xc00 */
  329. __u8 pad9[0xd40-0xc80]; /* 0xc80 */
  330. __u64 kernel_stack; /* 0xd40 */
  331. __u64 thread_info; /* 0xd48 */
  332. __u64 async_stack; /* 0xd50 */
  333. __u64 kernel_asce; /* 0xd58 */
  334. __u64 user_asce; /* 0xd60 */
  335. __u64 panic_stack; /* 0xd68 */
  336. __u64 user_exec_asce; /* 0xd70 */
  337. __u8 pad10[0xd80-0xd78]; /* 0xd78 */
  338. /* entry.S sensitive area start */
  339. struct cpuinfo_S390 cpu_data; /* 0xd80 */
  340. __u32 ipl_device; /* 0xdb8 */
  341. __u32 pad11; /* 0xdbc */
  342. /* entry.S sensitive area end */
  343. /* SMP info area: defined by DJB */
  344. __u64 clock_comparator; /* 0xdc0 */
  345. __u64 ext_call_fast; /* 0xdc8 */
  346. __u64 percpu_offset; /* 0xdd0 */
  347. __u64 current_task; /* 0xdd8 */
  348. __u32 softirq_pending; /* 0xde0 */
  349. __u32 pad_0x0de4; /* 0xde4 */
  350. __u64 int_clock; /* 0xde8 */
  351. __u8 pad12[0xe00-0xdf0]; /* 0xdf0 */
  352. /* 0xe00 is used as indicator for dump tools */
  353. /* whether the kernel died with panic() or not */
  354. __u32 panic_magic; /* 0xe00 */
  355. __u8 pad13[0x11b8-0xe04]; /* 0xe04 */
  356. /* 64 bit extparam used for pfault, diag 250 etc */
  357. __u64 ext_params2; /* 0x11B8 */
  358. __u8 pad14[0x1200-0x11C0]; /* 0x11C0 */
  359. /* System info area */
  360. __u64 floating_pt_save_area[16]; /* 0x1200 */
  361. __u64 gpregs_save_area[16]; /* 0x1280 */
  362. __u32 st_status_fixed_logout[4]; /* 0x1300 */
  363. __u8 pad15[0x1318-0x1310]; /* 0x1310 */
  364. __u32 prefixreg_save_area; /* 0x1318 */
  365. __u32 fpt_creg_save_area; /* 0x131c */
  366. __u8 pad16[0x1324-0x1320]; /* 0x1320 */
  367. __u32 tod_progreg_save_area; /* 0x1324 */
  368. __u32 cpu_timer_save_area[2]; /* 0x1328 */
  369. __u32 clock_comp_save_area[2]; /* 0x1330 */
  370. __u8 pad17[0x1340-0x1338]; /* 0x1338 */
  371. __u32 access_regs_save_area[16]; /* 0x1340 */
  372. __u64 cregs_save_area[16]; /* 0x1380 */
  373. /* align to the top of the prefix area */
  374. __u8 pad18[0x2000-0x1400]; /* 0x1400 */
  375. #endif /* !__s390x__ */
  376. } __attribute__((packed)); /* End structure*/
  377. #define S390_lowcore (*((struct _lowcore *) 0))
  378. extern struct _lowcore *lowcore_ptr[];
  379. static inline void set_prefix(__u32 address)
  380. {
  381. asm volatile("spx %0" : : "m" (address) : "memory");
  382. }
  383. static inline __u32 store_prefix(void)
  384. {
  385. __u32 address;
  386. asm volatile("stpx %0" : "=m" (address));
  387. return address;
  388. }
  389. #define __PANIC_MAGIC 0xDEADC0DE
  390. #endif
  391. #endif