^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) * On sparc, thread_info data is static and TI_XXX offsets are computed by hand.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/mm_types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) // #include <linux/mm.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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/hibernate.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #ifdef CONFIG_SPARC32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) int sparc32_foo(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) DEFINE(AOFF_thread_fork_kpsr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) offsetof(struct thread_struct, fork_kpsr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) int sparc64_foo(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #ifdef CONFIG_HIBERNATION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) BLANK();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) OFFSET(SC_REG_FP, saved_context, fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) OFFSET(SC_REG_CWP, saved_context, cwp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) OFFSET(SC_REG_WSTATE, saved_context, wstate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) OFFSET(SC_REG_TICK, saved_context, tick);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) OFFSET(SC_REG_PSTATE, saved_context, pstate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) OFFSET(SC_REG_G4, saved_context, g4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) OFFSET(SC_REG_G5, saved_context, g5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) OFFSET(SC_REG_G6, saved_context, g6);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int foo(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) BLANK();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) BLANK();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) BLANK();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)