panic() cleanup.
this change
- makes panic() variadic, doing full printf() formatting -
no more NO_NUM, and no more separate printf() statements
needed to print extra info (or something in hex) before panicing
- unifies panic() - same panic() name and usage for everyone -
vm, kernel and rest have different names/syntax currently
in order to implement their own luxuries, but no longer
- throws out the 1st argument, to make source less noisy.
the panic() in syslib retrieves the server name from the kernel
so it should be clear enough who is panicing; e.g.
panic("sigaction failed: %d", errno);
looks like:
at_wini(73130): panic: sigaction failed: 0
syslib:panic.c: stacktrace: 0x74dc 0x2025 0x100a
- throws out report() - printf() is more convenient and powerful
- harmonizes/fixes the use of panic() - there were a few places
that used printf-style formatting (didn't work) and newlines
(messes up the formatting) in panic()
- throws out a few per-server panic() functions
- cleans up a tie-in of tty with panic()
merging printf() and panic() statements to be done incrementally.
This commit is contained in:
@@ -48,8 +48,7 @@ struct proc *p;
|
||||
return ESRCH;
|
||||
pagefaults = rp->p_nextpagefault;
|
||||
if(!RTS_ISSET(rp, RTS_PAGEFAULT))
|
||||
minix_panic("non-PAGEFAULT process on pagefault chain",
|
||||
rp->p_endpoint);
|
||||
panic( "non-PAGEFAULT process on pagefault chain: %d", rp->p_endpoint);
|
||||
m_ptr->SVMCTL_PF_WHO = rp->p_endpoint;
|
||||
m_ptr->SVMCTL_PF_I386_CR2 = rp->p_pagefault.pf_virtual;
|
||||
m_ptr->SVMCTL_PF_I386_ERR = rp->p_pagefault.pf_flags;
|
||||
|
||||
@@ -70,7 +70,7 @@ void pagefault( struct proc *pr,
|
||||
proc_stacktrace(proc_addr(SYSTEM));
|
||||
}
|
||||
printf("pc of pagefault: 0x%lx\n", frame->eip);
|
||||
minix_panic("page fault in system process", pr->p_endpoint);
|
||||
panic("page fault in system process: %d", pr->p_endpoint);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -163,8 +163,7 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame)
|
||||
frame->eip = (reg_t) __user_copy_msg_pointer_failure;
|
||||
return;
|
||||
default:
|
||||
minix_panic("Copy involving a user pointer "
|
||||
"failed unexpectedly!", NO_NUM);
|
||||
panic("Copy involving a user pointer failed unexpectedly!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,11 +215,11 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame)
|
||||
(unsigned) saved_proc->p_reg.pc);
|
||||
proc_stacktrace(saved_proc);
|
||||
|
||||
minix_panic("exception in a kernel task", saved_proc->p_endpoint);
|
||||
panic("exception in a kernel task: %d", saved_proc->p_endpoint);
|
||||
}
|
||||
else {
|
||||
/* in an early stage of boot process we don't have processes yet */
|
||||
minix_panic("exception in kernel while booting", NO_NUM);
|
||||
panic("exception in kernel while booting");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ FORWARD _PROTOTYPE( void vm_enable_paging, (void) );
|
||||
PUBLIC void vm_init(struct proc *newptproc)
|
||||
{
|
||||
if(vm_running)
|
||||
minix_panic("vm_init: vm_running", NO_NUM);
|
||||
panic("vm_init: vm_running");
|
||||
switch_address_space(newptproc);
|
||||
vm_enable_paging();
|
||||
vm_running = 1;
|
||||
@@ -198,7 +198,7 @@ PRIVATE int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
|
||||
NOREC_RETURN(linlincopy, EFAULT_DST);
|
||||
}
|
||||
|
||||
minix_panic("lin_lin_copy fault out of range", NO_NUM);
|
||||
panic("lin_lin_copy fault out of range");
|
||||
|
||||
/* Not reached. */
|
||||
NOREC_RETURN(linlincopy, EFAULT);
|
||||
@@ -229,7 +229,7 @@ PRIVATE u32_t phys_get32(phys_bytes addr)
|
||||
|
||||
if((r=lin_lin_copy(NULL, addr,
|
||||
proc_addr(SYSTEM), vir2phys(&v), sizeof(v))) != OK) {
|
||||
minix_panic("lin_lin_copy for phys_get32 failed", r);
|
||||
panic("lin_lin_copy for phys_get32 failed: %d", r);
|
||||
}
|
||||
|
||||
return v;
|
||||
@@ -364,7 +364,7 @@ vir_bytes bytes; /* # of bytes to be copied */
|
||||
phys_bytes seg_base;
|
||||
|
||||
if(seg != T && seg != D && seg != S)
|
||||
minix_panic("umap_local: wrong seg", seg);
|
||||
panic("umap_local: wrong seg: %d", seg);
|
||||
|
||||
if (bytes <= 0) return( (phys_bytes) 0);
|
||||
if (vir_addr + bytes <= vir_addr) return 0; /* overflow */
|
||||
@@ -413,7 +413,7 @@ vir_bytes bytes; /* # of bytes to be copied */
|
||||
phys = 0;
|
||||
}
|
||||
if(phys == 0)
|
||||
minix_panic("vm_lookup returned phys", phys);
|
||||
panic("vm_lookup returned phys: %d", phys);
|
||||
}
|
||||
|
||||
|
||||
@@ -603,7 +603,7 @@ int delivermsg(struct proc *rp)
|
||||
printf("vir: 0x%lx lin was: 0x%lx umap now: 0x%lx\n",
|
||||
rp->p_delivermsg_vir, rp->p_delivermsg_lin,
|
||||
umap_local(rp, D, rp->p_delivermsg_vir, sizeof(message)));
|
||||
minix_panic("that's wrong", NO_NUM);
|
||||
panic("that's wrong");
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -847,7 +847,7 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */
|
||||
struct proc *target;
|
||||
phys_bytes lin;
|
||||
if(r != EFAULT_SRC && r != EFAULT_DST)
|
||||
minix_panic("lin_lin_copy failed", r);
|
||||
panic("lin_lin_copy failed: %d", r);
|
||||
if(!vmcheck || !caller) {
|
||||
NOREC_RETURN(virtualcopy, r);
|
||||
}
|
||||
@@ -861,7 +861,7 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */
|
||||
lin = phys_addr[_DST_];
|
||||
target = procs[_DST_];
|
||||
} else {
|
||||
minix_panic("r strange", r);
|
||||
panic("r strange: %d", r);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -648,9 +648,8 @@ copr_return:
|
||||
jmp restart
|
||||
|
||||
copr_not_available_in_kernel:
|
||||
movl $NO_NUM, 4(%esp)
|
||||
movl $0, (%esp)
|
||||
call minix_panic
|
||||
call panic
|
||||
|
||||
double_fault:
|
||||
EXCEPTION_ERR_CODE(DOUBLE_FAULT_VECTOR)
|
||||
|
||||
@@ -135,7 +135,7 @@ PUBLIC void prot_init(void)
|
||||
|
||||
/* Click-round kernel. */
|
||||
if(kinfo.data_base % CLICK_SIZE)
|
||||
minix_panic("kinfo.data_base not aligned", NO_NUM);
|
||||
panic("kinfo.data_base not aligned");
|
||||
kinfo.data_size = (phys_bytes) (CLICK_CEIL(kinfo.data_size));
|
||||
|
||||
/* Build gdt and idt pointers in GDT where the BIOS expects them. */
|
||||
@@ -330,7 +330,7 @@ for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) {
|
||||
}
|
||||
if(fail) {
|
||||
printf("%d/%d checks failed\n", fail, checked);
|
||||
minix_panic("wrong", fail);
|
||||
panic("wrong: %d", fail);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ PUBLIC void printseg(char *banner, int iscs, struct proc *pr, u32_t selector)
|
||||
}
|
||||
|
||||
if(desc->granularity & 0x20) { /* reserved */
|
||||
minix_panic("granularity reserved field set", NO_NUM);
|
||||
panic("granularity reserved field set");
|
||||
}
|
||||
|
||||
if(!(desc->access & PRESENT))
|
||||
|
||||
@@ -118,7 +118,7 @@ void arch_watchdog_lockup(struct nmi_frame * frame)
|
||||
frame->cs,
|
||||
frame->eflags
|
||||
);
|
||||
minix_panic("Kernel lockup\n", NO_NUM);
|
||||
panic("Kernel lockup");
|
||||
}
|
||||
|
||||
void i386_watchdog_start(void)
|
||||
|
||||
@@ -24,8 +24,7 @@ check_runqueues_f(char *file, int line)
|
||||
FIXME("check_runqueues being done");
|
||||
|
||||
#define MYPANIC(msg) { \
|
||||
printf("check_runqueues:%s:%d: %s\n", file, line, msg); \
|
||||
minix_panic("check_runqueues failed", NO_NUM); \
|
||||
panic("check_runqueues:%s:%d: %s\n", file, line, msg); \
|
||||
}
|
||||
|
||||
for (xp = BEG_PROC_ADDR; xp < END_PROC_ADDR; ++xp) {
|
||||
|
||||
@@ -60,20 +60,18 @@
|
||||
|
||||
#if DEBUG_VMASSERT
|
||||
#define vmassert(t) { \
|
||||
if(!(t)) { minix_panic("vm: assert " #t " failed in " __FILE__, __LINE__); } }
|
||||
if(!(t)) { panic("kernel:%s:%d: assert %s failed", __FILE__, __LINE__, #t); } }
|
||||
#else
|
||||
#define vmassert(t) { }
|
||||
#endif
|
||||
|
||||
#define NOT_REACHABLE do { \
|
||||
printf("NOT_REACHABLE at %s:%d\n", __FILE__, __LINE__); \
|
||||
minix_panic("execution at an unexpected location\n", NO_NUM); \
|
||||
panic("NOT_REACHABLE at %s:%d", __FILE__, __LINE__); \
|
||||
for(;;); \
|
||||
} while(0)
|
||||
|
||||
#define NOT_IMPLEMENTED do { \
|
||||
printf("NOT_IMPLEMENTED at %s:%d\n", __FILE__, __LINE__); \
|
||||
minix_panic("NOT_IMPLEMENTED", NO_NUM); \
|
||||
panic("NOT_IMPLEMENTED at %s:%d", __FILE__, __LINE__); \
|
||||
} while(0)
|
||||
|
||||
#ifdef CONFIG_BOOT_VERBOSE
|
||||
|
||||
@@ -32,7 +32,7 @@ PUBLIC void put_irq_handler( irq_hook_t* hook, int irq, irq_handler_t handler)
|
||||
unsigned long bitmap;
|
||||
|
||||
if( irq < 0 || irq >= NR_IRQ_VECTORS )
|
||||
minix_panic("invalid call to put_irq_handler", irq);
|
||||
panic("invalid call to put_irq_handler: %d", irq);
|
||||
|
||||
line = &irq_handlers[irq];
|
||||
|
||||
@@ -48,7 +48,7 @@ PUBLIC void put_irq_handler( irq_hook_t* hook, int irq, irq_handler_t handler)
|
||||
if (!(bitmap & id)) break;
|
||||
|
||||
if(id == 0)
|
||||
minix_panic("Too many handlers for irq", irq);
|
||||
panic("Too many handlers for irq: %d", irq);
|
||||
|
||||
hook->next = NULL;
|
||||
hook->handler = handler;
|
||||
@@ -76,7 +76,7 @@ PUBLIC void rm_irq_handler( irq_hook_t* hook ) {
|
||||
irq_hook_t **line;
|
||||
|
||||
if( irq < 0 || irq >= NR_IRQ_VECTORS )
|
||||
minix_panic("invalid call to rm_irq_handler", irq);
|
||||
panic("invalid call to rm_irq_handler: %d", irq);
|
||||
|
||||
/* disable the irq. */
|
||||
irq_actids[hook->irq] |= hook->id;
|
||||
|
||||
@@ -241,10 +241,10 @@ PUBLIC void main()
|
||||
/*
|
||||
* enable timer interrupts and clock task on the boot CPU
|
||||
*/
|
||||
|
||||
if (boot_cpu_init_timer(system_hz)) {
|
||||
minix_panic("FATAL : failed to initialize timer interrupts, "
|
||||
"cannot continue without any clock source!",
|
||||
NO_NUM);
|
||||
panic( "FATAL : failed to initialize timer interrupts; "
|
||||
"cannot continue without any clock source!");
|
||||
}
|
||||
|
||||
/* Warnings for sanity checks that take time. These warnings are printed
|
||||
|
||||
@@ -210,8 +210,7 @@ check_misc_flags:
|
||||
|
||||
#if DEBUG_SCHED_CHECK
|
||||
if (proc_ptr->p_misc_flags & MF_SC_ACTIVE)
|
||||
minix_panic("MF_SC_ACTIVE and MF_SC_DEFER set",
|
||||
NO_NUM);
|
||||
panic("MF_SC_ACTIVE and MF_SC_DEFER set");
|
||||
#endif
|
||||
|
||||
arch_do_syscall(proc_ptr);
|
||||
@@ -311,7 +310,7 @@ long bit_map; /* notification event set or flags */
|
||||
|
||||
#if DEBUG_SCHED_CHECK
|
||||
if (caller_ptr->p_misc_flags & MF_SC_ACTIVE)
|
||||
minix_panic("MF_SC_ACTIVE already set", NO_NUM);
|
||||
panic("MF_SC_ACTIVE already set");
|
||||
#endif
|
||||
|
||||
/* Set a flag to allow reliable tracing of leaving the system call. */
|
||||
@@ -322,7 +321,7 @@ long bit_map; /* notification event set or flags */
|
||||
if(caller_ptr->p_misc_flags & MF_DELIVERMSG) {
|
||||
printf("sys_call: MF_DELIVERMSG on for %s / %d\n",
|
||||
caller_ptr->p_name, caller_ptr->p_endpoint);
|
||||
minix_panic("MF_DELIVERMSG on", NO_NUM);
|
||||
panic("MF_DELIVERMSG on");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -699,7 +698,7 @@ int flags;
|
||||
vmassert(!(caller_ptr->p_misc_flags & MF_DELIVERMSG));
|
||||
vmassert(src_e == ANY || hisep == src_e);
|
||||
if((r=QueueMess(hisep, vir2phys(&m), caller_ptr)) != OK) {
|
||||
minix_panic("mini_receive: local QueueMess failed", NO_NUM);
|
||||
panic("mini_receive: local QueueMess failed");
|
||||
}
|
||||
return(OK); /* report success */
|
||||
}
|
||||
@@ -794,7 +793,7 @@ endpoint_t dst_e; /* which process to notify */
|
||||
BuildNotifyMessage(&m, proc_nr(caller_ptr), dst_ptr);
|
||||
vmassert(!(dst_ptr->p_misc_flags & MF_DELIVERMSG));
|
||||
if((r=QueueMess(caller_ptr->p_endpoint, vir2phys(&m), dst_ptr)) != OK) {
|
||||
minix_panic("mini_notify: local QueueMess failed", NO_NUM);
|
||||
panic("mini_notify: local QueueMess failed");
|
||||
}
|
||||
RTS_UNSET(dst_ptr, RTS_RECEIVING);
|
||||
return(OK);
|
||||
@@ -1165,7 +1164,7 @@ register struct proc *rp; /* this process is now runnable */
|
||||
NOREC_ENTER(enqueuefunc);
|
||||
|
||||
#if DEBUG_SCHED_CHECK
|
||||
if (rp->p_ready) minix_panic("enqueue already ready process", NO_NUM);
|
||||
if (rp->p_ready) panic("enqueue already ready process");
|
||||
#endif
|
||||
|
||||
/* Determine where to insert to process. */
|
||||
@@ -1224,7 +1223,7 @@ PRIVATE void enqueue_head(struct proc *rp)
|
||||
int q = rp->p_priority; /* scheduling queue to use */
|
||||
|
||||
#if DEBUG_SCHED_CHECK
|
||||
if (rp->p_ready) minix_panic("enqueue already ready process", NO_NUM);
|
||||
if (rp->p_ready) panic("enqueue already ready process");
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -1271,12 +1270,12 @@ register struct proc *rp; /* this process is no longer runnable */
|
||||
/* Side-effect for kernel: check if the task's stack still is ok? */
|
||||
if (iskernelp(rp)) {
|
||||
if (*priv(rp)->s_stack_guard != STACK_GUARD)
|
||||
minix_panic("stack overrun by task", proc_nr(rp));
|
||||
panic("stack overrun by task: %d", proc_nr(rp));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DEBUG_SCHED_CHECK
|
||||
if (! rp->p_ready) minix_panic("dequeue() already unready process", NO_NUM);
|
||||
if (! rp->p_ready) panic("dequeue() already unready process");
|
||||
#endif
|
||||
|
||||
/* Now make sure that the process is not in its ready queue. Remove the
|
||||
@@ -1466,7 +1465,7 @@ int *p, fatalflag;
|
||||
#endif
|
||||
} else ok = 1;
|
||||
if(!ok && fatalflag) {
|
||||
minix_panic("invalid endpoint ", e);
|
||||
panic("invalid endpoint: %d", e);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,6 @@ _PROTOTYPE( void main, (void) );
|
||||
_PROTOTYPE( void prepare_shutdown, (int how) );
|
||||
_PROTOTYPE( void minix_shutdown, (struct timer *tp) );
|
||||
|
||||
/* utility.c */
|
||||
_PROTOTYPE( void minix_panic, (char *s, int n) );
|
||||
|
||||
/* proc.c */
|
||||
_PROTOTYPE( int do_ipc, (int call_nr, int src_dst,
|
||||
message *m_ptr, long bit_map) );
|
||||
|
||||
@@ -324,7 +324,7 @@ PUBLIC void send_sig(int proc_nr, int sig_nr)
|
||||
register struct proc *rp;
|
||||
|
||||
if(!isokprocn(proc_nr) || isemptyn(proc_nr))
|
||||
minix_panic("send_sig to empty process", proc_nr);
|
||||
panic("send_sig to empty process: %d", proc_nr);
|
||||
|
||||
rp = proc_addr(proc_nr);
|
||||
sigaddset(&priv(rp)->s_sig_pending, sig_nr);
|
||||
@@ -354,7 +354,7 @@ int sig_nr; /* signal to be sent */
|
||||
register struct proc *rp;
|
||||
|
||||
if (proc_nr == PM_PROC_NR)
|
||||
minix_panic("cause_sig: PM gets signal", NO_NUM);
|
||||
panic("cause_sig: PM gets signal");
|
||||
|
||||
/* Check if the signal is already pending. Process it otherwise. */
|
||||
rp = proc_addr(proc_nr);
|
||||
@@ -458,7 +458,7 @@ register struct proc *rc; /* slot of process to clean up */
|
||||
register struct proc *rp; /* iterate over process table */
|
||||
register struct proc **xpp; /* iterate over caller queue */
|
||||
|
||||
if(isemptyp(rc)) minix_panic("clear_proc: empty process", rc->p_endpoint);
|
||||
if(isemptyp(rc)) panic("clear_proc: empty process: %d", rc->p_endpoint);
|
||||
|
||||
if(rc->p_endpoint == PM_PROC_NR || rc->p_endpoint == VFS_PROC_NR ||
|
||||
rc->p_endpoint == VM_PROC_NR)
|
||||
@@ -468,7 +468,7 @@ register struct proc *rc; /* slot of process to clean up */
|
||||
*/
|
||||
printf("died: ");
|
||||
proc_stacktrace(rc);
|
||||
minix_panic("system process died", rc->p_endpoint);
|
||||
panic("system process died: %d", rc->p_endpoint);
|
||||
}
|
||||
|
||||
/* Make sure that the exiting process is no longer scheduled. */
|
||||
|
||||
@@ -147,7 +147,7 @@ irq_hook_t *hook;
|
||||
* automatically get their interrupt hooks unhooked.
|
||||
*/
|
||||
if(!isokendpt(hook->proc_nr_e, &proc_nr))
|
||||
minix_panic("invalid interrupt handler", hook->proc_nr_e);
|
||||
panic("invalid interrupt handler: %d", hook->proc_nr_e);
|
||||
|
||||
/* Add a bit for this interrupt to the process' pending interrupts. When
|
||||
* sending the notification message, this bit map will be magically set
|
||||
|
||||
@@ -350,7 +350,7 @@ PUBLIC int do_safecopy(struct proc * caller, message * m_ptr)
|
||||
src_seg = m_ptr->SCP_SEG;
|
||||
dst_seg = D;
|
||||
access = CPF_WRITE;
|
||||
} else minix_panic("Impossible system call nr. ", m_ptr->m_type);
|
||||
} else panic("Impossible system call nr.: %d", m_ptr->m_type);
|
||||
|
||||
return safecopy(caller, m_ptr->SCP_FROM_TO, caller->p_endpoint,
|
||||
(cp_grant_id_t) m_ptr->SCP_GID, src_seg, dst_seg,
|
||||
|
||||
@@ -47,7 +47,7 @@ PUBLIC int do_sysctl(struct proc * caller, message * m_ptr)
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
minix_panic("do_sysctl: can't happen", NO_NUM);
|
||||
panic("do_sysctl: can't happen");
|
||||
|
||||
return(OK);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ PUBLIC int do_umap(struct proc * caller, message * m_ptr)
|
||||
return EFAULT;
|
||||
}
|
||||
if(phys_addr == 0)
|
||||
minix_panic("vm_lookup returned zero physical address", NO_NUM);
|
||||
panic("vm_lookup returned zero physical address");
|
||||
break;
|
||||
default:
|
||||
if((r=arch_umap(targetpr, offset, count, seg_type, &lin_addr))
|
||||
|
||||
@@ -158,7 +158,7 @@ PUBLIC int do_vdevio(struct proc * caller, message * m_ptr)
|
||||
return(OK);
|
||||
|
||||
bad:
|
||||
minix_panic("do_vdevio: unaligned port", port);
|
||||
panic("do_vdevio: unaligned port: %d", port);
|
||||
return EPERM;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +56,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
|
||||
#if 0
|
||||
if(!RTS_ISSET(target, RTS_VMREQTARGET)) {
|
||||
printf("set stack: %s\n", rp->p_vmrequest.stacktrace);
|
||||
minix_panic("RTS_VMREQTARGET not set for target",
|
||||
NO_NUM);
|
||||
panic( "RTS_VMREQTARGET not set for target");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -95,7 +94,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
|
||||
(void *) rp->p_endpoint;
|
||||
break;
|
||||
default:
|
||||
minix_panic("VMREQUEST wrong type", NO_NUM);
|
||||
panic("VMREQUEST wrong type");
|
||||
}
|
||||
|
||||
rp->p_vmrequest.vmresult = VMSUSPEND;
|
||||
@@ -148,8 +147,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
|
||||
printf("suspended with stack: %s\n",
|
||||
p->p_vmrequest.stacktrace);
|
||||
#endif
|
||||
minix_panic("strange request type",
|
||||
p->p_vmrequest.type);
|
||||
panic( "strange request type: %d",p->p_vmrequest.type);
|
||||
}
|
||||
|
||||
RTS_UNSET(p, RTS_VMREQUEST);
|
||||
@@ -157,17 +155,17 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
|
||||
|
||||
case VMCTL_ENABLE_PAGING:
|
||||
if(vm_running)
|
||||
minix_panic("do_vmctl: paging already enabled", NO_NUM);
|
||||
panic("do_vmctl: paging already enabled");
|
||||
vm_init(p);
|
||||
if(!vm_running)
|
||||
minix_panic("do_vmctl: paging enabling failed", NO_NUM);
|
||||
panic("do_vmctl: paging enabling failed");
|
||||
vmassert(p->p_delivermsg_lin ==
|
||||
umap_local(p, D, p->p_delivermsg_vir, sizeof(message)));
|
||||
if ((err = arch_enable_paging()) != OK) {
|
||||
return err;
|
||||
}
|
||||
if(newmap(caller, p, (struct mem_map *) m_ptr->SVMCTL_VALUE) != OK)
|
||||
minix_panic("do_vmctl: newmap failed", NO_NUM);
|
||||
panic("do_vmctl: newmap failed");
|
||||
FIXLINMSG(p);
|
||||
vmassert(p->p_delivermsg_lin);
|
||||
return OK;
|
||||
|
||||
@@ -1,42 +1,35 @@
|
||||
/* This file contains a collection of miscellaneous procedures:
|
||||
* minix_panic: abort MINIX due to a fatal error
|
||||
* panic: abort MINIX due to a fatal error
|
||||
* kputc: buffered putc used by kernel printf
|
||||
*/
|
||||
|
||||
#include "kernel.h"
|
||||
#include "proc.h"
|
||||
|
||||
#include <minix/syslib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <minix/sys_config.h>
|
||||
|
||||
/*===========================================================================*
|
||||
* panic *
|
||||
*===========================================================================*/
|
||||
PUBLIC void panic(char *what, char *mess,int nr)
|
||||
{
|
||||
/* This function is for when a library call wants to panic.
|
||||
* The library call calls printf() and tries to exit a process,
|
||||
* which isn't applicable in the kernel.
|
||||
*/
|
||||
minix_panic(mess, nr);
|
||||
}
|
||||
#define ARE_PANICING 0xDEADC0FF
|
||||
|
||||
/*===========================================================================*
|
||||
* minix_panic *
|
||||
* panic *
|
||||
*===========================================================================*/
|
||||
PUBLIC void minix_panic(char *mess,int nr)
|
||||
PUBLIC void panic(const char *fmt, ...)
|
||||
{
|
||||
/* The system has run aground of a fatal kernel error. Terminate execution. */
|
||||
if (minix_panicing++) {
|
||||
va_list arg;
|
||||
/* The system has run aground of a fatal kernel error. Terminate execution. */
|
||||
if (minix_panicing == ARE_PANICING) {
|
||||
arch_monitor();
|
||||
}
|
||||
|
||||
if (mess != NULL) {
|
||||
printf("kernel panic: %s", mess);
|
||||
if(nr != NO_NUM)
|
||||
printf(" %d", nr);
|
||||
}
|
||||
minix_panicing = ARE_PANICING;
|
||||
if (fmt != NULL) {
|
||||
printf("kernel panic: ");
|
||||
va_start(arg, fmt);
|
||||
vprintf(fmt, arg);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user