* powerpc64 port now (manually) cycles, most test programs in tests/test are fine too

* fixed bug in ncal.pas which in some circumstances treated the hidden length parameter for open arrays as 32 bit integer

git-svn-id: trunk@1303 -
This commit is contained in:
tom_at_work 2005-10-05 21:55:25 +00:00
parent 29777b5ce9
commit b2e1cf2610
11 changed files with 41 additions and 317 deletions

View File

@ -366,7 +366,7 @@ type
begin
maybe_load_para_in_temp(p);
hightree:=caddnode.create(subn,geninlinenode(in_length_x,false,p.getcopy),
cordconstnode.create(1,s32inttype,false));
cordconstnode.create(1,sinttype,false));
loadconst:=false;
end;
end;
@ -375,13 +375,13 @@ type
len:=0;
end;
if loadconst then
hightree:=cordconstnode.create(len,s32inttype,true)
hightree:=cordconstnode.create(len,sinttype,true)
else
begin
if not assigned(hightree) then
internalerror(200304071);
{ Need to use explicit, because it can also be a enum }
hightree:=ctypeconvnode.create_internal(hightree,s32inttype);
hightree:=ctypeconvnode.create_internal(hightree,sinttype);
end;
result:=hightree;
end;

View File

@ -1040,7 +1040,6 @@ begin
reference_reset_base(href, NR_STACK_POINTER_REG, -localsize);
a_load_store(list, A_STDU, NR_STACK_POINTER_REG, href);
end else begin
writeln(localsize);
reference_reset_base(href, NR_NO, -localsize);
// use R0 for loading the constant (which is definitely > 32k when entering

View File

@ -113,20 +113,23 @@ begin
(right.nodetype = ordconstn) and
ispowerof2(tordconstnode(right).value, power) then
begin
{ From "The PowerPC Compiler Writer's Guide": }
{ This code uses the fact that, in the PowerPC architecture, }
{ the shift right algebraic instructions set the Carry bit if }
{ the source register contains a negative number and one or }
{ more 1-bits are shifted out. Otherwise, the carry bit is }
{ cleared. The addze instruction corrects the quotient, if }
{ necessary, when the dividend is negative. For example, if }
{ n = -13, (0xFFFF_FFF3), and k = 2, after executing the srawi }
{ instruction, q = -4 (0xFFFF_FFFC) and CA = 1. After executing }
{ the addze instruction, q = -3, the correct quotient. }
// ts: buggy....... sar also used in a unsigned division...
cg.a_op_const_reg_reg(exprasmlist, OP_SAR, OS_64, power,
numerator, resultreg);
exprasmlist.concat(taicpu.op_reg_reg(A_ADDZE, resultreg, resultreg));
if (is_signed(right.resulttype.def)) then begin
{ From "The PowerPC Compiler Writer's Guide": }
{ This code uses the fact that, in the PowerPC architecture, }
{ the shift right algebraic instructions set the Carry bit if }
{ the source register contains a negative number and one or }
{ more 1-bits are shifted out. Otherwise, the carry bit is }
{ cleared. The addze instruction corrects the quotient, if }
{ necessary, when the dividend is negative. For example, if }
{ n = -13, (0xFFFF_FFF3), and k = 2, after executing the srawi }
{ instruction, q = -4 (0xFFFF_FFFC) and CA = 1. After executing }
{ the addze instruction, q = -3, the correct quotient. }
cg.a_op_const_reg_reg(exprasmlist, OP_SAR, OS_64, power,
numerator, resultreg);
exprasmlist.concat(taicpu.op_reg_reg(A_ADDZE, resultreg, resultreg));
end else begin
cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, power, numerator, resultreg);
end;
end
else
begin

View File

@ -1301,7 +1301,7 @@ implementation
begin
s:=proc_get_importname(pd);
if s<>'' then
gen_external_stub(asmlist[al_procedures],pd,s);
gen_external_stub(asmlist[al_procedures],pd,{$IFDEF POWERPC64}'.'+{$ENDIF}s);
end;
{ Import DLL specified? }

View File

@ -275,12 +275,13 @@
PVarRec = ^TVarRec;
TVarRec = record
case VType : Ptrint of
vtInteger : (VInteger: Longint);
{$ifdef ENDIAN_BIG}
vtBoolean : (booldummy1,booldummy2,booldummy3: byte; VBoolean: Boolean);
vtChar : (chardummy1,chardummy2,chardummy3: byte; VChar: Char);
vtWideChar : (wchardummy1,VWideChar: WideChar);
vtInteger : ({$IFDEF CPU64}integerdummy1 : Longint;{$ENDIF CPU64}VInteger: Longint);
vtBoolean : ({$IFDEF CPU64}booldummy : Longint;{$ENDIF CPU64}booldummy1,booldummy2,booldummy3: byte; VBoolean: Boolean);
vtChar : ({$IFDEF CPU64}chardummy : Longint;{$ENDIF CPU64}chardummy1,chardummy2,chardummy3: byte; VChar: Char);
vtWideChar : ({$IFDEF CPU64}widechardummy : Longint;{$ENDIF CPU64}wchardummy1,VWideChar: WideChar);
{$else ENDIAN_BIG}
vtInteger : (VInteger: Longint);
vtBoolean : (VBoolean: Boolean);
vtChar : (VChar: Char);
vtWideChar : (VWideChar: WideChar);

View File

@ -1,5 +1,3 @@
/*
*/
/* Startup code for programs linked with GNU libc.
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@ -136,147 +134,4 @@ ___fpc_brk_addr:
.comm operatingsystem_parameter_argc, 4
.comm operatingsystem_parameter_argv, 8
.comm operatingsystem_parameter_envp, 8
.comm operatingsystem_parameter_auxp, 8
.comm operatingsystem_parameter_exitp, 8
/*
*/
/* Startup code for programs linked with GNU libc.
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
.macro LOAD_64BIT_VAL ra, value
addis \ra, 0, \value@highest
ori \ra,\ra,\value@higher
sldi \ra,\ra,32
oris \ra,\ra,\value@h
ori \ra,\ra,\value@l
.endm
.macro FUNCTION_PROLOG fn
.section ".text"
.align 2
.globl \fn
.section ".opd", "aw"
.align 3
\fn:
.quad .\fn, .TOC.@tocbase, 0
.previous
.size \fn, 24
.type \fn, @function
.globl .\fn
.\fn:
.endm
.macro FUNCTION_EPILOG fn
.long 0
.byte 0, 12, 0, 0, 0, 0, 0, 0
.type .\fn, @function
.size .\fn,.-.\fn
.endm
.macro PRINTMSG msg len
lis 4, \msg@highest
ori 4, 4, \msg@higher
sldi 4, 4, 32
oris 4, 4, \msg@h
ori 4, 4, \msg@l
li 5, \len
li 0,4
li 3,1
sc
.endm
/*
cprt0 pascal entry
*/
FUNCTION_PROLOG _start
mr 26, 1
/* Set up an initial stack frame, and clear the LR */
clrrdi 1, 1, 5 /* align r1 */
li 0, 0
stdu 1,-48(1)
mtlr 0
std 0, 0(1) /* r1 = pointer to NULL value */
/* store argument count (= 0(r1) )*/
ld 3, 0(26)
LOAD_64BIT_VAL 10, operatingsystem_parameter_argc
stw 3, 0(10)
/* calculate argument vector address and store (= 8(r1) + 8 ) */
addi 4, 26, 8
LOAD_64BIT_VAL 10, operatingsystem_parameter_argv
std 4, 0(10)
/* store environment pointer (= argv + (argc+1)* 8 ) */
addi 5, 3, 1
sldi 5, 5, 3
add 5, 4, 5
LOAD_64BIT_VAL 10, operatingsystem_parameter_envp
std 5, 0(10)
bl .__libc_init_first
nop
lis 3, _dl_fini@highest
ori 3, 3, _dl_fini@higher
sldi 3,3,32
oris 3, 3, _dl_fini@h
ori 3, 3, _dl_fini@l
bl .PASCALMAIN
nop
ori 0, 0, 0
/* directly jump to exit procedure, not via the function pointer */
b _haltproc
.align 3
.global ._haltproc
.section ".opd", "aw"
.align 3
._haltproc:
.quad _haltproc, .TOC.@tocbase, 0
.previous
.size ._haltproc, 24
.global _haltproc
_haltproc:
/* exit call */
li 0, 1
sc
b _haltproc
/* Define a symbol for the first piece of initialized data. */
.section ".data"
.globl __data_start
__data_start:
data_start:
.globl ___fpc_brk_addr /* heap management */
.type ___fpc_brk_addr, @object
.size ___fpc_brk_addr, 4
___fpc_brk_addr:
.long 0
.text
.comm operatingsystem_parameter_argc, 4
.comm operatingsystem_parameter_argv, 8
.comm operatingsystem_parameter_envp, 8
.comm operatingsystem_parameter_auxp, 8
.comm operatingsystem_parameter_exitp, 8

View File

@ -2,7 +2,3 @@
*/
/* empty */
/*
*/
/* empty */

View File

@ -1,10 +1,4 @@
/*
*/
/* empty */
/*
*/
/* empty */

View File

@ -127,132 +127,3 @@ ___fpc_brk_addr:
.comm operatingsystem_parameter_argv, 8
.comm operatingsystem_parameter_envp, 8
/*
*/
/* Startup code for programs linked with GNU libc.
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
.macro LOAD_64BIT_VAL ra, value
lis \ra,\value@highest
ori \ra,\ra,\value@higher
sldi \ra,\ra,32
oris \ra,\ra,\value@h
ori \ra,\ra,\value@l
.endm
.macro FUNCTION_PROLOG fn
.section ".text"
.align 2
.globl \fn
.section ".opd", "aw"
.align 3
\fn:
.quad .\fn, .TOC.@tocbase, 0
.previous
.size \fn, 24
.type \fn, @function
.globl .\fn
.\fn:
.endm
.macro FUNCTION_EPILOG fn
.long 0
.byte 0, 12, 0, 0, 0, 0, 0, 0
.type .\fn, @function
.size .\fn,.-.\fn
.endm
.macro PRINTMSG msg len
lis 4, \msg@highest
ori 4, 4, \msg@higher
sldi 4, 4, 32
oris 4, 4, \msg@h
ori 4, 4, \msg@l
li 5, \len
li 0,4
li 3,1
sc
.endm
/*
Main Pascal entry point label (function)
*/
FUNCTION_PROLOG _start
mr 26, 1
/* Set up an initial stack frame, and clear the LR */
clrrdi 1, 1, 5 /* align r1 */
li 0, 0
stdu 1,-48(1)
mtlr 0
std 0, 0(1) /* r1 = pointer to NULL value */
/* store argument count (= 0(r1) )*/
ld 3, 0(26)
LOAD_64BIT_VAL 10, operatingsystem_parameter_argc
stw 3, 0(10)
/* calculate argument vector address and store (= 8(r1) + 8 ) */
addi 4, 26, 8
LOAD_64BIT_VAL 10, operatingsystem_parameter_argv
std 4, 0(10)
/* store environment pointer (= argv + (argc+1)* 8 ) */
addi 5, 3, 1
sldi 5, 5, 3
add 5, 4, 5
LOAD_64BIT_VAL 10, operatingsystem_parameter_envp
std 5, 0(10)
bl .PASCALMAIN
ori 0, 0, 0
/* directly jump to exit procedure, not via the function pointer */
b ._haltproc
.align 3
.global _haltproc
.section ".opd", "aw"
.align 3
_haltproc:
.quad ._haltproc, .TOC.@tocbase, 0
.previous
.size _haltproc, 24
.global ._haltproc
._haltproc:
/* exit call */
li 0, 1
sc
b ._haltproc
/* Define a symbol for the first piece of initialized data. */
.section ".data"
.globl __data_start
__data_start:
data_start:
.globl ___fpc_brk_addr /* heap management */
.type ___fpc_brk_addr, @object
.size ___fpc_brk_addr, 4
___fpc_brk_addr:
.long 0
.text
.comm operatingsystem_parameter_argc, 4
.comm operatingsystem_parameter_argv, 8
.comm operatingsystem_parameter_envp, 8

View File

@ -18,7 +18,7 @@
type
TPPC_Reg = QWord;
{ from include/ppc/ptrace.h }
{ from include/asm-ppc64/ptrace.h }
pptregs = ^tptregs;
tptregs = record
gpr: array[0..31] of TPPC_Reg;
@ -29,38 +29,39 @@ type
link: TPPC_Reg;
xer: TPPC_Reg;
ccr: TPPC_Reg;
mq: TPPC_Reg; { 601 only (not used at present) }
{ Used on APUS to hold IPL value. }
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-ppc/signal.h }
{ from include/asm-ppc64/signal.h }
stack_t = record
ss_sp: pointer;
ss_flags: longint;
ss_size: size_t;
end;
{ from include/asm-ppc/sigcontext.h }
{ from include/asm-ppc64/sigcontext.h }
tsigcontext_struct = record
_unused: array[0..3] of PtrUInt;
_unused: array[0..3] of dword;
signal: longint;
handler: PtrInt;
oldmask: PtrInt;
pad0 : longint;
handler: dword;
oldmask: dword;
pt_regs: pptregs;
end;
{ from include/asm-ppc/ucontext.h }
{ from include/asm-ppc64/ucontext.h }
pucontext = ^tucontext;
tucontext = record
uc_flags : dword;
uc_link : pucontext;
uc_stack : stack_t;
uc_mcontext : tsigcontext_struct;
uc_sigmask : sigset_t;
__unused : array[0..14] of sigset_t;
uc_mcontext : tsigcontext_struct;
end;

View File

@ -186,6 +186,10 @@ type
{$define NEWSIGNAL}
{$endif CPUx86_64}
{$ifdef CPUPOWERPC64}
{$define NEWSIGNAL}
{$endif CPUPOWERPC64}
SigActionRec = packed record // this is temporary for the migration
sa_handler : SigActionHandler;
{$ifdef NEWSIGNAL}