From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 18 08:14:43 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AAB2937B401 for ; Fri, 18 Jul 2003 08:14:43 -0700 (PDT) Received: from mail.liwing.de (mail.liwing.de [213.70.188.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5D06843F93 for ; Fri, 18 Jul 2003 08:14:42 -0700 (PDT) (envelope-from rehsack@liwing.de) Received: (qmail 40270 invoked from network); 18 Jul 2003 15:14:39 -0000 Received: from stingray.liwing.de (HELO liwing.de) ([213.70.188.164]) (envelope-sender ) by mail.liwing.de (qmail-ldap-1.03) with SMTP for ; 18 Jul 2003 15:14:39 -0000 Message-ID: <3F180EDF.2050708@liwing.de> Date: Fri, 18 Jul 2003 17:14:39 +0200 From: Jens Rehsack Organization: LiWing IT-Services User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: de-de, de, en-us, en MIME-Version: 1.0 To: FreeBSD Hackers Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: buildkernel fails after world update including new gcc 3.3.1-pre X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2003 15:14:44 -0000 Hi, I updated a system of us for testing the the compiler and I run into following problem: cc -c -O -pipe -march=pentium4 -Wall \ -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ -Wmissing-prototypes -Wpointer-arith -Winline \ -Wcast-qual-fformat-extensions -std=c99 -nostdinc \ -I- -I. -I/usr/src/sys -I/usr/src/sys/dev \ -I/usr/src/sys/contrib/dev/acpica \ -I/usr/src/sys/contrib/ipfilter \ -I/usr/src/sys/contrib/dev/ath \ -I/usr/src/sys/contrib/dev/ath/freebsd -D_KERNEL \ -include opt_global.h -fno-common \ -mno-align-long-strings \ -mpreferred-stack-boundary=2 -ffreestanding \ /usr/src/sys/dev/ata/ata-all.c {standard input}: Assembler messages: {standard input}:7652: Error: invalid character '_' in mnemonic *** Error code 1 Stop in /usr/obj/usr/src/sys/MOBY. *** Error code 1 Stop in /usr/src. *** Error code 1 Stop in /usr/src. The lines around the location are: ata_enclosure_status: pushl %ebp movl %esp, %ebp pushl %edi pushl %esi pushl %ebx subl $24, %esp movl 8(%ebp), %edi movl $6, -16(%ebp) testb $8, 20(%edi) ds ; je .L2817 movl (%edi), %eax movl $1, 4(%esp) movl %eax, (%esp) call *248(%eax) movl (%edi), %ecx movl $0, %eax movl $128, %edx #APP lock ; cmpxchgl %edx,244(%ecx) ; setz %al ; movzbl %al,%eax ; 1: # atomic_cmpset_int #NO_APP testl %eax, %eax jne .L2830 movl $0, %esi movl $128, %ebx .L2822: The line 7652 is the "#NO_APP". After asking the current@ list I didn't receive any answer so I assumed either noone had the time to look over it or it's not really interesting for any responsible. So I started some research about the '#APP'/'#NO_APP', the code origin, etc. The '#APP'/'#NO_APP' pair is used by the compiler to mark the assembly section to be reformatted by the as(1) builtin preprocessor. Because that's not the only '#APP'/'#NO_APP' pair, there must be sth. different. A try to reformat the assembly file produces the experience that the error is gone when the label '1:' is placed on a new line. The question I couldn't answer by myself is now: is there any difference in the resulting code, if the inline assembly of 'atomic_cmpset_int' will be written like: static __inline int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) { int res = exp; __asm __volatile ( "" __XSTRING(MPLOCKED) "\n\t" "cmpxchgl %1,%2\n\t" "setz %%al\n\t" "movzbl %%al,%0\n\t" "1:\n\t" "# atomic_cmpset_int" : "+a" (res) /* 0 (result) */ : "r" (src), /* 1 */ "m" (*(dst)) /* 2 */ : "memory"); return (res); } as it's shown in an example in src/contrib/binutils/gas/config/tc-i386.c? Or is the resulting code different from the original? I understood the ';' as a instruction sepatator, so for my understanding there will be no difference. But I think about the 'lock' instruction which is required for SMP kernels? How works it here? Does it locks the entire 3 instructions or just the first of them? It would be great if someone could explain that to me. Thanks and best regards, Jens