Make sure we use calll/retl for the C code, so the stack frame layout
authorhpa <hpa>
Mon, 10 Dec 2001 09:24:01 +0000 (09:24 +0000)
committerhpa <hpa>
Mon, 10 Dec 2001 09:24:01 +0000 (09:24 +0000)
matches the one used in 32-bit mode.

memdisk/Makefile
memdisk/conio.c
memdisk/init.S16

index 2516478..83b2210 100644 (file)
@@ -33,7 +33,8 @@ clean:
        $(AS) -o $@ $<
 
 %.s16: %.s
-       echo '.code16' | cat - $< > $@
+       echo '.code16' > $@
+       sed -e 's/\bcall\b/calll/g' -e 's/\bret\b/retl/g' < $< >> $@
 
 %.s: %.S
        $(CC) -x c $(CFLAGS) -Wp,-traditional -E -o $@ $<
index 5e6cc66..744dc52 100644 (file)
@@ -17,6 +17,7 @@
  * Output to the screen
  */
 
+#include <stdint.h>
 #include "conio.h"
 
 int putchar(int ch)
@@ -25,8 +26,8 @@ int putchar(int ch)
     putchar('\r');             /* \n -> \r\n */
 
   asm volatile("int $0x10"
-              :: "a" (0x1400|(ch&0xff)),
-              "b" (0x07)
+              :: "a" ((uint16_t)(0x0e00|(ch&0xff))),
+              "b" ((uint16_t)0x07)
               : "eax", "ebx", "ecx", "edx",
               "esi", "edi", "ebp");
 
@@ -40,6 +41,7 @@ int puts(const char *s)
   while ( *s ) {
     putchar(*s);
     count++;
+    s++;
   }
 
   return count;
index 0231d8f..465d63b 100644 (file)
@@ -127,7 +127,7 @@ start:
 
 main:
                sti
-               call setup              # Call the C code
+               calll setup             # Call the C code
                # The setup function returns the drive number,
                # which should be returned in %dl
                movw %ax,%dx