mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 08:30:54 +02:00
+ basic sparc64-linux specific rtl code, based on the sparc-linux one
git-svn-id: trunk@36515 -
This commit is contained in:
parent
a6c2f1660b
commit
c7d4a64ae4
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -9369,11 +9369,16 @@ rtl/linux/sparc/sighndh.inc svneol=native#text/plain
|
||||
rtl/linux/sparc/stat.inc svneol=native#text/plain
|
||||
rtl/linux/sparc/syscall.inc svneol=native#text/plain
|
||||
rtl/linux/sparc/syscallh.inc svneol=native#text/plain
|
||||
rtl/linux/sparc64/bsyscall.inc svneol=native#text/plain
|
||||
rtl/linux/sparc64/si_c.inc svneol=native#text/plain
|
||||
rtl/linux/sparc64/si_dll.inc svneol=native#text/plain
|
||||
rtl/linux/sparc64/si_g.inc svneol=native#text/plain
|
||||
rtl/linux/sparc64/si_prc.inc svneol=native#text/plain
|
||||
rtl/linux/sparc64/sighnd.inc svneol=native#text/plain
|
||||
rtl/linux/sparc64/sighndh.inc svneol=native#text/plain
|
||||
rtl/linux/sparc64/stat.inc svneol=native#text/plain
|
||||
rtl/linux/sparc64/syscall.inc svneol=native#text/plain
|
||||
rtl/linux/sparc64/syscallh.inc svneol=native#text/plain
|
||||
rtl/linux/sparcgen/sysnr.inc svneol=native#text/plain
|
||||
rtl/linux/suuid.inc svneol=native#text/plain
|
||||
rtl/linux/sysnr-gen.inc svneol=native#text/plain
|
||||
|
39
rtl/linux/sparc64/bsyscall.inc
Normal file
39
rtl/linux/sparc64/bsyscall.inc
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2005 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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
|
||||
{$define FPC_BASEUNIX_HAS_FPPIPE}
|
||||
Function fppipe(var fildes : tfildes):cint;assembler;
|
||||
{
|
||||
This function puts the registers in place, does the call, and then
|
||||
copies back the registers as they are after the SysCall.
|
||||
}
|
||||
asm
|
||||
mov 42,%g1
|
||||
mov %i0,%o0
|
||||
ta 0x10
|
||||
bcc .LSyscOK
|
||||
nop
|
||||
call fpseterrno
|
||||
nop
|
||||
mov -1,%i0
|
||||
b .Lend
|
||||
nop
|
||||
.LSyscOK:
|
||||
st %o0,[%i0]
|
||||
st %o1,[%i0+4]
|
||||
mov 0,%i0
|
||||
.Lend:
|
||||
end;
|
||||
|
79
rtl/linux/sparc64/sighnd.inc
Normal file
79
rtl/linux/sparc64/sighnd.inc
Normal file
@ -0,0 +1,79 @@
|
||||
{
|
||||
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.
|
||||
|
||||
Signal handler is arch dependant due to processor to language
|
||||
exception conversion.
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigContext);public name '_FPC_DEFAULTSIGHANDLER';cdecl;
|
||||
var
|
||||
res : word;
|
||||
addr, framebp : pointer;
|
||||
begin
|
||||
res:=0;
|
||||
addr:=nil;
|
||||
framebp:=nil;
|
||||
case sig of
|
||||
SIGFPE :
|
||||
begin
|
||||
if assigned(siginfo) then
|
||||
begin
|
||||
addr := siginfo^._sifields._sigfault._addr;
|
||||
case siginfo^.si_code of
|
||||
FPE_INTDIV:
|
||||
res:=200;
|
||||
FPE_INTOVF:
|
||||
res:=215;
|
||||
FPE_FLTDIV:
|
||||
res:=200;
|
||||
FPE_FLTOVF:
|
||||
res:=205;
|
||||
FPE_FLTUND:
|
||||
res:=206;
|
||||
else
|
||||
res:=207;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
SIGBUS :
|
||||
begin
|
||||
if assigned(siginfo) then
|
||||
addr := siginfo^._sifields._sigfault._addr;
|
||||
res:=214;
|
||||
end;
|
||||
SIGILL,
|
||||
SIGSEGV :
|
||||
begin
|
||||
if assigned(siginfo) then
|
||||
addr := siginfo^._sifields._sigfault._addr;
|
||||
res:=216;
|
||||
end;
|
||||
SIGINT:
|
||||
res:=217;
|
||||
SIGQUIT:
|
||||
res:=233;
|
||||
end;
|
||||
reenable_signal(sig);
|
||||
|
||||
if assigned(sigcontext) then
|
||||
begin
|
||||
addr:=pointer(sigcontext^.sigc_pc);
|
||||
framebp:=pointer(sigcontext^.sigc_gregs[SIG_SP]);
|
||||
end;
|
||||
|
||||
{ give runtime error at the position where the signal was raised }
|
||||
if res<>0 then
|
||||
HandleErrorAddrFrame(res,addr,framebp);
|
||||
end;
|
||||
|
||||
|
78
rtl/linux/sparc64/sighndh.inc
Normal file
78
rtl/linux/sparc64/sighndh.inc
Normal file
@ -0,0 +1,78 @@
|
||||
{
|
||||
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.
|
||||
|
||||
TSigContext
|
||||
|
||||
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
|
||||
__SUNOS_MAXWIN = 31;
|
||||
SIG_G0 = 0;
|
||||
SIG_G1 = 1;
|
||||
SIG_G2 = 2;
|
||||
SIG_G3 = 3;
|
||||
SIG_G4 = 4;
|
||||
SIG_G5 = 5;
|
||||
SIG_G6 = 6;
|
||||
SIG_G7 = 7;
|
||||
SIG_O0 = 8;
|
||||
SIG_O1 = 9;
|
||||
SIG_O2 = 10;
|
||||
SIG_O3 = 11;
|
||||
SIG_O4 = 12;
|
||||
SIG_O5 = 13;
|
||||
SIG_O6 = 14;
|
||||
SIG_O7 = 15;
|
||||
{ l and i registers do not seem to be
|
||||
written in sigcontext struct
|
||||
SIG_L0 = 16;
|
||||
SIG_L1 = 17;
|
||||
SIG_L2 = 18;
|
||||
SIG_L3 = 19;
|
||||
SIG_L4 = 20;
|
||||
SIG_L5 = 21;
|
||||
SIG_L6 = 22;
|
||||
SIG_L7 = 23;
|
||||
SIG_I0 = 24;
|
||||
SIG_I1 = 25;
|
||||
SIG_I2 = 26;
|
||||
SIG_I3 = 27;
|
||||
SIG_I4 = 28;
|
||||
SIG_I5 = 29;
|
||||
SIG_I6 = 30;
|
||||
SIG_I7 = 31; }
|
||||
|
||||
SIG_SP = SIG_O6;
|
||||
{ SIG_FP = SIG_I6; }
|
||||
|
||||
|
||||
type
|
||||
twbuf = record
|
||||
locals : array[0..7] of longint;
|
||||
ins : array[0..7] of longint;
|
||||
end;
|
||||
|
||||
PSigContext = ^TSigContext;
|
||||
TSigContext = record
|
||||
// sigc_onstack, { state to restore }
|
||||
// sigc_mask, { sigmask to restore }
|
||||
// sigc_sp, { stack pointer }
|
||||
sigc_psr, { for condition codes etc }
|
||||
sigc_pc, { program counter }
|
||||
sigc_npc, { next program counter }
|
||||
sigc_y : clong;
|
||||
sigc_gregs : array [0..31] of clong;
|
||||
end;
|
||||
|
||||
|
195
rtl/linux/sparc64/syscall.inc
Normal file
195
rtl/linux/sparc64/syscall.inc
Normal file
@ -0,0 +1,195 @@
|
||||
{
|
||||
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}
|
||||
|
||||
|
||||
{$define FPC_SYSTEM_HAS_FPFORK}
|
||||
{
|
||||
behaviour of result of fork on sparc/linux is different than on other
|
||||
linux flavours
|
||||
}
|
||||
function Fpfork : pid_t; [public, alias : 'FPC_SYSC_FORK'];assembler;
|
||||
asm
|
||||
mov 2,%g1
|
||||
ta 0x6d
|
||||
bcc .LSyscOK
|
||||
nop
|
||||
call SetErrno
|
||||
nop
|
||||
ba .LReturn
|
||||
mov -1,%i0
|
||||
.LSyscOK:
|
||||
// o1 contains 1 in the parent
|
||||
// and 0 in the child
|
||||
sub %o1, 1, %o1
|
||||
and %o0, %o1, %i0
|
||||
.LReturn:
|
||||
end;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
--- Main:The System Call Self ---
|
||||
*****************************************************************************}
|
||||
|
||||
function FpSysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL0'];
|
||||
{
|
||||
This function puts the registers in place, does the call, and then
|
||||
copies back the registers as they are after the SysCall.
|
||||
}
|
||||
asm
|
||||
mov %i0,%g1
|
||||
ta 0x6d
|
||||
bcc .LSyscOK
|
||||
nop
|
||||
call SetErrno
|
||||
nop
|
||||
mov -1,%o0
|
||||
.LSyscOK:
|
||||
mov %o0,%i0
|
||||
end;
|
||||
|
||||
|
||||
function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
|
||||
{
|
||||
This function puts the registers in place, does the call, and then
|
||||
copies back the registers as they are after the SysCall.
|
||||
}
|
||||
asm
|
||||
mov %i0,%g1
|
||||
mov %i1,%o0
|
||||
ta 0x6d
|
||||
bcc .LSyscOK
|
||||
nop
|
||||
call SetErrno
|
||||
nop
|
||||
mov -1,%o0
|
||||
.LSyscOK:
|
||||
mov %o0,%i0
|
||||
end;
|
||||
|
||||
|
||||
function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL2'];
|
||||
{
|
||||
This function puts the registers in place, does the call, and then
|
||||
copies back the registers as they are after the SysCall.
|
||||
}
|
||||
asm
|
||||
mov %i0,%g1
|
||||
mov %i1,%o0
|
||||
mov %i2,%o1
|
||||
ta 0x6d
|
||||
bcc .LSyscOK
|
||||
nop
|
||||
call SetErrno
|
||||
nop
|
||||
mov -1,%o0
|
||||
.LSyscOK:
|
||||
mov %o0,%i0
|
||||
end;
|
||||
|
||||
|
||||
function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
|
||||
{
|
||||
This function puts the registers in place, does the call, and then
|
||||
copies back the registers as they are after the SysCall.
|
||||
}
|
||||
asm
|
||||
mov %i0,%g1
|
||||
mov %i1,%o0
|
||||
mov %i2,%o1
|
||||
mov %i3,%o2
|
||||
ta 0x6d
|
||||
bcc .LSyscOK
|
||||
nop
|
||||
call SetErrno
|
||||
nop
|
||||
mov -1,%o0
|
||||
.LSyscOK:
|
||||
mov %o0,%i0
|
||||
end;
|
||||
|
||||
|
||||
function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL4'];
|
||||
{
|
||||
This function puts the registers in place, does the call, and then
|
||||
copies back the registers as they are after the SysCall.
|
||||
}
|
||||
asm
|
||||
mov %i0,%g1
|
||||
mov %i1,%o0
|
||||
mov %i2,%o1
|
||||
mov %i3,%o2
|
||||
mov %i4,%o3
|
||||
ta 0x6d
|
||||
bcc .LSyscOK
|
||||
nop
|
||||
call SetErrno
|
||||
nop
|
||||
mov -1,%o0
|
||||
.LSyscOK:
|
||||
mov %o0,%i0
|
||||
end;
|
||||
|
||||
|
||||
function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
|
||||
{
|
||||
This function puts the registers in place, does the call, and then
|
||||
copies back the registers as they are after the SysCall.
|
||||
}
|
||||
asm
|
||||
mov %i0,%g1
|
||||
mov %i1,%o0
|
||||
mov %i2,%o1
|
||||
mov %i3,%o2
|
||||
mov %i4,%o3
|
||||
mov %i5,%o4
|
||||
ta 0x6d
|
||||
bcc .LSyscOK
|
||||
nop
|
||||
call SetErrno
|
||||
nop
|
||||
mov -1,%o0
|
||||
.LSyscOK:
|
||||
mov %o0,%i0
|
||||
end;
|
||||
|
||||
|
||||
function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL6'];
|
||||
{
|
||||
This function puts the registers in place, does the call, and then
|
||||
copies back the registers as they are after the SysCall.
|
||||
}
|
||||
asm
|
||||
mov %i0,%g1
|
||||
mov %i1,%o0
|
||||
mov %i2,%o1
|
||||
mov %i3,%o2
|
||||
mov %i4,%o3
|
||||
ld [%i6+92],%o5
|
||||
mov %i5,%o4
|
||||
ta 0x6d
|
||||
bcc .LSyscOK
|
||||
nop
|
||||
call SetErrno
|
||||
nop
|
||||
mov -1,%o0
|
||||
.LSyscOK:
|
||||
mov %o0,%i0
|
||||
end;
|
||||
|
||||
|
44
rtl/linux/sparc64/syscallh.inc
Normal file
44
rtl/linux/sparc64/syscallh.inc
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
Copyright (c) 2002 by Marco van de Voort
|
||||
|
||||
Header for syscall in system unit for SPARC64 *nix.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
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. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
|
||||
****************************************************************************
|
||||
|
||||
}
|
||||
|
||||
Type
|
||||
TSysResult = Int64; // all platforms, cint=32-bit.
|
||||
// On platforms with off_t =64-bit, people should
|
||||
// use int64, and typecast all calls that don't
|
||||
// return off_t to cint.
|
||||
|
||||
// I don't think this is going to work on several platforms
|
||||
// 64-bit machines don't have only 64-bit params.
|
||||
|
||||
TSysParam = Int64;
|
||||
|
||||
function Do_SysCall(sysnr:TSysParam):TSysResult; external name 'FPC_SYSCALL0';
|
||||
function Do_SysCall(sysnr,param1:TSysParam):TSysResult; external name 'FPC_SYSCALL1';
|
||||
function Do_SysCall(sysnr,param1,param2:TSysParam):TSysResult; external name 'FPC_SYSCALL2';
|
||||
function Do_SysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; external name 'FPC_SYSCALL3';
|
||||
function Do_SysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; external name 'FPC_SYSCALL4';
|
||||
function Do_SysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; external name 'FPC_SYSCALL5';
|
||||
function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; external name 'FPC_SYSCALL6';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user