summaryrefslogtreecommitdiff
path: root/arch/frv/kernel/asm-offsets.c
blob: 0a468e9b51add897d2307582b4a8c910952d1bab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// 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.
 */

#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/personality.h>
#include <linux/kbuild.h>
#include <asm/registers.h>
#include <asm/ucontext.h>
#include <asm/processor.h>
#include <asm/thread_info.h>
#include <asm/gdb-stub.h>

#define DEF_PTREG(sym, reg) OFFSET(sym, pt_regs, reg)
#define DEF_IREG(sym, reg) OFFSET(sym, user_context, reg)
#define DEF_FREG(sym, reg) OFFSET(sym, user_context, reg)
#define DEF_0REG(sym, reg) OFFSET(sym, frv_frame0, reg)

void foo(void)
{
	/* offsets into the thread_info structure */
	OFFSET(TI_TASK,			thread_info, task);
	OFFSET(TI_FLAGS,		thread_info, flags);
	OFFSET(TI_STATUS,		thread_info, status);
	OFFSET(TI_CPU,			thread_info, cpu);
	OFFSET(TI_PREEMPT_COUNT,	thread_info, preempt_count);
	OFFSET(TI_ADDR_LIMIT,		thread_info, addr_limit);
	BLANK();

	/* offsets into register file storage */
	DEF_PTREG(REG_PSR,		psr);
	DEF_PTREG(REG_ISR,		isr);
	DEF_PTREG(REG_CCR,		ccr);
	DEF_PTREG(REG_CCCR,		cccr);
	DEF_PTREG(REG_LR,		lr);
	DEF_PTREG(REG_LCR,		lcr);
	DEF_PTREG(REG_PC,		pc);
	DEF_PTREG(REG__STATUS,		__status);
	DEF_PTREG(REG_SYSCALLNO,	syscallno);
	DEF_PTREG(REG_ORIG_GR8,		orig_gr8);
	DEF_PTREG(REG_GNER0,		gner0);
	DEF_PTREG(REG_GNER1,		gner1);
	DEF_PTREG(REG_IACC0,		iacc0);
	DEF_PTREG(REG_TBR,		tbr);
	DEF_PTREG(REG_GR0,		tbr);
	DEFINE(REG__END,		sizeof(struct pt_regs));
	BLANK();

	DEF_0REG(REG_DCR,		debug.dcr);
	DEF_0REG(REG_IBAR0,		debug.ibar[0]);
	DEF_0REG(REG_DBAR0,		debug.dbar[0]);
	DEF_0REG(REG_DBDR00,		debug.dbdr[0][0]);
	DEF_0REG(REG_DBMR00,		debug.dbmr[0][0]);
	BLANK();

	DEF_IREG(__INT_GR0,		i.gr[0]);
	DEF_FREG(__USER_FPMEDIA,	f);
	DEF_FREG(__FPMEDIA_FR0,		f.fr[0]);
	DEF_FREG(__FPMEDIA_FNER0,	f.fner[0]);
	DEF_FREG(__FPMEDIA_MSR0,	f.msr[0]);
	DEF_FREG(__FPMEDIA_ACC0,	f.acc[0]);
	DEF_FREG(__FPMEDIA_ACCG0,	f.accg[0]);
	DEF_FREG(__FPMEDIA_FSR0,	f.fsr[0]);
	BLANK();

	DEFINE(NR_PT_REGS,		sizeof(struct pt_regs) / 4);
	DEFINE(NR_USER_INT_REGS,	sizeof(struct user_int_regs) / 4);
	DEFINE(NR_USER_FPMEDIA_REGS,	sizeof(struct user_fpmedia_regs) / 4);
	DEFINE(NR_USER_CONTEXT,		sizeof(struct user_context) / 4);
	DEFINE(FRV_FRAME0_SIZE,		sizeof(struct frv_frame0));
	BLANK();

	/* offsets into thread_struct */
	OFFSET(__THREAD_FRAME,		thread_struct, frame);
	OFFSET(__THREAD_CURR,		thread_struct, curr);
	OFFSET(__THREAD_SP,		thread_struct, sp);
	OFFSET(__THREAD_FP,		thread_struct, fp);
	OFFSET(__THREAD_LR,		thread_struct, lr);
	OFFSET(__THREAD_PC,		thread_struct, pc);
	OFFSET(__THREAD_GR16,		thread_struct, gr[0]);
	OFFSET(__THREAD_SCHED_LR,	thread_struct, sched_lr);
	OFFSET(__THREAD_FRAME0,		thread_struct, frame0);
	OFFSET(__THREAD_USER,		thread_struct, user);
	BLANK();

	/* offsets into frv_debug_status */
	OFFSET(DEBUG_BPSR,		frv_debug_status, bpsr);
	OFFSET(DEBUG_DCR,		frv_debug_status, dcr);
	OFFSET(DEBUG_BRR,		frv_debug_status, brr);
	OFFSET(DEBUG_NMAR,		frv_debug_status, nmar);
	BLANK();
}