Re: show stopper for Gcc 2.95.2 conversion
On 1999-Nov-09 05:01:43 +1100, Luoqi Chen wrote: + "=D" (addr), "=c" (count) : + "r" (bsh + offset), "0" (addr), "1" (count) : + "%eax", "memory"); You may use "+D" and "+c" for the in-out operands, "+D" (addr), "+c" (count) : "r" (bsh + offset) : Just as a word of caution: "+" isn't supported prior to gcc 2.8.x, so you can't use it for code that might be MFC to 3.x. And just to make it more of a pain, I've found code similar to the original patch also fails on gcc 2.7 when the operands are volatile :-(. Peter To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: show stopper for Gcc 2.95.2 conversion
"David O'Brien" writes: On Sat, Nov 06, 1999 at 10:34:18AM +0100, Gary Jennejohn wrote: Here's a patch to bus.h which works for both EGCS and GCC 2.95.2. I have Here is the patch I've been working on (before I 1st got BDE's reply). The changes are mostly from OpenBSD + style changes for the way we do things. Can you also test this one? [patch snipped] This patch also works with both compilers. Seems kind of hairy, though. Any idea why GCC 2.95.2 produces so much more code ? # ls -l /kernel*gc* -rwxr-xr-x 1 root wheel 1753591 Nov 7 10:50 /kernel.egcs* -rwxr-xr-x 1 root wheel 1788387 Nov 7 10:57 /kernel.gcc* well, it's not all that much more. --- Gary Jennejohn Home - [EMAIL PROTECTED] Work - [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: show stopper for Gcc 2.95.2 conversion
"Daniel C. Sobral" writes: Gary Jennejohn wrote: Any idea why GCC 2.95.2 produces so much more code ? Mmmm... O'Brien, could you make sure the space-critical code in sys/boot compiles ok? I still have GCC 2.95.2 installed. This is what I get in /sys/boot: === i386/boot2 (cd /usr/src/sys/boot/i386/boot2; m4 -DFLAGS=0 boot1.m4 boot1.s) | as -o boot1.o ld -nostdlib -static -N -e start -Ttext 0x7c00 -o boot1.out boot1.o objcopy -S -O binary boot1.out boot1 dd if=/dev/zero of=boot2.ldr bs=512 count=1 2/dev/null cc -elf -I/usr/src/sys/boot/i386/boot2/../btx/lib -I. -fno-builtin -Os -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mrtd -Wall -Waggregate-return -Wbad-function-cast -Wcast-align -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings -c boot2.c (cd /usr/src/sys/boot/i386/boot2; m4 -DSIOPRT=0x3f8 -DSIOFMT=0x3 -DSIOSPD=9600 sio.s) | as -o sio.o ld -nostdlib -static -N -Ttext 0x1000 -o boot2.out /usr/src/sys/boot/i386/boot2/../btx/lib/crt0.o boot2.o sio.o objcopy -S -O binary boot2.out boot2.bin btxld -v -E 0x1000 -f bin -b /usr/src/sys/boot/i386/boot2/../btx/btx/btx -l boot2.ldr -o boot2.ld -P 1 boot2.bin kernel: ver=1.01 size=700 load=9000 entry=9010 map=16M pgctl=1:1 client: fmt=bin size=15c0 text=0 data=0 bss=0 entry=0 output: fmt=bin size=1ec0 text=200 data=1cc0 org=0 entry=0 -192 bytes available --- Gary Jennejohn Home - [EMAIL PROTECTED] Work - [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: show stopper for Gcc 2.95.2 conversion
Gary Jennejohn wrote: Mmmm... O'Brien, could you make sure the space-critical code in sys/boot compiles ok? I still have GCC 2.95.2 installed. This is what I get in /sys/boot: === i386/boot2 (cd /usr/src/sys/boot/i386/boot2; m4 -DFLAGS=0 boot1.m4 boot1.s) | as -o boot1.o ld -nostdlib -static -N -e start -Ttext 0x7c00 -o boot1.out boot1.o objcopy -S -O binary boot1.out boot1 dd if=/dev/zero of=boot2.ldr bs=512 count=1 2/dev/null cc -elf -I/usr/src/sys/boot/i386/boot2/../btx/lib -I. -fno-builtin -Os -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mrtd -Wall -Waggregate-return -Wbad-function-cast -Wcast-align -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings -c boot2.c (cd /usr/src/sys/boot/i386/boot2; m4 -DSIOPRT=0x3f8 -DSIOFMT=0x3 -DSIOSPD=9600 sio.s) | as -o sio.o ld -nostdlib -static -N -Ttext 0x1000 -o boot2.out /usr/src/sys/boot/i386/boot2/../btx/lib/crt0.o boot2.o sio.o objcopy -S -O binary boot2.out boot2.bin btxld -v -E 0x1000 -f bin -b /usr/src/sys/boot/i386/boot2/../btx/btx/btx -l boot2.ldr -o boot2.ld -P 1 boot2.bin kernel: ver=1.01 size=700 load=9000 entry=9010 map=16M pgctl=1:1 client: fmt=bin size=15c0 text=0 data=0 bss=0 entry=0 output: fmt=bin size=1ec0 text=200 data=1cc0 org=0 entry=0 -192 bytes available Well, the flags seem correct (in particular -Os). It would be interesting to see what's the difference in the assembler code generated by both. Unfortunately, I cannot upgrade my system for the time being. -- Daniel C. Sobral(8-DCS) [EMAIL PROTECTED] [EMAIL PROTECTED] What y'all wanna do? Wanna be hackers? Code crackers? Slackers Wastin' time with all the chatroom yakkers? To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: show stopper for Gcc 2.95.2 conversion
On Sat, Nov 06, 1999 at 10:34:18AM +0100, Gary Jennejohn wrote: Here's a patch to bus.h which works for both EGCS and GCC 2.95.2. I have Here is the patch I've been working on (before I 1st got BDE's reply). The changes are mostly from OpenBSD + style changes for the way we do things. Can you also test this one? Index: bus.h === RCS file: /home/ncvs/src/sys/i386/include/bus.h,v retrieving revision 1.6 diff -u -r1.6 bus.h --- bus.h 1999/08/28 00:44:07 1.6 +++ bus.h 1999/11/06 21:42:15 @@ -252,15 +252,14 @@ else #endif { - int __x __asm__("%eax"); __asm __volatile(" \n\ cld \n\ - 1: movb (%1),%%al \n\ + 1: movb (%2),%%al \n\ stosb \n\ loop 1b": - "=a" (__x) : - "r" (bsh + offset), "D" (addr), "c" (count) : - "%edi", "%ecx", "memory"); + "=D" (addr), "=c" (count) : + "r" (bsh + offset), "0" (addr), "1" (count) : + "%eax", "memory"); } #endif } @@ -280,15 +279,14 @@ else #endif { - int __x __asm__("%eax"); __asm __volatile(" \n\ cld \n\ - 1: movw (%1),%%ax \n\ + 1: movw (%2),%%ax \n\ stosw \n\ loop 1b": - "=a" (__x) : - "r" (bsh + offset), "D" (addr), "c" (count) : - "%edi", "%ecx", "memory"); + "=D" (addr), "=c" (count) : + "r" (bsh + offset), "0" (addr), "1" (count) : + "%eax", "memory"); } #endif } @@ -308,15 +306,14 @@ else #endif { - int __x __asm__("%eax"); __asm __volatile(" \n\ cld \n\ - 1: movl (%1),%%eax \n\ + 1: movl (%2),%%eax \n\ stosl \n\ loop 1b": - "=a" (__x) : - "r" (bsh + offset), "D" (addr), "c" (count) : - "%edi", "%ecx", "memory"); + "=D" (addr), "=c" (count) : + "r" (bsh + offset), "0" (addr), "1" (count) : + "%eax", "memory"); } #endif } @@ -355,16 +352,16 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int __x __asm__("%eax"); + int _port_ = bsh + offset; \ __asm __volatile(" \n\ cld \n\ - 1: inb %w1,%%al\n\ + 1: inb %w2,%%al\n\ stosb \n\ - incl %1 \n\ + incl %2 \n\ loop 1b": - "=a" (__x) : - "d" (bsh + offset), "D" (addr), "c" (count) : - "%edx", "%edi", "%ecx", "memory"); + "=D" (addr), "=c" (count), "=d" (_port_): + "0" (addr), "1" (count), "2" (bsh + offset) : + "%eax", "memory", "cc"); } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -372,13 +369,14 @@ else #endif { + int _port_ = bsh + offset; \ __asm __volatile(" \n\ cld \n\ repne \n\ movsb" : - : - "S" (bsh + offset), "D" (addr), "c" (count) : - "%esi", "%edi", "%ecx", "memory"); + "=S" (_port_), "=D" (addr), "=c" (count): + "0"
Re: show stopper for Gcc 2.95.2 conversion
Bruce Evans writes: On Fri, 5 Nov 1999, David O'Brien wrote: The current show stopper for switching over to GCC 2.95.2 is a problem compiling the `ahc' driver: cc -c -O -pipe -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -ansi -nostdinc -I- -I. -I../.. -I../../../include -DKERNEL -include opt_global.h -elf ../../dev/aic7xxx/aic7xxx.c ../../dev/aic7xxx/aic7xxx.c: In function `ahc_download_instr': machine/bus.h:584: Invalid `asm' statement: machine/bus.h:584: fixed or forbidden register 2 (cx) was spilled for class CREG. *** Error code 1 The asm statement is broken. The clobber list shouldn't include any registers that are explicitly allocated as operands. As usual, Bruce is right. Here's a patch to bus.h which works for both EGCS and GCC 2.95.2. I have ahc0 and ahc1 and I generated and successfully booted kernels using both compilers with this patch. = Patch = --- /sys/i386/include/bus.h Sat Aug 28 02:44:07 1999 +++ /sys/i386/include/bus.h_mod Sat Nov 6 09:45:47 1999 @@ -260,7 +260,7 @@ loop 1b": "=a" (__x) : "r" (bsh + offset), "D" (addr), "c" (count) : - "%edi", "%ecx", "memory"); + "memory"); } #endif } @@ -288,7 +288,7 @@ loop 1b": "=a" (__x) : "r" (bsh + offset), "D" (addr), "c" (count) : - "%edi", "%ecx", "memory"); + "memory"); } #endif } @@ -316,7 +316,7 @@ loop 1b": "=a" (__x) : "r" (bsh + offset), "D" (addr), "c" (count) : - "%edi", "%ecx", "memory"); + "memory"); } #endif } @@ -364,7 +364,7 @@ loop 1b": "=a" (__x) : "d" (bsh + offset), "D" (addr), "c" (count) : - "%edx", "%edi", "%ecx", "memory"); + "memory"); } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -378,7 +378,7 @@ movsb" : : "S" (bsh + offset), "D" (addr), "c" (count) : - "%esi", "%edi", "%ecx", "memory"); + "memory"); } #endif } @@ -401,7 +401,7 @@ loop 1b": "=a" (__x) : "d" (bsh + offset), "D" (addr), "c" (count) : - "%edx", "%edi", "%ecx", "memory"); + "memory"); } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -415,7 +415,7 @@ movsw" : : "S" (bsh + offset), "D" (addr), "c" (count) : - "%esi", "%edi", "%ecx", "memory"); + "memory"); } #endif } @@ -438,7 +438,7 @@ loop 1b": "=a" (__x) : "d" (bsh + offset), "D" (addr), "c" (count) : - "%edx", "%edi", "%ecx", "memory"); + "memory"); } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -452,7 +452,7 @@ movsl" : : "S" (bsh + offset), "D" (addr), "c" (count) : - "%esi", "%edi", "%ecx", "memory"); + "memory"); } #endif } @@ -580,8 +580,7 @@ movb %%al,(%1) \n\ loop 1b": "=a" (__x) : - "r" (bsh + offset), "S" (addr), "c" (count) : - "%esi", "%ecx"); + "r" (bsh + offset), "S" (addr), "c" (count)); } #endif } @@ -608,8 +607,7 @@ movw %%ax,(%1) \n\ loop 1b": "=a" (__x) : - "r" (bsh + offset), "S" (addr), "c" (count) : - "%esi", "%ecx"); + "r" (bsh + offset), "S" (addr), "c" (count)); } #endif } @@ -636,8 +634,7 @@
Re: show stopper for Gcc 2.95.2 conversion
On Friday, 5 November 1999 at 14:04:15 -0800, David O'Brien wrote: The current show stopper for switching over to GCC 2.95.2 is a problem compiling the `ahc' driver: cc -c -O -pipe -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -ansi -nostdinc -I- -I. -I../.. -I../../../include -DKERNEL -include opt_global.h -elf ../../dev/aic7xxx/aic7xxx.c ../../dev/aic7xxx/aic7xxx.c: In function `ahc_download_instr': machine/bus.h:584: Invalid `asm' statement: machine/bus.h:584: fixed or forbidden register 2 (cx) was spilled for class CREG. *** Error code 1 The message is misleading, as the problematic header is /sys/i386/include/bus.h not, /usr/include/machine/bus.h. In the kernel build environment, machine/ points to ../../i386/include. From the point of view of the compiler, the name is correct. Greg -- Finger [EMAIL PROTECTED] for PGP public key See complete headers for address and phone numbers To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message