mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 11:09:42 +02:00
* several 1.0.x files removed
This commit is contained in:
parent
09bf7e5016
commit
c52aa63243
@ -1,152 +0,0 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 1999-2000 by Jonas Maebe,
|
||||
member of the Free Pascal development team.
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{$packrecords C}
|
||||
|
||||
const
|
||||
SI_PAD_SIZE = ((128/sizeof(longint)) - 3);
|
||||
|
||||
type
|
||||
tfpreg = record
|
||||
significand: array[0..3] of word;
|
||||
exponent: word;
|
||||
end;
|
||||
|
||||
pfpstate = ^tfpstate;
|
||||
tfpstate = record
|
||||
cw, sw, tag, ipoff, cssel, dataoff, datasel: cardinal;
|
||||
st: array[0..7] of tfpreg;
|
||||
status: cardinal;
|
||||
end;
|
||||
|
||||
PSigContextRec = ^SigContextRec;
|
||||
SigContextRec = record
|
||||
gs, __gsh: word;
|
||||
fs, __fsh: word;
|
||||
es, __esh: word;
|
||||
ds, __dsh: word;
|
||||
edi: cardinal;
|
||||
esi: cardinal;
|
||||
ebp: cardinal;
|
||||
esp: cardinal;
|
||||
ebx: cardinal;
|
||||
edx: cardinal;
|
||||
ecx: cardinal;
|
||||
eax: cardinal;
|
||||
trapno: cardinal;
|
||||
err: cardinal;
|
||||
eip: cardinal;
|
||||
cs, __csh: word;
|
||||
eflags: cardinal;
|
||||
esp_at_signal: cardinal;
|
||||
ss, __ssh: word;
|
||||
fpstate: pfpstate;
|
||||
oldmask: cardinal;
|
||||
cr2: cardinal;
|
||||
end;
|
||||
|
||||
(*
|
||||
PSigInfoRec = ^SigInfoRec;
|
||||
SigInfoRec = record
|
||||
si_signo: longint;
|
||||
si_errno: longint;
|
||||
si_code: longint;
|
||||
|
||||
case longint of
|
||||
0:
|
||||
(pad: array[SI_PAD_SIZE] of longint);
|
||||
1: { kill }
|
||||
( kill: record
|
||||
pid: longint; { sender's pid }
|
||||
uid : longint; { sender's uid }
|
||||
end );
|
||||
2: { POSIX.1b timers }
|
||||
( timer : record
|
||||
timer1 : cardinal;
|
||||
timer2 : cardinal;
|
||||
end );
|
||||
3: { POSIX.1b signals }
|
||||
( rt : record
|
||||
pid : longint; { sender's pid }
|
||||
uid : longint; { sender's uid }
|
||||
sigval : longint;
|
||||
end );
|
||||
4: { SIGCHLD }
|
||||
( sigchld : record
|
||||
pid : longint; { which child }
|
||||
uid : longint; { sender's uid }
|
||||
status : longint; { exit code }
|
||||
utime : timeval;
|
||||
stime : timeval;
|
||||
end );
|
||||
5: { SIGILL, SIGFPE, SIGSEGV, SIGBUS }
|
||||
( sigfault : record
|
||||
addr : pointer;{ faulting insn/memory ref. }
|
||||
end );
|
||||
6:
|
||||
( sigpoll : record
|
||||
band : longint; { POLL_IN, POLL_OUT, POLL_MSG }
|
||||
fd : longint;
|
||||
end );
|
||||
end;
|
||||
*)
|
||||
|
||||
SignalHandler = Procedure(Sig : Longint);cdecl;
|
||||
PSignalHandler = ^SignalHandler;
|
||||
SignalRestorer = Procedure;cdecl;
|
||||
PSignalRestorer = ^SignalRestorer;
|
||||
TSigAction = procedure(Sig: Longint; SigContext: SigContextRec);cdecl;
|
||||
|
||||
SigSet = Longint;
|
||||
PSigSet = ^SigSet;
|
||||
|
||||
SigActionRec = packed record
|
||||
Handler : record
|
||||
case byte of
|
||||
0: (Sh: SignalHandler);
|
||||
1: (Sa: TSigAction);
|
||||
end;
|
||||
Sa_Mask : SigSet;
|
||||
Sa_Flags : Longint;
|
||||
Sa_restorer : SignalRestorer; { Obsolete - Don't use }
|
||||
end;
|
||||
PSigActionRec = ^SigActionRec;
|
||||
|
||||
Procedure SigAction(Signum:Integer;Act,OldAct:PSigActionRec );
|
||||
{
|
||||
Change action of process upon receipt of a signal.
|
||||
Signum specifies the signal (all except SigKill and SigStop).
|
||||
If Act is non-nil, it is used to specify the new action.
|
||||
If OldAct is non-nil the previous action is saved there.
|
||||
}
|
||||
|
||||
Var
|
||||
sr : Syscallregs;
|
||||
begin
|
||||
sr.reg2:=Signum;
|
||||
sr.reg3:=Longint(act);
|
||||
sr.reg4:=Longint(oldact);
|
||||
SysCall(Syscall_nr_sigaction,sr);
|
||||
end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 2003-03-29 16:55:56 michael
|
||||
+ Patch from Mattias Gaertner for single typeinfo
|
||||
|
||||
Revision 1.3 2002/09/07 16:01:20 peter
|
||||
* old logs removed and tabs fixed
|
||||
|
||||
}
|
@ -1,222 +0,0 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 1999-2000 by Michael Van Canneyt,
|
||||
member of the Free Pascal development team.
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{No debugging for syslinux include !}
|
||||
{$IFDEF SYS_LINUX}
|
||||
{$UNDEF SYSCALL_DEBUG}
|
||||
{$ENDIF SYS_LINUX}
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
--- Main:The System Call Self ---
|
||||
*****************************************************************************}
|
||||
|
||||
|
||||
Procedure Do_SysCallspec( callnr:longint;var regs : SysCallregs );assembler;{$ifndef VER1_0}oldfpccall;{$endif}
|
||||
{
|
||||
This function puts the registers in place, does the call, and then
|
||||
copies back the registers as they are after the SysCall.
|
||||
}
|
||||
{$ifdef cpui386}
|
||||
{$ASMMODE ATT}
|
||||
{$define fpc_syscall_ok}
|
||||
asm
|
||||
{ load the registers... }
|
||||
movl 12(%ebp),%eax
|
||||
movl 4(%eax),%ebx
|
||||
movl 8(%eax),%ecx
|
||||
movl 12(%eax),%edx
|
||||
movl 16(%eax),%esi
|
||||
movl 20(%eax),%edi
|
||||
{ set the call number }
|
||||
movl 8(%ebp),%eax
|
||||
{ Go ! }
|
||||
int $0x80
|
||||
{ Put back the registers... }
|
||||
pushl %eax
|
||||
movl 12(%ebp),%eax
|
||||
movl %edi,20(%eax)
|
||||
movl %esi,16(%eax)
|
||||
movl %edx,12(%eax)
|
||||
movl %ecx,8(%eax)
|
||||
movl %ebx,4(%eax)
|
||||
popl %ebx
|
||||
movl %ebx,(%eax)
|
||||
end;
|
||||
{$endif cpui386}
|
||||
{$ifdef cpum68k}
|
||||
{$define fpc_syscall_ok}
|
||||
asm
|
||||
{ load the registers... }
|
||||
move.l 12(a6),a0
|
||||
move.l 4(a0),d1
|
||||
move.l 8(a0),d2
|
||||
move.l 12(a0),d3
|
||||
move.l 16(a0),d4
|
||||
move.l 20(a0),d5
|
||||
{ set the call number }
|
||||
move.l 8(a6),d0
|
||||
{ Go ! }
|
||||
trap #0
|
||||
{ Put back the registers... }
|
||||
move.l d0,-(sp)
|
||||
move.l 12(a6),a0
|
||||
move.l d5,20(a0)
|
||||
move.l d4,16(a0)
|
||||
move.l d3,12(a0)
|
||||
move.l d2,8(a0)
|
||||
move.l d1,4(a0)
|
||||
move.l (sp)+,d1
|
||||
move.l d1,(a0)
|
||||
end;
|
||||
{$endif cpum68k}
|
||||
{$ifdef cpupowerpc}
|
||||
{$define fpc_syscall_ok}
|
||||
asm
|
||||
{ load the registers... }
|
||||
lwz r5, 12(r4)
|
||||
lwz r6, 16(r4)
|
||||
lwz r7, 20(r4)
|
||||
mr r0, r3
|
||||
lwz r3, 4(r4)
|
||||
stw r4, regs
|
||||
lwz r4, 8(r4)
|
||||
{ Go ! }
|
||||
sc
|
||||
bns Lsyscallo_ok
|
||||
neg r3,r3
|
||||
Lsyscallo_ok:
|
||||
{ Put back the registers... }
|
||||
lwz r8, regs
|
||||
stw r3, 0(r8)
|
||||
stw r4, 4(r8)
|
||||
stw r5, 8(r8)
|
||||
stw r6, 12(r8)
|
||||
stw r7, 16(r8)
|
||||
end;
|
||||
{$endif cpupowerpc}
|
||||
{$ifdef cpusparc}
|
||||
{$define fpc_syscall_ok}
|
||||
asm
|
||||
{ we are using the callers register window }
|
||||
or %i0,%g0,%g1
|
||||
ld [%i1],%o0
|
||||
ld [%i1+4],%o1
|
||||
ld [%i1+8],%o2
|
||||
ld [%i1+12],%o3
|
||||
ld [%i1+16],%o4
|
||||
{ Go ! }
|
||||
ta 0x10
|
||||
{ Put back the registers... }
|
||||
st %o0,[%i1]
|
||||
st %o1,[%i1+4]
|
||||
st %o2,[%i1+8]
|
||||
st %o3,[%i1+12]
|
||||
st %o4,[%i1+16]
|
||||
end;
|
||||
{$endif cpupowerpc}
|
||||
{$ifndef fpc_syscall_ok}
|
||||
{$error Cannot decide which processor you have!}
|
||||
asm
|
||||
end;
|
||||
{$endif not fpc_syscall_ok}
|
||||
|
||||
{$IFDEF SYSCALL_DEBUG}
|
||||
Const
|
||||
DoSysCallDebug : Boolean = False;
|
||||
|
||||
var
|
||||
LastCnt,
|
||||
LastEax,
|
||||
LastCall : longint;
|
||||
DebugTxt : string[20];
|
||||
{$ENDIF}
|
||||
|
||||
Function SysCall( callnr:longint;var regs : SysCallregs ):longint;
|
||||
{
|
||||
This function serves as an interface to do_SysCall.
|
||||
If the SysCall returned a negative number, it returns -1, and puts the
|
||||
SysCall result in errno. Otherwise, it returns the SysCall return value
|
||||
}
|
||||
begin
|
||||
do_SysCallspec(callnr,regs);
|
||||
if regs.reg1<0 then
|
||||
begin
|
||||
{$IFDEF SYSCALL_DEBUG}
|
||||
If DoSysCallDebug then
|
||||
debugtxt:=' syscall error: ';
|
||||
{$endif}
|
||||
fpseterrno(-regs.reg1);
|
||||
SysCall:=-1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
{$IFDEF SYSCALL_DEBUG}
|
||||
if DoSysCallDebug then
|
||||
debugtxt:=' syscall returned: ';
|
||||
{$endif}
|
||||
SysCall:=regs.reg1;
|
||||
fpseterrno(0);
|
||||
end;
|
||||
{$IFDEF SYSCALL_DEBUG}
|
||||
if DoSysCallDebug then
|
||||
begin
|
||||
inc(lastcnt);
|
||||
if (callnr<>lastcall) or (regs.reg1<>lasteax) then
|
||||
begin
|
||||
if lastcnt>1 then
|
||||
writeln(sys_nr_txt[lastcall],debugtxt,lasteax,' (',lastcnt,'x)');
|
||||
lastcall:=callnr;
|
||||
lasteax:=regs.reg1;
|
||||
lastcnt:=0;
|
||||
writeln(sys_nr_txt[lastcall],debugtxt,lasteax);
|
||||
end;
|
||||
end;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2003-10-31 09:22:02 mazen
|
||||
+ assembler mode forced to ATT style for x86 cpu
|
||||
|
||||
Revision 1.1 2003/10/30 16:16:49 marco
|
||||
* moved legacy syscall to i386/
|
||||
|
||||
Revision 1.7 2003/10/29 19:45:44 peter
|
||||
* use oldfpccall because all registers are destroyed
|
||||
|
||||
Revision 1.6 2003/09/14 20:15:01 marco
|
||||
* Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
|
||||
|
||||
Revision 1.5 2003/08/21 22:24:52 olle
|
||||
- removed parameter from fpc_iocheck
|
||||
|
||||
Revision 1.4 2003/06/17 16:39:58 jonas
|
||||
* fixed old syscall handling for ppc
|
||||
|
||||
Revision 1.3 2003/06/04 15:18:14 peter
|
||||
* compile fix for systhrds
|
||||
|
||||
Revision 1.2 2003/04/22 17:07:55 florian
|
||||
* there where two SYSCALL1 procedures for the powerpc, fixed
|
||||
|
||||
Revision 1.1 2002/11/11 21:40:26 marco
|
||||
* rename syscall.inc -> syscallo.inc
|
||||
|
||||
Revision 1.1 2002/10/14 19:39:44 peter
|
||||
* syscall moved into seperate include
|
||||
}
|
||||
|
@ -1,199 +0,0 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 1999-2000 by Michael Van Canneyt,
|
||||
member of the Free Pascal development team.
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{ Include syscall itself }
|
||||
{$i syscallo.inc}
|
||||
|
||||
Function Sys_mmap(adr,len,prot,flags,fdes,off:longint):longint; // moved from sysunix.inc, used in sbrk
|
||||
type
|
||||
tmmapargs=packed record
|
||||
address : longint;
|
||||
size : longint;
|
||||
prot : longint;
|
||||
flags : longint;
|
||||
fd : longint;
|
||||
offset : longint;
|
||||
end;
|
||||
var
|
||||
t : syscallregs;
|
||||
mmapargs : tmmapargs;
|
||||
begin
|
||||
mmapargs.address:=adr;
|
||||
mmapargs.size:=len;
|
||||
mmapargs.prot:=prot;
|
||||
mmapargs.flags:=flags;
|
||||
mmapargs.fd:=fdes;
|
||||
mmapargs.offset:=off;
|
||||
t.reg2:=longint(@mmapargs);
|
||||
Sys_mmap:=syscall(syscall_nr_mmap,t);
|
||||
end;
|
||||
|
||||
Function Sys_munmap(adr,len:longint):longint; // moved from sysunix.inc, used in sbrk
|
||||
var
|
||||
t : syscallregs;
|
||||
begin
|
||||
t.reg2:=adr;
|
||||
t.reg3:=len;
|
||||
Sys_munmap:=syscall(syscall_nr_munmap,t);
|
||||
end;
|
||||
|
||||
|
||||
function Clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
|
||||
begin
|
||||
if (pointer(func)=nil) or (sp=nil) then
|
||||
exit(-1); // give an error result
|
||||
{$ifdef cpui386}
|
||||
asm
|
||||
{ Insert the argument onto the new stack. }
|
||||
movl sp,%ecx
|
||||
subl $8,%ecx
|
||||
movl args,%eax
|
||||
movl %eax,4(%ecx)
|
||||
|
||||
{ Save the function pointer as the zeroth argument.
|
||||
It will be popped off in the child in the ebx frobbing below. }
|
||||
movl func,%eax
|
||||
movl %eax,0(%ecx)
|
||||
|
||||
{ Do the system call }
|
||||
pushl %ebx
|
||||
movl flags,%ebx
|
||||
movl SysCall_nr_clone,%eax
|
||||
int $0x80
|
||||
popl %ebx
|
||||
test %eax,%eax
|
||||
jnz .Lclone_end
|
||||
|
||||
{ We're in the new thread }
|
||||
subl %ebp,%ebp { terminate the stack frame }
|
||||
call *%ebx
|
||||
{ exit process }
|
||||
movl %eax,%ebx
|
||||
movl $1,%eax
|
||||
int $0x80
|
||||
|
||||
.Lclone_end:
|
||||
movl %eax,__RESULT
|
||||
end;
|
||||
{$endif cpui386}
|
||||
{$ifdef cpum68k}
|
||||
{ No yet translated, my m68k assembler is too weak for such things PM }
|
||||
(*
|
||||
asm
|
||||
{ Insert the argument onto the new stack. }
|
||||
movl sp,%ecx
|
||||
subl $8,%ecx
|
||||
movl args,%eax
|
||||
movl %eax,4(%ecx)
|
||||
|
||||
{ Save the function pointer as the zeroth argument.
|
||||
It will be popped off in the child in the ebx frobbing below. }
|
||||
movl func,%eax
|
||||
movl %eax,0(%ecx)
|
||||
|
||||
{ Do the system call }
|
||||
pushl %ebx
|
||||
movl flags,%ebx
|
||||
movl SysCall_nr_clone,%eax
|
||||
int $0x80
|
||||
popl %ebx
|
||||
test %eax,%eax
|
||||
jnz .Lclone_end
|
||||
|
||||
{ We're in the new thread }
|
||||
subl %ebp,%ebp { terminate the stack frame }
|
||||
call *%ebx
|
||||
{ exit process }
|
||||
movl %eax,%ebx
|
||||
movl $1,%eax
|
||||
int $0x80
|
||||
|
||||
.Lclone_end:
|
||||
movl %eax,__RESULT
|
||||
end;
|
||||
*)
|
||||
{$endif cpum68k}
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{
|
||||
Interface to Unix ioctl call.
|
||||
Performs various operations on the filedescriptor Handle.
|
||||
Ndx describes the operation to perform.
|
||||
Data points to data needed for the Ndx function. The structure of this
|
||||
data is function-dependent.
|
||||
}
|
||||
Function Sys_IOCtl(Handle,Ndx: Longint;Data: Pointer):LongInt; // This was missing here, instead hardcode in Do_IsDevice
|
||||
var
|
||||
sr: SysCallRegs;
|
||||
begin
|
||||
sr.reg2:=Handle;
|
||||
sr.reg3:=Ndx;
|
||||
sr.reg4:=Longint(Data);
|
||||
Sys_IOCtl:=SysCall(Syscall_nr_ioctl,sr);
|
||||
end;
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2003-10-30 16:43:38 marco
|
||||
* i386 specific due to clone and old syscall conv
|
||||
|
||||
Revision 1.19 2003/10/17 20:56:24 olle
|
||||
* Changed m68k to cpum68k, i386 to cpui386
|
||||
|
||||
Revision 1.18 2003/09/14 20:15:01 marco
|
||||
* Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
|
||||
|
||||
Revision 1.17 2002/12/18 16:43:26 marco
|
||||
* new unix rtl, linux part.....
|
||||
|
||||
Revision 1.16 2002/11/11 21:40:26 marco
|
||||
* rename syscall.inc -> syscallo.inc
|
||||
|
||||
Revision 1.15 2002/10/14 19:39:17 peter
|
||||
* threads unit added for thread support
|
||||
|
||||
Revision 1.14 2002/09/10 21:32:14 jonas
|
||||
+ added "nop" after sc instruction, since normally in case of success,
|
||||
sc returns to the second instruction after itself
|
||||
|
||||
Revision 1.13 2002/09/07 16:01:19 peter
|
||||
* old logs removed and tabs fixed
|
||||
|
||||
Revision 1.12 2002/09/07 13:14:04 florian
|
||||
* hopefully final fix for ppc syscall BTW: The regX numbering is somehow messy
|
||||
|
||||
Revision 1.11 2002/09/03 21:37:54 florian
|
||||
* hopefully final fix for ppc syscall
|
||||
|
||||
Revision 1.10 2002/09/02 20:42:22 florian
|
||||
* another ppc syscall fix
|
||||
|
||||
Revision 1.9 2002/09/02 20:03:20 florian
|
||||
* ppc syscall code fixed
|
||||
|
||||
Revision 1.8 2002/08/19 18:24:05 jonas
|
||||
+ ppc support for do_syscall
|
||||
|
||||
Revision 1.7 2002/07/29 21:28:17 florian
|
||||
* several fixes to get further with linux/ppc system unit compilation
|
||||
|
||||
Revision 1.6 2002/07/28 20:43:48 florian
|
||||
* several fixes for linux/powerpc
|
||||
* several fixes to MT
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user