Path: utzoo!censor!comspec!lethe!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!clyde.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!samsung!zaphod.mps.ohio-state.edu!wuarchive!udel!princeton!cs!elan!nr From: nr@elan.Princeton.EDU (Norman Ramsey) Newsgroups: comp.lang.modula3 Subject: signal handling on the DS3100 for the SRC implementation Message-ID: <6935@rossignol.Princeton.EDU> Date: 14 Feb 91 23:06:13 GMT Sender: news@cs.Princeton.EDU Organization: Dept. of Computer Science, Princeton University Lines: 154 The interface Usignal doesn't work correctly on the DS3100 (MIPS R2000 architecture) running Ultrix 4.0. Here's an interface that does work. INTERFACE MipsSignal; IMPORT Formatter; FROM Ctypes IMPORT int; CONST BRK_USERBP = 0; TYPE struct_sigcontext = RECORD sc_onstack : int; (* sigstack state to restore *) sc_mask : int; (* signal mask to restore *) sc_pc : int; (* pc at time of signal *) (* * General purpose registers *) sc_regs : ARRAY [0..31] OF int; (* processor regs 0 to 31 *) sc_mdlo : int; (* mul/div low *) sc_mdhi : int; (* mul/div high *) (* * Floating point coprocessor state *) sc_ownedfp : int; (* fp has been used *) sc_fpregs : ARRAY [0..31] OF int; (* fp regs 0 to 31 *) sc_fpc_csr : int; (* floating point control and status reg *) sc_fpc_eir : int; (* floating point exception instruction reg *) (* * END OF REGION THAT MUST AGREE WITH setjmp.h * END OF jmp_buf REGION *) (* * System coprocessor registers at time of signal *) sc_cause : int; (* cp0 cause register *) sc_badvaddr : int; (* cp0 bad virtual address *) sc_badpaddr : int; (* cpu bd bad physical address *) END; struct_sigvec = RECORD sv_handler : SignalHandler; sv_mask : int; sv_flags : int; END; SignalHandler = PROCEDURE (sig, code: int; scp: UNTRACED REF struct_sigcontext); <*EXTERNAL*> PROCEDURE sigvec (sig: int; VAR vec, ovec: struct_sigvec): int; TYPE jmp_buf = RECORD jb_onstack : int; (* sigstack state to restore *) jb_mask : int; (* signal mask to restore *) jb_pc : int; (* pc at time of signal *) (* * General purpose registers *) jb_regs : ARRAY [0..31] OF int; (* processor regs 0 to 31 *) jb_mdlo : int; (* mul/div low *) jb_mdhi : int; (* mul/div high *) (* * Floating point coprocessor state *) jb_ownedfp : int; (* fp has been used *) jb_fpregs : ARRAY [0..31] OF int; (* fp regs 0 to 31 *) jb_fpc_csr : int; (* floating point control and status reg *) jb_fpc_eir : int; (* floating point exception instruction reg *) jb_padding : ARRAY [0..10] OF int; END; <*EXTERNAL "_setjmp" *> PROCEDURE WildSetjmp (VAR env: jmp_buf): int; <*EXTERNAL "_longjmp"*> PROCEDURE WildLongjmp (VAR env: jmp_buf; val: int); <*EXTERNAL "setjmp"*> PROCEDURE Setjmp (VAR env: jmp_buf): int; <*EXTERNAL "longjmp"*> PROCEDURE Longjmp (VAR env: jmp_buf; val: int); CONST SigDescriptions = ARRAY OF TEXT { "signal 0", "hangup", "interrupt", "quit", "illegal instruction", "trap", "IOT instruction", "EMT instruction", "floating point exception", "kill", "bus error", "segmentation violation", "bad argument to system call", "write on a pipe with no one to read it", "alarm clock", "software termination signal from kill", "urgent condition on IO channel", "sendable stop signal not from tty", "stop signal from tty", "continue a stopped process", "to parent on child stop or exit", "to readers pgrp upon background tty read", "like TTIN for output if (tp->t_local<OSTOP)", "input/output possible signal", "exceeded CPU time limit", "exceeded file size limit", "virtual time alarm", "profiling time alarm", "window size changes", "Sys-V rec lock: notify user upon server crash", "User signal 1 (from SysV)", "User signal 2 (from SysV)" }; FpeDescriptions = ARRAY OF TEXT { "fpe 0", "integer overflow", "integer divide by zero", "floating overflow", "floating/decimal divide by zero", "floating underflow", "decimal overflow", "subscript out of range", "divide by zero floating fault", "floating underflow fault" }; TYPE BRK = { USERBP, KERNELBP, ABORT, BD_TAKEN, BD_NOTTAKEN, SSTEPBP, OVERFLOW, DIVZERO, RANGE, STACKOVERFLOW }; CONST BRKDescriptions = ARRAY BRK OF TEXT { "user bp (used by debuggers)", "kernel bp (used by prom)", "no longer used", "for taken bd emulation", "for not taken bd emulation", "user bp (used by debuggers)", "overflow check", "divide by zero check", "range error check", "used by Ada" }; END MipsSignal. -- Norman Ramsey nr@princeton.edu