diff options
author | Robert de Bath <rdebath@poboxes.com> | 1997-02-25 20:42:19 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:38:07 +0200 |
commit | 4c36e9a0c125ccfff37aa440dab2cf58c4152fff (patch) | |
tree | a5d9c84ba2661029ddb2223dacd50529a361c3d5 /libc/syscall/syslib3.c | |
parent | f8de35da65c5d93bb733073cf40da154bc1c0748 (diff) | |
parent | 9696d7b0e1f3a1b0f5fd4a0428eb75afe8ad4ed6 (diff) | |
download | dev86-4c36e9a0c125ccfff37aa440dab2cf58c4152fff.tar.gz |
Import Dev86src-0.0.11.tar.gzv0.0.11
Diffstat (limited to 'libc/syscall/syslib3.c')
-rw-r--r-- | libc/syscall/syslib3.c | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/libc/syscall/syslib3.c b/libc/syscall/syslib3.c deleted file mode 100644 index c4df1fc..0000000 --- a/libc/syscall/syslib3.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 1996 Robert de Bath <rdebath@cix.compulink.co.uk> - * This file is part of the Linux-8086 C library and is distributed - * under the GNU Library General Public License. - */ - -#include <sys/types.h> -#include <errno.h> -#include <time.h> -#include <sys/times.h> - -/* MSDOS has it's own versions */ -#ifndef __MSDOS__ -#ifdef __AS386_32__ - -/********************** Function __cstartup *******************************/ - -#ifdef L___cstart3 - -void (*__cleanup)() = 0; -char ** environ; - -#asm - loc 2 -call_main: - .long _main ! Segment 2 is the trailing pointers, main and the - .long call_exit ! routine to call exit. -#if __FIRST_ARG_IN_AX__ - .data -saved_arg1: - .long 0 -#endif -#if __CALLER_SAVES__ - .data -loopy_safe: - .long 0 -#endif - .text - -export ___mkargv -___mkargv: ! BCC Tells linker to init argv ... none needed. - -export ___cstartup -___cstartup: ! Crt0 startup (Linux style) - mov eax,[esp] - test eax,eax - jz call_exit ! If argc == 0 this is being called by ldd, exit. - mov eax,[esp+8] - mov [_environ],eax -#if __FIRST_ARG_IN_AX__ - pop [saved_arg1] ! Argc will go into eax -#endif - - mov esi,#auto_start ! Pointer to first autostart function -auto_run: -#if __FIRST_ARG_IN_AX__ - mov eax,[saved_arg1] -#endif -#if __CALLER_SAVES__ - mov [loopy_safe],esi -#endif - mov ebx,[esi] - test ebx,ebx - jz no_func - call ebx ! Call the function -no_func: -#if __CALLER_SAVES__ - mov esi,[loopy_safe] -#endif - add esi,#4 ! SI at next - jmp auto_run ! And round for the next. - -call_exit: ! Last item called by above. - pop ebx ! Be tidy. -#if !__FIRST_ARG_IN_AX__ - push eax ! At the end the last called was main() push it`s -#endif - call _exit ! return val and call exit(); -bad_exit: - jmp bad_exit ! Exit returned !! - -export _exit -export __exit -_exit: ! exit(rv) function -#if __FIRST_ARG_IN_AX__ - mov [saved_arg1],eax -#else - push [esp+4] ! Copy the `rv` for the exit fuctions. -#endif - mov ebx,[___cleanup] ! Call exit, normally this is `__do_exit` - test ebx,ebx - je no_clean ! But it`s default is null - call ebx -no_clean: -#if __FIRST_ARG_IN_AX__ - mov eax,[saved_arg1] -#else - add esp,#4 -#endif -__exit: ! _exit(rv) - br ___exit ! This is just an alias for __exit(); - -#endasm -#endif - -/********************** Function ? ************************************/ - -/*---*/ -#endif -#endif |