* Ported except for readdir which is 200 lines C code in FBSD linux

emulator
This commit is contained in:
marco 2000-02-02 18:07:27 +00:00
parent 1be354d497
commit db4815503d

View File

@ -260,60 +260,79 @@ begin
end; end;
Sys_Stat:=checkreturnvalue(retval,retval); Sys_Stat:=checkreturnvalue(retval,retval);
end; end;
Function Sys_Symlink(oldname,newname:pchar):longint; Function Sys_Symlink(oldname,newname:pchar):longint;
{ {
We need this for erase We need this for erase
} }
var var retval : longint;
regs : SysCallregs;
begin
regs.reg2:=longint(oldname);
regs.reg3:=longint(newname);
Sys_symlink:=SysCall(SysCall_nr_symlink,regs);
end;
begin
asm
pushl newname
pushl oldname
mov $57,%eax
int $0x80
addl $8,%eax
mov %eax,retval
end;
Sys_Symlink:=checkreturnvalue(retval,retval);
end;
{***************************************************************************** {*****************************************************************************
--- Directory:Directory related calls --- --- Directory:Directory related calls ---
*****************************************************************************} *****************************************************************************}
Function Sys_Chdir(Filename:pchar):longint; Function Sys_Chdir(Filename:pchar):longint;
var
regs : SysCallregs; var retval : longint;
begin begin
regs.reg2:=longint(filename); asm
Sys_ChDir:=SysCall(SysCall_nr_chdir,regs); pushl FileName
mov $12,%eax
int $0x80
addl $4,%eax
mov %eax,retval
end;
Sys_ChDir:=checkreturnvalue(retval,retval);
end; end;
Function Sys_Mkdir(Filename:pchar;mode:longint):longint; Function Sys_Mkdir(Filename:pchar;mode:longint):longint;
var
regs : SysCallregs; var retval : longint;
begin
regs.reg2:=longint(filename); begin {Mode is 16-bit on F-BSD}
regs.reg3:=mode; asm
Sys_MkDir:=SysCall(SysCall_nr_mkdir,regs); mov mode,%eax
pushw %ax
pushl FileName
mov $136,%eax
int $0x80
addl $6,%eax
mov %eax,retval
end;
Sys_MkDir:=checkreturnvalue(retval,retval);
end; end;
Function Sys_Rmdir(Filename:pchar):longint; Function Sys_Rmdir(Filename:pchar):longint;
var
regs : SysCallregs; var retval : longint;
begin begin
regs.reg2:=longint(filename); asm
Sys_Rmdir:=SysCall(SysCall_nr_rmdir,regs); pushl FileName
mov $137,%eax
int $0x80
addl $4,%eax
mov %eax,retval
end;
Sys_ChDir:=checkreturnvalue(retval,retval);
end; end;
{ we need this for getcwd, NOT touched for BSD version }
{ we need this for getcwd }
Function OpenDir(f:pchar):pdir; Function OpenDir(f:pchar):pdir;
var var
fd:integer; fd:integer;
st:stat; st:stat;
@ -345,8 +364,6 @@ begin
opendir:=ptr; opendir:=ptr;
end; end;
function CloseDir(p:pdir):integer; function CloseDir(p:pdir):integer;
begin begin
closedir:=sys_close(p^.fd); closedir:=sys_close(p^.fd);
@ -355,7 +372,6 @@ begin
end; end;
Function Sys_ReadDir(p:pdir):pdirent; Function Sys_ReadDir(p:pdir):pdirent;
var var
regs :SysCallregs; regs :SysCallregs;
@ -378,20 +394,30 @@ end;
*****************************************************************************} *****************************************************************************}
Procedure Sys_Exit(ExitCode:Integer); Procedure Sys_Exit(ExitCode:Integer);
var
regs : SysCallregs; var retval : longint;
begin begin
regs.reg2:=exitcode; asm
SysCall(SysCall_nr_exit,regs) pushl ExitCode
mov $1,%eax
int $0x80
addl $4,%eax
mov %eax,retval
end;
Sys_Exit:=checkreturnvalue(retval,retval);
end; end;
{ {
$Log$ $Log$
Revision 1.2 2000-02-02 16:35:10 marco Revision 1.3 2000-02-02 18:07:27 marco
* Ported except for readdir which is 200 lines C code in FBSD linux
emulator
Revision 1.2 2000/02/02 16:35:10 marco
* Ported more functions. Half done now. * Ported more functions. Half done now.
Revision 1.1 2000/02/02 15:41:56 marco Revision 1.1 2000/02/02 15:41:56 marco
* Initial BSD version. Still needs a lot of work. * Initial BSD version. Still needs a lot of work.
} }