This patch removes the global variables who_p and who_e from the
[minix.git] / kernel / system / do_abort.c
blob3d9213cfd3a26df8a160a032902e0a0c9055c3d9
1 /* The kernel call implemented in this file:
2 * m_type: SYS_ABORT
4 * The parameters for this kernel call are:
5 * m1_i1: ABRT_HOW (how to abort, possibly fetch monitor params)
6 * m1_i2: ABRT_MON_ENDPT (proc nr to get monitor params from)
7 * m1_i3: ABRT_MON_LEN (length of monitor params)
8 * m1_p1: ABRT_MON_ADDR (virtual address of params)
9 */
11 #include "../system.h"
12 #include <unistd.h>
14 #if USE_ABORT
16 /*===========================================================================*
17 * do_abort *
18 *===========================================================================*/
19 PUBLIC int do_abort(struct proc * caller, message * m_ptr)
21 /* Handle sys_abort. MINIX is unable to continue. This can originate e.g.
22 * in the PM (normal abort or panic) or TTY (after CTRL-ALT-DEL).
24 int how = m_ptr->ABRT_HOW;
26 /* See if the monitor is to run the specified instructions. */
27 if (how == RBT_MONITOR) {
28 int p;
29 static char paramsbuffer[512];
30 int len;
31 len = MIN(m_ptr->ABRT_MON_LEN, sizeof(paramsbuffer)-1);
33 if((p=data_copy(m_ptr->ABRT_MON_ENDPT,
34 (vir_bytes) m_ptr->ABRT_MON_ADDR,
35 SYSTEM, (vir_bytes) paramsbuffer, len)) != OK) {
36 return p;
38 paramsbuffer[len] = '\0';
40 /* Parameters seem ok, copy them and prepare shutting down. */
41 if((p = arch_set_params(paramsbuffer, len+1)) != OK)
42 return p;
45 /* Now prepare to shutdown MINIX. */
46 prepare_shutdown(how);
47 return(OK); /* pro-forma (really EDISASTER) */
50 #endif /* USE_ABORT */