:okays. here the journey ends. i got it :)
:
:problem is that gcc compiled with -mrtd disabled but sio.S/sio_putc()
:still used that calling convention. so fix is easy:
:
:-# -mrtd will produce bad code (missing stack pops) when combined with
:-# gcc-3.4's (default on) unit-at-a-time optimization. See the code
:-# generated for 'xputc' as an example.
:-#
:-.if ${CCVER} == "gcc2"
: CFLAGS+= -mrtd
:-.endif
:...
:
:done. gcc3 boots again. /me bows
: simon
:...
:ps: oh yea, please commit ASAP :)
Ok, I think you did find the problem, KUDOS! Excellent job!
The fix has to be slightly different, though. Even though we disable
unit-at-a-time for GCC3 builds of boot2, -mrtd is still likely unsafe
so I don't want to reenable it. What we have to do instead is
conditionalize sio_putc() in sio.S.
Please try this patch instead and tell me if it works.
-Matt
Index: Makefile
===================================================================
RCS file: /cvs/src/sys/boot/i386/boot2/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- Makefile 6 Aug 2004 20:50:35 -0000 1.11
+++ Makefile 11 Sep 2004 07:00:22 -0000
@@ -64,8 +64,14 @@
# gcc-3.4's (default on) unit-at-a-time optimization. See the code
# generated for 'xputc' as an example.
#
+# __USING_MRTD__ is used to conditionalize any assembly modules
+# (aka sio_putc())
+#
.if ${CCVER} == "gcc2"
CFLAGS+= -mrtd
+MRTDFLAGS=-D__USING_MRTD__
+.else
+MRTDFLAGS=
.endif
# Unfortunately, unit-at-a-time creates other issues as well, as yet
@@ -128,7 +134,7 @@
sio.o: sio.S
${CC} -DSIOPRT=${BOOT_COMCONSOLE_PORT} -DSIOFMT=${B2SIOFMT} \
- -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
+ -DSIOSPD=${BOOT_COMCONSOLE_SPEED} ${MRTDFLAGS} \
${AFLAGS} ${.IMPSRC} -o ${.TARGET} -c
install:
Index: sio.S
===================================================================
RCS file: /cvs/src/sys/boot/i386/boot2/sio.S,v
retrieving revision 1.6
diff -u -r1.6 sio.S
--- sio.S 18 Jul 2004 23:40:01 -0000 1.6
+++ sio.S 11 Sep 2004 07:03:40 -0000
@@ -80,7 +80,12 @@
movb 0x4(%esp,1),%al # Get character
subb $0x5,%dl # Transmitter hold reg
outb %al,(%dx) # Write character
-sio_putc.2: ret $0x4
+sio_putc.2:
+#ifdef __USING_MRTD__
+ ret $0x4
+#else
+ ret
+#endif
/*
* int sio_getc(void)