OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [ppc/] [kernel/] [mk_defs.c] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1624 jcastillo
/*
2
 * This program is used to generate definitions needed by
3
 * assembly language modules.
4
 */
5
#define MK_DEFS
6
#include <stdio.h> 
7
 
8
#include <linux/signal.h>
9
#include <linux/sched.h>
10
#include <linux/head.h>
11
#include <linux/kernel.h>
12
#include <linux/errno.h>
13
#include <linux/string.h>
14
#include <linux/types.h>
15
#include <linux/ptrace.h>
16
#include <linux/mman.h>
17
#include <linux/mm.h>
18
#include <asm/pgtable.h>
19
 
20
extern int errno;
21
 
22
main(int argc, char *argv[])
23
{
24
        FILE *out;
25
        struct task_struct task;
26
        struct thread_struct tss;
27
        struct pt_regs regs;
28
        if (!(out = fopen(argv[1], "w")))
29
        {
30
                fprintf(stderr, "Can't create output file: %s\n", strerror(errno));
31
                exit(1);
32
        }
33
        fprintf(out, "/*\n");
34
        fprintf(out, " * WARNING! This file is automatically generated - DO NOT EDIT!\n");
35
        fprintf(out, " */\n");
36
        put_line(out, "STATE", (int)&task.state-(int)&task);
37
        put_line(out, "COUNTER", (int)&task.counter-(int)&task);
38
        put_line(out, "BLOCKED", (int)&task.blocked-(int)&task);
39
        put_line(out, "SIGNAL", (int)&task.signal-(int)&task);
40
        put_line(out, "KERNEL_STACK_PAGE", (int)&task.kernel_stack_page-(int)&task);
41
        put_line(out, "TSS", (int)&task.tss-(int)&task);
42
        put_line(out, "KSP", (int)&tss.ksp-(int)&tss);
43
        put_line(out, "LAST_PC", (int)&tss.last_pc-(int)&tss);
44
        put_line(out, "USER_STACK", (int)&tss.user_stack-(int)&tss);
45
        put_line(out, "PT_REGS", (int)&tss.regs-(int)&tss);
46
        put_line(out, "PF_TRACESYS", PF_TRACESYS);
47
        put_line(out, "TASK_FLAGS", (int)&task.flags-(int)&task);
48
        put_line(out, "MMU_SEG0", (int)&tss.segs[0]-(int)&tss);
49
        put_line(out, "MMU_SEG1", (int)&tss.segs[1]-(int)&tss);
50
        put_line(out, "MMU_SEG2", (int)&tss.segs[2]-(int)&tss);
51
        put_line(out, "MMU_SEG3", (int)&tss.segs[3]-(int)&tss);
52
        put_line(out, "MMU_SEG4", (int)&tss.segs[4]-(int)&tss);
53
        put_line(out, "MMU_SEG5", (int)&tss.segs[5]-(int)&tss);
54
        put_line(out, "MMU_SEG6", (int)&tss.segs[6]-(int)&tss);
55
        put_line(out, "MMU_SEG7", (int)&tss.segs[7]-(int)&tss);
56
        put_line(out, "MMU_SEG8", (int)&tss.segs[8]-(int)&tss);
57
        put_line(out, "MMU_SEG9", (int)&tss.segs[9]-(int)&tss);
58
        put_line(out, "MMU_SEG10", (int)&tss.segs[10]-(int)&tss);
59
        put_line(out, "MMU_SEG11", (int)&tss.segs[11]-(int)&tss);
60
        put_line(out, "MMU_SEG12", (int)&tss.segs[12]-(int)&tss);
61
        put_line(out, "MMU_SEG13", (int)&tss.segs[13]-(int)&tss);
62
        put_line(out, "MMU_SEG14", (int)&tss.segs[14]-(int)&tss);
63
        put_line(out, "MMU_SEG15", (int)&tss.segs[15]-(int)&tss);
64
        put_line(out, "TSS_FPR0", (int)&tss.fpr[0]-(int)&tss);
65
        put_line(out, "TSS_FPR1", (int)&tss.fpr[1]-(int)&tss);
66
        put_line(out, "TSS_FPR2", (int)&tss.fpr[2]-(int)&tss);
67
        put_line(out, "TSS_FPR3", (int)&tss.fpr[3]-(int)&tss);
68
        put_line(out, "TSS_FPR4", (int)&tss.fpr[4]-(int)&tss);
69
        put_line(out, "TSS_FPR5", (int)&tss.fpr[5]-(int)&tss);
70
        put_line(out, "TSS_FPR6", (int)&tss.fpr[6]-(int)&tss);
71
        put_line(out, "TSS_FPR7", (int)&tss.fpr[7]-(int)&tss);
72
        put_line(out, "TSS_FPR8", (int)&tss.fpr[8]-(int)&tss);
73
        put_line(out, "TSS_FPR9", (int)&tss.fpr[9]-(int)&tss);
74
        put_line(out, "TSS_FPR10", (int)&tss.fpr[10]-(int)&tss);
75
        put_line(out, "TSS_FPR11", (int)&tss.fpr[11]-(int)&tss);
76
        put_line(out, "TSS_FPR12", (int)&tss.fpr[12]-(int)&tss);
77
        put_line(out, "TSS_FPR13", (int)&tss.fpr[13]-(int)&tss);
78
        put_line(out, "TSS_FPR14", (int)&tss.fpr[14]-(int)&tss);
79
        put_line(out, "TSS_FPR15", (int)&tss.fpr[15]-(int)&tss);
80
        put_line(out, "TSS_FPR16", (int)&tss.fpr[16]-(int)&tss);
81
        put_line(out, "TSS_FPR17", (int)&tss.fpr[17]-(int)&tss);
82
        put_line(out, "TSS_FPR18", (int)&tss.fpr[18]-(int)&tss);
83
        put_line(out, "TSS_FPR19", (int)&tss.fpr[19]-(int)&tss);
84
        put_line(out, "TSS_FPR20", (int)&tss.fpr[20]-(int)&tss);
85
        put_line(out, "TSS_FPR21", (int)&tss.fpr[21]-(int)&tss);
86
        put_line(out, "TSS_FPR22", (int)&tss.fpr[22]-(int)&tss);
87
        put_line(out, "TSS_FPR23", (int)&tss.fpr[23]-(int)&tss);
88
        put_line(out, "TSS_FPR24", (int)&tss.fpr[24]-(int)&tss);
89
        put_line(out, "TSS_FPR25", (int)&tss.fpr[25]-(int)&tss);
90
        put_line(out, "TSS_FPR26", (int)&tss.fpr[26]-(int)&tss);
91
        put_line(out, "TSS_FPR27", (int)&tss.fpr[27]-(int)&tss);
92
        put_line(out, "TSS_FPR28", (int)&tss.fpr[28]-(int)&tss);
93
        put_line(out, "TSS_FPR29", (int)&tss.fpr[29]-(int)&tss);
94
        put_line(out, "TSS_FPR30", (int)&tss.fpr[30]-(int)&tss);
95
        put_line(out, "TSS_FPR31", (int)&tss.fpr[31]-(int)&tss);
96
        /* Interrupt register frame */
97
        put_line(out, "INT_FRAME_SIZE", sizeof(regs));
98
        put_line(out, "GPR0", (int)&regs.gpr[0]-(int)&regs);
99
        put_line(out, "GPR1", (int)&regs.gpr[1]-(int)&regs);
100
        put_line(out, "GPR2", (int)&regs.gpr[2]-(int)&regs);
101
        put_line(out, "GPR3", (int)&regs.gpr[3]-(int)&regs);
102
        put_line(out, "GPR4", (int)&regs.gpr[4]-(int)&regs);
103
        put_line(out, "GPR5", (int)&regs.gpr[5]-(int)&regs);
104
        put_line(out, "GPR6", (int)&regs.gpr[6]-(int)&regs);
105
        put_line(out, "GPR7", (int)&regs.gpr[7]-(int)&regs);
106
        put_line(out, "GPR8", (int)&regs.gpr[8]-(int)&regs);
107
        put_line(out, "GPR9", (int)&regs.gpr[9]-(int)&regs);
108
        put_line(out, "GPR10", (int)&regs.gpr[10]-(int)&regs);
109
        put_line(out, "GPR11", (int)&regs.gpr[11]-(int)&regs);
110
        put_line(out, "GPR12", (int)&regs.gpr[12]-(int)&regs);
111
        put_line(out, "GPR13", (int)&regs.gpr[13]-(int)&regs);
112
        put_line(out, "GPR14", (int)&regs.gpr[14]-(int)&regs);
113
        put_line(out, "GPR15", (int)&regs.gpr[15]-(int)&regs);
114
        put_line(out, "GPR16", (int)&regs.gpr[16]-(int)&regs);
115
        put_line(out, "GPR17", (int)&regs.gpr[17]-(int)&regs);
116
        put_line(out, "GPR18", (int)&regs.gpr[18]-(int)&regs);
117
        put_line(out, "GPR19", (int)&regs.gpr[19]-(int)&regs);
118
        put_line(out, "GPR20", (int)&regs.gpr[20]-(int)&regs);
119
        put_line(out, "GPR21", (int)&regs.gpr[21]-(int)&regs);
120
        put_line(out, "GPR22", (int)&regs.gpr[22]-(int)&regs);
121
        put_line(out, "GPR23", (int)&regs.gpr[23]-(int)&regs);
122
        put_line(out, "GPR24", (int)&regs.gpr[24]-(int)&regs);
123
        put_line(out, "GPR25", (int)&regs.gpr[25]-(int)&regs);
124
        put_line(out, "GPR26", (int)&regs.gpr[26]-(int)&regs);
125
        put_line(out, "GPR27", (int)&regs.gpr[27]-(int)&regs);
126
        put_line(out, "GPR28", (int)&regs.gpr[28]-(int)&regs);
127
        put_line(out, "GPR29", (int)&regs.gpr[29]-(int)&regs);
128
        put_line(out, "GPR30", (int)&regs.gpr[30]-(int)&regs);
129
        put_line(out, "GPR31", (int)&regs.gpr[31]-(int)&regs);
130
        put_line(out, "FPR0", (int)&regs.fpr[0]-(int)&regs);
131
        put_line(out, "FPR1", (int)&regs.fpr[1]-(int)&regs);
132
        put_line(out, "FPR2", (int)&regs.fpr[2]-(int)&regs);
133
        put_line(out, "FPR3", (int)&regs.fpr[3]-(int)&regs);
134
        put_line(out, "FPCSR", (int)&regs.fpcsr-(int)&regs);
135
        /* Note: these symbols include "_" because they overlap with special register names */
136
        put_line(out, "_NIP", (int)&regs.nip-(int)&regs);
137
        put_line(out, "_MSR", (int)&regs.msr-(int)&regs);
138
        put_line(out, "_CTR", (int)&regs.ctr-(int)&regs);
139
        put_line(out, "_LINK", (int)&regs.link-(int)&regs);
140
        put_line(out, "_CCR", (int)&regs.ccr-(int)&regs);
141
        put_line(out, "_XER", (int)&regs.xer-(int)&regs);
142
        put_line(out, "_DAR", (int)&regs.dar-(int)&regs);
143
        put_line(out, "_DSISR", (int)&regs.dsisr-(int)&regs);
144
        put_line(out, "_HASH1", (int)&regs.hash1-(int)&regs);
145
        put_line(out, "_HASH2", (int)&regs.hash2-(int)&regs);
146
        put_line(out, "_IMISS", (int)&regs.imiss-(int)&regs);
147
        put_line(out, "_DMISS", (int)&regs.dmiss-(int)&regs);
148
        put_line(out, "_ICMP", (int)&regs.icmp-(int)&regs);
149
        put_line(out, "_DCMP", (int)&regs.dcmp-(int)&regs);
150
        put_line(out, "ORIG_GPR3", (int)&regs.orig_gpr3-(int)&regs);
151
        put_line(out, "RESULT", (int)&regs.result-(int)&regs);
152
        put_line(out, "TRAP", (int)&regs.trap-(int)&regs);
153
        put_line(out, "MARKER", (int)&regs.marker-(int)&regs);
154
        exit(0);
155
}
156
 
157
put_line(FILE *out, char *name, int offset)
158
{
159
        fprintf(out, "#define %s %d\n", name, offset);
160
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.