aboutsummaryrefslogtreecommitdiffstats
path: root/sample/hello2.c
diff options
context:
space:
mode:
authorhpa <hpa>2003-05-20 00:56:07 +0000
committerhpa <hpa>2003-05-20 00:56:07 +0000
commit05b031712688ef9cb724784ec246fa54813c0f7c (patch)
tree7de769de632f31791d1ff5a56214a430dce2c982 /sample/hello2.c
parent7a0f50d0582454c9d7fbecf6aaa4edac9c570129 (diff)
downloadsyslinux.git-05b031712688ef9cb724784ec246fa54813c0f7c.tar.gz
syslinux.git-05b031712688ef9cb724784ec246fa54813c0f7c.tar.xz
syslinux.git-05b031712688ef9cb724784ec246fa54813c0f7c.zip
Clean up a bit.
Diffstat (limited to 'sample/hello2.c')
-rw-r--r--sample/hello2.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sample/hello2.c b/sample/hello2.c
index 68dc6976..26a8a759 100644
--- a/sample/hello2.c
+++ b/sample/hello2.c
@@ -30,26 +30,32 @@ static inline void memset(void *buf, int ch, unsigned int len)
: "+D" (buf), "+c" (len) : "a" (ch) : "memory");
}
-static inline void memcpy(void *dst, const void *src, unsigned int len)
+static void strcpy(char *dst, const char *src)
{
- asm volatile("cld; rep; movsb"
- : "+D" (dst), "+S" (src), "+c" (len) : : "memory");
+ while ( *src )
+ *dst++ = *src++;
+
+ *dst = '\0';
}
-int __start(void)
+static void writemsg(const char *msg)
{
- const char msg[] = "Hello, World!\r\n";
- com32sys_t inreg, outreg;
- const char *p;
+ com32sys_t inreg;
memset(&inreg, 0, sizeof inreg);
- /* Bounce buffer is at least 64K in size */
- memcpy(__com32.cs_bounce, msg, sizeof msg);
+ strcpy(__com32.cs_bounce, msg);
inreg.eax.w[0] = 0x0002; /* Write string */
inreg.ebx.w[0] = OFFS(__com32.cs_bounce);
inreg.es = SEG(__com32.cs_bounce);
__com32.cs_syscall(0x22, &inreg, NULL);
+};
+int __start(void)
+{
+ writemsg("Hello, World!\r\n"
+ "cmdline = ");
+ writemsg(__com32.cs_cmdline);
+ writemsg("\r\n");
return 0;
}