blob: 48c9af7a76831ea63ef6ef92760df02f15c1188c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Generate definitions needed by assembly language modules.
3 * This code generates raw asm output which is post-processed to extract
4 * and format the required data.
5 */
6
Heiko Carstenscbb870c2010-02-26 22:37:43 +01007#define ASM_OFFSETS_C
8
Christoph Lameter7a88d7a2008-04-29 01:04:09 -07009#include <linux/kbuild.h>
Christian Borntraeger95d38fd2013-05-17 14:41:34 +020010#include <linux/kvm_host.h>
Heiko Carstenscbb870c2010-02-26 22:37:43 +010011#include <linux/sched.h>
Martin Schwidefskyb5f87f12014-10-01 10:57:57 +020012#include <asm/idle.h>
Martin Schwidefskyb0206322008-12-25 13:38:36 +010013#include <asm/vdso.h>
Christian Borntraeger480e5922011-09-20 17:07:28 +020014#include <asm/pgtable.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Martin Schwidefsky987bcda2010-02-26 22:37:31 +010016/*
17 * Make sure that the compiler is new enough. We want a compiler that
18 * is known to work with the "Q" assembler constraint.
19 */
Martin Schwidefskyf318a122014-10-29 12:50:31 +010020#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
21#error Your compiler is too old; please use version 4.3 or newer
Martin Schwidefsky987bcda2010-02-26 22:37:31 +010022#endif
23
Linus Torvalds1da177e2005-04-16 15:20:36 -070024int main(void)
25{
Martin Schwidefsky3827ec32015-07-20 10:01:46 +020026 DEFINE(__TASK_thread_info, offsetof(struct task_struct, stack));
27 DEFINE(__TASK_thread, offsetof(struct task_struct, thread));
Christoph Lameter4ca4d7b2008-04-29 01:04:10 -070028 DEFINE(__TASK_pid, offsetof(struct task_struct, pid));
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 BLANK();
Martin Schwidefsky3827ec32015-07-20 10:01:46 +020030 DEFINE(__THREAD_ksp, offsetof(struct thread_struct, ksp));
Hendrik Bruecknerd0164ee2015-06-29 16:43:06 +020031 DEFINE(__THREAD_FPU_fpc, offsetof(struct thread_struct, fpu.fpc));
32 DEFINE(__THREAD_FPU_flags, offsetof(struct thread_struct, fpu.flags));
33 DEFINE(__THREAD_FPU_regs, offsetof(struct thread_struct, fpu.regs));
Martin Schwidefsky3827ec32015-07-20 10:01:46 +020034 DEFINE(__THREAD_per_cause, offsetof(struct thread_struct, per_event.cause));
35 DEFINE(__THREAD_per_address, offsetof(struct thread_struct, per_event.address));
36 DEFINE(__THREAD_per_paid, offsetof(struct thread_struct, per_event.paid));
37 DEFINE(__THREAD_trap_tdb, offsetof(struct thread_struct, trap_tdb));
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 BLANK();
Christoph Lameter4ca4d7b2008-04-29 01:04:10 -070039 DEFINE(__TI_task, offsetof(struct thread_info, task));
Christoph Lameter4ca4d7b2008-04-29 01:04:10 -070040 DEFINE(__TI_flags, offsetof(struct thread_info, flags));
Martin Schwidefsky61649882013-04-24 12:58:39 +020041 DEFINE(__TI_sysc_table, offsetof(struct thread_info, sys_call_table));
Christoph Lameter4ca4d7b2008-04-29 01:04:10 -070042 DEFINE(__TI_cpu, offsetof(struct thread_info, cpu));
43 DEFINE(__TI_precount, offsetof(struct thread_info, preempt_count));
Martin Schwidefsky5b409ed2009-04-14 15:36:27 +020044 DEFINE(__TI_user_timer, offsetof(struct thread_info, user_timer));
45 DEFINE(__TI_system_timer, offsetof(struct thread_info, system_timer));
Martin Schwidefsky86f25522010-05-17 10:00:05 +020046 DEFINE(__TI_last_break, offsetof(struct thread_info, last_break));
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 BLANK();
Christoph Lameter4ca4d7b2008-04-29 01:04:10 -070048 DEFINE(__PT_ARGS, offsetof(struct pt_regs, args));
49 DEFINE(__PT_PSW, offsetof(struct pt_regs, psw));
50 DEFINE(__PT_GPRS, offsetof(struct pt_regs, gprs));
51 DEFINE(__PT_ORIG_GPR2, offsetof(struct pt_regs, orig_gpr2));
Martin Schwidefskyaa33c8c2011-12-27 11:27:18 +010052 DEFINE(__PT_INT_CODE, offsetof(struct pt_regs, int_code));
Martin Schwidefsky48f6b002013-06-17 14:54:02 +020053 DEFINE(__PT_INT_PARM, offsetof(struct pt_regs, int_parm));
Martin Schwidefskyaa33c8c2011-12-27 11:27:18 +010054 DEFINE(__PT_INT_PARM_LONG, offsetof(struct pt_regs, int_parm_long));
Martin Schwidefskyd3a73ac2014-04-15 12:55:07 +020055 DEFINE(__PT_FLAGS, offsetof(struct pt_regs, flags));
Christoph Lameter4ca4d7b2008-04-29 01:04:10 -070056 DEFINE(__PT_SIZE, sizeof(struct pt_regs));
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 BLANK();
Christoph Lameter4ca4d7b2008-04-29 01:04:10 -070058 DEFINE(__SF_BACKCHAIN, offsetof(struct stack_frame, back_chain));
59 DEFINE(__SF_GPRS, offsetof(struct stack_frame, gprs));
60 DEFINE(__SF_EMPTY, offsetof(struct stack_frame, empty1));
Martin Schwidefskyb0206322008-12-25 13:38:36 +010061 BLANK();
62 /* timeval/timezone offsets for use by vdso */
63 DEFINE(__VDSO_UPD_COUNT, offsetof(struct vdso_data, tb_update_count));
64 DEFINE(__VDSO_XTIME_STAMP, offsetof(struct vdso_data, xtime_tod_stamp));
65 DEFINE(__VDSO_XTIME_SEC, offsetof(struct vdso_data, xtime_clock_sec));
66 DEFINE(__VDSO_XTIME_NSEC, offsetof(struct vdso_data, xtime_clock_nsec));
Martin Schwidefskyb7eacb52014-08-29 12:31:45 +020067 DEFINE(__VDSO_XTIME_CRS_SEC, offsetof(struct vdso_data, xtime_coarse_sec));
68 DEFINE(__VDSO_XTIME_CRS_NSEC, offsetof(struct vdso_data, xtime_coarse_nsec));
Martin Schwidefskyb0206322008-12-25 13:38:36 +010069 DEFINE(__VDSO_WTOM_SEC, offsetof(struct vdso_data, wtom_clock_sec));
70 DEFINE(__VDSO_WTOM_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
Martin Schwidefskyb7eacb52014-08-29 12:31:45 +020071 DEFINE(__VDSO_WTOM_CRS_SEC, offsetof(struct vdso_data, wtom_coarse_sec));
72 DEFINE(__VDSO_WTOM_CRS_NSEC, offsetof(struct vdso_data, wtom_coarse_nsec));
Martin Schwidefskyb0206322008-12-25 13:38:36 +010073 DEFINE(__VDSO_TIMEZONE, offsetof(struct vdso_data, tz_minuteswest));
Martin Schwidefskyc742b312008-12-31 15:11:42 +010074 DEFINE(__VDSO_ECTG_OK, offsetof(struct vdso_data, ectg_available));
Martin Schwidefsky79c74ec2013-11-22 10:04:53 +010075 DEFINE(__VDSO_TK_MULT, offsetof(struct vdso_data, tk_mult));
76 DEFINE(__VDSO_TK_SHIFT, offsetof(struct vdso_data, tk_shift));
Heiko Carstenscbb870c2010-02-26 22:37:43 +010077 DEFINE(__VDSO_ECTG_BASE, offsetof(struct vdso_per_cpu_data, ectg_timer_base));
78 DEFINE(__VDSO_ECTG_USER, offsetof(struct vdso_per_cpu_data, ectg_user_time));
Martin Schwidefskyb0206322008-12-25 13:38:36 +010079 /* constants used by the vdso */
Heiko Carstensb3423982010-10-29 16:50:41 +020080 DEFINE(__CLOCK_REALTIME, CLOCK_REALTIME);
81 DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC);
Martin Schwidefskyb7eacb52014-08-29 12:31:45 +020082 DEFINE(__CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE);
83 DEFINE(__CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC_COARSE);
Martin Schwidefskyb5e64b32013-12-02 14:54:56 +010084 DEFINE(__CLOCK_THREAD_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID);
Heiko Carstensb3423982010-10-29 16:50:41 +020085 DEFINE(__CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
Martin Schwidefskyb7eacb52014-08-29 12:31:45 +020086 DEFINE(__CLOCK_COARSE_RES, LOW_RES_NSEC);
Heiko Carstenscbb870c2010-02-26 22:37:43 +010087 BLANK();
Martin Schwidefsky4c1051e2012-03-11 11:59:27 -040088 /* idle data offsets */
Martin Schwidefsky27f6b412012-07-20 11:15:08 +020089 DEFINE(__CLOCK_IDLE_ENTER, offsetof(struct s390_idle_data, clock_idle_enter));
90 DEFINE(__CLOCK_IDLE_EXIT, offsetof(struct s390_idle_data, clock_idle_exit));
91 DEFINE(__TIMER_IDLE_ENTER, offsetof(struct s390_idle_data, timer_idle_enter));
92 DEFINE(__TIMER_IDLE_EXIT, offsetof(struct s390_idle_data, timer_idle_exit));
Heiko Carstenscbb870c2010-02-26 22:37:43 +010093 /* lowcore offsets */
94 DEFINE(__LC_EXT_PARAMS, offsetof(struct _lowcore, ext_params));
Martin Schwidefsky7e180bd2012-03-11 11:59:25 -040095 DEFINE(__LC_EXT_CPU_ADDR, offsetof(struct _lowcore, ext_cpu_addr));
Heiko Carstenscbb870c2010-02-26 22:37:43 +010096 DEFINE(__LC_EXT_INT_CODE, offsetof(struct _lowcore, ext_int_code));
97 DEFINE(__LC_SVC_ILC, offsetof(struct _lowcore, svc_ilc));
98 DEFINE(__LC_SVC_INT_CODE, offsetof(struct _lowcore, svc_code));
99 DEFINE(__LC_PGM_ILC, offsetof(struct _lowcore, pgm_ilc));
100 DEFINE(__LC_PGM_INT_CODE, offsetof(struct _lowcore, pgm_code));
Martin Schwidefsky1e546222010-10-25 16:10:37 +0200101 DEFINE(__LC_TRANS_EXC_CODE, offsetof(struct _lowcore, trans_exc_code));
Jens Freimannda7cf252014-02-26 17:03:29 +0100102 DEFINE(__LC_MON_CLASS_NR, offsetof(struct _lowcore, mon_class_num));
Jens Freimann21ee7ff2014-02-26 16:32:46 +0100103 DEFINE(__LC_PER_CODE, offsetof(struct _lowcore, per_code));
104 DEFINE(__LC_PER_ATMID, offsetof(struct _lowcore, per_atmid));
Heiko Carstenscbb870c2010-02-26 22:37:43 +0100105 DEFINE(__LC_PER_ADDRESS, offsetof(struct _lowcore, per_address));
Jens Freimannda7cf252014-02-26 17:03:29 +0100106 DEFINE(__LC_EXC_ACCESS_ID, offsetof(struct _lowcore, exc_access_id));
Jens Freimann21ee7ff2014-02-26 16:32:46 +0100107 DEFINE(__LC_PER_ACCESS_ID, offsetof(struct _lowcore, per_access_id));
Jens Freimannda7cf252014-02-26 17:03:29 +0100108 DEFINE(__LC_OP_ACCESS_ID, offsetof(struct _lowcore, op_access_id));
Jens Freimann3d53b462014-02-10 10:55:37 +0100109 DEFINE(__LC_AR_MODE_ID, offsetof(struct _lowcore, ar_mode_id));
Jens Freimannda7cf252014-02-26 17:03:29 +0100110 DEFINE(__LC_MON_CODE, offsetof(struct _lowcore, monitor_code));
Heiko Carstenscbb870c2010-02-26 22:37:43 +0100111 DEFINE(__LC_SUBCHANNEL_ID, offsetof(struct _lowcore, subchannel_id));
112 DEFINE(__LC_SUBCHANNEL_NR, offsetof(struct _lowcore, subchannel_nr));
113 DEFINE(__LC_IO_INT_PARM, offsetof(struct _lowcore, io_int_parm));
114 DEFINE(__LC_IO_INT_WORD, offsetof(struct _lowcore, io_int_word));
115 DEFINE(__LC_STFL_FAC_LIST, offsetof(struct _lowcore, stfl_fac_list));
116 DEFINE(__LC_MCCK_CODE, offsetof(struct _lowcore, mcck_interruption_code));
Jens Freimannda7cf252014-02-26 17:03:29 +0100117 DEFINE(__LC_MCCK_EXT_DAM_CODE, offsetof(struct _lowcore, external_damage_code));
Heiko Carstenscbb870c2010-02-26 22:37:43 +0100118 DEFINE(__LC_RST_OLD_PSW, offsetof(struct _lowcore, restart_old_psw));
119 DEFINE(__LC_EXT_OLD_PSW, offsetof(struct _lowcore, external_old_psw));
120 DEFINE(__LC_SVC_OLD_PSW, offsetof(struct _lowcore, svc_old_psw));
121 DEFINE(__LC_PGM_OLD_PSW, offsetof(struct _lowcore, program_old_psw));
122 DEFINE(__LC_MCK_OLD_PSW, offsetof(struct _lowcore, mcck_old_psw));
123 DEFINE(__LC_IO_OLD_PSW, offsetof(struct _lowcore, io_old_psw));
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -0400124 DEFINE(__LC_RST_NEW_PSW, offsetof(struct _lowcore, restart_psw));
Heiko Carstenscbb870c2010-02-26 22:37:43 +0100125 DEFINE(__LC_EXT_NEW_PSW, offsetof(struct _lowcore, external_new_psw));
126 DEFINE(__LC_SVC_NEW_PSW, offsetof(struct _lowcore, svc_new_psw));
127 DEFINE(__LC_PGM_NEW_PSW, offsetof(struct _lowcore, program_new_psw));
128 DEFINE(__LC_MCK_NEW_PSW, offsetof(struct _lowcore, mcck_new_psw));
129 DEFINE(__LC_IO_NEW_PSW, offsetof(struct _lowcore, io_new_psw));
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -0400130 BLANK();
Martin Schwidefskyc5328902011-12-27 11:27:15 +0100131 DEFINE(__LC_SAVE_AREA_SYNC, offsetof(struct _lowcore, save_area_sync));
132 DEFINE(__LC_SAVE_AREA_ASYNC, offsetof(struct _lowcore, save_area_async));
133 DEFINE(__LC_SAVE_AREA_RESTART, offsetof(struct _lowcore, save_area_restart));
Martin Schwidefskyd3a73ac2014-04-15 12:55:07 +0200134 DEFINE(__LC_CPU_FLAGS, offsetof(struct _lowcore, cpu_flags));
Heiko Carstenscbb870c2010-02-26 22:37:43 +0100135 DEFINE(__LC_RETURN_PSW, offsetof(struct _lowcore, return_psw));
136 DEFINE(__LC_RETURN_MCCK_PSW, offsetof(struct _lowcore, return_mcck_psw));
137 DEFINE(__LC_SYNC_ENTER_TIMER, offsetof(struct _lowcore, sync_enter_timer));
138 DEFINE(__LC_ASYNC_ENTER_TIMER, offsetof(struct _lowcore, async_enter_timer));
Martin Schwidefsky63779812010-05-17 10:00:03 +0200139 DEFINE(__LC_MCCK_ENTER_TIMER, offsetof(struct _lowcore, mcck_enter_timer));
Heiko Carstenscbb870c2010-02-26 22:37:43 +0100140 DEFINE(__LC_EXIT_TIMER, offsetof(struct _lowcore, exit_timer));
141 DEFINE(__LC_USER_TIMER, offsetof(struct _lowcore, user_timer));
142 DEFINE(__LC_SYSTEM_TIMER, offsetof(struct _lowcore, system_timer));
143 DEFINE(__LC_STEAL_TIMER, offsetof(struct _lowcore, steal_timer));
144 DEFINE(__LC_LAST_UPDATE_TIMER, offsetof(struct _lowcore, last_update_timer));
145 DEFINE(__LC_LAST_UPDATE_CLOCK, offsetof(struct _lowcore, last_update_clock));
146 DEFINE(__LC_CURRENT, offsetof(struct _lowcore, current_task));
Heiko Carstensf2db2e62011-05-23 10:24:34 +0200147 DEFINE(__LC_CURRENT_PID, offsetof(struct _lowcore, current_pid));
Heiko Carstenscbb870c2010-02-26 22:37:43 +0100148 DEFINE(__LC_THREAD_INFO, offsetof(struct _lowcore, thread_info));
149 DEFINE(__LC_KERNEL_STACK, offsetof(struct _lowcore, kernel_stack));
150 DEFINE(__LC_ASYNC_STACK, offsetof(struct _lowcore, async_stack));
151 DEFINE(__LC_PANIC_STACK, offsetof(struct _lowcore, panic_stack));
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -0400152 DEFINE(__LC_RESTART_STACK, offsetof(struct _lowcore, restart_stack));
153 DEFINE(__LC_RESTART_FN, offsetof(struct _lowcore, restart_fn));
Heiko Carstensfbe76562012-06-05 09:59:52 +0200154 DEFINE(__LC_RESTART_DATA, offsetof(struct _lowcore, restart_data));
155 DEFINE(__LC_RESTART_SOURCE, offsetof(struct _lowcore, restart_source));
Heiko Carstens457f2182014-03-21 10:42:25 +0100156 DEFINE(__LC_KERNEL_ASCE, offsetof(struct _lowcore, kernel_asce));
Christian Borntraeger480e5922011-09-20 17:07:28 +0200157 DEFINE(__LC_USER_ASCE, offsetof(struct _lowcore, user_asce));
Heiko Carstenscbb870c2010-02-26 22:37:43 +0100158 DEFINE(__LC_INT_CLOCK, offsetof(struct _lowcore, int_clock));
Martin Schwidefsky63779812010-05-17 10:00:03 +0200159 DEFINE(__LC_MCCK_CLOCK, offsetof(struct _lowcore, mcck_clock));
Heiko Carstenscbb870c2010-02-26 22:37:43 +0100160 DEFINE(__LC_MACHINE_FLAGS, offsetof(struct _lowcore, machine_flags));
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -0400161 DEFINE(__LC_DUMP_REIPL, offsetof(struct _lowcore, ipib));
162 BLANK();
Heiko Carstenscbb870c2010-02-26 22:37:43 +0100163 DEFINE(__LC_CPU_TIMER_SAVE_AREA, offsetof(struct _lowcore, cpu_timer_save_area));
164 DEFINE(__LC_CLOCK_COMP_SAVE_AREA, offsetof(struct _lowcore, clock_comp_save_area));
165 DEFINE(__LC_PSW_SAVE_AREA, offsetof(struct _lowcore, psw_save_area));
166 DEFINE(__LC_PREFIX_SAVE_AREA, offsetof(struct _lowcore, prefixreg_save_area));
167 DEFINE(__LC_AREGS_SAVE_AREA, offsetof(struct _lowcore, access_regs_save_area));
168 DEFINE(__LC_FPREGS_SAVE_AREA, offsetof(struct _lowcore, floating_pt_save_area));
169 DEFINE(__LC_GPREGS_SAVE_AREA, offsetof(struct _lowcore, gpregs_save_area));
170 DEFINE(__LC_CREGS_SAVE_AREA, offsetof(struct _lowcore, cregs_save_area));
Jens Freimannda7cf252014-02-26 17:03:29 +0100171 DEFINE(__LC_DATA_EXC_CODE, offsetof(struct _lowcore, data_exc_code));
172 DEFINE(__LC_MCCK_FAIL_STOR_ADDR, offsetof(struct _lowcore, failing_storage_address));
Eric Farmanbc17de72014-04-14 16:01:09 -0400173 DEFINE(__LC_VX_SAVE_AREA_ADDR, offsetof(struct _lowcore, vector_save_area_addr));
Heiko Carstenscbb870c2010-02-26 22:37:43 +0100174 DEFINE(__LC_EXT_PARAMS2, offsetof(struct _lowcore, ext_params2));
175 DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, floating_pt_save_area));
176 DEFINE(__LC_PASTE, offsetof(struct _lowcore, paste));
177 DEFINE(__LC_FP_CREG_SAVE_AREA, offsetof(struct _lowcore, fpt_creg_save_area));
178 DEFINE(__LC_LAST_BREAK, offsetof(struct _lowcore, breaking_event_addr));
179 DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data));
Martin Schwidefskye5992f22011-07-24 10:48:20 +0200180 DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap));
Martin Schwidefskyd35339a2012-07-31 11:03:04 +0200181 DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb));
Christian Borntraeger480e5922011-09-20 17:07:28 +0200182 DEFINE(__GMAP_ASCE, offsetof(struct gmap, asce));
Christian Borntraeger95d38fd2013-05-17 14:41:34 +0200183 DEFINE(__SIE_PROG0C, offsetof(struct kvm_s390_sie_block, prog0c));
Christian Borntraeger49b99e12013-05-17 14:41:35 +0200184 DEFINE(__SIE_PROG20, offsetof(struct kvm_s390_sie_block, prog20));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 return 0;
186}