* more ppc fixes, hello world works again under linuxppc

This commit is contained in:
Jonas Maebe 2003-11-29 22:54:32 +00:00
parent ea754b9a49
commit 8ad6133ea3
4 changed files with 52 additions and 33 deletions
compiler/powerpc
rtl/linux/powerpc

View File

@ -228,7 +228,7 @@ unit agppcgas;
else
internalerror(2003112901);
end;
cond2str:=cond2str++#9+tostr(c.bo)+','+tostr(c.bi)+',';
cond2str:=cond2str+#9+tostr(c.bo)+','+tostr(c.bi)+',';
end;
true:
if (op >= A_B) and (op <= A_BCLRL) then
@ -253,9 +253,9 @@ unit agppcgas;
end;
case c.cond of
C_LT..C_NU:
cond2str := tempstr+gas_regname(newreg(R_SPECIALREGISTER,c.cr,R_SUBWHOLE))+',';
cond2str := tempstr+gas_regname(newreg(R_SPECIALREGISTER,c.cr,R_SUBWHOLE));
C_T,C_F,C_DNZT,C_DNZF,C_DZT,C_DZF:
cond2str := tempstr+tostr(c.crbit)+',';
cond2str := tempstr+tostr(c.crbit);
else
cond2str := tempstr;
end;
@ -287,7 +287,12 @@ unit agppcgas;
A_BCTR,A_BCTRL,A_BLR,A_BLRL:
s:=#9+gas_op2str[op]
else
s:=cond2str(op,taicpu(hp).condition);
begin
s:=cond2str(op,taicpu(hp).condition);
if (s[length(s)] <> #9) and
(taicpu(hp).ops>0) then
s := s + ',';
end;
end;
if (taicpu(hp).ops>0) and (taicpu(hp).oper[0]^.typ<>top_none) then
@ -323,7 +328,10 @@ begin
end.
{
$Log$
Revision 1.36 2003-11-29 18:17:26 jonas
Revision 1.37 2003-11-29 22:54:32 jonas
* more ppc fixes, hello world works again under linuxppc
Revision 1.36 2003/11/29 18:17:26 jonas
* fixed writing of conditional branches which only depend on the value
of ctr

View File

@ -77,8 +77,9 @@ unit cpupi;
tg.setfirsttemp(ofs);
end
else
{ at 0(r1), the previous value of r1 will be stored }
tg.setfirsttemp(4);
if assigned(procdef.localst) then
{ at 0(r1), the previous value of r1 will be stored }
tg.setfirsttemp(4);
end;
@ -127,7 +128,10 @@ begin
end.
{
$Log$
Revision 1.30 2003-11-29 16:27:19 jonas
Revision 1.31 2003-11-29 22:54:32 jonas
* more ppc fixes, hello world works again under linuxppc
Revision 1.30 2003/11/29 16:27:19 jonas
* fixed several ppc assembler reader related problems
* local vars in assembler procedures now start at offset 4
* fixed second_int_to_bool (apparently an integer can be in LOC_JUMP??)

View File

@ -669,10 +669,21 @@ Unit rappcgas;
begin
{ we can search here without an extra table which is sorted by string length
because we take the whole remaining string without the leading B }
if copy(hs,length(s)-1,2)='LR' then
begin
actopcode := A_BCLR;
setlength(hs,length(hs)-2)
end
else if copy(hs,length(s)-2,3)='CTR' then
begin
actopcode := A_BCCTR;
setlength(hs,length(hs)-3)
end
else
actopcode := A_BC;
for cond:=low(TAsmCondFlag) to high(TAsmCondFlag) do
if copy(hs,2,length(s)-1)=UpperAsmCondFlag2Str[cond] then
begin
actopcode:=A_BC;
actcondition.simple:=true;
actcondition.cond:=cond;
if (cond in [C_LT,C_LE,C_EQ,C_GE,C_GT,C_NL,C_NE,C_NG,C_SO,C_NS,C_UN,C_NU]) then
@ -681,19 +692,6 @@ Unit rappcgas;
is_asmopcode:=true;
exit;
end;
if copy(hs,length(s)-1,2)='LR' then
for cond:=C_LT to C_NU do
if copy(hs,2,length(s)-3)=UpperAsmCondFlag2Str[cond] then
begin
actopcode:=A_BCLR;
actcondition.simple:=false;
actcondition.bo:=AsmCondFlag2BOLT_NU[cond];
actcondition.bo:=AsmCondFlag2BI[cond];
actcondition.cr := RS_CR0;
actasmtoken:=AS_OPCODE;
is_asmopcode:=true;
exit;
end;
end;
end;
@ -760,7 +758,10 @@ initialization
end.
{
$Log$
Revision 1.7 2003-11-29 16:27:19 jonas
Revision 1.8 2003-11-29 22:54:32 jonas
* more ppc fixes, hello world works again under linuxppc
Revision 1.7 2003/11/29 16:27:19 jonas
* fixed several ppc assembler reader related problems
* local vars in assembler procedures now start at offset 4
* fixed second_int_to_bool (apparently an integer can be in LOC_JUMP??)

View File

@ -31,11 +31,12 @@ function FpSysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYS
asm
mr r0,r3
sc
bnslr
bns .LDone
neg r3, r3
lis r4,(Errno+4)@ha
stw r3,(Errno+4)@l(r4)
li r3,-1
.LDone:
end;
function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
@ -47,11 +48,12 @@ asm
mr r0,r3
mr r3,r4
sc
bnslr
bns .LDone
neg r3, r3
lis r4,(Errno+4)@ha
stw r3,(Errno+4)@l(r4)
li r3,-1
.LDone:
end;
@ -65,11 +67,12 @@ asm
mr r3,r4
mr r4,r5
sc
bnslr
bns .LDone
neg r3, r3
lis r4,(Errno+4)@ha
stw r3,(Errno+4)@l(r4)
li r3,-1
.LDone:
end;
function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
@ -83,12 +86,12 @@ asm
mr r4,r5
mr r5,r6
sc
bnslr
bns .LDone
neg r3, r3
lis r4,(Errno+4)@ha
stw r3,(Errno+4)@l(r4)
li r3,-1
.LDone:
end;
@ -104,11 +107,12 @@ asm
mr r5,r6
mr r6,r7
sc
bnslr
bns .LDone
neg r3, r3
lis r4,(Errno+4)@ha
stw r3,(Errno+4)@l(r4)
li r3,-1
.LDone:
end;
function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
@ -124,11 +128,12 @@ asm
mr r6,r7
mr r7,r8
sc
bnslr
bns .LDone
neg r3, r3
lis r4,(Errno+4)@ha
stw r3,(Errno+4)@l(r4)
li r3,-1
.LDone:
end;
@ -146,11 +151,12 @@ asm
mr r7,r8
mr r8,r9
sc
bnslr
bns .LDone
neg r3, r3
lis r4,(Errno+4)@ha
stw r3,(Errno+4)@l(r4)
li r3,-1
.LDone:
end;
// Old style syscall:
@ -235,8 +241,8 @@ end;
{
$Log$
Revision 1.9 2003-11-29 18:18:11 jonas
* fixed syscacll for new assembler reader
Revision 1.10 2003-11-29 22:54:32 jonas
* more ppc fixes, hello world works again under linuxppc
Revision 1.8 2003/11/15 19:01:27 florian
* fixed rtl to work with the integrated fpc ppc assembler reader