mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 00:28:23 +02:00
* fixed last commit (1337) which broke some files in the repository
git-svn-id: trunk@1338 -
This commit is contained in:
parent
f7f0f9c426
commit
9e7d550455
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -4084,6 +4084,7 @@ rtl/powerpc/makefile.cpu -text
|
||||
rtl/powerpc/math.inc svneol=native#text/plain
|
||||
rtl/powerpc/mathu.inc svneol=native#text/plain
|
||||
rtl/powerpc/mathuh.inc svneol=native#text/plain
|
||||
rtl/powerpc/powerpc.inc -text
|
||||
rtl/powerpc/set.inc svneol=native#text/plain
|
||||
rtl/powerpc/setjump.inc svneol=native#text/plain
|
||||
rtl/powerpc/setjumph.inc svneol=native#text/plain
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,303 @@
|
||||
{
|
||||
Copyright (c) 1998-2002 by Florian Klaempfl
|
||||
|
||||
Generate PowerPC assembler for type converting nodes
|
||||
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
****************************************************************************
|
||||
}
|
||||
unit nppccnv;
|
||||
|
||||
{$I fpcdefs.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
node, ncnv, ncgcnv, defcmp;
|
||||
|
||||
type
|
||||
tppctypeconvnode = class(tcgtypeconvnode)
|
||||
protected
|
||||
{ procedure second_int_to_int;override; }
|
||||
{ procedure second_string_to_string;override; }
|
||||
{ procedure second_cstring_to_pchar;override; }
|
||||
{ procedure second_string_to_chararray;override; }
|
||||
{ procedure second_array_to_pointer;override; }
|
||||
function first_int_to_real: tnode; override;
|
||||
{ procedure second_pointer_to_array;override; }
|
||||
{ procedure second_chararray_to_string;override; }
|
||||
{ procedure second_char_to_string;override; }
|
||||
procedure second_int_to_real; override;
|
||||
{ procedure second_real_to_real; override;}
|
||||
{ procedure second_cord_to_pointer;override; }
|
||||
{ procedure second_proc_to_procvar;override; }
|
||||
{ procedure second_bool_to_int;override; }
|
||||
procedure second_int_to_bool; override;
|
||||
{ procedure second_load_smallset;override; }
|
||||
{ procedure second_ansistring_to_pchar;override; }
|
||||
{ procedure second_pchar_to_string;override; }
|
||||
{ procedure second_class_to_intf;override; }
|
||||
{ procedure second_char_to_char;override; }
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
verbose, globtype, globals, systems,
|
||||
symconst, symdef, aasmbase, aasmtai,
|
||||
defutil,
|
||||
cgbase, cgutils, pass_1, pass_2,
|
||||
ncon, ncal,
|
||||
ncgutil,
|
||||
cpubase, aasmcpu,
|
||||
rgobj, tgobj, cgobj;
|
||||
|
||||
{*****************************************************************************
|
||||
FirstTypeConv
|
||||
*****************************************************************************}
|
||||
|
||||
function tppctypeconvnode.first_int_to_real: tnode;
|
||||
begin
|
||||
if (is_currency(left.resulttype.def)) then begin
|
||||
// hack to avoid double division by 10000, as it's
|
||||
// already done by resulttypepass.resulttype_int_to_real
|
||||
left.resulttype := s64inttype;
|
||||
end else begin
|
||||
// everything that is less than 64 bits is converted to a 64 bit signed
|
||||
// integer - because the int_to_real conversion is faster for 64 bit
|
||||
// signed ints compared to 64 bit unsigned ints.
|
||||
if (not (torddef(left.resulttype.def).typ in [s64bit, u64bit])) then begin
|
||||
inserttypeconv(left, s64inttype);
|
||||
end;
|
||||
end;
|
||||
firstpass(left);
|
||||
result := nil;
|
||||
if registersfpu < 1 then
|
||||
registersfpu := 1;
|
||||
expectloc := LOC_FPUREGISTER;
|
||||
end;
|
||||
|
||||
{*****************************************************************************
|
||||
SecondTypeConv
|
||||
*****************************************************************************}
|
||||
|
||||
procedure tppctypeconvnode.second_int_to_real;
|
||||
const
|
||||
convconst : double = $100000000;
|
||||
var
|
||||
tempconst : trealconstnode;
|
||||
disp, disp2: treference;
|
||||
// temp registers for converting signed ints
|
||||
valuereg, leftreg,
|
||||
// additional temp registers for converting unsigned 64 bit ints
|
||||
tmpintreg1, tmpintreg2, tmpfpureg, tmpfpuconst : tregister;
|
||||
size: tcgsize;
|
||||
signed: boolean;
|
||||
begin
|
||||
|
||||
location_reset(location, LOC_FPUREGISTER, def_cgsize(resulttype.def));
|
||||
|
||||
{ the code here comes from the PowerPC Compiler Writer's Guide }
|
||||
{ * longint to double (works for all rounding modes) }
|
||||
{ std R3,disp(R1) # store doubleword }
|
||||
{ lfd FR1,disp(R1) # load float double }
|
||||
{ fcfid FR1,FR1 # convert to floating-point integer }
|
||||
|
||||
{ * unsigned 64 bit int to fp value (works for all rounding modes) }
|
||||
{ rldicl rT1,rS,32,32 # isolate high half }
|
||||
{ rldicl rT2,rS,0,32 # isolate low half }
|
||||
{ std rT1,disp(R1) # store high half }
|
||||
{ std rT2,disp+8(R1) # store low half }
|
||||
{ lfd frT1,disp(R1) # load high half }
|
||||
{ lfd frD,disp+8(R1) # load low half }
|
||||
{ fcfid frT1,frT1 # convert each half to floating }
|
||||
{ fcfid frD,frD # point integer (no round) }
|
||||
{ fmadd frD,frC,frT1,frD # (2^32)*high + low }
|
||||
{ # (only add can round) }
|
||||
tg.Gettemp(exprasmlist, 8, tt_normal, disp);
|
||||
|
||||
{ do the signed case for everything but 64 bit unsigned integers }
|
||||
signed := (left.location.size <> OS_64);
|
||||
|
||||
{ we need a certain constant for the conversion of unsigned 64 bit integers,
|
||||
so create them here. Additonally another temporary location is neeted }
|
||||
if (not signed) then begin
|
||||
// allocate temp for constant value used for unsigned 64 bit ints
|
||||
tempconst :=
|
||||
crealconstnode.create(convconst, pbestrealtype^);
|
||||
resulttypepass(tempconst);
|
||||
firstpass(tempconst);
|
||||
secondpass(tempconst);
|
||||
if (tempconst.location.loc <> LOC_CREFERENCE) then
|
||||
internalerror(200110011);
|
||||
|
||||
// allocate second temp memory
|
||||
tg.Gettemp(exprasmlist, 8, tt_normal, disp2);
|
||||
end;
|
||||
|
||||
case left.location.loc of
|
||||
// the conversion algorithm does not modify the input register, so it can
|
||||
// be used for both LOC_REGISTER and LOC_CREGISTER
|
||||
LOC_REGISTER, LOC_CREGISTER:
|
||||
begin
|
||||
leftreg := left.location.register;
|
||||
valuereg := leftreg;
|
||||
end;
|
||||
LOC_REFERENCE, LOC_CREFERENCE:
|
||||
begin
|
||||
leftreg := cg.getintregister(exprasmlist, OS_INT);
|
||||
valuereg := leftreg;
|
||||
if signed then
|
||||
size := OS_S64
|
||||
else
|
||||
size := OS_64;
|
||||
cg.a_load_ref_reg(exprasmlist, def_cgsize(left.resulttype.def),
|
||||
size, left.location.reference, leftreg);
|
||||
end
|
||||
else
|
||||
internalerror(200110012);
|
||||
end;
|
||||
|
||||
if (signed) then begin
|
||||
// std rS, disp(r1)
|
||||
cg.a_load_reg_ref(exprasmlist, OS_S64, OS_S64, valuereg, disp);
|
||||
// lfd frD, disp(r1)
|
||||
location.register := cg.getfpuregister(exprasmlist,OS_F64);
|
||||
cg.a_loadfpu_ref_reg(exprasmlist,OS_F64, disp, location.register);
|
||||
// fcfid frD, frD
|
||||
exprasmlist.concat(taicpu.op_reg_reg(A_FCFID, location.register,
|
||||
location.register));
|
||||
end else begin
|
||||
{ ts:todo use TOC for this constant or at least schedule better }
|
||||
// lfd frC, const
|
||||
tmpfpuconst := cg.getfpuregister(exprasmlist,OS_F64);
|
||||
cg.a_loadfpu_ref_reg(exprasmlist,OS_F64,tempconst.location.reference,
|
||||
tmpfpuconst);
|
||||
tempconst.free;
|
||||
|
||||
tmpintreg1 := cg.getintregister(exprasmlist, OS_64);
|
||||
// rldicl rT1, rS, 32, 32
|
||||
exprasmlist.concat(taicpu.op_reg_reg_const_const(A_RLDICL, tmpintreg1, valuereg, 32, 32));
|
||||
// rldicl rT2, rS, 0, 32
|
||||
tmpintreg2 := cg.getintregister(exprasmlist, OS_64);
|
||||
exprasmlist.concat(taicpu.op_reg_reg_const_const(A_RLDICL, tmpintreg2, valuereg, 0, 32));
|
||||
|
||||
// std rT1, disp(r1)
|
||||
cg.a_load_reg_ref(exprasmlist, OS_S64, OS_S64, tmpintreg1, disp);
|
||||
// std rT2, disp2(r1)
|
||||
cg.a_load_reg_ref(exprasmlist, OS_S64, OS_S64, tmpintreg2, disp2);
|
||||
|
||||
// lfd frT1, disp(R1)
|
||||
tmpfpureg := cg.getfpuregister(exprasmlist,OS_F64);
|
||||
cg.a_loadfpu_ref_reg(exprasmlist,OS_F64, disp, tmpfpureg);
|
||||
// lfd frD, disp+8(R1)
|
||||
location.register := cg.getfpuregister(exprasmlist,OS_F64);
|
||||
cg.a_loadfpu_ref_reg(exprasmlist,OS_F64, disp2, location.register);
|
||||
|
||||
// fcfid frT1, frT1
|
||||
exprasmlist.concat(taicpu.op_reg_reg(A_FCFID, tmpfpureg,
|
||||
tmpfpureg));
|
||||
// fcfid frD, frD
|
||||
exprasmlist.concat(taicpu.op_reg_reg(A_FCFID, location.register,
|
||||
location.register));
|
||||
// fmadd frD,frC,frT1,frD # (2^32)*high + low }
|
||||
exprasmlist.concat(taicpu.op_reg_reg_reg_reg(A_FMADD, location.register, tmpfpuconst,
|
||||
tmpfpureg, location.register));
|
||||
|
||||
// free used temps
|
||||
tg.ungetiftemp(exprasmlist, disp2);
|
||||
end;
|
||||
// free reference
|
||||
tg.ungetiftemp(exprasmlist, disp);
|
||||
|
||||
end;
|
||||
|
||||
procedure tppctypeconvnode.second_int_to_bool;
|
||||
var
|
||||
hreg1,
|
||||
hreg2: tregister;
|
||||
resflags: tresflags;
|
||||
opsize: tcgsize;
|
||||
hlabel, oldtruelabel, oldfalselabel: tasmlabel;
|
||||
begin
|
||||
oldtruelabel := truelabel;
|
||||
oldfalselabel := falselabel;
|
||||
objectlibrary.getjumplabel(truelabel);
|
||||
objectlibrary.getjumplabel(falselabel);
|
||||
secondpass(left);
|
||||
if codegenerror then
|
||||
exit;
|
||||
|
||||
{ byte(boolean) or word(wordbool) or longint(longbool) must }
|
||||
{ be accepted for var parameters }
|
||||
if (nf_explicit in flags) and
|
||||
(left.resulttype.def.size = resulttype.def.size) and
|
||||
(left.location.loc in [LOC_REFERENCE, LOC_CREFERENCE, LOC_CREGISTER]) then
|
||||
begin
|
||||
truelabel := oldtruelabel;
|
||||
falselabel := oldfalselabel;
|
||||
location_copy(location, left.location);
|
||||
exit;
|
||||
end;
|
||||
|
||||
location_reset(location, LOC_REGISTER, def_cgsize(resulttype.def));
|
||||
opsize := def_cgsize(left.resulttype.def);
|
||||
case left.location.loc of
|
||||
LOC_CREFERENCE, LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER:
|
||||
begin
|
||||
if left.location.loc in [LOC_CREFERENCE, LOC_REFERENCE] then
|
||||
begin
|
||||
hreg1 := cg.getintregister(exprasmlist, OS_INT);
|
||||
cg.a_load_ref_reg(exprasmlist, opsize, opsize,
|
||||
left.location.reference, hreg1);
|
||||
end
|
||||
else
|
||||
begin
|
||||
hreg1 := left.location.register;
|
||||
end;
|
||||
hreg2 := cg.getintregister(exprasmlist, OS_INT);
|
||||
exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBIC, hreg2, hreg1, 1));
|
||||
exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBFE, hreg1, hreg2, hreg1));
|
||||
end;
|
||||
LOC_FLAGS:
|
||||
begin
|
||||
hreg1 := cg.getintregister(exprasmlist, OS_INT);
|
||||
resflags := left.location.resflags;
|
||||
cg.g_flags2reg(exprasmlist, location.size, resflags, hreg1);
|
||||
end;
|
||||
LOC_JUMP:
|
||||
begin
|
||||
hreg1 := cg.getintregister(exprasmlist, OS_INT);
|
||||
objectlibrary.getjumplabel(hlabel);
|
||||
cg.a_label(exprasmlist, truelabel);
|
||||
cg.a_load_const_reg(exprasmlist, OS_INT, 1, hreg1);
|
||||
cg.a_jmp_always(exprasmlist, hlabel);
|
||||
cg.a_label(exprasmlist, falselabel);
|
||||
cg.a_load_const_reg(exprasmlist, OS_INT, 0, hreg1);
|
||||
cg.a_label(exprasmlist, hlabel);
|
||||
end;
|
||||
else
|
||||
internalerror(10062);
|
||||
end;
|
||||
location.register := hreg1;
|
||||
truelabel := oldtruelabel;
|
||||
falselabel := oldfalselabel;
|
||||
end;
|
||||
|
||||
begin
|
||||
ctypeconvnode := tppctypeconvnode;
|
||||
end.
|
||||
|
@ -0,0 +1,317 @@
|
||||
#
|
||||
# Makefile.fpc for Free Pascal Linux RTL
|
||||
#
|
||||
|
||||
[package]
|
||||
main=rtl
|
||||
|
||||
[target]
|
||||
loaders=prt0 dllprt0 cprt0 gprt0 $(CRT21)
|
||||
units=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil \
|
||||
heaptrc lineinfo \
|
||||
$(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) \
|
||||
crt printer $(GGIGRAPH_UNIT) \
|
||||
sysutils typinfo math matrix varutils \
|
||||
charset ucomplex getopts \
|
||||
errors sockets gpm ipc serial terminfo dl dynlibs \
|
||||
video mouse keyboard variants types dateutils sysconst \
|
||||
cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
|
||||
|
||||
rsts=math varutils typinfo variants sysconst rtlconsts fpmkunit
|
||||
|
||||
[require]
|
||||
nortl=y
|
||||
|
||||
[clean]
|
||||
units=syslinux linux
|
||||
|
||||
[install]
|
||||
fpcpackage=y
|
||||
|
||||
[default]
|
||||
fpcdir=../..
|
||||
target=linux
|
||||
|
||||
[compiler]
|
||||
includedir=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET)
|
||||
sourcedir=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET) $(COMMON)
|
||||
targetdir=.
|
||||
|
||||
[lib]
|
||||
libname=libfprtl.so
|
||||
libversion=2.0.0
|
||||
libunits=$(SYSTEMUNIT) objpas strings \
|
||||
unix ports \
|
||||
dos crt objects printer \
|
||||
sysutils typinfo math \
|
||||
cpu mmx getopts heaptrc \
|
||||
errors sockets ipc dl dynlibs varutils
|
||||
|
||||
[prerules]
|
||||
RTL=..
|
||||
INC=$(RTL)/inc
|
||||
COMMON=$(RTL)/common
|
||||
PROCINC=$(RTL)/$(CPU_TARGET)
|
||||
UNIXINC=$(RTL)/unix
|
||||
|
||||
ifneq ($(CPU_TARGET),powerpc64)
|
||||
GGIGRAPH_UNIT=ggigraph
|
||||
else
|
||||
GGIGRAPH_UNIT=
|
||||
endif
|
||||
|
||||
ifeq ($(CPU_TARGET),i386)
|
||||
CRT21=cprt21 gprt21
|
||||
CPU_UNITS=x86 ports cpu mmx graph
|
||||
else
|
||||
CPU_UNITS=
|
||||
endif
|
||||
|
||||
UNITPREFIX=rtl
|
||||
|
||||
ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
|
||||
SYSTEMUNIT=system
|
||||
LINUXUNIT1=
|
||||
ifeq ($(CPU_TARGET),i386)
|
||||
CPU_UNITS+=oldlinux
|
||||
endif
|
||||
LINUXUNIT2=linux
|
||||
else
|
||||
SYSTEMUNIT=syslinux
|
||||
LINUXUNIT1=linux
|
||||
LINUXUNIT2=
|
||||
override FPCOPT+=-dUNIX
|
||||
endif
|
||||
|
||||
# Use new feature from 1.0.5 version
|
||||
# that generates release PPU files
|
||||
# which will not be recompiled
|
||||
ifdef RELEASE
|
||||
override FPCOPT+=-Ur
|
||||
endif
|
||||
|
||||
# Paths
|
||||
OBJPASDIR=$(RTL)/objpas
|
||||
GRAPHDIR=$(INC)/graph
|
||||
|
||||
# Use new graph unit ?
|
||||
# NEWGRAPH=YES
|
||||
# Use LibGGI ?
|
||||
# Use
|
||||
#
|
||||
ifndef USELIBGGI
|
||||
USELIBGGI=NO
|
||||
endif
|
||||
|
||||
[rules]
|
||||
# Get the $(SYSTEMUNIT) independent include file names.
|
||||
# This will set the following variables :
|
||||
# SYSINCNAMES
|
||||
include $(INC)/makefile.inc
|
||||
SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
|
||||
|
||||
# Get the processor dependent include file names.
|
||||
# This will set the following variables :
|
||||
# CPUINCNAMES
|
||||
include $(PROCINC)/makefile.cpu
|
||||
SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
|
||||
|
||||
# Put $(SYSTEMUNIT) unit dependencies together.
|
||||
SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
|
||||
|
||||
# Select 32/64 mode
|
||||
ifeq ($(CPU_TARGET),i386)
|
||||
ASTARGET=--32
|
||||
endif
|
||||
ifeq ($(CPU_TARGET),x86_64)
|
||||
ASTARGET=--64
|
||||
endif
|
||||
ifeq ($(CPU_TARGET),powerpc64)
|
||||
ASTARGET=-a64
|
||||
endif
|
||||
|
||||
#
|
||||
# Loaders
|
||||
#
|
||||
|
||||
prt0$(OEXT) : $(CPU_TARGET)/prt0.as
|
||||
$(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)prt0$(OEXT) $(CPU_TARGET)/prt0.as
|
||||
|
||||
dllprt0$(OEXT) : $(CPU_TARGET)/dllprt0.as
|
||||
$(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)dllprt0$(OEXT) $(CPU_TARGET)/dllprt0.as
|
||||
|
||||
gprt0$(OEXT) : $(CPU_TARGET)/gprt0.as
|
||||
$(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)gprt0$(OEXT) $(CPU_TARGET)/gprt0.as
|
||||
|
||||
cprt0$(OEXT) : $(CPU_TARGET)/cprt0.as
|
||||
$(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)cprt0$(OEXT) $(CPU_TARGET)/cprt0.as
|
||||
|
||||
cprt21$(OEXT) : $(CPU_TARGET)/cprt21.as
|
||||
$(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)cprt21$(OEXT) $(CPU_TARGET)/cprt21.as
|
||||
|
||||
gprt21$(OEXT) : $(CPU_TARGET)/gprt21.as
|
||||
$(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)gprt21$(OEXT) $(CPU_TARGET)/gprt21.as
|
||||
|
||||
|
||||
#
|
||||
# $(SYSTEMUNIT) Units ($(SYSTEMUNIT), Objpas, Strings)
|
||||
#
|
||||
|
||||
$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS)
|
||||
$(COMPILER) -Us -Sg $(SYSTEMUNIT).pp
|
||||
|
||||
objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
|
||||
|
||||
dateutils$(PPUEXT): $(OBJPASDIR)/dateutils.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/dateutils.pp
|
||||
|
||||
strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
|
||||
$(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
|
||||
$(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#
|
||||
# $(SYSTEMUNIT) Dependent Units
|
||||
#
|
||||
|
||||
unix$(PPUEXT) : unix.pp strings$(PPUEXT) baseunix$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
|
||||
unxconst.inc $(UNIXINC)/timezone.inc $(SYSTEMUNIT)$(PPUEXT) \
|
||||
unxfunc.inc
|
||||
|
||||
unixtype$(PPUEXT) : $(UNIXINC)/unixtype.pp ptypes.inc $(UNIXINC)/ctypes.inc $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
baseunix$(PPUEXT) : errno.inc ptypes.inc $(UNIXINC)/ctypes.inc \
|
||||
$(UNIXINC)/bunxh.inc \
|
||||
bunxsysc.inc $(CPU_TARGET)/syscallh.inc $(CPU_TARGET)/sysnr.inc \
|
||||
ostypes.inc osmacro.inc $(UNIXINC)/gensigset.inc \
|
||||
$(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
ports$(PPUEXT) : ports.pp unix$(PPUEXT) objpas$(PPUEXT)
|
||||
|
||||
dl$(PPUEXT) : $(UNIXINC)/dl.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
dynlibs$(PPUEXT) : $(INC)/dynlibs.pp $(UNIXINC)/dynlibs.inc dl$(PPUEXT) objpas$(PPUEXT)
|
||||
|
||||
#
|
||||
# TP7 Compatible RTL Units
|
||||
#
|
||||
|
||||
dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
|
||||
unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
crt$(PPUEXT) : crt.pp $(INC)/textrec.inc unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
objects$(PPUEXT) : $(INC)/objects.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
printer$(PPUEXT) : printer.pp $(INC)/textrec.inc unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#
|
||||
# Graph
|
||||
#
|
||||
include $(GRAPHDIR)/makefile.inc
|
||||
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
||||
|
||||
graph$(PPUEXT) : graph.pp unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) \
|
||||
$(GRAPHINCDEPS) $(UNIXINC)/graph16.inc
|
||||
$(COMPILER) -I$(GRAPHDIR) $(UNIXINC)/graph.pp
|
||||
|
||||
|
||||
ggigraph$(PPUEXT) : $(UNIXINC)/ggigraph.pp unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) \
|
||||
$(GRAPHINCDEPS)
|
||||
$(COMPILER) -I$(GRAPHDIR) $(UNIXINC)/ggigraph.pp
|
||||
|
||||
#
|
||||
# Delphi Compatible Units
|
||||
#
|
||||
|
||||
sysutils$(PPUEXT) : $(UNIXINC)/sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
|
||||
objpas$(PPUEXT) unix$(PPUEXT) errors$(PPUEXT) sysconst$(PPUEXT)
|
||||
$(COMPILER) -Fi$(OBJPASDIR)/sysutils $(UNIXINC)/sysutils.pp
|
||||
|
||||
classes$(PPUEXT) : $(UNIXINC)/classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
|
||||
sysutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT)
|
||||
$(COMPILER) -Fi$(OBJPASDIR)/classes $(UNIXINC)/classes.pp
|
||||
|
||||
typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT) sysutils$(PPUEXT) rtlconsts$(PPUEXT)
|
||||
$(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp
|
||||
|
||||
math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/math.pp
|
||||
|
||||
gettext$(PPUEXT): $(OBJPASDIR)/gettext.pp objpas$(PPUEXT) sysutils$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/gettext.pp
|
||||
|
||||
varutils$(PPUEXT) : $(OBJPASDIR)/cvarutil.inc $(OBJPASDIR)/varutils.inc \
|
||||
$(OBJPASDIR)/varutilh.inc varutils.pp sysutils$(PPUEXT)
|
||||
$(COMPILER) -I$(OBJPASDIR) $(UNIXINC)/varutils.pp
|
||||
|
||||
variants$(PPUEXT) : $(INC)/variants.pp sysutils$(PPUEXT) sysconst$(PPUEXT) varutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT)
|
||||
$(COMPILER) -Fi$(INC) $(INC)/variants.pp
|
||||
|
||||
types$(PPUEXT) : $(OBJPASDIR)/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/types.pp
|
||||
|
||||
sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/sysconst.pp
|
||||
|
||||
rtlconsts$(PPUEXT) : $(OBJPASDIR)/rtlconsts.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/rtlconsts.pp
|
||||
|
||||
strutils$(PPUEXT) : $(OBJPASDIR)/strutils.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) \
|
||||
sysutils$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/strutils.pp
|
||||
|
||||
#
|
||||
# Mac Pascal Model
|
||||
#
|
||||
|
||||
macpas$(PPUEXT) : $(INC)/macpas.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(INC)/macpas.pp $(REDIR)
|
||||
|
||||
#
|
||||
# Other $(SYSTEMUNIT)-independent RTL Units
|
||||
#
|
||||
|
||||
cpu$(PPUEXT) : $(PROCINC)/cpu.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
mmx$(PPUEXT) : $(PROCINC)/mmx.pp cpu$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) -Sg $(INC)/heaptrc.pp
|
||||
|
||||
lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
ucomplex$(PPUEXT) : $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
fpmkunit$(PPUEXT) : $(COMMON)/fpmkunit.pp classes$(PPUEXT)
|
||||
|
||||
#
|
||||
# Other $(SYSTEMUNIT)-dependent RTL Units
|
||||
#
|
||||
|
||||
sockets$(PPUEXT) : sockets.pp $(INC)/textrec.inc $(INC)/filerec.inc \
|
||||
unixsock.inc unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
errors$(PPUEXT) : errors.pp strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
ipc$(PPUEXT) : ipc.pp unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
terminfo$(PPUEXT) : terminfo.pp unix$(PPUEXT)
|
||||
|
||||
callspec$(PPUEXT) : $(INC)/callspec.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
cmem$(PPUEXT) : $(INC)/cmem.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
cthreads$(PPUEXT) : $(UNIXINC)/cthreads.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
cwstring$(PPUEXT) : $(UNIXINC)/cwstring.pp $(SYSTEMUNIT)$(PPUEXT) sysutils$(PPUEXT) baseunix$(PPUEXT) unix$(PPUEXT) unixtype$(PPUEXT) ctypes$(PPUEXT)
|
||||
|
||||
gpm$(PPUEXT): gpm.pp unix$(PPUEXT) baseunix$(PPUEXT) sockets$(PPUEXT)
|
||||
|
||||
ctypes$(PPUEXT) : $(INC)/ctypes.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
fpcylix$(PPUEXT) : fpcylix.pp $(SYSTEMUNIT)$(PPUEXT) dynlibs$(PPUEXT) objpas$(PPUEXT)
|
@ -0,0 +1,118 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2001 by Free Pascal development team
|
||||
|
||||
Linux IPC implemented with ipccall
|
||||
|
||||
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.
|
||||
|
||||
***********************************************************************}
|
||||
{ The following definitions come from linux/ipc.h }
|
||||
|
||||
Function ftok (Path : pchar; ID : cint) : TKey;
|
||||
Var Info : TStat;
|
||||
begin
|
||||
If fpstat(path,info)<0 then
|
||||
ftok:=-1
|
||||
else
|
||||
begin
|
||||
ftok:= (info.st_ino and $FFFF) or ((info.st_dev and $ff) shl 16) or (byte(ID) shl 24)
|
||||
end;
|
||||
end;
|
||||
|
||||
Const
|
||||
CALL_SEMOP = 1;
|
||||
CALL_SEMGET = 2;
|
||||
CALL_SEMCTL = 3;
|
||||
CALL_MSGSND = 11;
|
||||
CALL_MSGRCV = 12;
|
||||
CALL_MSGGET = 13;
|
||||
CALL_MSGCTL = 14;
|
||||
CALL_SHMAT = 21;
|
||||
CALL_SHMDT = 22;
|
||||
CALL_SHMGET = 23;
|
||||
CALL_SHMCTL = 24;
|
||||
|
||||
{ generic call that handles all IPC calls }
|
||||
|
||||
function ipccall(Call,First,Second,Third : cint; P : Pointer) : ptrint;
|
||||
begin
|
||||
ipccall:=do_syscall(syscall_nr_ipc,call,first,second,third,ptrint(P));
|
||||
// ipcerror:=fpgetErrno;
|
||||
end;
|
||||
|
||||
function shmget(key: Tkey; size:cint; flag:cint):cint;
|
||||
begin
|
||||
shmget:=ipccall (CALL_SHMGET,key,size,flag,nil);
|
||||
end;
|
||||
|
||||
Function shmat (shmid:cint; shmaddr:pointer; shmflg:cint):pointer;
|
||||
Var raddr : pchar;
|
||||
error : ptrint;
|
||||
begin
|
||||
error:=ipccall(CALL_SHMAT,shmid,shmflg,cint(@raddr),shmaddr);
|
||||
If Error<0 then
|
||||
shmat:=pchar(error)
|
||||
else
|
||||
shmat:=raddr;
|
||||
end;
|
||||
|
||||
function shmdt (shmaddr:pointer): cint;
|
||||
begin
|
||||
shmdt:=ipccall(CALL_SHMDT,0,0,0,shmaddr);
|
||||
end;
|
||||
|
||||
function shmctl(shmid:cint; cmd:cint; buf: pshmid_ds): cint;
|
||||
begin
|
||||
shmctl:=ipccall(CALL_SHMCTL,shmid,cmd,0,buf);
|
||||
end;
|
||||
|
||||
function msgget(key:Tkey; msgflg:cint):cint;
|
||||
begin
|
||||
msgget:=ipccall(CALL_MSGGET,key,msgflg,0,Nil);
|
||||
end;
|
||||
|
||||
function msgsnd(msqid:cint; msgp: PMSGBuf; msgsz: size_t; msgflg:cint):cint;
|
||||
begin
|
||||
msgsnd:=ipccall(Call_MSGSND,msqid,msgsz,msgflg,msgp);
|
||||
end;
|
||||
|
||||
function msgrcv(msqid:cint; msgp: PMSGBuf; msgsz: size_t; msgtyp:cint; msgflg:cint):cint;
|
||||
Type
|
||||
TIPC_Kludge = Record
|
||||
msgp : pmsgbuf;
|
||||
msgtyp : cint;
|
||||
end;
|
||||
Var
|
||||
tmp : TIPC_Kludge;
|
||||
begin
|
||||
tmp.msgp := msgp;
|
||||
tmp.msgtyp := msgtyp;
|
||||
msgrcv:=ipccall(CALL_MSGRCV,msqid,msgsz,msgflg,@tmp);
|
||||
end;
|
||||
|
||||
Function msgctl(msqid:cint; cmd: cint; buf: PMSQid_ds): cint;
|
||||
begin
|
||||
msgctl:=ipccall(CALL_MSGCTL,msqid,cmd,0,buf);
|
||||
end;
|
||||
|
||||
Function semget(key:Tkey; nsems:cint; semflg:cint): cint;
|
||||
begin
|
||||
semget:=ipccall (CALL_SEMGET,key,nsems,semflg,Nil);
|
||||
end;
|
||||
|
||||
Function semop(semid:cint; sops: psembuf; nsops:cuint): cint;
|
||||
begin
|
||||
semop:=ipccall (CALL_SEMOP,semid,cint(nsops),0,Pointer(sops));
|
||||
end;
|
||||
|
||||
Function semctl(semid:cint; semnum:cint; cmd:cint; var arg: tsemun): cint;
|
||||
begin
|
||||
semctl:=ipccall(CALL_SEMCTL,semid,semnum,cmd,@arg);
|
||||
end;
|
||||
|
@ -0,0 +1,54 @@
|
||||
{
|
||||
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);cdecl;
|
||||
var
|
||||
res : word;
|
||||
{ fpustate: longint; }
|
||||
begin
|
||||
res:=0;
|
||||
writeln('signaltorunerror');
|
||||
{ exception flags are turned off by kernel }
|
||||
fpc_enable_ppc_fpu_exceptions;
|
||||
case sig of
|
||||
SIGFPE :
|
||||
begin
|
||||
{
|
||||
fpscr is cleared by the kernel -> can't find out cause :(
|
||||
fpustate := fpc_get_ppc_fpscr;
|
||||
if (fpustate and ppc_fpu_underflow) <> 0 then
|
||||
res := 206
|
||||
else if (fpustate and ppc_fpu_overflow) <> 0 then
|
||||
res := 205
|
||||
else if (fpustate and ppc_fpu_divbyzero) <> 0 then
|
||||
res := 200
|
||||
else
|
||||
}
|
||||
res := 207;
|
||||
end;
|
||||
SIGBUS :
|
||||
res:=214;
|
||||
SIGILL,
|
||||
SIGSEGV :
|
||||
res:=216;
|
||||
end;
|
||||
{ give runtime error at the position where the signal was raised }
|
||||
if res<>0 then
|
||||
HandleErrorAddrFrame(res,pointer(SigContext^.pt_regs^.nip),pointer(SigContext^.pt_regs^.gpr[1]));
|
||||
end;
|
||||
|
@ -0,0 +1,81 @@
|
||||
{
|
||||
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}
|
||||
|
||||
type
|
||||
TPPC_Reg = QWord;
|
||||
{ from include/asm-ppc64/ptrace.h }
|
||||
pptregs = ^tptregs;
|
||||
tptregs = record
|
||||
gpr: array[0..31] of TPPC_Reg;
|
||||
nip: TPPC_Reg;
|
||||
msr: TPPC_Reg;
|
||||
orig_gpr3: TPPC_Reg; { Used for restarting system calls }
|
||||
ctr: TPPC_Reg;
|
||||
link: TPPC_Reg;
|
||||
xer: TPPC_Reg;
|
||||
ccr: TPPC_Reg;
|
||||
softe: TPPC_Reg; { soft enabled/disabled }
|
||||
trap: TPPC_Reg; { Reason for being here }
|
||||
dar: TPPC_Reg; { Fault registers }
|
||||
dsisr: TPPC_Reg;
|
||||
result: TPPC_Reg; { Result of a system call }
|
||||
end;
|
||||
|
||||
{ from include/asm-ppc64/signal.h }
|
||||
stack_t = record
|
||||
ss_sp: pointer;
|
||||
ss_flags: longint;
|
||||
ss_size: size_t;
|
||||
end;
|
||||
|
||||
{ from include/asm-ppc64/sigcontext.h }
|
||||
tsigcontext_struct = record
|
||||
_unused: array[0..3] of qword;
|
||||
signal: longint;
|
||||
pad0 : longint;
|
||||
handler: qword;
|
||||
oldmask: qword;
|
||||
pt_regs: pptregs;
|
||||
end;
|
||||
|
||||
{ from include/asm-ppc64/ucontext.h }
|
||||
pucontext = ^tucontext;
|
||||
tucontext = record
|
||||
uc_flags : qword;
|
||||
uc_link : pucontext;
|
||||
uc_stack : stack_t;
|
||||
uc_sigmask : qword;{sigset_t;}
|
||||
__unused : array[0..14] of qword;{sigset_t;}
|
||||
uc_mcontext : tsigcontext_struct;
|
||||
end;
|
||||
|
||||
|
||||
{ from arch/ppc/kernel/signal.c, the type of the actual parameter passed }
|
||||
{ to the sigaction handler }
|
||||
t_rt_sigframe = record
|
||||
uc: tucontext;
|
||||
_unused: array[0..1] of qword;
|
||||
tramp: array[0..5] of dword;
|
||||
pinfo: psiginfo;
|
||||
puc: pointer;
|
||||
siginfo: tsiginfo;
|
||||
abigap: array[0..287] of byte;
|
||||
end;
|
||||
|
||||
PSigContext = ^TSigContext;
|
||||
TSigContext= tsigcontext_struct;
|
1163
rtl/powerpc/powerpc.inc
Normal file
1163
rtl/powerpc/powerpc.inc
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user