From: Nicholas Nethercote Date: Wed, 13 Oct 2004 13:05:20 +0000 (+0000) Subject: Arch-abstraction: X-Git-Tag: svn/VALGRIND_3_0_0~1545 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcae323a885b9b6f84137a8d069564807a556b97;p=thirdparty%2Fvalgrind.git Arch-abstraction: - move LDT stuff out of core, into x86-linux specific stuff. Some of it (VG_(do_useseg)()?) may be really x86-specific, rather than x86/linux-specific, but that can be fixed later if it's really shared with another OS. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2748 --- diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am index 00aad6ff3d..03782b410e 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am @@ -79,7 +79,6 @@ stage2_SOURCES = \ vg_toolint.c \ vg_translate.c \ vg_transtab.c \ - vg_ldt.c \ vg_cpuid.S stage2_DEPENDENCIES = $(srcdir)/valgrind.vs x86/stage2.lds stage2_LDFLAGS=-Wl,--export-dynamic -Wl,-e,_ume_entry -g \ @@ -92,6 +91,7 @@ stage2_LDADD= \ demangle/dyn-string.o \ demangle/safe-ctype.o \ ${VG_ARCH}/libarch.a \ + ${VG_PLATFORM}/libplatform.a \ -ldl vg_intercept.c: $(srcdir)/gen_intercepts.pl $(srcdir)/vg_intercept.c.base diff --git a/coregrind/core.h b/coregrind/core.h index bc75b09f74..0180808095 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -607,25 +607,6 @@ struct vg_mallocfunc_info { extern Bool VG_(sk_malloc_called_by_scheduler); -/* --------------------------------------------------------------------- - Exports of vg_ldt.c - ------------------------------------------------------------------ */ - -/* Simulate the modify_ldt syscall. */ -extern Int VG_(sys_modify_ldt) ( ThreadId tid, - Int func, void* ptr, UInt bytecount ); - -/* Simulate the {get,set}_thread_area syscalls. */ -extern Int VG_(sys_set_thread_area) ( ThreadId tid, - struct vki_modify_ldt_ldt_s* info ); -extern Int VG_(sys_get_thread_area) ( ThreadId tid, - struct vki_modify_ldt_ldt_s* info ); - -/* Called from generated code. Given a segment selector and a virtual - address, return a linear address, and do limit checks too. */ -extern Addr VG_(do_useseg) ( UInt seg_selector, Addr virtual_addr ); - - /* --------------------------------------------------------------------- Exports of vg_libpthread.c ------------------------------------------------------------------ */ diff --git a/coregrind/x86-linux/Makefile.am b/coregrind/x86-linux/Makefile.am index 31e8cc5a01..451e4dc452 100644 --- a/coregrind/x86-linux/Makefile.am +++ b/coregrind/x86-linux/Makefile.am @@ -6,3 +6,9 @@ AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer -g noinst_HEADERS = \ core_platform.h \ vki_unistd.h + +noinst_LIBRARIES = libplatform.a + + +libplatform_a_SOURCES = \ + ldt.c diff --git a/coregrind/x86-linux/core_platform.h b/coregrind/x86-linux/core_platform.h index c7bb37a3e0..6ffe040c6b 100644 --- a/coregrind/x86-linux/core_platform.h +++ b/coregrind/x86-linux/core_platform.h @@ -63,6 +63,29 @@ #endif // __X86_LINUX_CORE_PLATFORM_H +/* --------------------------------------------------------------------- + Exports of vg_ldt.c + ------------------------------------------------------------------ */ + +// XXX: eventually all these should be x86-private, and not visible to the +// core (except maybe do_useseg()?) + +/* Simulate the modify_ldt syscall. */ +extern Int VG_(sys_modify_ldt) ( ThreadId tid, + Int func, void* ptr, UInt bytecount ); + +/* Simulate the {get,set}_thread_area syscalls. */ +extern Int VG_(sys_set_thread_area) ( ThreadId tid, + struct vki_modify_ldt_ldt_s* info ); +extern Int VG_(sys_get_thread_area) ( ThreadId tid, + struct vki_modify_ldt_ldt_s* info ); + +/* Called from generated code. Given a segment selector and a virtual + address, return a linear address, and do limit checks too. */ +extern Addr VG_(do_useseg) ( UInt seg_selector, Addr virtual_addr ); + + + /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/ diff --git a/coregrind/vg_ldt.c b/coregrind/x86-linux/ldt.c similarity index 99% rename from coregrind/vg_ldt.c rename to coregrind/x86-linux/ldt.c index d83c9f3600..42b976bd54 100644 --- a/coregrind/vg_ldt.c +++ b/coregrind/x86-linux/ldt.c @@ -91,7 +91,6 @@ /* The size of each LDT entry == sizeof(VgLdtEntry) */ #define VG_LDT_ENTRY_SIZE 8 - /* Allocate and deallocate LDTs for threads. */ /* Create an LDT. If the parent_ldt is NULL, zero out the diff --git a/coregrind/x86/core_arch.h b/coregrind/x86/core_arch.h index 019279808d..d3469f5a8d 100644 --- a/coregrind/x86/core_arch.h +++ b/coregrind/x86/core_arch.h @@ -193,9 +193,11 @@ extern void VG_(helper_AAM); extern void VG_(helper_cmpxchg8b); /* --------------------------------------------------------------------- - Exports of vg_ldt.c + LDT type ------------------------------------------------------------------ */ +// XXX: eventually this will be x86-private, not seen by the core(?) + /* This is the hardware-format for a segment descriptor, ie what the x86 actually deals with. It is 8 bytes long. It's ugly. */ @@ -223,7 +225,6 @@ typedef struct _LDT_ENTRY { LdtEnt; } VgLdtEntry; - /* --------------------------------------------------------------------- Constants pertaining to the simulated CPU state, VG_(baseBlock), which need to go here to avoid ugly circularities.