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