diff options
author | hpa <hpa> | 2003-07-01 00:42:12 +0000 |
---|---|---|
committer | hpa <hpa> | 2003-07-01 00:42:12 +0000 |
commit | 375e27432bd47011d4852621f9b1a3f5a8e1789d (patch) | |
tree | 592fea7166f5691568ce7e4e5dae5416730567b7 /sample | |
parent | 5248848c354a060c026e45598edf0b627abca117 (diff) | |
download | syslinux-375e27432bd47011d4852621f9b1a3f5a8e1789d.tar.gz |
COM32: Try to support both farcall and intcall
Diffstat (limited to 'sample')
-rw-r--r-- | sample/c32entry.S | 57 | ||||
-rw-r--r-- | sample/hello.c | 2 | ||||
-rw-r--r-- | sample/hello2.c | 2 |
3 files changed, 55 insertions, 6 deletions
diff --git a/sample/c32entry.S b/sample/c32entry.S index 251838d4..1ae57a2c 100644 --- a/sample/c32entry.S +++ b/sample/c32entry.S @@ -1,15 +1,64 @@ +#ident "$Id$" +# ----------------------------------------------------------------------- +# +# Copyright 2003 H. Peter Anvin - All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall +# be included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# ----------------------------------------------------------------------- + +# COM32 start up code - must be linked first in the binary + + .section ".text","ax" .globl _start _start: # This first instruction acts as COM32 magic number movl $0x21cd4cff,%eax + + # Upwards string operations + cld + + # Zero the .bss segment + xorl %eax,%eax + movl $__bss_start,%edi # Symbol provided by linker + movl $_end+3,%ecx # Symbol provided by linker + subl %edi,%ecx + shrl $2,%ecx + rep ; stosl + + # Copy COM32 invocation parameters leal 4(%esp),%esi movl $__com32,%edi - mov $5,%ecx - cld - rep ; movsl + movl $6,%ecx + cmpl (%esi),%ecx + jbe 1f + movl (%esi),%ecx +1: rep ; movsl + + # Run program; we call this __start rather than main since we + # did not parse the command line or anything like that. jmp __start .section ".bss","a" .globl __com32 -__com32: .space 20 +__com32: .space 24 diff --git a/sample/hello.c b/sample/hello.c index a2b79dde..8730ba1a 100644 --- a/sample/hello.c +++ b/sample/hello.c @@ -38,7 +38,7 @@ int __start(void) for ( p = msg ; *p ; p++ ) { inreg.edx.b[0] = *p; inreg.eax.b[1] = 0x02; /* Write Character */ - __com32.cs_syscall(0x21, &inreg, NULL); + __com32.cs_intcall(0x21, &inreg, NULL); } return 0; diff --git a/sample/hello2.c b/sample/hello2.c index 26a8a759..871ad047 100644 --- a/sample/hello2.c +++ b/sample/hello2.c @@ -48,7 +48,7 @@ static void writemsg(const char *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); + __com32.cs_intcall(0x22, &inreg, NULL); }; int __start(void) |