summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ffbc6ec)
raw | patch | inline | side by side (parent: ffbc6ec)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 30 Jul 2019 18:38:45 +0000 (21:38 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 30 Jul 2019 18:38:45 +0000 (21:38 +0300) |
diff --git a/src/cpfront/linux/486/Posix/Mod/Csignal.cp b/src/cpfront/linux/486/Posix/Mod/Csignal.cp
index 43100cad52bed7649e09e711a7a2e829decbed41..1e2c77df9f1676389a6a96c9d83af39d875597bc 100644 (file)
SIGTTOU* = 22;
SIGUSR1* = 10;
SIGUSR2* = 12;
- SIGPOLL* = 29;
- SIGPROF* = 27;
SIGSYS* = 31;
SIGTRAP* = 5;
SIGURG* = 23;
TYPE
Pstruct_sigaction* = POINTER TO struct_sigaction;
struct_sigaction* ['struct sigaction'] = RECORD [noalign] (* 140 *)
- handler*: RECORD [union] (* 4 *)
- sa_handler*: PROCEDURE [ccall] (sig: int); (* 0+4 *)
- sa_sigaction*: PROCEDURE [ccall] (sig: int; IN siginfo: siginfo_t; context: PosixCtypes.Pvoid); (* 0+4 *)
+ handler* ["/*handler"]: RECORD [union] (* 4 *)
+ sa_handler* ["*/sa_handler"]: PROCEDURE [ccall] (sig: int); (* 0+4 *)
+ sa_sigaction* ["*/sa_sigaction"]: PROCEDURE [ccall] (sig: int; IN siginfo: siginfo_t; context: PosixCtypes.Pvoid); (* 0+4 *)
END; (* 0+4 *)
sa_mask*: sigset_t; (* 4+128 *)
sa_flags*: int; (* 132+4 *)
SA_RESETHAND* = -2147483648;
SA_RESTART* = 268435456;
SA_SIGINFO* = 4;
- SA_NOCLDWAIT* = 2;
SA_NODEFER* = 1073741824;
SS_ONSTACK* = 1;
SS_DISABLE* = 2;
ss_size*: size_t; (* 8+4 *)
END;
- TYPE
- P_siginfo_t* = POINTER TO _siginfo_t;
- _siginfo_t* ['siginfo_t'] = RECORD [noalign] (* 128 *)
- si_signo*: int; (* 0+4 *)
- si_errno*: int; (* 4+4 *)
- si_code*: int; (* 8+4 *)
- si_pid*: pid_t; (* 12+4 *)
- si_addr*: PosixCtypes.Pvoid; (* 12+4 *)
- si_band*: long; (* 12+4 *)
- si_uid*: uid_t; (* 16+4 *)
- si_status*: int; (* 20+4 *)
- si_value*: union_sigval; (* 20+4 *)
- END;
-
TYPE
Psiginfo_t* = POINTER TO siginfo_t;
siginfo_t* ['siginfo_t'] = RECORD [noalign] (* 128 *)
si_signo*: int; (* 0+4 *)
si_errno*: int; (* 4+4 *)
si_code*: int; (* 8+4 *)
- info*: RECORD [union] (* 12 *)
+ info* ["/*info"]: RECORD [union] (* 12 *)
sigill*: RECORD [noalign] (* 4 *)
- si_addr*: PosixCtypes.Pvoid; (* 0+4 *)
+ si_addr* ["*/si_addr"]: PosixCtypes.Pvoid; (* 0+4 *)
END; (* 0+4 *)
sigfpe*: RECORD [noalign] (* 4 *)
- si_addr*: PosixCtypes.Pvoid; (* 0+4 *)
+ si_addr* ["*/si_addr"]: PosixCtypes.Pvoid; (* 0+4 *)
END; (* 0+4 *)
sigsegv*: RECORD [noalign] (* 4 *)
- si_addr*: PosixCtypes.Pvoid; (* 0+4 *)
+ si_addr* ["*/si_addr"]: PosixCtypes.Pvoid; (* 0+4 *)
END; (* 0+4 *)
sigbus*: RECORD [noalign] (* 4 *)
- si_addr*: PosixCtypes.Pvoid; (* 0+4 *)
+ si_addr* ["*/si_addr"]: PosixCtypes.Pvoid; (* 0+4 *)
END; (* 0+4 *)
sigchld*: RECORD [noalign] (* 12 *)
- si_pid*: pid_t; (* 0+4 *)
- si_uid*: uid_t; (* 4+4 *)
- si_status*: int; (* 8+4 *)
+ si_pid* ["*/si_pid"]: pid_t; (* 0+4 *)
+ si_uid* ["*/si_uid"]: uid_t; (* 4+4 *)
+ si_status* ["*/si_status"]: int; (* 8+4 *)
END; (* 0+12 *)
- sigpoll*: RECORD [noalign] (* 4 *)
- si_band*: long; (* 0+4 *)
- END; (* 0+4 *)
other*: RECORD [noalign] (* 4 *)
- si_value*: union_sigval; (* 0+4 *)
+ si_value* ["*/si_value"]: union_sigval; (* 0+4 *)
END; (* 8+4 *)
END; (* 12+12 *)
END;
CLD_STOPPED* = 5;
CLD_CONTINUED* = 6;
- CONST
- POLL_IN* = 1;
- POLL_OUT* = 2;
- POLL_MSG* = 3;
- POLL_ERR* = 4;
- POLL_PRI* = 5;
- POLL_HUP* = 6;
-
CONST
SI_USER* = 0;
SI_QUEUE* = -1;
PROCEDURE [ccall] psiginfo* (IN pinfo: siginfo_t; IN [nil] s: ARRAY [untagged] OF SHORTCHAR);
PROCEDURE [ccall] psignal* (sig: int; IN [nil] s: ARRAY [untagged] OF SHORTCHAR);
PROCEDURE [ccall] pthread_kill* (thread: pthread_t; sig: int): int;
- PROCEDURE [ccall] pthread_sigmask* (how: int; IN [nil] set: sigset_t; VAR [nil] oldset: sigset_t): int;
+ PROCEDURE [ccall] pthread_sigmask* (how: int; VAR [nil] set: sigset_t; VAR [nil] oldset: sigset_t): int;
PROCEDURE [ccall] raise* (sig: int): int;
PROCEDURE [ccall] sigaction* (sig: int; IN [nil] act: struct_sigaction; VAR [nil] oact: struct_sigaction): int;
PROCEDURE [ccall] sigaddset* (VAR set: sigset_t; signum: int): int;
PROCEDURE [ccall] sigdelset* (VAR set: sigset_t; signum: int): int;
PROCEDURE [ccall] sigemptyset* (VAR set: sigset_t): int;
PROCEDURE [ccall] sigfillset* (VAR set: sigset_t): int;
- PROCEDURE [ccall] sighold* (sig: int): int;
- PROCEDURE [ccall] sigignore* (sig: int): int;
- PROCEDURE [ccall] siginterrupt* (sig, flag: int): int;
- PROCEDURE [ccall] sigismember* (IN set: sigset_t; signum: int): int;
- PROCEDURE [ccall] sigpause* (sig: int): int;
+ PROCEDURE [ccall] sigismember* (VAR set: sigset_t; signum: int): int;
PROCEDURE [ccall] sigpending* (VAR set: sigset_t): int;
- PROCEDURE [ccall] sigprocmask* (how: int; IN [nil] set: sigset_t; VAR [nil] oset: sigset_t): int;
+ PROCEDURE [ccall] sigprocmask* (how: int; VAR [nil] set: sigset_t; VAR [nil] oset: sigset_t): int;
PROCEDURE [ccall] sigqueue* (pid: pid_t; sig: int; IN value: union_sigval): int;
- PROCEDURE [ccall] sigrelse* (sig: int): int;
- PROCEDURE [ccall] sigsuspend* (IN sigmask: sigset_t): int;
- PROCEDURE [ccall] sigtimedwait* (IN set: sigset_t; VAR [nil] info: siginfo_t; IN timeout: struct_timespec): int;
- PROCEDURE [ccall] sigwait* (IN set: sigset_t; VAR sig: int): int;
- PROCEDURE [ccall] sigwaitinfo* (IN set: sigset_t; VAR [nil] info: siginfo_t): int;
+ PROCEDURE [ccall] sigsuspend* (VAR sigmask: sigset_t): int;
+ PROCEDURE [ccall] sigtimedwait* (VAR set: sigset_t; VAR [nil] info: siginfo_t; IN timeout: struct_timespec): int;
+ PROCEDURE [ccall] sigwait* (VAR set: sigset_t; VAR sig: int): int;
+ PROCEDURE [ccall] sigwaitinfo* (VAR set: sigset_t; VAR [nil] info: siginfo_t): int;
END PosixCsignal.
diff --git a/src/cpfront/linux/486/Posix/Mod/Csys_mman.cp b/src/cpfront/linux/486/Posix/Mod/Csys_mman.cp
index 6ff9357cb52c7eba00e59bde7e7b4d4b50edc4f3..d27cecd5a8f00a9dfccfd4ac8b4e866cc2f8ba69 100644 (file)
MS_INVALIDATE* = 2;
MS_SYNC* = 4;
- CONST
- MCL_CURRENT* = 1;
- MCL_FUTURE* = 2;
-
CONST
MAP_FAILED* = -1;
size_t* = PosixCsys_types.size_t;
PROCEDURE [ccall] mlock* (addr: PosixCtypes.Pvoid; len: size_t): int;
- PROCEDURE [ccall] mlockall* (flags: int): int;
PROCEDURE [ccall] mmap* (addr: PosixCtypes.Pvoid; len: size_t; prot, flags, fildes: int; off: off_t): PosixCtypes.Pvoid;
PROCEDURE [ccall] mprotect* (addr: PosixCtypes.Pvoid; len: size_t; prot: int): int;
PROCEDURE [ccall] msync* (addr: PosixCtypes.Pvoid; len: size_t; flags: int): int;
PROCEDURE [ccall] munlock* (addr: PosixCtypes.Pvoid; len: size_t): int;
- PROCEDURE [ccall] munlockall* (): int;
PROCEDURE [ccall] munmap* (addr: PosixCtypes.Pvoid; len: size_t): int;
PROCEDURE [ccall] posix_madvise* (addr: PosixCtypes.Pvoid; len: size_t; advice: int): int;
PROCEDURE [ccall] posix_mem_offset* (addr: PosixCtypes.Pvoid; len: size_t; VAR off: off_t; VAR contng_len: size_t; VAR fildes: int): int;
diff --git a/src/cpfront/posix/generic/System/Mod/Kernel.cp b/src/cpfront/posix/generic/System/Mod/Kernel.cp
index bf9e33d9a4f94021cbdae310e7884ba6d5e9a673..7c2c0bf26f9052a1bf73235b000c60cb52b07596 100644 (file)
trapCount-: INTEGER;
err-, pc-, sp-, fp-, stack-, val-: INTEGER;
- isTry: BOOLEAN;
- startEnv: setjmp.sigjmp_buf;
+ isTry, checkReadable: BOOLEAN;
+ startEnv, checkReadableEnv: setjmp.sigjmp_buf;
tryEnv: setjmp.jmp_buf;
startDLink, tryDLink: DLink;
PROCEDURE^ Try* (h: TryHandler; a, b, c: INTEGER);
PROCEDURE IsReadable* (from, to: INTEGER): BOOLEAN;
- VAR i: INTEGER;
+ VAR r: BOOLEAN; res: setjmp.int; i: INTEGER; x: BYTE;
BEGIN
- i := trapCount;
- Try(TryRead, from, to, 0);
- RETURN trapCount = i
+ r := checkReadable;
+ checkReadable := TRUE;
+ res := setjmp.sigsetjmp(checkReadableEnv, 1);
+ IF res = 0 THEN
+ IF from <= to THEN
+ FOR i := from TO to DO
+ S.GET(i, x)
+ END
+ ELSE
+ FOR i := to TO from BY -1 DO
+ S.GET(i, x)
+ END
+ END
+ END;
+ checkReadable := r;
+ RETURN res = 0
END IsReadable;
(* --------------------- NEW implementation (portable) -------------------- *)
stdlib.abort
END Trap;
- PROCEDURE [ccall] TrapHandler (signo: signal.int; IN _info: signal.siginfo_t; context: ADDRESS);
- TYPE SigInfo = POINTER [untagged] TO signal._siginfo_t;
- VAR res: signal.int; info: SigInfo;
+ PROCEDURE [ccall] TrapHandler (signo: signal.int; IN info: signal.siginfo_t; context: ADDRESS);
+ VAR res: signal.int;
BEGIN
- info := S.VAL(SigInfo, S.ADR(_info)); (* !!! hack for CPfront *)
+ IF checkReadable THEN
+ setjmp.siglongjmp(checkReadableEnv, 1)
+ END;
IF trapped THEN
DefaultTrapViewer;
IF ~secondTrap THEN trapped := FALSE; secondTrap := TRUE END
END;
- err := -signo; pc := 0; sp := 0; fp := 0; stack := 0; val := 0;
+ err := -signo; pc := 0; sp := 0; fp := 0; stack := baseStack; val := 0;
CASE signo OF
| signal.SIGFPE:
- pc := info.si_addr;
val := info.si_code;
+ pc := info.info.sigfpe.si_addr;
CASE info.si_code OF
| signal.FPE_INTDIV: err := 139 (* division by zero *)
| signal.FPE_INTOVF: err := 138 (* integer overflow *)
val := info.si_code;
err := 200 (* keyboard interrupt *)
| signal.SIGSEGV:
- val := info.si_addr;
+ val := info.info.sigsegv.si_addr;
err := 203 (* illigal read *)
| signal.SIGBUS:
- val := info.si_addr;
+ val := info.info.sigbus.si_addr;
err := 10001H (* bus error *)
| signal.SIGILL:
- pc := info.si_addr;
+ pc := info.info.sigill.si_addr;
err := 202; (* illigal instruction *)
IF IsReadable(pc, pc + 4) THEN
S.GET(pc, val)
(* !!! InitFPU *)
TrapCleanup;
IF isTry THEN
- SetDLink(tryDLink);
setjmp._longjmp(tryEnv, 1)
END;
IF (err = 128) OR (err = 200) & ~intTrap THEN (* do nothing *)
END;
trapped := FALSE; secondTrap := FALSE;
IF restart # NIL THEN
- SetDLink(startDLink);
setjmp.siglongjmp(startEnv, 1)
END;
stdlib.abort