arch/s390/kernel/asm-offsets.c

Source file repositories/reference/linux-study-clean/arch/s390/kernel/asm-offsets.c

File Facts

System
Linux kernel
Corpus path
arch/s390/kernel/asm-offsets.c
Extension
.c
Size
8740 bytes
Lines
196
Domain
Architecture Layer
Bucket
arch/s390
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0
/*
 * Generate definitions needed by assembly language modules.
 * This code generates raw asm output which is post-processed to extract
 * and format the required data.
 */
#define COMPILE_OFFSETS

#include <linux/kbuild.h>
#include <linux/sched.h>
#include <linux/purgatory.h>
#include <linux/pgtable.h>
#include <linux/ftrace_regs.h>
#include <linux/kernel_stat.h>
#include <asm/kvm_host_types.h>
#include <asm/stacktrace.h>
#include <asm/ptrace.h>
#include <asm/idle.h>

int main(void)
{
	/* task struct offsets */
	OFFSET(__TASK_stack, task_struct, stack);
	OFFSET(__TASK_thread, task_struct, thread);
	OFFSET(__TASK_pid, task_struct, pid);
#ifdef CONFIG_STACKPROTECTOR
	OFFSET(__TASK_stack_canary, task_struct, stack_canary);
#endif
	BLANK();
	/* thread struct offsets */
	OFFSET(__THREAD_ksp, thread_struct, ksp);
	BLANK();
	/* thread info offsets */
	OFFSET(__TI_flags, task_struct, thread_info.flags);
	OFFSET(__TI_sie, task_struct, thread_info.sie);
	BLANK();
	/* pt_regs offsets */
	OFFSET(__PT_PSW, pt_regs, psw);
	OFFSET(__PT_GPRS, pt_regs, gprs);
	OFFSET(__PT_R0, pt_regs, gprs[0]);
	OFFSET(__PT_R1, pt_regs, gprs[1]);
	OFFSET(__PT_R2, pt_regs, gprs[2]);
	OFFSET(__PT_R3, pt_regs, gprs[3]);
	OFFSET(__PT_R4, pt_regs, gprs[4]);
	OFFSET(__PT_R5, pt_regs, gprs[5]);
	OFFSET(__PT_R6, pt_regs, gprs[6]);
	OFFSET(__PT_R7, pt_regs, gprs[7]);
	OFFSET(__PT_R8, pt_regs, gprs[8]);
	OFFSET(__PT_R9, pt_regs, gprs[9]);
	OFFSET(__PT_R10, pt_regs, gprs[10]);
	OFFSET(__PT_R11, pt_regs, gprs[11]);
	OFFSET(__PT_R12, pt_regs, gprs[12]);
	OFFSET(__PT_R13, pt_regs, gprs[13]);
	OFFSET(__PT_R14, pt_regs, gprs[14]);
	OFFSET(__PT_R15, pt_regs, gprs[15]);
	OFFSET(__PT_ORIG_GPR2, pt_regs, orig_gpr2);
	OFFSET(__PT_INT_CODE, pt_regs, int_code);
	OFFSET(__PT_FLAGS, pt_regs, flags);
	OFFSET(__PT_LAST_BREAK, pt_regs, last_break);
	DEFINE(__PT_SIZE, sizeof(struct pt_regs));
	BLANK();
	/* stack_frame offsets */
	OFFSET(__SF_BACKCHAIN, stack_frame, back_chain);
	OFFSET(__SF_GPRS, stack_frame, gprs);
	OFFSET(__SF_EMPTY, stack_frame, empty[0]);
	OFFSET(__SF_SIE_CONTROL, stack_frame, sie_control_block);
	OFFSET(__SF_SIE_SAVEAREA, stack_frame, sie_savearea);
	OFFSET(__SF_SIE_RETURN, stack_frame, sie_return);
	OFFSET(__SF_SIE_FLAGS, stack_frame, sie_flags);
	OFFSET(__SF_SIE_CONTROL_PHYS, stack_frame, sie_control_block_phys);
	OFFSET(__SF_SIE_GUEST_ASCE, stack_frame, sie_guest_asce);
	OFFSET(__SF_SIE_IRQ, stack_frame, sie_irq);
	DEFINE(STACK_FRAME_OVERHEAD, sizeof(struct stack_frame));
	BLANK();
	OFFSET(__SFUSER_BACKCHAIN, stack_frame_user, back_chain);
	DEFINE(STACK_FRAME_USER_OVERHEAD, sizeof(struct stack_frame_user));
	OFFSET(__SFVDSO_RETURN_ADDRESS, stack_frame_vdso_wrapper, return_address);
	DEFINE(STACK_FRAME_VDSO_OVERHEAD, sizeof(struct stack_frame_vdso_wrapper));
	BLANK();
	/* hardware defined lowcore locations 0x000 - 0x1ff */
	OFFSET(__LC_EXT_PARAMS, lowcore, ext_params);
	OFFSET(__LC_EXT_CPU_ADDR, lowcore, ext_cpu_addr);
	OFFSET(__LC_EXT_INT_CODE, lowcore, ext_int_code);
	OFFSET(__LC_PGM_ILC, lowcore, pgm_ilc);
	OFFSET(__LC_PGM_CODE, lowcore, pgm_code);
	OFFSET(__LC_PGM_INT_CODE, lowcore, pgm_int_code);
	OFFSET(__LC_DATA_EXC_CODE, lowcore, data_exc_code);
	OFFSET(__LC_MON_CLASS_NR, lowcore, mon_class_num);
	OFFSET(__LC_PER_CODE, lowcore, per_code);
	OFFSET(__LC_PER_ATMID, lowcore, per_atmid);

Annotation

Implementation Notes