home *** CD-ROM | disk | FTP | other *** search
- / minimal 2 syscalls for demonstration echo program
- / Just write and _exit defined here.
- / Abstracted from syscall library by:
- / From: pgd@compuram.bbt.se
- / Message-Id: <9004162210.AA14300@compuram.bbt.se>
- / which was reposted to comp.unix.xenix by:
- / From: dws@uafsun4.uark.edu (David W. Summers)
- / Message-ID: <4088@uafhp.uark.edu>
-
- .set exit,1
- .set write,4
-
- #define sys(fun) movl $fun,%eax;.byte 0x9a,0,0,0,0,7,0
-
- #define DEFSYS(fun,lbl) \
- .globl lbl ; \
- lbl: sys(fun) ; \
- jb 1f ; \
- ret ; \
- 1: movl %eax,_errno ; \
- movl $-1,%eax ; \
- ret \
-
- .text
- DEFSYS(write,_write)
-
- .globl __exit
- __exit:
- sys(exit)
- movl %eax,_errno
- movl $-1,%eax
- ret
-
- / Gross hack. This program _doesn't_ use flotaing point printf, but there's
- / no easy way we can tell when its needed, so the __fltused EXTDEF is
- / generated in the normal case for safety. SO we define it here to keep the
- / linker happy.
- .data
- .globl __fltused
- __fltused:
- .byte 0
-