For /dev/mem, map in memory to be copied to memory's own address space
[minix3.git] / kernel / system / do_abort.c
blobd0b32b516702a0ed66d9d1fde95653ba97950579
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_PROC (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(m_ptr)
20 message *m_ptr; /* pointer to request message */
22 /* Handle sys_abort. MINIX is unable to continue. This can originate e.g.
23 * in the PM (normal abort or panic) or TTY (after CTRL-ALT-DEL).
25 int how = m_ptr->ABRT_HOW;
26 int proc_nr;
27 int length;
28 phys_bytes src_phys;
30 /* See if the monitor is to run the specified instructions. */
31 if (how == RBT_MONITOR) {
33 if(!isokendpt(m_ptr->ABRT_MON_ENDPT, &proc_nr)) return(EDEADSRCDST);
34 length = m_ptr->ABRT_MON_LEN + 1;
35 if (length > kinfo.params_size) return(E2BIG);
36 src_phys = numap_local(proc_nr,(vir_bytes)m_ptr->ABRT_MON_ADDR,length);
37 if (! src_phys) return(EFAULT);
39 /* Parameters seem ok, copy them and prepare shutting down. */
40 phys_copy(src_phys, kinfo.params_base, (phys_bytes) length);
43 /* Now prepare to shutdown MINIX. */
44 prepare_shutdown(how);
45 return(OK); /* pro-forma (really EDISASTER) */
48 #endif /* USE_ABORT */