2005-10-14 10:58:59 +02:00
|
|
|
/* The kernel call implemented in this file:
|
2005-07-14 17:12:12 +02:00
|
|
|
* m_type: SYS_ABORT
|
|
|
|
*
|
2005-10-14 10:58:59 +02:00
|
|
|
* The parameters for this kernel call are:
|
2005-07-14 17:12:12 +02:00
|
|
|
* m1_i1: ABRT_HOW (how to abort, possibly fetch monitor params)
|
2009-09-17 22:51:34 +02:00
|
|
|
* m1_i2: ABRT_MON_ENDPT (proc nr to get monitor params from)
|
2005-07-14 17:12:12 +02:00
|
|
|
* 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 */
|
|
|
|
{
|
2005-10-13 11:43:39 +02:00
|
|
|
/* Handle sys_abort. MINIX is unable to continue. This can originate e.g.
|
|
|
|
* in the PM (normal abort or 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 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) {
|
2008-11-19 13:26:10 +01:00
|
|
|
int p;
|
|
|
|
static char paramsbuffer[512];
|
|
|
|
int len;
|
|
|
|
len = MIN(m_ptr->ABRT_MON_LEN, sizeof(paramsbuffer)-1);
|
2005-07-29 17:26:23 +02:00
|
|
|
|
2008-11-19 13:26:10 +01:00
|
|
|
if((p=data_copy(m_ptr->ABRT_MON_ENDPT, (vir_bytes) m_ptr->ABRT_MON_ADDR,
|
|
|
|
SYSTEM, (vir_bytes) paramsbuffer, len)) != OK) {
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
paramsbuffer[len] = '\0';
|
2005-07-29 17:26:23 +02:00
|
|
|
|
|
|
|
/* Parameters seem ok, copy them and prepare shutting down. */
|
2008-11-19 13:26:10 +01:00
|
|
|
if((p = arch_set_params(paramsbuffer, len+1)) != OK)
|
|
|
|
return p;
|
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 */
|
|
|
|
|