2005-07-14 17:12:12 +02:00
|
|
|
/* The system call implemented in this file:
|
|
|
|
* m_type: SYS_ABORT
|
|
|
|
*
|
|
|
|
* The parameters for this system call are:
|
|
|
|
* m1_i1: ABRT_HOW (how to abort, possibly fetch monitor params)
|
|
|
|
* m1_i2: ABRT_MON_PROC (proc nr to get monitor params from)
|
|
|
|
* m1_i3: ABRT_MON_LEN (length of monitor params)
|
|
|
|
* m1_p1: ABRT_MON_ADDR (virtual address of params)
|
|
|
|
*/
|
2005-07-19 14:21:36 +02:00
|
|
|
|
|
|
|
#include "../system.h"
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2005-07-14 17:12:12 +02:00
|
|
|
#if USE_ABORT
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* do_abort *
|
|
|
|
*===========================================================================*/
|
|
|
|
PUBLIC int do_abort(m_ptr)
|
|
|
|
message *m_ptr; /* pointer to request message */
|
|
|
|
{
|
|
|
|
/* Handle sys_abort. MINIX is unable to continue. This can originate in the
|
2005-07-29 17:26:23 +02:00
|
|
|
* PM (normal abort or panic) or FS (panic), or TTY (after CTRL-ALT-DEL).
|
2005-07-14 17:12:12 +02:00
|
|
|
*/
|
|
|
|
int how = m_ptr->ABRT_HOW;
|
2005-07-29 17:26:23 +02:00
|
|
|
int proc_nr;
|
|
|
|
int length;
|
|
|
|
phys_bytes src_phys;
|
2005-07-19 14:21:36 +02:00
|
|
|
|
2005-07-21 20:36:40 +02:00
|
|
|
/* See if the monitor is to run the specified instructions. */
|
2005-07-14 17:12:12 +02:00
|
|
|
if (how == RBT_MONITOR) {
|
2005-07-29 17:26:23 +02:00
|
|
|
|
|
|
|
proc_nr = m_ptr->ABRT_MON_PROC;
|
|
|
|
if (! isokprocn(proc_nr)) return(EINVAL);
|
|
|
|
length = m_ptr->ABRT_MON_LEN + 1;
|
|
|
|
if (length > kinfo.params_size) return(E2BIG);
|
|
|
|
src_phys = numap_local(proc_nr,(vir_bytes)m_ptr->ABRT_MON_ADDR,length);
|
|
|
|
if (! src_phys) return(EFAULT);
|
|
|
|
|
|
|
|
/* Parameters seem ok, copy them and prepare shutting down. */
|
|
|
|
phys_copy(src_phys, kinfo.params_base, (phys_bytes) length);
|
2005-07-14 17:12:12 +02:00
|
|
|
}
|
2005-07-21 20:36:40 +02:00
|
|
|
|
2005-07-27 16:32:16 +02:00
|
|
|
/* Now prepare to shutdown MINIX. */
|
|
|
|
prepare_shutdown(how);
|
2005-07-14 17:12:12 +02:00
|
|
|
return(OK); /* pro-forma (really EDISASTER) */
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* USE_ABORT */
|
|
|
|
|