Subject: port-i386/17443: i386-current doesn't build (assembly errors)
To: None <>
From: None <>
List: netbsd-bugs
Date: 06/30/2002 11:07:25
>Number:         17443
>Category:       port-i386
>Synopsis:       i386-current doesn't build (assembly errors)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 30 08:08:00 PDT 2002
>Originator:     Jan Schaumann (jschauma at netbsd dot org)
>Release:        NetBSD 1.6B
System: NetBSD www 1.6B NetBSD 1.6B (MEISTER) #0: Sun Jun 30 10:50:38 EDT 2002 jschauma@www:/src/sys/arch/i386/compile/MEISTER i386

	Initial situation:
	Fresh install of NetBSD 1.5.2.  CVS checkout of src, followed by ./ -t
	Kernel configuration using USETOOLS=yes TOOLDIR=/usr/src/tools
	Using these variables, issuing "make depend && make" gives two errors:
cc  -ffreestanding  -O2 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wno-uninitialized  -Di386 -I.  -I../../../../arch -I../../../.. -nostdinc  -DMAXUSERS=32 -D_KERNEL -D_KERNEL_OPT   -c ../../../../arch/i386/i386/bios32.c
/tmp/ccZH9rvc.s: Assembler messages:
/tmp/ccZH9rvc.s:116: Error: operands given don't match any known 386 instruction
*** Error code 1

After modifying bios32.c as in the patch below, the next error occurs:

cc  -ffreestanding  -O2 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wno-uninitialized  -Di386 -I.  -I../../../../arch -I../../../.. -nostdinc  -DMAXUSERS=32 -D_KERNEL -D_KERNEL_OPT   -c ../../../../arch/i386/isa/npx.c
/tmp/ccnpHi20.s: Assembler messages:
/tmp/ccnpHi20.s:331: Error: no such 386 instruction: `fxsave'
/tmp/ccnpHi20.s:425: Error: no such 386 instruction: `fxsave'
/tmp/ccnpHi20.s:464: Error: no such 386 instruction: `fxrstor'
/tmp/ccnpHi20.s:493: Error: no such 386 instruction: `fxsave'
/tmp/ccnpHi20.s:576: Error: no such 386 instruction: `fxsave'
*** Error code 1

	recreate the situation described above

	Now, I don't have any idea if this willfundamentally break
	random things (don't know assembly all that well), but the
	patches below make it compile, and so far the kernel seems
	to run ok.

Index: i386/bios32.c
RCS file: /cvsroot/syssrc/sys/arch/i386/i386/bios32.c,v
retrieving revision 1.6
diff -b -u -r1.6 bios32.c
--- i386/bios32.c	2002/06/26 12:20:29	1.6
+++ i386/bios32.c	2002/06/30 14:59:05
@@ -148,7 +148,7 @@
 	if (bios32_entry.offset == 0)
 		return (0);	/* BIOS32 not present */
-	__asm __volatile("lcall *(%%edi)"
+	__asm __volatile("lcall (%%edi)"
 		: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
 		: "0" (service), "1" (0), "D" (&bios32_entry));
Index: isa/npx.c
RCS file: /cvsroot/syssrc/sys/arch/i386/isa/npx.c,v
retrieving revision 1.85
diff -b -u -r1.85 npx.c
--- isa/npx.c	2002/04/01 08:11:56	1.85
+++ isa/npx.c	2002/06/30 14:59:07
@@ -108,8 +108,8 @@
 #define	stts()			lcr0(rcr0() | CR0_TS)
 #ifdef I686_CPU
-#define	fxsave(addr)		__asm("fxsave %0" : "=m" (*addr))
-#define	fxrstor(addr)		__asm("fxrstor %0" : : "m" (*addr))
+#define	fxsave(addr)		__asm("fsave %0" : "=m" (*addr))
+#define	fxrstor(addr)		__asm("frstor %0" : : "m" (*addr))
 #endif /* I686_CPU */
 static __inline void