This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

egcs-19990321 omits __asm__ __volatile__()!


The following unholy mess is distilled out of linux/arch/i386/kernel/time.c
(linux-2.2.5-pre2 to be precise) after preprocessing. This is the file I
reported earlier when compiled with egcs-19990321 made linux-2.2.x hang on
boot.

extern inline unsigned char  inb  (unsigned short port) { unsigned char  _v;  __asm__ __volatile__ ("in" "b" " %"  "w"  "1,%"   ""   "0"  : "=a" (_v) : "Nd" (port)   ); return _v; } extern inline unsigned char  inb_p (unsigned short port) { unsigned char  _v;  __asm__ __volatile__ ("in" "b" " %"  "w"  "1,%"   ""   "0"  "\noutb %%al,$0x80"   : "=a" (_v) : "Nd" (port)   ); return _v; } 

extern inline void outb  (unsigned   char   value, unsigned short port) {  __asm__ __volatile__ ("out" "b" " %"   "b"   "0,%"  "w"  "1"  : : "a" (value), "Nd" (port)); } extern inline void outb_p (unsigned   char   value, unsigned short port) {  __asm__ __volatile__ ("out" "b" " %"   "b"   "0,%"  "w"  "1"  "\noutb %%al,$0x80"   : : "a" (value), "Nd" (port));} 

static int set_rtc_mmss(unsigned long nowtime)
{
	int retval = 0;
	unsigned char save_control;
	save_control = ({ outb_p(( 11   ),(0x70 + ( 0 )) ); inb_p((0x70 + ( 1 )) ); }) ;  
	({ outb_p((  11   ),(0x70 + ( 0 )) ); outb_p(( (save_control| 0x80 ) ),(0x70 + ( 1 )) ); }) ;
	return retval;
}




You'll see the line that asigns to save_control calls both outb_p() and
inb_p(). Those in turn expand to __asm__ __inline__ fragments that include
"out" and "in" instructions. The .s file from:

  gcc -O2 -fomit-frame-pointer -S t.c

for egcs-19990321 does _not_ include the inb_p() expansion, for egcs-1.1.2
it does. A diff(1) of the two (old is egcs-1.1.2, new is snapshot) shows
the breakage clearly:

--- t.s	Sat Mar 27 16:07:38 1999
+++ t.s-s	Sat Mar 27 16:07:31 1999
@@ -9,17 +9,10 @@
 #APP
 	outb %al,$112
 outb %al,$0x80
-	inb $113,%al
-outb %al,$0x80
-#NO_APP
-	movb %al,%dl
-	movb $11,%al
-#APP
 	outb %al,$112
 outb %al,$0x80
 #NO_APP
-	orb $128,%dl
-	movb %dl,%al
+	movb $-128,%al
 #APP
 	outb %al,$113
 outb %al,$0x80
@@ -28,4 +21,4 @@
 	ret
 .Lfe1:
 	.size	 set_rtc_mmss,.Lfe1-set_rtc_mmss
-	.ident	"GCC: (GNU) egcs-2.91.66 19990314 (egcs-1.1.2 release)"
+	.ident	"GCC: (GNU) egcs-2.93.13 19990321 (gcc2 ss-980929 experimental)"
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viņa del Mar, Chile                               +56 32 672616

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]