|
From: Nicholas N. <nj...@ca...> - 2004-10-13 17:55:43
|
CVS commit by nethercote:
Some combined cleaning up and arch-abstraction, involving UME and start-up:
- removed some assumptions that arch==x86 in Makefile.am files
- removed ume_arch.h; moved its contents into ume.h. There was no need for
these to be separate.
- moved ume_go.c into an x86/ subdir; gave it the more meaningful name
jmp_with_stack.c in the process (the corresponding function also got the name
change)
A x86/jmp_with_stack.c 1.1 [GPL (v2+)]
M +5 -5 Makefile.am 1.88
M +2 -4 stage1.c 1.22
M +2 -1 ume.c 1.31
M +14 -4 ume.h 1.11
M +0 -1 vg_main.c 1.215
M +3 -3 x86/Makefile.am 1.12
R ume_arch.h 1.2
R x86/ume_go.c 1.3
--- valgrind/coregrind/Makefile.am #1.87:1.88
@@ -30,8 +30,9 @@
valgrind_SOURCES = \
- stage1.c \
ume.c \
- x86/ume_entry.S \
- x86/ume_go.c
+ ${VG_ARCH}/ume_entry.S \
+ \
+ stage1.c \
+ ${VG_ARCH}/jmp_with_stack.c
valgrind_DEPENDENCIES =
valgrind_LDFLAGS=-static -g -Wl,-e,_ume_entry
@@ -46,5 +47,5 @@
stage2_SOURCES = \
ume.c \
- x86/ume_entry.S \
+ ${VG_ARCH}/ume_entry.S \
\
vg_scheduler.c \
@@ -142,5 +143,4 @@
core_asm.h \
ume.h \
- ume_arch.h \
vg_symtab2.h \
vg_symtypes.h \
--- valgrind/coregrind/stage1.c #1.21:1.22
@@ -43,7 +43,5 @@
#include "core.h"
-
#include "ume.h"
-#include "ume_arch.h"
static int stack[SIGSTKSZ*4];
@@ -294,5 +292,5 @@ static void hoops(void)
}
- ume_go(info.init_eip, (addr_t)esp);
+ jmp_with_stack(info.init_eip, (addr_t)esp);
}
@@ -314,5 +312,5 @@ int main(void)
/* move onto another stack so we can play with the main one */
- ume_go((addr_t)hoops, (addr_t)stack + sizeof(stack));
+ jmp_with_stack((addr_t)hoops, (addr_t)stack + sizeof(stack));
}
--- valgrind/coregrind/ume.c #1.30:1.31
@@ -1,5 +1,6 @@
/*--------------------------------------------------------------------*/
-/*--- User-mode execve() ume.c ---*/
+/*--- User-mode execve(), and other stuff shared between stage1 ---*/
+/*--- and stage2. ume.c ---*/
/*--------------------------------------------------------------------*/
--- valgrind/coregrind/ume.h #1.10:1.11
@@ -45,8 +45,4 @@ void foreach_map(int (*fn)(char *start,
void* extra);
-/*------------------------------------------------------------*/
-/*--- Loading ELF files ---*/
-/*------------------------------------------------------------*/
-
#if ELFSZ == 64
#define ESZ(x) Elf64_##x
@@ -60,4 +56,18 @@ void foreach_map(int (*fn)(char *start,
typedef ESZ(Addr) addr_t;
+extern void *ume_exec_esp; /* esp on entry at exec time */
+
+// Jump to a new 'ip' with the stack 'sp'.
+void jmp_with_stack(addr_t ip, addr_t sp) __attribute__((noreturn));
+
+void foreach_map(int (*fn)(char *start, char *end,
+ const char *perm, off_t offset,
+ int maj, int min, int ino, void* extra),
+ void* extra);
+
+/*------------------------------------------------------------*/
+/*--- Loading ELF files ---*/
+/*------------------------------------------------------------*/
+
// Info needed to load and run a program. IN/INOUT/OUT refers to the
// inputs/outputs of do_exec().
--- valgrind/coregrind/vg_main.c #1.214:1.215
@@ -33,5 +33,4 @@
#include "core.h"
#include "ume.h"
-#include "ume_arch.h"
#include <dirent.h>
--- valgrind/coregrind/x86/Makefile.am #1.11:1.12
@@ -11,7 +11,7 @@
noinst_LIBRARIES = libarch.a
-EXTRA_DIST = \
- ume_entry.S \
- ume_go.c
+EXTRA_DIST = \
+ jmp_with_stack.c \
+ ume_entry.S
BUILT_SOURCES = stage2.lds
|