^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * This program is used to generate definitions needed by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * assembly language modules.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * We use the technique used in the OSF Mach kernel code:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * generate asm statements containing #defines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * compile this file to assembler, and then extract the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * #defines from the assembly-language output.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define ASM_OFFSETS_C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/stddef.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/kernel_stat.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/kbuild.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <asm/bootinfo.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/amigahw.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/font.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int main(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /* offsets into the task struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) DEFINE(TASK_THREAD, offsetof(struct task_struct, thread));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) DEFINE(TASK_MM, offsetof(struct task_struct, mm));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) DEFINE(TASK_STACK, offsetof(struct task_struct, stack));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) /* offsets into the thread struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) DEFINE(THREAD_USP, offsetof(struct thread_struct, usp));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) DEFINE(THREAD_SR, offsetof(struct thread_struct, sr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) DEFINE(THREAD_FS, offsetof(struct thread_struct, fs));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) DEFINE(THREAD_CRP, offsetof(struct thread_struct, crp));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) DEFINE(THREAD_ESP0, offsetof(struct thread_struct, esp0));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) DEFINE(THREAD_FPREG, offsetof(struct thread_struct, fp));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) DEFINE(THREAD_FPCNTL, offsetof(struct thread_struct, fpcntl));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) DEFINE(THREAD_FPSTATE, offsetof(struct thread_struct, fpstate));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /* offsets into the thread_info struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) DEFINE(TINFO_PREEMPT, offsetof(struct thread_info, preempt_count));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) DEFINE(TINFO_FLAGS, offsetof(struct thread_info, flags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) /* offsets into the pt_regs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) DEFINE(PT_OFF_D0, offsetof(struct pt_regs, d0));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) DEFINE(PT_OFF_ORIG_D0, offsetof(struct pt_regs, orig_d0));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) DEFINE(PT_OFF_D1, offsetof(struct pt_regs, d1));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) DEFINE(PT_OFF_D2, offsetof(struct pt_regs, d2));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) DEFINE(PT_OFF_D3, offsetof(struct pt_regs, d3));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) DEFINE(PT_OFF_D4, offsetof(struct pt_regs, d4));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) DEFINE(PT_OFF_D5, offsetof(struct pt_regs, d5));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) DEFINE(PT_OFF_A0, offsetof(struct pt_regs, a0));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) DEFINE(PT_OFF_A1, offsetof(struct pt_regs, a1));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) DEFINE(PT_OFF_A2, offsetof(struct pt_regs, a2));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) DEFINE(PT_OFF_PC, offsetof(struct pt_regs, pc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) DEFINE(PT_OFF_SR, offsetof(struct pt_regs, sr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) /* bitfields are a bit difficult */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #ifdef CONFIG_COLDFIRE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) DEFINE(PT_OFF_FORMATVEC, offsetof(struct pt_regs, sr) - 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) DEFINE(PT_OFF_FORMATVEC, offsetof(struct pt_regs, pc) + 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) /* offsets into the irq_cpustat_t struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) /* signal defines */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) DEFINE(LSIGSEGV, SIGSEGV);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) DEFINE(LSEGV_MAPERR, SEGV_MAPERR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) DEFINE(LSIGTRAP, SIGTRAP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) DEFINE(LTRAP_TRACE, TRAP_TRACE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #ifdef CONFIG_MMU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /* offsets into the bi_record struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) DEFINE(BIR_TAG, offsetof(struct bi_record, tag));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) DEFINE(BIR_SIZE, offsetof(struct bi_record, size));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) DEFINE(BIR_DATA, offsetof(struct bi_record, data));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) /* offsets into the font_desc struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) DEFINE(FONT_DESC_IDX, offsetof(struct font_desc, idx));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) DEFINE(FONT_DESC_NAME, offsetof(struct font_desc, name));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) DEFINE(FONT_DESC_WIDTH, offsetof(struct font_desc, width));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) DEFINE(FONT_DESC_HEIGHT, offsetof(struct font_desc, height));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) DEFINE(FONT_DESC_DATA, offsetof(struct font_desc, data));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) DEFINE(FONT_DESC_PREF, offsetof(struct font_desc, pref));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) /* offsets into the custom struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) DEFINE(CUSTOMBASE, &amiga_custom);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) DEFINE(C_INTENAR, offsetof(struct CUSTOM, intenar));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) DEFINE(C_INTREQR, offsetof(struct CUSTOM, intreqr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) DEFINE(C_INTENA, offsetof(struct CUSTOM, intena));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) DEFINE(C_INTREQ, offsetof(struct CUSTOM, intreq));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) DEFINE(C_SERDATR, offsetof(struct CUSTOM, serdatr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) DEFINE(C_SERDAT, offsetof(struct CUSTOM, serdat));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) DEFINE(C_SERPER, offsetof(struct CUSTOM, serper));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) DEFINE(CIAABASE, &ciaa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) DEFINE(CIABBASE, &ciab);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) DEFINE(C_PRA, offsetof(struct CIA, pra));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) DEFINE(ZTWOBASE, zTwoBase);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /* enum m68k_fixup_type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) DEFINE(M68K_FIXUP_MEMOFFSET, m68k_fixup_memoffset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) }