From: Dmitriy K. <dm...@ka...> - 2004-02-26 15:48:11
|
Welcome all I tried using 0.5.3 and 0.5.4 on old machine with amd k6-3+ CPU 0.5.3 runs ok but 0.5.4 crash my win2k (I tried only Debian 1gb imaged,updated to 3.0r1 using Debian CDs) After investing this issue I think I found the problem: 1.almost all is cross-compiled with i686-pc-cygwin 2.context switch code in src\colinux\arch\i386\passage.c use fxsave/fxrestor(which just not avaible on old CPUs)(fsave/frestor is avaible but not save SSE context but SSE is not exist on k6 anyway) here is patch for build 0.5.4 which will work on old CPUs (possible problem is that SSE state will not be saved when patched version runs on modern CPUs,better use some #define to detect minimal target CPU) diff -r -u colinux-20040225.k6/src/Makefile colinux-20040225/src/Makefile --- colinux-20040225.k6/src/Makefile 2004-02-26 03:28:39.496512000 +0600 +++ colinux-20040225/src/Makefile 2004-02-25 08:13:22.000000000 +0600 @@ -81,7 +81,7 @@ HOST_API_CFLAGS=-DCO_HOST_API -AR=i586-pc-cygwin-ar +AR=i686-pc-cygwin-ar TOOL_USER_CC=$(CC) $(USER_CFLAGS) $(CO_INCLUDES) -c $^ -o $@ TOOL_USER_GPP=$(GPP) $(USER_CFLAGS) $(CO_INCLUDES) -c $^ -o $@ diff -r -u colinux-20040225.k6/src/colinux/arch/i386/passage.c colinux-20040225/src/colinux/arch/i386/passage.c --- colinux-20040225.k6/src/colinux/arch/i386/passage.c 2004-02-26 21:24:34.790468800 +0600 +++ colinux-20040225/src/colinux/arch/i386/passage.c 2004-02-22 04:55:14.000000000 +0600 @@ -65,8 +65,9 @@ /* save return address */ " movl %ebx, 0x38(%ebp)" "\n" -/* " fxsave 0x70(%ebp)" "\n" */ - " fsave 0x70(%ebp)" "\n" + +/* save FPU / MMX / SSE state */ + " fxsave 0x70(%ebp)" "\n" /* Put the virtual address of the passage page in EBX */ " movl %ecx, %ebx" "\n" @@ -141,6 +142,7 @@ " movl %ebx, 0x0C(%ebp)" "\n" " movl %cs, %ebx" "\n" " movl %ebx, 0x04(%ebp)" "\n" + /* be on the safe side and nullify the segment registers */ " movl $0, %ebx" "\n" " movl %ebx, %fs" "\n" @@ -312,7 +314,7 @@ "1:" "\n" /* restore FPU / MMX / SSE state */ - " frstor 0x70(%ebp)" "\n" + " fxrstor 0x70(%ebp)" "\n" /* get old ESP in EAX */ " lss 0x40(%ebp), %eax" "\n" diff -r -u colinux-20040225.k6/src/colinux/os/winnt/Makefile colinux-20040225/src/colinux/os/winnt/Makefile --- colinux-20040225.k6/src/colinux/os/winnt/Makefile 2004-02-26 03:58:59.884100800 +0600 +++ colinux-20040225/src/colinux/os/winnt/Makefile 2004-02-05 03:32:54.000000000 +0600 @@ -7,7 +7,7 @@ #----------------------------------------------------------------- ifeq ($(COLINUX_ARCH),i386) -CROSS_TARGET=i586-pc-cygwin- +CROSS_TARGET=i686-pc-cygwin- else $(error Other Windows architectures not supported yet!) endif diff -r -u colinux-20040225.k6/src/colinux/os/winnt/build/Makefile colinux-20040225/src/colinux/os/winnt/build/Makefile --- colinux-20040225.k6/src/colinux/os/winnt/build/Makefile 2004-02-26 03:29:09.109092800 +0600 +++ colinux-20040225/src/colinux/os/winnt/build/Makefile 2004-02-25 05:21:30.000000000 +0600 @@ -24,7 +24,7 @@ CLEAN_FILES += $(BUILD_PATH)/driver.base.tmp $(BUILD_PATH)/driver.base.tmp: $(BUILD_PATH)/driver.o - i586-pc-cygwin-gcc -Wl,--base-file,$@ \ + i686-pc-cygwin-gcc -Wl,--base-file,$@ \ -Wl,--entry,_DriverEntry@8 \ -nostartfiles -nostdlib \ -o junk.tmp $^ -lntoskrnl -lhal -lgcc @@ -32,12 +32,12 @@ CLEAN_FILES += $(BUILD_PATH)/driver.base.exp $(BUILD_PATH)/driver.base.exp: $(BUILD_PATH)/driver.base.tmp - i586-pc-cygwin-dlltool --dllname linux.sys \ + i686-pc-cygwin-dlltool --dllname linux.sys \ --base-file $^ \ --output-exp $@ $(DRIVER_TARGET): $(BUILD_PATH)/driver.o $(BUILD_PATH)/driver.base.exp - i586-pc-cygwin-gcc \ + i686-pc-cygwin-gcc \ -Wl,--subsystem,native \ -Wl,--image-base,0x10000 \ -Wl,--file-alignment,0x1000 \ -- p.s.sorry for bad English With regads, Dmitriy mailto:dm...@ka... |
From: Dan A. <da...@gm...> - 2004-02-26 16:04:57
|
On Thu, Feb 26, 2004 at 09:34:21PM +0600, Dmitriy Kazimirow wrote: > Welcome all > I tried using 0.5.3 and 0.5.4 on old machine with amd k6-3+ CPU > 0.5.3 runs ok but 0.5.4 crash my win2k > (I tried only Debian 1gb imaged,updated to 3.0r1 using Debian CDs) > After investing this issue I think I found the problem: > 1.almost all is cross-compiled with i686-pc-cygwin > 2.context switch code in src\colinux\arch\i386\passage.c use > fxsave/fxrestor(which just not avaible on old CPUs)(fsave/frestor is > avaible but not save SSE context but SSE is not exist on k6 anyway) > > here is patch for build 0.5.4 which will work on old CPUs > (possible problem is that SSE state will not be saved when patched > version runs on modern CPUs,better use some #define to detect minimal > target CPU) Did you actually test it? The patch below is a reversed one, BTW. I'll try to see how we can merge it in. -- Dan Aloni da...@gm... |
From: Dan A. <da...@gm...> - 2004-02-26 17:53:16
|
On Thu, Feb 26, 2004 at 09:34:21PM +0600, Dmitriy Kazimirow wrote: > +++ colinux-20040225/src/Makefile 2004-02-25 08:13:22.000000000 +0600 > @@ -81,7 +81,7 @@ > > HOST_API_CFLAGS=-DCO_HOST_API > > -AR=i586-pc-cygwin-ar > +AR=i686-pc-cygwin-ar > >[snip] > > ifeq ($(COLINUX_ARCH),i386) > -CROSS_TARGET=i586-pc-cygwin- > +CROSS_TARGET=i686-pc-cygwin- > else > $(error Other Windows architectures not supported yet!) > endif > diff -r -u colinux-20040225.k6/src/colinux/os/winnt/build/Makefile colinux-20040225/src/colinux/os/winnt/build/Makefile > --- colinux-20040225.k6/src/colinux/os/winnt/build/Makefile 2004-02-26 03:29:09.109092800 +0600 > +++ colinux-20040225/src/colinux/os/winnt/build/Makefile 2004-02-25 05:21:30.000000000 +0600 > @@ -24,7 +24,7 @@ > > CLEAN_FILES += $(BUILD_PATH)/driver.base.tmp > $(BUILD_PATH)/driver.base.tmp: $(BUILD_PATH)/driver.o > - i586-pc-cygwin-gcc -Wl,--base-file,$@ \ > + i686-pc-cygwin-gcc -Wl,--base-file,$@ \ > -Wl,--entry,_DriverEntry@8 \ > -nostartfiles -nostdlib \ > -o junk.tmp $^ -lntoskrnl -lhal -lgcc > @@ -32,12 +32,12 @@ The prefix of the cygwin's tool chain executables denotes about the platform of the compiler and not about the code it produces, e.g, you can compile an i686 code by passing -march=i686 to i586-pc-cygwin-gcc and compile an i586 code by passing -march=i586 to i686-pc-cygwin-gcc. AFAIK, the default compilation target is i386 unless specified otherwise. Both the Windows driver and userspace supplied with the binary distribution of coLinux are compiled without any '-march='-style parameters meaning that they are compatible with i386. So, the meaningful part in your patch is the where you replace fx* instructions with f*. I plan for future versions of coLinux to detect whether fxsave can be used or not and then choose the right passage page code. Another remark is that the vmlinux file distributed with coLinux versions up to 0.5.4 was compiled with -march=i386. In 0.5.4, it was compiled with -march=i686. This change will be reverted in the next versions. -- Dan Aloni da...@gm... |