Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/arch/sparc/kernel/asm-offsets.c
29281 views
1
// SPDX-License-Identifier: GPL-2.0
2
/*
3
* This program is used to generate definitions needed by
4
* assembly language modules.
5
*
6
* We use the technique used in the OSF Mach kernel code:
7
* generate asm statements containing #defines,
8
* compile this file to assembler, and then extract the
9
* #defines from the assembly-language output.
10
*
11
* On sparc, thread_info data is static and TI_XXX offsets are computed by hand.
12
*/
13
#define COMPILE_OFFSETS
14
15
#include <linux/sched.h>
16
#include <linux/mm_types.h>
17
// #include <linux/mm.h>
18
#include <linux/kbuild.h>
19
20
#include <asm/hibernate.h>
21
22
#ifdef CONFIG_SPARC32
23
static int __used sparc32_foo(void)
24
{
25
DEFINE(AOFF_thread_fork_kpsr,
26
offsetof(struct thread_struct, fork_kpsr));
27
return 0;
28
}
29
#else
30
static int __used sparc64_foo(void)
31
{
32
#ifdef CONFIG_HIBERNATION
33
BLANK();
34
OFFSET(SC_REG_FP, saved_context, fp);
35
OFFSET(SC_REG_CWP, saved_context, cwp);
36
OFFSET(SC_REG_WSTATE, saved_context, wstate);
37
38
OFFSET(SC_REG_TICK, saved_context, tick);
39
OFFSET(SC_REG_PSTATE, saved_context, pstate);
40
41
OFFSET(SC_REG_G4, saved_context, g4);
42
OFFSET(SC_REG_G5, saved_context, g5);
43
OFFSET(SC_REG_G6, saved_context, g6);
44
#endif
45
return 0;
46
}
47
#endif
48
49
static int __used foo(void)
50
{
51
BLANK();
52
DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread));
53
BLANK();
54
DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context));
55
BLANK();
56
DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm));
57
58
/* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */
59
return 0;
60
}
61
62
63