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)
|
||||
|
||||
Reference in New Issue
Block a user