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
|
|
|
|
* PM (normal abort or panic) or FS (panic), or TTY (user issued CTRL-ALT-DEL
|
|
|
|
* or ESC after debugging dumps).
|
|
|
|
*/
|
|
|
|
int how = m_ptr->ABRT_HOW;
|
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) {
|
|
|
|
int proc_nr = m_ptr->ABRT_MON_PROC;
|
|
|
|
int length = m_ptr->ABRT_MON_LEN + 1;
|
|
|
|
vir_bytes src_vir = (vir_bytes) m_ptr->ABRT_MON_ADDR;
|
|
|
|
phys_bytes src_phys = numap_local(proc_nr, src_vir, length);
|
|
|
|
|
|
|
|
/* Validate length and address of shutdown code before copying. */
|
2005-07-19 14:21:36 +02:00
|
|
|
if (length > kinfo.params_size || src_phys == 0)
|
|
|
|
phys_copy(vir2phys("delay;boot"), kinfo.params_base, 11);
|
2005-07-14 17:12:12 +02:00
|
|
|
else
|
|
|
|
phys_copy(src_phys, kinfo.params_base, (phys_bytes) length);
|
|
|
|
}
|
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 */
|
|
|
|
|