Commit 2b8b611e authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] uml: cross-build support : mk_thread

mk_thread converted
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a31769ed
...@@ -35,7 +35,7 @@ $(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread ...@@ -35,7 +35,7 @@ $(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread
$(SYS_UTIL_DIR)/mk_sc: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE $(SYS_UTIL_DIR)/mk_sc: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE
$(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
$(SYS_UTIL_DIR)/mk_thread: scripts_basic $(ARCH_SYMLINKS) $(GEN_HEADERS) FORCE $(SYS_UTIL_DIR)/mk_thread: scripts_basic $(ARCH_DIR)/kernel-offsets.h FORCE
$(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
$(SYS_UTIL_DIR): scripts_basic include/asm FORCE $(SYS_UTIL_DIR): scripts_basic include/asm FORCE
......
...@@ -26,7 +26,7 @@ $(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread ...@@ -26,7 +26,7 @@ $(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread
$(SYS_UTIL_DIR)/mk_sc: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE $(SYS_UTIL_DIR)/mk_sc: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE
$(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
$(SYS_UTIL_DIR)/mk_thread: scripts_basic $(ARCH_SYMLINKS) $(GEN_HEADERS) FORCE $(SYS_UTIL_DIR)/mk_thread: scripts_basic $(GEN_HEADERS) $(ARCH_DIR)/kernel-offsets.h FORCE
$(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
CLEAN_FILES += $(SYS_HEADERS) CLEAN_FILES += $(SYS_HEADERS)
hostprogs-y := mk_sc mk_thread hostprogs-y := mk_sc mk_thread
always := $(hostprogs-y) always := $(hostprogs-y)
mk_thread-objs := mk_thread_kern.o mk_thread_user.o
HOSTCFLAGS_mk_thread_kern.o := $(CFLAGS) $(CPPFLAGS)
HOSTCFLAGS_mk_thread_user.o := $(USER_CFLAGS)
HOSTCFLAGS_mk_sc.o := -I$(objtree)/arch/um HOSTCFLAGS_mk_sc.o := -I$(objtree)/arch/um
HOSTCFLAGS_mk_thread.o := -I$(objtree)/arch/um
#include <stdio.h> #include <stdio.h>
#include <kernel-offsets.h>
void print_head(void) int main(int argc, char **argv)
{ {
printf("/*\n"); printf("/*\n");
printf(" * Generated by mk_thread\n"); printf(" * Generated by mk_thread\n");
...@@ -9,22 +10,13 @@ void print_head(void) ...@@ -9,22 +10,13 @@ void print_head(void)
printf("#ifndef __UM_THREAD_H\n"); printf("#ifndef __UM_THREAD_H\n");
printf("#define __UM_THREAD_H\n"); printf("#define __UM_THREAD_H\n");
printf("\n"); printf("\n");
} printf("#define TASK_DEBUGREGS(task) ((unsigned long *) "
"&(((char *) (task))[%d]))\n", TASK_DEBUGREGS);
void print_constant_ptr(char *name, int value) #ifdef TASK_EXTERN_PID
{ printf("#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[%d]))\n",
printf("#define %s(task) ((unsigned long *) " TASK_EXTERN_PID);
"&(((char *) (task))[%d]))\n", name, value); #endif
}
void print_constant(char *name, char *type, int value)
{
printf("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n", name, type,
value);
}
void print_tail(void)
{
printf("\n"); printf("\n");
printf("#endif\n"); printf("#endif\n");
return(0);
} }
#include "linux/config.h"
#include "linux/stddef.h"
#include "linux/sched.h"
extern void print_head(void);
extern void print_constant_ptr(char *name, int value);
extern void print_constant(char *name, char *type, int value);
extern void print_tail(void);
#define THREAD_OFFSET(field) offsetof(struct task_struct, thread.field)
int main(int argc, char **argv)
{
print_head();
print_constant_ptr("TASK_DEBUGREGS", THREAD_OFFSET(arch.debugregs));
#ifdef CONFIG_MODE_TT
print_constant("TASK_EXTERN_PID", "int", THREAD_OFFSET(mode.tt.extern_pid));
#endif
print_tail();
return(0);
}
...@@ -4,8 +4,5 @@ ...@@ -4,8 +4,5 @@
hostprogs-y := mk_sc mk_thread hostprogs-y := mk_sc mk_thread
always := $(hostprogs-y) always := $(hostprogs-y)
mk_thread-objs := mk_thread_kern.o mk_thread_user.o
HOSTCFLAGS_mk_thread_kern.o := $(CFLAGS) $(CPPFLAGS)
HOSTCFLAGS_mk_thread_user.o := $(USER_CFLAGS)
HOSTCFLAGS_mk_sc.o := -I$(objtree)/arch/um HOSTCFLAGS_mk_sc.o := -I$(objtree)/arch/um
HOSTCFLAGS_mk_thread.o := -I$(objtree)/arch/um
#include <stdio.h> #include <stdio.h>
#include <kernel-offsets.h>
void print_head(void) int main(int argc, char **argv)
{ {
printf("/*\n"); printf("/*\n");
printf(" * Generated by mk_thread\n"); printf(" * Generated by mk_thread\n");
...@@ -9,22 +10,11 @@ void print_head(void) ...@@ -9,22 +10,11 @@ void print_head(void)
printf("#ifndef __UM_THREAD_H\n"); printf("#ifndef __UM_THREAD_H\n");
printf("#define __UM_THREAD_H\n"); printf("#define __UM_THREAD_H\n");
printf("\n"); printf("\n");
} #ifdef TASK_EXTERN_PID
printf("#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[%d]))\n",
void print_constant_ptr(char *name, int value) TASK_EXTERN_PID);
{ #endif
printf("#define %s(task) ((unsigned long *) "
"&(((char *) (task))[%d]))\n", name, value);
}
void print_constant(char *name, char *type, int value)
{
printf("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n", name, type,
value);
}
void print_tail(void)
{
printf("\n"); printf("\n");
printf("#endif\n"); printf("#endif\n");
return(0);
} }
#include "linux/config.h"
#include "linux/stddef.h"
#include "linux/sched.h"
extern void print_head(void);
extern void print_constant_ptr(char *name, int value);
extern void print_constant(char *name, char *type, int value);
extern void print_tail(void);
#define THREAD_OFFSET(field) offsetof(struct task_struct, thread.field)
int main(int argc, char **argv)
{
print_head();
#ifdef CONFIG_MODE_TT
print_constant("TASK_EXTERN_PID", "int", THREAD_OFFSET(mode.tt.extern_pid));
#endif
print_tail();
return(0);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment