|
@@ -28,13 +28,32 @@ function FpSysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYS
|
|
|
This function puts the registers in place, does the call, and then
|
|
|
copies back the registers as they are after the SysCall.
|
|
|
}
|
|
|
+var
|
|
|
+ temp, retaddress: longint;
|
|
|
asm
|
|
|
mr r0,r3
|
|
|
sc
|
|
|
bns .LDone
|
|
|
- neg r3, r3
|
|
|
+ lis r10,(fpc_threadvar_relocate_proc)@ha
|
|
|
+ lwz r10,(fpc_threadvar_relocate_proc)@l(r10)
|
|
|
+ cmpwi r10,0
|
|
|
+ bne .LThreaded
|
|
|
lis r4,(Errno+4)@ha
|
|
|
stw r3,(Errno+4)@l(r4)
|
|
|
+ b .LFailed
|
|
|
+.LThreaded:
|
|
|
+ stw r3,temp
|
|
|
+ mflr r3
|
|
|
+ mtctr r10
|
|
|
+ lis r4,(errno)@ha
|
|
|
+ stw r3,retaddress
|
|
|
+ lwz r3,(errno)@l(r4)
|
|
|
+ bctrl
|
|
|
+ lwz r4,temp
|
|
|
+ lwz r5,retaddress
|
|
|
+ stw r4,0(r3)
|
|
|
+ mtlr r5
|
|
|
+.LFailed:
|
|
|
li r3,-1
|
|
|
.LDone:
|
|
|
end;
|
|
@@ -44,14 +63,33 @@ function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler;[public,alias:'
|
|
|
This function puts the registers in place, does the call, and then
|
|
|
copies back the registers as they are after the SysCall.
|
|
|
}
|
|
|
+var
|
|
|
+ temp, retaddress: longint;
|
|
|
asm
|
|
|
mr r0,r3
|
|
|
mr r3,r4
|
|
|
sc
|
|
|
bns .LDone
|
|
|
- neg r3, r3
|
|
|
+ lis r10,(fpc_threadvar_relocate_proc)@ha
|
|
|
+ lwz r10,(fpc_threadvar_relocate_proc)@l(r10)
|
|
|
+ cmpwi r10,0
|
|
|
+ bne .LThreaded
|
|
|
lis r4,(Errno+4)@ha
|
|
|
stw r3,(Errno+4)@l(r4)
|
|
|
+ b .LFailed
|
|
|
+.LThreaded:
|
|
|
+ stw r3,temp
|
|
|
+ mflr r3
|
|
|
+ mtctr r10
|
|
|
+ lis r4,(errno)@ha
|
|
|
+ stw r3,retaddress
|
|
|
+ lwz r3,(errno)@l(r4)
|
|
|
+ bctrl
|
|
|
+ lwz r4,temp
|
|
|
+ lwz r5,retaddress
|
|
|
+ stw r4,0(r3)
|
|
|
+ mtlr r5
|
|
|
+.LFailed:
|
|
|
li r3,-1
|
|
|
.LDone:
|
|
|
end;
|
|
@@ -62,16 +100,35 @@ function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler;[public,
|
|
|
This function puts the registers in place, does the call, and then
|
|
|
copies back the registers as they are after the SysCall.
|
|
|
}
|
|
|
+var
|
|
|
+ temp, retaddress: longint;
|
|
|
asm
|
|
|
mr r0,r3
|
|
|
mr r3,r4
|
|
|
mr r4,r5
|
|
|
sc
|
|
|
- bns .LDone
|
|
|
- neg r3, r3
|
|
|
- lis r4,(Errno+4)@ha
|
|
|
- stw r3,(Errno+4)@l(r4)
|
|
|
- li r3,-1
|
|
|
+ bns .LDone
|
|
|
+ lis r10,(fpc_threadvar_relocate_proc)@ha
|
|
|
+ lwz r10,(fpc_threadvar_relocate_proc)@l(r10)
|
|
|
+ cmpwi r10,0
|
|
|
+ bne .LThreaded
|
|
|
+ lis r4,(Errno+4)@ha
|
|
|
+ stw r3,(Errno+4)@l(r4)
|
|
|
+ b .LFailed
|
|
|
+.LThreaded:
|
|
|
+ stw r3,temp
|
|
|
+ mflr r3
|
|
|
+ mtctr r10
|
|
|
+ lis r4,(errno)@ha
|
|
|
+ stw r3,retaddress
|
|
|
+ lwz r3,(errno)@l(r4)
|
|
|
+ bctrl
|
|
|
+ lwz r4,temp
|
|
|
+ lwz r5,retaddress
|
|
|
+ stw r4,0(r3)
|
|
|
+ mtlr r5
|
|
|
+.LFailed:
|
|
|
+ li r3,-1
|
|
|
.LDone:
|
|
|
end;
|
|
|
|
|
@@ -80,17 +137,36 @@ function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[
|
|
|
This function puts the registers in place, does the call, and then
|
|
|
copies back the registers as they are after the SysCall.
|
|
|
}
|
|
|
+var
|
|
|
+ temp, retaddress: longint;
|
|
|
asm
|
|
|
mr r0,r3
|
|
|
mr r3,r4
|
|
|
mr r4,r5
|
|
|
mr r5,r6
|
|
|
sc
|
|
|
- bns .LDone
|
|
|
- neg r3, r3
|
|
|
- lis r4,(Errno+4)@ha
|
|
|
- stw r3,(Errno+4)@l(r4)
|
|
|
- li r3,-1
|
|
|
+ bns .LDone
|
|
|
+ lis r10,(fpc_threadvar_relocate_proc)@ha
|
|
|
+ lwz r10,(fpc_threadvar_relocate_proc)@l(r10)
|
|
|
+ cmpwi r10,0
|
|
|
+ bne .LThreaded
|
|
|
+ lis r4,(Errno+4)@ha
|
|
|
+ stw r3,(Errno+4)@l(r4)
|
|
|
+ b .LFailed
|
|
|
+.LThreaded:
|
|
|
+ stw r3,temp
|
|
|
+ mflr r3
|
|
|
+ mtctr r10
|
|
|
+ lis r4,(errno)@ha
|
|
|
+ stw r3,retaddress
|
|
|
+ lwz r3,(errno)@l(r4)
|
|
|
+ bctrl
|
|
|
+ lwz r4,temp
|
|
|
+ lwz r5,retaddress
|
|
|
+ stw r4,0(r3)
|
|
|
+ mtlr r5
|
|
|
+.LFailed:
|
|
|
+ li r3,-1
|
|
|
.LDone:
|
|
|
end;
|
|
|
|
|
@@ -100,6 +176,8 @@ function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; asse
|
|
|
This function puts the registers in place, does the call, and then
|
|
|
copies back the registers as they are after the SysCall.
|
|
|
}
|
|
|
+var
|
|
|
+ temp, retaddress: longint;
|
|
|
asm
|
|
|
mr r0,r3
|
|
|
mr r3,r4
|
|
@@ -107,11 +185,28 @@ asm
|
|
|
mr r5,r6
|
|
|
mr r6,r7
|
|
|
sc
|
|
|
- bns .LDone
|
|
|
- neg r3, r3
|
|
|
- lis r4,(Errno+4)@ha
|
|
|
- stw r3,(Errno+4)@l(r4)
|
|
|
- li r3,-1
|
|
|
+ bns .LDone
|
|
|
+ lis r10,(fpc_threadvar_relocate_proc)@ha
|
|
|
+ lwz r10,(fpc_threadvar_relocate_proc)@l(r10)
|
|
|
+ cmpwi r10,0
|
|
|
+ bne .LThreaded
|
|
|
+ lis r4,(Errno+4)@ha
|
|
|
+ stw r3,(Errno+4)@l(r4)
|
|
|
+ b .LFailed
|
|
|
+.LThreaded:
|
|
|
+ stw r3,temp
|
|
|
+ mflr r3
|
|
|
+ mtctr r10
|
|
|
+ lis r4,(errno)@ha
|
|
|
+ stw r3,retaddress
|
|
|
+ lwz r3,(errno)@l(r4)
|
|
|
+ bctrl
|
|
|
+ lwz r4,temp
|
|
|
+ lwz r5,retaddress
|
|
|
+ stw r4,0(r3)
|
|
|
+ mtlr r5
|
|
|
+.LFailed:
|
|
|
+ li r3,-1
|
|
|
.LDone:
|
|
|
end;
|
|
|
|
|
@@ -120,6 +215,8 @@ function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResul
|
|
|
This function puts the registers in place, does the call, and then
|
|
|
copies back the registers as they are after the SysCall.
|
|
|
}
|
|
|
+var
|
|
|
+ temp, retaddress: longint;
|
|
|
asm
|
|
|
mr r0,r3
|
|
|
mr r3,r4
|
|
@@ -128,11 +225,28 @@ asm
|
|
|
mr r6,r7
|
|
|
mr r7,r8
|
|
|
sc
|
|
|
- bns .LDone
|
|
|
- neg r3, r3
|
|
|
- lis r4,(Errno+4)@ha
|
|
|
- stw r3,(Errno+4)@l(r4)
|
|
|
- li r3,-1
|
|
|
+ bns .LDone
|
|
|
+ lis r10,(fpc_threadvar_relocate_proc)@ha
|
|
|
+ lwz r10,(fpc_threadvar_relocate_proc)@l(r10)
|
|
|
+ cmpwi r10,0
|
|
|
+ bne .LThreaded
|
|
|
+ lis r4,(Errno+4)@ha
|
|
|
+ stw r3,(Errno+4)@l(r4)
|
|
|
+ b .LFailed
|
|
|
+.LThreaded:
|
|
|
+ stw r3,temp
|
|
|
+ mflr r3
|
|
|
+ mtctr r10
|
|
|
+ lis r4,(errno)@ha
|
|
|
+ stw r3,retaddress
|
|
|
+ lwz r3,(errno)@l(r4)
|
|
|
+ bctrl
|
|
|
+ lwz r4,temp
|
|
|
+ lwz r5,retaddress
|
|
|
+ stw r4,0(r3)
|
|
|
+ mtlr r5
|
|
|
+.LFailed:
|
|
|
+ li r3,-1
|
|
|
.LDone:
|
|
|
end;
|
|
|
|
|
@@ -142,6 +256,8 @@ function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TS
|
|
|
This function puts the registers in place, does the call, and then
|
|
|
copies back the registers as they are after the SysCall.
|
|
|
}
|
|
|
+var
|
|
|
+ temp, retaddress: longint;
|
|
|
asm
|
|
|
mr r0,r3
|
|
|
mr r3,r4
|
|
@@ -151,11 +267,28 @@ asm
|
|
|
mr r7,r8
|
|
|
mr r8,r9
|
|
|
sc
|
|
|
- bns .LDone
|
|
|
- neg r3, r3
|
|
|
- lis r4,(Errno+4)@ha
|
|
|
- stw r3,(Errno+4)@l(r4)
|
|
|
- li r3,-1
|
|
|
+ bns .LDone
|
|
|
+ lis r10,(fpc_threadvar_relocate_proc)@ha
|
|
|
+ lwz r10,(fpc_threadvar_relocate_proc)@l(r10)
|
|
|
+ cmpwi r10,0
|
|
|
+ bne .LThreaded
|
|
|
+ lis r4,(Errno+4)@ha
|
|
|
+ stw r3,(Errno+4)@l(r4)
|
|
|
+ b .LFailed
|
|
|
+.LThreaded:
|
|
|
+ stw r3,temp
|
|
|
+ mflr r3
|
|
|
+ mtctr r10
|
|
|
+ lis r4,(errno)@ha
|
|
|
+ stw r3,retaddress
|
|
|
+ lwz r3,(errno)@l(r4)
|
|
|
+ bctrl
|
|
|
+ lwz r4,temp
|
|
|
+ lwz r5,retaddress
|
|
|
+ stw r4,0(r3)
|
|
|
+ mtlr r5
|
|
|
+.LFailed:
|
|
|
+ li r3,-1
|
|
|
.LDone:
|
|
|
end;
|
|
|
|
|
@@ -179,7 +312,6 @@ asm
|
|
|
{ Go ! }
|
|
|
sc
|
|
|
bns .Lsyscall_ok
|
|
|
- neg r3,r3
|
|
|
.Lsyscall_ok:
|
|
|
{ Put back the registers... }
|
|
|
stw r3, 0(r8)
|
|
@@ -241,7 +373,11 @@ end;
|
|
|
|
|
|
{
|
|
|
$Log$
|
|
|
- Revision 1.10 2003-11-29 22:54:32 jonas
|
|
|
+ Revision 1.11 2003-12-28 20:55:10 jonas
|
|
|
+ * fixed result of failed syscalls (no extra neg is needed)
|
|
|
+ + support multi-threaded programs
|
|
|
+
|
|
|
+ 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
|