source: trunk/minix/kernel/system/do_abort.c@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 1.5 KB
Line 
1/* The kernel call implemented in this file:
2 * m_type: SYS_ABORT
3 *
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 */
10
11#include "../system.h"
12#include <unistd.h>
13
14#if USE_ABORT
15
16/*===========================================================================*
17 * do_abort *
18 *===========================================================================*/
19PUBLIC int do_abort(m_ptr)
20message *m_ptr; /* pointer to request message */
21{
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).
24 */
25 int how = m_ptr->ABRT_HOW;
26 int proc_nr;
27 int length;
28 phys_bytes src_phys;
29
30 /* See if the monitor is to run the specified instructions. */
31 if (how == RBT_MONITOR) {
32
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);
38
39 /* Parameters seem ok, copy them and prepare shutting down. */
40 phys_copy(src_phys, kinfo.params_base, (phys_bytes) length);
41 }
42
43 /* Now prepare to shutdown MINIX. */
44 prepare_shutdown(how);
45 return(OK); /* pro-forma (really EDISASTER) */
46}
47
48#endif /* USE_ABORT */
49
Note: See TracBrowser for help on using the repository browser.