1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Generate definitions needed by assembly language modules.
4 * This code generates raw asm output which is post-processed to extract
5 * and format the required data.
6 */
7
8#include <linux/types.h>
9#include <linux/stddef.h>
10#include <linux/sched.h>
11#include <linux/ptrace.h>
12#include <linux/kbuild.h>
13#include <asm/io.h>
14
15void foo(void)
16{
17 DEFINE(TI_TASK, offsetof(struct thread_info, task));
18 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
19 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
20 DEFINE(TI_FP, offsetof(struct thread_info, fp));
21 DEFINE(TI_STATUS, offsetof(struct thread_info, status));
22 BLANK();
23
24 DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked));
25 DEFINE(TASK_CRED, offsetof(struct task_struct, cred));
26 DEFINE(TASK_REAL_PARENT, offsetof(struct task_struct, real_parent));
27 DEFINE(TASK_GROUP_LEADER, offsetof(struct task_struct, group_leader));
28 DEFINE(TASK_TGID, offsetof(struct task_struct, tgid));
29 BLANK();
30
31 DEFINE(CRED_UID, offsetof(struct cred, uid));
32 DEFINE(CRED_EUID, offsetof(struct cred, euid));
33 DEFINE(CRED_GID, offsetof(struct cred, gid));
34 DEFINE(CRED_EGID, offsetof(struct cred, egid));
35 BLANK();
36
37 DEFINE(SIZEOF_PT_REGS, sizeof(struct pt_regs));
38 DEFINE(PT_PTRACED, PT_PTRACED);
39 DEFINE(CLONE_VM, CLONE_VM);
40 DEFINE(CLONE_UNTRACED, CLONE_UNTRACED);
41 DEFINE(SIGCHLD, SIGCHLD);
42 BLANK();
43
44 DEFINE(HAE_CACHE, offsetof(struct alpha_machine_vector, hae_cache));
45 DEFINE(HAE_REG, offsetof(struct alpha_machine_vector, hae_register));
46}
47

source code of linux/arch/alpha/kernel/asm-offsets.c