summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 13d3d1d)
raw | patch | inline | side by side (parent: 13d3d1d)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 28 Jul 2019 17:53:49 +0000 (20:53 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 28 Jul 2019 17:53:49 +0000 (20:53 +0300) |
src/cpfront/posix/generic/System/Mod/Kernel.cp | patch | blob | history |
diff --git a/src/cpfront/posix/generic/System/Mod/Kernel.cp b/src/cpfront/posix/generic/System/Mod/Kernel.cp
index 279fef9483a2960fa170d6ef66c71e7771eae372..bf9e33d9a4f94021cbdae310e7884ba6d5e9a673 100644 (file)
(* init fpu? *)
(* add signal blocking to avoid race conditions in Try/Trap/TrapHandler *)
(* add BeepHook for Beep *)
- (* implement Call using libffi *)
CONST
nameLen* = 256;
farg[cn] := S.VAL(Ptype, S.ADR(typ));
END SetType;
- PROCEDURE PushVal (size: INTEGER);
+ PROCEDURE PushAdr (size: INTEGER);
BEGIN
ASSERT(size IN {1, 2, 4, 8}, 20);
- ASSERT(littleEndian); (* !!! swap 64bit value *)
+ ASSERT(littleEndian OR (size <= 4), 100); (* !!! swap 64bit value *)
varg[cn] := S.ADR(par[d]);
INC(cn); INC(d, MAX(1, size DIV 4))
+ END PushAdr;
+
+ PROCEDURE PushVal (size: INTEGER);
+ BEGIN
+ ASSERT(size IN {1, 2, 4, 8}, 20);
+ ASSERT(littleEndian OR (size <= 4), 100); (* !!! swap 64bit value *)
+ varg[cn] := par[d];
+ INC(cn); INC(d, MAX(1, size DIV 4))
END PushVal;
PROCEDURE Push (IN typ: LibFFI.type);
BEGIN
- SetType(typ); PushVal(typ.size)
+ SetType(typ); PushAdr(typ.size)
END Push;
BEGIN
targ[ut].type := LibFFI.TYPE_STRUCT;
targ[ut].elements := S.VAL(PPtype, S.ADR(earg[ue]));
SetType(targ[ut]); INC(ut);
- size := MIN(1, typ.size);
+ size := MAX(1, typ.size);
(* !!! better to pass original layout *)
WHILE size >= 8 DO
earg[ue] := S.VAL(Ptype, S.ADR(LibFFI.type_uint64));
FOR i := 0 TO typ.id DIV 16 - 1 DO
Push(LibFFI.type_sint32) (* dim size *)
END
+ ELSE (* fix array *)
+ INC(d) (* skip size *)
END
END
END;