aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/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/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/util')
-rw-r--r--arch/um/util/Makefile8
-rw-r--r--arch/um/util/mk_constants_kern.c28
-rw-r--r--arch/um/util/mk_constants_user.c28
-rw-r--r--arch/um/util/mk_task_kern.c17
-rw-r--r--arch/um/util/mk_task_user.c30
5 files changed, 111 insertions, 0 deletions
diff --git a/arch/um/util/Makefile b/arch/um/util/Makefile
new file mode 100644
index 000000000000..e2ab71209f3f
--- /dev/null
+++ b/arch/um/util/Makefile
@@ -0,0 +1,8 @@
1hostprogs-y := mk_task mk_constants
2always := $(hostprogs-y)
3
4mk_task-objs := mk_task_user.o mk_task_kern.o
5mk_constants-objs := mk_constants_user.o mk_constants_kern.o
6
7HOSTCFLAGS_mk_task_kern.o := $(CFLAGS) $(CPPFLAGS)
8HOSTCFLAGS_mk_constants_kern.o := $(CFLAGS) $(CPPFLAGS)
diff --git a/arch/um/util/mk_constants_kern.c b/arch/um/util/mk_constants_kern.c
new file mode 100644
index 000000000000..cdcb1232a1ea
--- /dev/null
+++ b/arch/um/util/mk_constants_kern.c
@@ -0,0 +1,28 @@
1#include "linux/kernel.h"
2#include "linux/stringify.h"
3#include "linux/time.h"
4#include "asm/page.h"
5
6extern void print_head(void);
7extern void print_constant_str(char *name, char *value);
8extern void print_constant_int(char *name, int value);
9extern void print_tail(void);
10
11int main(int argc, char **argv)
12{
13 print_head();
14 print_constant_int("UM_KERN_PAGE_SIZE", PAGE_SIZE);
15
16 print_constant_str("UM_KERN_EMERG", KERN_EMERG);
17 print_constant_str("UM_KERN_ALERT", KERN_ALERT);
18 print_constant_str("UM_KERN_CRIT", KERN_CRIT);
19 print_constant_str("UM_KERN_ERR", KERN_ERR);
20 print_constant_str("UM_KERN_WARNING", KERN_WARNING);
21 print_constant_str("UM_KERN_NOTICE", KERN_NOTICE);
22 print_constant_str("UM_KERN_INFO", KERN_INFO);
23 print_constant_str("UM_KERN_DEBUG", KERN_DEBUG);
24
25 print_constant_int("UM_NSEC_PER_SEC", NSEC_PER_SEC);
26 print_tail();
27 return(0);
28}
diff --git a/arch/um/util/mk_constants_user.c b/arch/um/util/mk_constants_user.c
new file mode 100644
index 000000000000..8f4d7e50be7c
--- /dev/null
+++ b/arch/um/util/mk_constants_user.c
@@ -0,0 +1,28 @@
1#include <stdio.h>
2
3void print_head(void)
4{
5 printf("/*\n");
6 printf(" * Generated by mk_constants\n");
7 printf(" */\n");
8 printf("\n");
9 printf("#ifndef __UM_CONSTANTS_H\n");
10 printf("#define __UM_CONSTANTS_H\n");
11 printf("\n");
12}
13
14void print_constant_str(char *name, char *value)
15{
16 printf("#define %s \"%s\"\n", name, value);
17}
18
19void print_constant_int(char *name, int value)
20{
21 printf("#define %s %d\n", name, value);
22}
23
24void print_tail(void)
25{
26 printf("\n");
27 printf("#endif\n");
28}
diff --git a/arch/um/util/mk_task_kern.c b/arch/um/util/mk_task_kern.c
new file mode 100644
index 000000000000..c218103315ed
--- /dev/null
+++ b/arch/um/util/mk_task_kern.c
@@ -0,0 +1,17 @@
1#include "linux/sched.h"
2#include "linux/stddef.h"
3
4extern void print(char *name, char *type, int offset);
5extern void print_ptr(char *name, char *type, int offset);
6extern void print_head(void);
7extern void print_tail(void);
8
9int main(int argc, char **argv)
10{
11 print_head();
12 print_ptr("TASK_REGS", "union uml_pt_regs",
13 offsetof(struct task_struct, thread.regs));
14 print("TASK_PID", "int", offsetof(struct task_struct, pid));
15 print_tail();
16 return(0);
17}
diff --git a/arch/um/util/mk_task_user.c b/arch/um/util/mk_task_user.c
new file mode 100644
index 000000000000..9db849f3f3ac
--- /dev/null
+++ b/arch/um/util/mk_task_user.c
@@ -0,0 +1,30 @@
1#include <stdio.h>
2
3void print(char *name, char *type, int offset)
4{
5 printf("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n", name, type,
6 offset);
7}
8
9void print_ptr(char *name, char *type, int offset)
10{
11 printf("#define %s(task) ((%s *) &(((char *) (task))[%d]))\n", name, type,
12 offset);
13}
14
15void print_head(void)
16{
17 printf("/*\n");
18 printf(" * Generated by mk_task\n");
19 printf(" */\n");
20 printf("\n");
21 printf("#ifndef __TASK_H\n");
22 printf("#define __TASK_H\n");
23 printf("\n");
24}
25
26void print_tail(void)
27{
28 printf("\n");
29 printf("#endif\n");
30}