summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authorhpa <hpa>2005-01-03 08:23:16 +0000
committerhpa <hpa>2005-01-03 08:23:16 +0000
commitdea185cee5808a3fda7d84f0e8683c2d08c71395 (patch)
tree94776ec966887d9181aa90641cf7c0a2d49317bf /sample
parentbf6a57a72c2c6f6d1589e266f790e61e6bb69a9d (diff)
downloadsyslinux-dea185cee5808a3fda7d84f0e8683c2d08c71395.tar.gz
Clean up compile problems.
Diffstat (limited to 'sample')
-rw-r--r--sample/Makefile2
-rw-r--r--sample/c32echo.c2
-rw-r--r--sample/c32entry.S2
-rw-r--r--sample/conio.c6
-rw-r--r--sample/filetest.c3
-rw-r--r--sample/hello.c2
-rw-r--r--sample/printf.c2
7 files changed, 14 insertions, 5 deletions
diff --git a/sample/Makefile b/sample/Makefile
index 79b06929..8bf7d880 100644
--- a/sample/Makefile
+++ b/sample/Makefile
@@ -18,7 +18,7 @@
gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \
then echo $(1); else echo $(2); fi)
-M32 := $(call gcc_ok,-m32,)
+M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,)
CC = gcc $(M32)
LD = ld -m elf_i386
diff --git a/sample/c32echo.c b/sample/c32echo.c
index 5fccdefc..6edb51a3 100644
--- a/sample/c32echo.c
+++ b/sample/c32echo.c
@@ -29,7 +29,7 @@ static inline void memset(void *buf, int ch, unsigned int len)
int __start(void)
{
- com32sys_t inreg, outreg;
+ com32sys_t inreg;
const char *p;
memset(&inreg, 0, sizeof inreg);
diff --git a/sample/c32entry.S b/sample/c32entry.S
index ee71d8fc..55a7d116 100644
--- a/sample/c32entry.S
+++ b/sample/c32entry.S
@@ -60,7 +60,7 @@ _start:
# did not parse the command line or anything like that.
jmp __start
- .section ".bss","a"
+ .section ".bss","aw"
.globl __entry_esp
__entry_esp: .space 4
.globl __com32
diff --git a/sample/conio.c b/sample/conio.c
index b8f4a6f1..f6f5c058 100644
--- a/sample/conio.c
+++ b/sample/conio.c
@@ -22,6 +22,12 @@
#define NULL ((void *)0)
+static inline void memset(void *buf, int ch, unsigned int len)
+{
+ asm volatile("cld; rep; stosb"
+ : "+D" (buf), "+c" (len) : "a" (ch) : "memory");
+}
+
int putchar(int ch)
{
com32sys_t regs;
diff --git a/sample/filetest.c b/sample/filetest.c
index c5701388..ca1d0a63 100644
--- a/sample/filetest.c
+++ b/sample/filetest.c
@@ -3,6 +3,7 @@
#define NULL ((void *)0)
int printf(const char *, ...);
+int putchar(int);
static inline void memset(void *buf, int ch, unsigned int len)
{
@@ -30,7 +31,7 @@ static void printregs(const com32sys_t *r)
int __start(void)
{
- unsigned int ax,cx,dx,es,si,di,t;
+ unsigned int ax,cx,si,t;
com32sys_t inreg,outreg;
char *p;
diff --git a/sample/hello.c b/sample/hello.c
index 58a5e873..d0842f78 100644
--- a/sample/hello.c
+++ b/sample/hello.c
@@ -30,7 +30,7 @@ static inline void memset(void *buf, int ch, unsigned int len)
int __start(void)
{
const char *msg = "Hello, World!\r\n";
- com32sys_t inreg, outreg;
+ com32sys_t inreg;
const char *p;
memset(&inreg, 0, sizeof inreg);
diff --git a/sample/printf.c b/sample/printf.c
index 68717f3d..eb16301e 100644
--- a/sample/printf.c
+++ b/sample/printf.c
@@ -13,6 +13,8 @@
#include <stdarg.h>
+int puts(const char *);
+
static inline int
isdigit(int ch)
{