From b2ce4472b53c22a0c1ea961a59245a15f281abd4 Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 19 Jan 1990 17:05:29 +0000 Subject: [PATCH] Added entry points for ANSI C --- mach/i86/libsys/LIST | 22 ++++++++++++++++++++++ mach/i86/libsys/_alarm.s | 8 ++++++++ mach/i86/libsys/_brk.s | 39 +++++++++++++++++++++++++++++++++++++++ mach/i86/libsys/_close.s | 8 ++++++++ mach/i86/libsys/_execl.s | 20 ++++++++++++++++++++ mach/i86/libsys/_execve.s | 8 ++++++++ mach/i86/libsys/_fork.s | 11 +++++++++++ mach/i86/libsys/_fstat.s | 8 ++++++++ mach/i86/libsys/_ftime.s | 8 ++++++++ mach/i86/libsys/_getpid.s | 8 ++++++++ mach/i86/libsys/_gtty.s | 15 +++++++++++++++ mach/i86/libsys/_ioctl.s | 7 +++++++ mach/i86/libsys/_kill.s | 8 ++++++++ mach/i86/libsys/_link.s | 7 +++++++ mach/i86/libsys/_lseek.s | 7 +++++++ mach/i86/libsys/_open.s | 7 +++++++ mach/i86/libsys/_pause.s | 8 ++++++++ mach/i86/libsys/_pipe.s | 8 ++++++++ mach/i86/libsys/_read.s | 7 +++++++ mach/i86/libsys/_sbrk.s | 25 +++++++++++++++++++++++++ mach/i86/libsys/_unlink.s | 8 ++++++++ mach/i86/libsys/_wait.s | 17 +++++++++++++++++ mach/i86/libsys/_write.s | 7 +++++++ 23 files changed, 271 insertions(+) create mode 100644 mach/i86/libsys/_alarm.s create mode 100644 mach/i86/libsys/_brk.s create mode 100644 mach/i86/libsys/_close.s create mode 100644 mach/i86/libsys/_execl.s create mode 100644 mach/i86/libsys/_execve.s create mode 100644 mach/i86/libsys/_fork.s create mode 100644 mach/i86/libsys/_fstat.s create mode 100644 mach/i86/libsys/_ftime.s create mode 100644 mach/i86/libsys/_getpid.s create mode 100644 mach/i86/libsys/_gtty.s create mode 100644 mach/i86/libsys/_ioctl.s create mode 100644 mach/i86/libsys/_kill.s create mode 100644 mach/i86/libsys/_link.s create mode 100644 mach/i86/libsys/_lseek.s create mode 100644 mach/i86/libsys/_open.s create mode 100644 mach/i86/libsys/_pause.s create mode 100644 mach/i86/libsys/_pipe.s create mode 100644 mach/i86/libsys/_read.s create mode 100644 mach/i86/libsys/_sbrk.s create mode 100644 mach/i86/libsys/_unlink.s create mode 100644 mach/i86/libsys/_wait.s create mode 100644 mach/i86/libsys/_write.s diff --git a/mach/i86/libsys/LIST b/mach/i86/libsys/LIST index 0e0418e1f..304bf8da0 100644 --- a/mach/i86/libsys/LIST +++ b/mach/i86/libsys/LIST @@ -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 diff --git a/mach/i86/libsys/_alarm.s b/mach/i86/libsys/_alarm.s new file mode 100644 index 000000000..5f70bde41 --- /dev/null +++ b/mach/i86/libsys/_alarm.s @@ -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 diff --git a/mach/i86/libsys/_brk.s b/mach/i86/libsys/_brk.s new file mode 100644 index 000000000..5f19bbb0b --- /dev/null +++ b/mach/i86/libsys/_brk.s @@ -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 diff --git a/mach/i86/libsys/_close.s b/mach/i86/libsys/_close.s new file mode 100644 index 000000000..c3a9b91cb --- /dev/null +++ b/mach/i86/libsys/_close.s @@ -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 diff --git a/mach/i86/libsys/_execl.s b/mach/i86/libsys/_execl.s new file mode 100644 index 000000000..9ae7d4853 --- /dev/null +++ b/mach/i86/libsys/_execl.s @@ -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 diff --git a/mach/i86/libsys/_execve.s b/mach/i86/libsys/_execve.s new file mode 100644 index 000000000..c6a7e03a4 --- /dev/null +++ b/mach/i86/libsys/_execve.s @@ -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 diff --git a/mach/i86/libsys/_fork.s b/mach/i86/libsys/_fork.s new file mode 100644 index 000000000..a61b18a5e --- /dev/null +++ b/mach/i86/libsys/_fork.s @@ -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 diff --git a/mach/i86/libsys/_fstat.s b/mach/i86/libsys/_fstat.s new file mode 100644 index 000000000..869102a67 --- /dev/null +++ b/mach/i86/libsys/_fstat.s @@ -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 diff --git a/mach/i86/libsys/_ftime.s b/mach/i86/libsys/_ftime.s new file mode 100644 index 000000000..aa5d5ebf9 --- /dev/null +++ b/mach/i86/libsys/_ftime.s @@ -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 diff --git a/mach/i86/libsys/_getpid.s b/mach/i86/libsys/_getpid.s new file mode 100644 index 000000000..0aaedff51 --- /dev/null +++ b/mach/i86/libsys/_getpid.s @@ -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 diff --git a/mach/i86/libsys/_gtty.s b/mach/i86/libsys/_gtty.s new file mode 100644 index 000000000..79c75e43f --- /dev/null +++ b/mach/i86/libsys/_gtty.s @@ -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 diff --git a/mach/i86/libsys/_ioctl.s b/mach/i86/libsys/_ioctl.s new file mode 100644 index 000000000..f42533990 --- /dev/null +++ b/mach/i86/libsys/_ioctl.s @@ -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 diff --git a/mach/i86/libsys/_kill.s b/mach/i86/libsys/_kill.s new file mode 100644 index 000000000..18f4590d6 --- /dev/null +++ b/mach/i86/libsys/_kill.s @@ -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 diff --git a/mach/i86/libsys/_link.s b/mach/i86/libsys/_link.s new file mode 100644 index 000000000..8ecd92d66 --- /dev/null +++ b/mach/i86/libsys/_link.s @@ -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 diff --git a/mach/i86/libsys/_lseek.s b/mach/i86/libsys/_lseek.s new file mode 100644 index 000000000..ba5e861a8 --- /dev/null +++ b/mach/i86/libsys/_lseek.s @@ -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 diff --git a/mach/i86/libsys/_open.s b/mach/i86/libsys/_open.s new file mode 100644 index 000000000..e411555c4 --- /dev/null +++ b/mach/i86/libsys/_open.s @@ -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 diff --git a/mach/i86/libsys/_pause.s b/mach/i86/libsys/_pause.s new file mode 100644 index 000000000..6e980d93d --- /dev/null +++ b/mach/i86/libsys/_pause.s @@ -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 diff --git a/mach/i86/libsys/_pipe.s b/mach/i86/libsys/_pipe.s new file mode 100644 index 000000000..46433e9ac --- /dev/null +++ b/mach/i86/libsys/_pipe.s @@ -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 diff --git a/mach/i86/libsys/_read.s b/mach/i86/libsys/_read.s new file mode 100644 index 000000000..f79558c95 --- /dev/null +++ b/mach/i86/libsys/_read.s @@ -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 diff --git a/mach/i86/libsys/_sbrk.s b/mach/i86/libsys/_sbrk.s new file mode 100644 index 000000000..322d288ec --- /dev/null +++ b/mach/i86/libsys/_sbrk.s @@ -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 diff --git a/mach/i86/libsys/_unlink.s b/mach/i86/libsys/_unlink.s new file mode 100644 index 000000000..bc344c065 --- /dev/null +++ b/mach/i86/libsys/_unlink.s @@ -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 diff --git a/mach/i86/libsys/_wait.s b/mach/i86/libsys/_wait.s new file mode 100644 index 000000000..e43ea9345 --- /dev/null +++ b/mach/i86/libsys/_wait.s @@ -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 diff --git a/mach/i86/libsys/_write.s b/mach/i86/libsys/_write.s new file mode 100644 index 000000000..d6f7d0bab --- /dev/null +++ b/mach/i86/libsys/_write.s @@ -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 -- 2.34.1