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 | *===========================================================================*/
|
---|
19 | PUBLIC int do_abort(m_ptr)
|
---|
20 | message *m_ptr; /* pointer to request message */
|
---|
21 | {
|
---|
22 | /* Handle sys_abort. MINIX is unable to continue. This can originate in the
|
---|
23 | * 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 | proc_nr = m_ptr->ABRT_MON_PROC;
|
---|
34 | if (! isokprocn(proc_nr)) return(EINVAL);
|
---|
35 | length = m_ptr->ABRT_MON_LEN + 1;
|
---|
36 | if (length > kinfo.params_size) return(E2BIG);
|
---|
37 | src_phys = numap_local(proc_nr,(vir_bytes)m_ptr->ABRT_MON_ADDR,length);
|
---|
38 | if (! src_phys) return(EFAULT);
|
---|
39 |
|
---|
40 | /* Parameters seem ok, copy them and prepare shutting down. */
|
---|
41 | phys_copy(src_phys, kinfo.params_base, (phys_bytes) length);
|
---|
42 | }
|
---|
43 |
|
---|
44 | /* Now prepare to shutdown MINIX. */
|
---|
45 | prepare_shutdown(how);
|
---|
46 | return(OK); /* pro-forma (really EDISASTER) */
|
---|
47 | }
|
---|
48 |
|
---|
49 | #endif /* USE_ABORT */
|
---|
50 |
|
---|