[Vm-dev] [commit] r2512 - Eliminate layout differences for BochsIA32Plugin between Mac and Win32.

commits at squeakvm.org commits at squeakvm.org
Mon Nov 14 18:05:00 UTC 2011


Author: eliot
Date: 2011-11-14 10:04:59 -0800 (Mon, 14 Nov 2011)
New Revision: 2512

Added:
   branches/Cog/processors/IA32/winbochs/exploration/
   branches/Cog/processors/IA32/winbochs/exploration/Makefile
Modified:
   branches/Cog/cygwinbuild/Makefile.plugin
   branches/Cog/macbuild/BochsIA32Plugin/BochsIA32Plugin.xcodeproj/project.pbxproj
   branches/Cog/processors/IA32/bochs/cpu/cpu.h
   branches/Cog/processors/IA32/bochs/exploration/Makefile
   branches/Cog/processors/IA32/bochs/fpu/softfloat.h
   branches/Cog/processors/IA32/macbochs/
   branches/Cog/processors/IA32/winbochs/
Log:
Eliminate layout differences for BochsIA32Plugin between Mac and Win32.
Support building a mingw (-mno-cygwin) c++ dll (and use it for BochsIA32Plugin).


Modified: branches/Cog/cygwinbuild/Makefile.plugin
===================================================================
--- branches/Cog/cygwinbuild/Makefile.plugin	2011-11-12 21:16:01 UTC (rev 2511)
+++ branches/Cog/cygwinbuild/Makefile.plugin	2011-11-14 18:04:59 UTC (rev 2512)
@@ -63,7 +63,8 @@
 #############################################################################
 # DLL settings
 #
-# Note: DLLTOOL/DLLWRAP does the work for everything related to plugins
+# Note: By default DLLTOOL/DLLWRAP do the work for everything related to plugins
+# but if LINK_WITH_GCC we use gcc and if LINK_WITH_GPP we use g++.
 #
 DLLTOOL:=	dlltool
 DLLWRAP:=	dllwrap -mno-cygwin
@@ -123,6 +124,23 @@
 		--output-lib $(LIBNAME).lib \
 		$(DLLTOOLEXTRAS) \
 		$(LIBOBJ)
+ifneq ($(LINK_WITH_GCC),)
+	gcc -shared \
+		-mno-cygwin \
+		-def $(LIBNAME).def \
+		-o   $(VMDIR)/$(LIBNAME).dll \
+		--entry _DllMain at 12 \
+		$(GCCLINKEXTRAS) \
+		$(LIBOBJ) $(EXTRALIBS)
+else ifneq ($(LINK_WITH_GPP),)
+	g++ -shared \
+		-mno-cygwin \
+		-def $(LIBNAME).def \
+		-o   $(VMDIR)/$(LIBNAME).dll \
+		--entry _DllMain at 12 \
+		$(GPPLINKEXTRAS) \
+		$(LIBOBJ) $(EXTRALIBS)
+else
 	$(DLLWRAP) -mwindows \
 		-def $(LIBNAME).def \
 		-o   $(VMDIR)/$(LIBNAME).dll \
@@ -130,6 +148,7 @@
 		$(DLLWRAPEXTRAS) \
 		$(LIBNAME).exp \
 		$(LIBOBJ) $(EXTRALIBS)
+endif
 	$(OPTSTRIP) --strip-all $(VMDIR)/$(LIBNAME).dll
 	-$(RM) $(LIBNAME).lib
 

Modified: branches/Cog/macbuild/BochsIA32Plugin/BochsIA32Plugin.xcodeproj/project.pbxproj
===================================================================
--- branches/Cog/macbuild/BochsIA32Plugin/BochsIA32Plugin.xcodeproj/project.pbxproj	2011-11-12 21:16:01 UTC (rev 2511)
+++ branches/Cog/macbuild/BochsIA32Plugin/BochsIA32Plugin.xcodeproj/project.pbxproj	2011-11-14 18:04:59 UTC (rev 2512)
@@ -10,7 +10,7 @@
 		73020E8D0EE714E60021D217 /* BochsIA32Plugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 73020E8C0EE714E60021D217 /* BochsIA32Plugin.c */; settings = {COMPILER_FLAGS = "-I../../platforms/Cross/vm -I../../platforms/Cross/plugins/BochsIA32Plugin -I\"../../platforms/Mac OS/vm\" -I../../src/vm"; }; };
 		737482B30EE7339F004E10F8 /* libcpu.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 737482B20EE7339F004E10F8 /* libcpu.a */; };
 		737482B50EE733BD004E10F8 /* libfpu.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 737482B40EE733BD004E10F8 /* libfpu.a */; };
-		737482B70EE7343B004E10F8 /* sqBochsIA32Plugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737482B60EE7343B004E10F8 /* sqBochsIA32Plugin.cpp */; settings = {COMPILER_FLAGS = "-I../../processors/IA32/bochs -I../../processors/IA32/bochs/instrument/stubs"; }; };
+		737482B70EE7343B004E10F8 /* sqBochsIA32Plugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737482B60EE7343B004E10F8 /* sqBochsIA32Plugin.cpp */; settings = {COMPILER_FLAGS = "-I../../processors/IA32/macbochs -I../../processors/IA32/bochs -I../../processors/IA32/bochs/instrument/stubs"; }; };
 		737483080EE7406A004E10F8 /* libdisasm.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 737483070EE7406A004E10F8 /* libdisasm.a */; };
 		8D01CCCE0486CAD60068D4B7 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */; };
 /* End PBXBuildFile section */

Modified: branches/Cog/processors/IA32/bochs/cpu/cpu.h
===================================================================
--- branches/Cog/processors/IA32/bochs/cpu/cpu.h	2011-11-12 21:16:01 UTC (rev 2511)
+++ branches/Cog/processors/IA32/bochs/cpu/cpu.h	2011-11-14 18:04:59 UTC (rev 2512)
@@ -861,7 +861,11 @@
   Bit32u smbase;
 
 #if BX_CPU_LEVEL >= 5
+# if COG	// msr moved further down to make the member offsets as platform
+  int unused_filler1[5];	//		(don't break existing code)
+# else		// independent as possible since MSC sizes msr differently to mac.
   bx_regs_msr_t msr;
+# endif
 #endif
 
 #if BX_SUPPORT_FPU || BX_SUPPORT_MMX
@@ -905,8 +909,12 @@
   volatile bx_bool smi_pending;
   volatile bx_bool nmi_pending;
 
+#if COG	// jmp_buf_env moved further down to make the member offsets as platform
+  int unused_filler2[18];	//		(don't break existing code)
+# else	// independent as possible since Windows and Mac jmp_buf sizes differ.
   // for exceptions
   jmp_buf jmp_buf_env;
+#endif
   Bit8u curr_exception;
 
   bx_segment_reg_t save_cs;
@@ -943,6 +951,18 @@
 #endif
   Bit8u trace;
 
+#if BX_CPU_LEVEL >= 5
+# if COG
+	// msr moved to here to make the member offsets as platform independent as
+	// possible since MSC sizes msr differently to mac.  stop_reason above is
+	// the last field that BochsIA32Alien accesses.
+  bx_regs_msr_t msr;
+# endif
+#endif
+#if COG	// jmp_buf_env moved here to make the member offsets as platform
+  jmp_buf jmp_buf_env;
+#endif	// independent as possible since Windows and Mac jmp_buf sizes differ.
+
   // for paging
   struct {
     bx_TLB_entry entry[BX_TLB_SIZE] BX_CPP_AlignN(16);

Modified: branches/Cog/processors/IA32/bochs/exploration/Makefile
===================================================================
--- branches/Cog/processors/IA32/bochs/exploration/Makefile	2011-11-12 21:16:01 UTC (rev 2511)
+++ branches/Cog/processors/IA32/bochs/exploration/Makefile	2011-11-14 18:04:59 UTC (rev 2512)
@@ -1,8 +1,21 @@
+LIBDEPS=../../bochs/cpu/libcpu.a
 CFLAGS=-m32 -I.. -I../../bochs -I../../bochs/cpu -I../../bochs/instrument/stubs -L../cpu -lcpu
+FULLLIBS=-L../fpu -lfpu -L../disasm -ldisasm
 
-all: printcpu printcpucr printcpuxmm
+.PHONY:	$(LIBDEPS)
+
+all: bxcpu.txt BochsIA32Alien-regs.st BochsIA32Alien-cr.st BochsIA32Alien-xmm.st
+
+bxcpu.txt: printbxcpu
+	./printbxcpu >bxcpu.txt
+
+BochsIA32Alien-regs.st: printcpu
 	./printcpu >BochsIA32Alien-regs.st
+
+BochsIA32Alien-cr.st: printcpucr
 	./printcpucr >BochsIA32Alien-cr.st
+
+BochsIA32Alien-xmm.st: printcpuxmm
 	./printcpuxmm >BochsIA32Alien-xmm.st
 
 clean:
@@ -10,11 +23,14 @@
 	rm -f printcpu printcpucr printcpuxmm
 	rm -f printcpu.exe printcpucr.exe printcpuxmm.exe
 
-printcpu: printcpu.c
-	g++ -o $@ printcpu.c $(CFLAGS)
+printbxcpu: ../../bochs/exploration/printbxcpu.cpp $(LIBDEPS)
+	g++ -o $@ $< $(CFLAGS)
 
-printcpucr: printcpucr.c
-	g++ -o $@ printcpucr.c $(CFLAGS)
+printcpu: ../../bochs/exploration/printcpu.c $(LIBDEPS)
+	g++ -o $@ $< $(CFLAGS)
 
-printcpuxmm: printcpuxmm.c
-	g++ -o $@ printcpuxmm.c $(CFLAGS)
+printcpucr: ../../bochs/exploration/printcpucr.c $(LIBDEPS)
+	g++ -o $@ $< $(CFLAGS)
+
+printcpuxmm: ../../bochs/exploration/printcpuxmm.c $(LIBDEPS)
+	g++ -o $@ $< $(CFLAGS)

Modified: branches/Cog/processors/IA32/bochs/fpu/softfloat.h
===================================================================
--- branches/Cog/processors/IA32/bochs/fpu/softfloat.h	2011-11-12 21:16:01 UTC (rev 2511)
+++ branches/Cog/processors/IA32/bochs/fpu/softfloat.h	2011-11-14 18:04:59 UTC (rev 2512)
@@ -256,6 +256,9 @@
 | Software IEC/IEEE floating-point types.
 *----------------------------------------------------------------------------*/
 
+#if COG /* gcc on Mac packs this into 12 bytes. */
+# pragma pack(push,4)
+#endif
 #ifdef BX_BIG_ENDIAN
 struct floatx80 {	// leave alignment to compiler
     Bit16u exp;
@@ -267,6 +270,9 @@
     Bit16u exp;
 };
 #endif
+#if COG
+# pragma pack(pop)
+#endif
 
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE integer-to-floating-point conversion routines.


Property changes on: branches/Cog/processors/IA32/macbochs
___________________________________________________________________
Modified: svn:ignore
   - Makefile
a.out.dSYM
bxversion.h
bxversion.rc
config.h
config.log
config.status
ltdlconf.h
bios
build
bx_debug
cpu
disasm
doc
exploration
fpu
gui
host
instrument
iodev
libtool
memory
misc

   + Makefile
bxversion.h
bxversion.rc
config.h
config.log
config.status
ltdlconf.h
bios
build
bx_debug
cpu
disasm
doc
fpu
gui
host
instrument
iodev
libtool
memory
misc



Property changes on: branches/Cog/processors/IA32/winbochs
___________________________________________________________________
Modified: svn:ignore
   - Makefile
bxversion.h
bxversion.rc
config.h
config.log
config.status
ltdlconf.h
bios
build
bx_debug
cpu
disasm
doc
exploration
fpu
gui
host
instrument
iodev
libtool
memory
misc

   + Makefile
bxversion.h
bxversion.rc
config.h
config.log
config.status
ltdlconf.h
bios
build
bx_debug
cpu
disasm
doc
fpu
gui
host
instrument
iodev
libtool
memory
misc



Property changes on: branches/Cog/processors/IA32/winbochs/exploration
___________________________________________________________________
Added: svn:ignore
   + *.exe
*.st
*.txt


Added: branches/Cog/processors/IA32/winbochs/exploration/Makefile
===================================================================
--- branches/Cog/processors/IA32/winbochs/exploration/Makefile	                        (rev 0)
+++ branches/Cog/processors/IA32/winbochs/exploration/Makefile	2011-11-14 18:04:59 UTC (rev 2512)
@@ -0,0 +1,36 @@
+LIBDEPS=../../bochs/cpu/libcpu.a
+CFLAGS=-m32 -I.. -I../../bochs -I../../bochs/cpu -I../../bochs/instrument/stubs -L../cpu -lcpu
+FULLLIBS=-L../fpu -lfpu -L../disasm -ldisasm
+
+.PHONY:	$(LIBDEPS)
+
+all: bxcpu.txt BochsIA32Alien-regs.st BochsIA32Alien-cr.st BochsIA32Alien-xmm.st
+
+bxcpu.txt: printbxcpu
+	./printbxcpu >bxcpu.txt
+
+BochsIA32Alien-regs.st: printcpu
+	./printcpu >BochsIA32Alien-regs.st
+
+BochsIA32Alien-cr.st: printcpucr
+	./printcpucr >BochsIA32Alien-cr.st
+
+BochsIA32Alien-xmm.st: printcpuxmm
+	./printcpuxmm >BochsIA32Alien-xmm.st
+
+clean:
+	rm -f BochsIA32Alien-regs.st BochsIA32Alien-cr.st BochsIA32Alien-xmm.st
+	rm -f printcpu printcpucr printcpuxmm
+	rm -f printcpu.exe printcpucr.exe printcpuxmm.exe
+
+printbxcpu: ../../bochs/exploration/printbxcpu.cpp $(LIBDEPS)
+	g++ -o $@ $< $(CFLAGS)
+
+printcpu: ../../bochs/exploration/printcpu.c $(LIBDEPS)
+	g++ -o $@ $< $(CFLAGS)
+
+printcpucr: ../../bochs/exploration/printcpucr.c $(LIBDEPS)
+	g++ -o $@ $< $(CFLAGS)
+
+printcpuxmm: ../../bochs/exploration/printcpuxmm.c $(LIBDEPS)
+	g++ -o $@ $< $(CFLAGS)



More information about the Vm-dev mailing list