summaryrefslogtreecommitdiffstats
path: root/tests/hello.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-02-24 20:14:06 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-02-24 20:14:06 +0000
commit4d1135e486fcdd3b00caf524f01af7f0d56a0af7 (patch)
treec7d3c54bef5a20e8dc3890f75db8607c4531a24a /tests/hello.c
parent5147f5aac0e725ce73ee04d0f1ca39284acf456c (diff)
downloadhqemu-4d1135e486fcdd3b00caf524f01af7f0d56a0af7.zip
hqemu-4d1135e486fcdd3b00caf524f01af7f0d56a0af7.tar.gz
i386 emulator test
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@11 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tests/hello.c')
-rw-r--r--tests/hello.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/hello.c b/tests/hello.c
new file mode 100644
index 0000000..89bd15b
--- /dev/null
+++ b/tests/hello.c
@@ -0,0 +1,26 @@
+#include <asm/unistd.h>
+
+extern inline volatile void exit(int status)
+{
+ int __res;
+ __asm__ volatile ("movl %%ecx,%%ebx\n"\
+ "int $0x80" \
+ : "=a" (__res) : "0" (__NR_exit),"c" ((long)(status)));
+}
+
+extern inline int write(int fd, const char * buf, int len)
+{
+ int status;
+ __asm__ volatile ("pushl %%ebx\n"\
+ "movl %%esi,%%ebx\n"\
+ "int $0x80\n" \
+ "popl %%ebx\n"\
+ : "=a" (status) \
+ : "0" (__NR_write),"S" ((long)(fd)),"c" ((long)(buf)),"d" ((long)(len)));
+}
+
+void _startup(void)
+{
+ write(1, "Hello World\n", 12);
+ exit(0);
+}
OpenPOWER on IntegriCloud