aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-i386/util
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/sys-i386/util
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/um/sys-i386/util')
-rw-r--r--arch/um/sys-i386/util/Makefile8
-rw-r--r--arch/um/sys-i386/util/mk_sc.c52
-rw-r--r--arch/um/sys-i386/util/mk_thread_kern.c22
-rw-r--r--arch/um/sys-i386/util/mk_thread_user.c30
4 files changed, 112 insertions, 0 deletions
diff --git a/arch/um/sys-i386/util/Makefile b/arch/um/sys-i386/util/Makefile
new file mode 100644
index 000000000000..34860f9ca7b0
--- /dev/null
+++ b/arch/um/sys-i386/util/Makefile
@@ -0,0 +1,8 @@
1
2hostprogs-y := mk_sc mk_thread
3always := $(hostprogs-y)
4
5mk_thread-objs := mk_thread_kern.o mk_thread_user.o
6
7HOSTCFLAGS_mk_thread_kern.o := $(CFLAGS) $(CPPFLAGS)
8HOSTCFLAGS_mk_thread_user.o := $(USER_CFLAGS)
diff --git a/arch/um/sys-i386/util/mk_sc.c b/arch/um/sys-i386/util/mk_sc.c
new file mode 100644
index 000000000000..85cbd30396f7
--- /dev/null
+++ b/arch/um/sys-i386/util/mk_sc.c
@@ -0,0 +1,52 @@
1#include <stdio.h>
2#include <signal.h>
3#include <linux/stddef.h>
4
5#define SC_OFFSET(name, field) \
6 printf("#define " name "(sc) *((unsigned long *) &(((char *) (sc))[%d]))\n",\
7 offsetof(struct sigcontext, field))
8
9#define SC_FP_OFFSET(name, field) \
10 printf("#define " name \
11 "(sc) *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\
12 offsetof(struct _fpstate, field))
13
14#define SC_FP_OFFSET_PTR(name, field, type) \
15 printf("#define " name \
16 "(sc) ((" type " *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\
17 offsetof(struct _fpstate, field))
18
19int main(int argc, char **argv)
20{
21 SC_OFFSET("SC_IP", eip);
22 SC_OFFSET("SC_SP", esp);
23 SC_OFFSET("SC_FS", fs);
24 SC_OFFSET("SC_GS", gs);
25 SC_OFFSET("SC_DS", ds);
26 SC_OFFSET("SC_ES", es);
27 SC_OFFSET("SC_SS", ss);
28 SC_OFFSET("SC_CS", cs);
29 SC_OFFSET("SC_EFLAGS", eflags);
30 SC_OFFSET("SC_EAX", eax);
31 SC_OFFSET("SC_EBX", ebx);
32 SC_OFFSET("SC_ECX", ecx);
33 SC_OFFSET("SC_EDX", edx);
34 SC_OFFSET("SC_EDI", edi);
35 SC_OFFSET("SC_ESI", esi);
36 SC_OFFSET("SC_EBP", ebp);
37 SC_OFFSET("SC_TRAPNO", trapno);
38 SC_OFFSET("SC_ERR", err);
39 SC_OFFSET("SC_CR2", cr2);
40 SC_OFFSET("SC_FPSTATE", fpstate);
41 SC_OFFSET("SC_SIGMASK", oldmask);
42 SC_FP_OFFSET("SC_FP_CW", cw);
43 SC_FP_OFFSET("SC_FP_SW", sw);
44 SC_FP_OFFSET("SC_FP_TAG", tag);
45 SC_FP_OFFSET("SC_FP_IPOFF", ipoff);
46 SC_FP_OFFSET("SC_FP_CSSEL", cssel);
47 SC_FP_OFFSET("SC_FP_DATAOFF", dataoff);
48 SC_FP_OFFSET("SC_FP_DATASEL", datasel);
49 SC_FP_OFFSET_PTR("SC_FP_ST", _st, "struct _fpstate");
50 SC_FP_OFFSET_PTR("SC_FXSR_ENV", _fxsr_env, "void");
51 return(0);
52}
diff --git a/arch/um/sys-i386/util/mk_thread_kern.c b/arch/um/sys-i386/util/mk_thread_kern.c
new file mode 100644
index 000000000000..948b1ce85230
--- /dev/null
+++ b/arch/um/sys-i386/util/mk_thread_kern.c
@@ -0,0 +1,22 @@
1#include "linux/config.h"
2#include "linux/stddef.h"
3#include "linux/sched.h"
4
5extern void print_head(void);
6extern void print_constant_ptr(char *name, int value);
7extern void print_constant(char *name, char *type, int value);
8extern void print_tail(void);
9
10#define THREAD_OFFSET(field) offsetof(struct task_struct, thread.field)
11
12int main(int argc, char **argv)
13{
14 print_head();
15 print_constant_ptr("TASK_DEBUGREGS", THREAD_OFFSET(arch.debugregs));
16#ifdef CONFIG_MODE_TT
17 print_constant("TASK_EXTERN_PID", "int", THREAD_OFFSET(mode.tt.extern_pid));
18#endif
19 print_tail();
20 return(0);
21}
22
diff --git a/arch/um/sys-i386/util/mk_thread_user.c b/arch/um/sys-i386/util/mk_thread_user.c
new file mode 100644
index 000000000000..2620cd6aa1f1
--- /dev/null
+++ b/arch/um/sys-i386/util/mk_thread_user.c
@@ -0,0 +1,30 @@
1#include <stdio.h>
2
3void print_head(void)
4{
5 printf("/*\n");
6 printf(" * Generated by mk_thread\n");
7 printf(" */\n");
8 printf("\n");
9 printf("#ifndef __UM_THREAD_H\n");
10 printf("#define __UM_THREAD_H\n");
11 printf("\n");
12}
13
14void print_constant_ptr(char *name, int value)
15{
16 printf("#define %s(task) ((unsigned long *) "
17 "&(((char *) (task))[%d]))\n", name, value);
18}
19
20void print_constant(char *name, char *type, int value)
21{
22 printf("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n", name, type,
23 value);
24}
25
26void print_tail(void)
27{
28 printf("\n");
29 printf("#endif\n");
30}