Added entry points for ANSI C

This commit is contained in:
ceriel 1990-01-19 17:05:29 +00:00
parent 5c228063bc
commit b2ce4472b5
23 changed files with 271 additions and 0 deletions

View file

@ -1,4 +1,26 @@
libmon_s.a
_alarm.s
_sbrk.s
_brk.s
_close.s
_execl.s
_execve.s
_fork.s
_fstat.s
_ftime.s
_getpid.s
_gtty.s
_ioctl.s
_kill.s
_link.s
_lseek.s
_open.s
_pause.s
_pipe.s
_read.s
_unlink.s
_wait.s
_write.s
exit.s
_exit.s
abort.s

8
mach/i86/libsys/_alarm.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __alarm
.extern __alarm, cerror
__alarm: int 0x9b
jb 9f
ret
9:
jmp cerror

39
mach/i86/libsys/_brk.s Normal file
View file

@ -0,0 +1,39 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __brk
.define xbrk
.define np
.extern __brk
.extern xbrk,endbss
.extern np, cerror
__brk:
mov bx,sp
mov ax,2(bx)
mov cx,sp
sub cx,128
jbe 1f
mov bx,(np)
mov (np),ax
sub ax,bx
jbe 2f
call xbrk
2:
xor ax,ax
ret
1:
mov ax,0xc
jmp cerror
xbrk:
push di
mov di,bx
mov cx,ax
xor ax,ax
shr cx,1
repz stos
jae 3f
stosb
3:
pop di
ret
.sect .data
np: .data2 endbss
.sect .text

8
mach/i86/libsys/_close.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __close
.extern __close, cerror
__close: int 0x86
jb 9f
xor ax,ax
ret
9: jmp cerror

20
mach/i86/libsys/_execl.s Normal file
View file

@ -0,0 +1,20 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __execl
.extern __execl, _environ, __execve
__execl:
push si
push di
push bp
mov bp,sp
push (_environ)
lea ax,10(bp)
push ax
push 8(bp)
call __execve
add sp,6
mov sp,bp
pop bp
pop di
pop si
ret

View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __execve
.extern __execve, cerror
__execve:
int 0x8b
jb 9f
ret
9: jmp cerror

11
mach/i86/libsys/_fork.s Normal file
View file

@ -0,0 +1,11 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __fork
.extern __fork, cerror
__fork: int 0x82
jmp 1f
jae 2f
jmp cerror
1:
xor ax,ax
2:
ret

8
mach/i86/libsys/_fstat.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __fstat
.extern __fstat, cerror
__fstat: int 0x9c
jb 9f
xor ax,ax
ret
9: jmp cerror

8
mach/i86/libsys/_ftime.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __ftime
.extern __ftime, cerror
__ftime: int 0xa3
jb 9f
ret
9:
jmp cerror

View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __getpid
.extern __getpid, cerror
__getpid: int 0x94
jb 9f
ret
9:
jmp cerror

15
mach/i86/libsys/_gtty.s Normal file
View file

@ -0,0 +1,15 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __gtty
.extern __gtty, __ioctl
__gtty:
push bp
mov bp,sp
push 6(bp)
mov ax,0x5401
push ax
push 4(bp)
call __ioctl
add sp,6
mov sp,bp
pop bp
ret

7
mach/i86/libsys/_ioctl.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __ioctl
.extern __ioctl, cerror
__ioctl: int 0xb6
jb 9f
ret
9: jmp cerror

8
mach/i86/libsys/_kill.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __kill
.extern __kill, cerror
__kill: int 0xa5
jb 9f
xor ax,ax
ret
9: jmp cerror

7
mach/i86/libsys/_link.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __link
.extern __link, cerror
__link: int 0x89
jb 9f
ret
9: jmp cerror

7
mach/i86/libsys/_lseek.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __lseek
.extern __lseek, cerror
__lseek: int 0x93
jb 9f
ret
9: jmp cerror

7
mach/i86/libsys/_open.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __open
.extern __open, cerror
__open: int 0x85
jb 9f
ret
9: jmp cerror

8
mach/i86/libsys/_pause.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __pause
.extern __pause, cerror
__pause: int 0x9d
jb 9f
ret
9:
jmp cerror

8
mach/i86/libsys/_pipe.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __pipe
.extern __pipe, cerror
__pipe: int 0xaa
jb 9f
xor ax,ax
ret
9: jmp cerror

7
mach/i86/libsys/_read.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __read
.extern __read, cerror
__read: int 0x83
jb 9f
ret
9: jmp cerror

25
mach/i86/libsys/_sbrk.s Normal file
View file

@ -0,0 +1,25 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __sbrk
.extern __sbrk, xbrk, cerror
__sbrk:
push bp
mov bp,sp
mov ax,4(bp)
mov bx,(np)
add ax,bx
mov cx,sp
sub cx,128
sub cx,ax
jbe 1f
mov (np),ax
sub ax,bx
jbe 2f
call xbrk
2:
mov ax,bx
pop bp
ret
1:
mov ax,0xc
pop bp
jmp cerror

View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __unlink
.extern __unlink, cerror
__unlink: int 0x8a
jb 9f
xor ax,ax
ret
9: jmp cerror

17
mach/i86/libsys/_wait.s Normal file
View file

@ -0,0 +1,17 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __wait
.extern __wait, cerror
__wait:
mov bx,sp
mov ax,2 ! void info about unused memory
! Should be 0 according to /usr/include/sys.s, but
! that doesn't work
push ax
push 2(bx)
push ax ! dummy return address
int 0x87
jb 9f
add sp,6
ret
9: add sp,6
jmp cerror

7
mach/i86/libsys/_write.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __write
.extern __write, cerror
__write: int 0x84
jb 9f
ret
9: jmp cerror