r= sef_receive(ANY, &m);
if (r != OK)
- panic(__FILE__, "sef_receive failed", r);
+ panic("sef_receive failed: %d", r);
if (is_notify(m.m_type)) {
if (_ENDPOINT_P(m.m_source) == PM_PROC_NR) {
do_pm_notify(&m);
size= 0x100000 / 8;
table= alloc_contig(size, AC_ALIGN4K, &busaddr);
if (table == NULL)
- panic("AMDDEV","malloc failed", NO_NUM);
+ panic("malloc failed");
if (index == 0)
{
memset(table, 0, size);
sa.sa_handler = SIG_MESS;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
- if (sigaction(SIGTERM,&sa,NULL)<0) panic("AT","sigaction failed", errno);
+ if (sigaction(SIGTERM,&sa,NULL)<0) panic("sigaction failed: %d", errno);
/* Set special disk parameters. */
init_params();
w_identify_wakeup_ticks = wakeup_secs * system_hz;
if(atapi_debug)
- panic("at_wini", "atapi_debug", NO_NUM);
+ panic("atapi_debug");
if(w_identify_wakeup_ticks <= 0) {
printf("changing wakeup from %d to %d ticks.\n",
/* Get the number of drives from the BIOS data area */
s=sys_readbios(NR_HD_DRIVES_ADDR, params, NR_HD_DRIVES_SIZE);
if (s != OK)
- panic(w_name(), "Couldn't read BIOS", s);
+ panic("Couldn't read BIOS: %d", s);
if ((nr_drives = params[0]) > 2) nr_drives = 2;
for (drive = 0, wn = wini; drive < COMPAT_DRIVES; drive++, wn++) {
BIOS_HD1_PARAMS_SIZE;
s=sys_readbios(vector, parv, size);
if (s != OK)
- panic(w_name(), "Couldn't read BIOS", s);
+ panic("Couldn't read BIOS: %d", s);
/* Calculate the address of the parameters and copy them */
s=sys_readbios(hclick_to_physb(parv[1]) + parv[0],
params, 16L);
if (s != OK)
- panic(w_name(),"Couldn't copy parameters", s);
+ panic("Couldn't copy parameters: %d", s);
/* Copy the parameters to the structures of the drive */
wn->lcylinders = bp_cylinders(params);
if (dma_base) {
if (sys_inb(dma_base + DMA_STATUS, &dma_status) != OK) {
- panic(w_name(),
- "unable to read DMA status register",
- NO_NUM);
+ panic("unable to read DMA status register");
}
}
/* Device information. */
if ((s=sys_insw(wn->base_cmd + REG_DATA, SELF, tmp_buf, SECTOR_SIZE)) != OK)
- panic(w_name(),"Call to sys_insw() failed", s);
+ panic("Call to sys_insw() failed: %d", s);
#if 0
if (id_word(0) & ID_GEN_NOT_ATA)
/* Device information. */
if ((s=sys_insw(wn->base_cmd + REG_DATA, SELF, tmp_buf, 512)) != OK)
- panic(w_name(),"Call to sys_insw() failed", s);
+ panic("Call to sys_insw() failed: %d", s);
size = 0; /* Size set later. */
check_dma(wn);
wn->irq = w_drive < 2 ? AT_WINI_0_IRQ : AT_WINI_1_IRQ;
wn->irq_hook_id = wn->irq; /* id to be returned if interrupt occurs */
if ((s=sys_irqsetpolicy(wn->irq, IRQ_REENABLE, &wn->irq_hook_id)) != OK)
- panic(w_name(), "couldn't set IRQ policy", s);
+ panic("couldn't set IRQ policy: %d", s);
if ((s=sys_irqenable(&wn->irq_hook_id)) != OK)
- panic(w_name(), "couldn't enable IRQ line", s);
+ panic("couldn't enable IRQ line: %d", s);
}
wn->state |= IDENTIFIED;
return(OK);
/* Try I/O on the actual drive (not any (sub)partition). */
if (w_prepare(w_drive * DEV_PER_DRIVE) == NIL_DEV)
- panic(w_name(), "Couldn't switch devices", NO_NUM);
+ panic("Couldn't switch devices");
r = w_transfer(SELF, DEV_GATHER_S, cvu64(0), &iov, 1);
/* Switch back. */
if (w_prepare(save_dev) == NIL_DEV)
- panic(w_name(), "Couldn't switch back devices", NO_NUM);
+ panic("Couldn't switch back devices");
/* Restore parameters. */
timeout_ticks = save_timeout;
/* Stop bus master operation */
r= sys_outb(wn->base_dma + DMA_COMMAND, 0);
- if (r != 0) panic("at_wini", "stop_dma: sys_outb failed", r);
+ if (r != 0) panic("stop_dma: sys_outb failed: %d", r);
}
PRIVATE void start_dma(struct wini *wn, int do_write)
v |= DMA_CMD_WRITE;
}
r= sys_outb(wn->base_dma + DMA_COMMAND, v);
- if (r != 0) panic("at_wini", "start_dma: sys_outb failed", r);
+ if (r != 0) panic("start_dma: sys_outb failed: %d", r);
}
PRIVATE int error_dma(struct wini *wn)
return 1; \
r= sys_inb(wn->base_dma + DMA_STATUS, &v);
- if (r != 0) panic("at_wini", "w_transfer: sys_inb failed", r);
+ if (r != 0) panic("w_transfer: sys_inb failed: %d", r);
if (!wn->dma_intseen) {
/* DMA did not complete successfully */
* way to implement this wait.
*/
if (sys_inb((wn->base_ctl+REG_CTL_ALTSTAT), &w_status) != OK)
- panic(w_name(), "couldn't get status", NO_NUM);
+ panic("couldn't get status");
}
if (do_dma) {
s= sys_safecopyto(proc_nr, iov->iov_addr,
addr_offset,
(vir_bytes)dma_buf+dma_buf_offset, n, D);
- if (s != OK)
- {
- panic(w_name(),
- "w_transfer: sys_vircopy failed",
- s);
+ if (s != OK) {
+ panic("w_transfer: sys_vircopy failed: %d", s);
}
} else {
memcpy((char *) iov->iov_addr + addr_offset,
if (w_wn->w_status & STATUS_DRQ) {
if ((s=sys_insw(wn->base_cmd+REG_DATA,
SELF, tmp_buf,
- SECTOR_SIZE)) != OK)
- {
- panic(w_name(),
- "Call to sys_insw() failed",
- s);
+ SECTOR_SIZE)) != OK) {
+ panic("Call to sys_insw() failed: %d", s);
}
}
break;
SECTOR_SIZE);
}
if(s != OK) {
- panic(w_name(),"Call to sys_insw() failed", s);
+ panic("Call to sys_insw() failed: %d", s);
}
} else {
if(proc_nr != SELF) {
}
if(s != OK) {
- panic(w_name(),"Call to sys_outsw() failed", s);
+ panic("Call to sys_outsw() failed: %d", s);
}
/* Data sent, wait for an interrupt. */
/* Select drive. */
if ((s=sys_outb(base_cmd + REG_LDH, cmd->ldh)) != OK)
- panic(w_name(),"Couldn't write register to select drive",s);
+ panic("Couldn't write register to select drive: %d", s);
if (!w_waitfor(STATUS_BSY, 0)) {
printf("%s: com_out: drive not ready\n", w_name());
pv_set(outbyte[5], base_cmd + REG_CYL_HI, cmd->cyl_hi);
pv_set(outbyte[6], base_cmd + REG_COMMAND, cmd->command);
if ((s=sys_voutb(outbyte,7)) != OK)
- panic(w_name(),"Couldn't write registers with sys_voutb()",s);
+ panic("Couldn't write registers with sys_voutb(): %d", s);
return(OK);
}
/* Select drive. */
if ((s=sys_outb(base_cmd + REG_LDH, cmd->ldh)) != OK)
- panic(w_name(),"Couldn't write register to select drive",s);
+ panic("Couldn't write register to select drive: %d", s);
if (!w_waitfor(STATUS_BSY, 0)) {
printf("%s: com_out: drive not ready\n", w_name());
pv_set(outbyte[8], base_cmd + REG_CYL_HI, cmd->cyl_hi);
pv_set(outbyte[9], base_cmd + REG_COMMAND, cmd->command);
if ((s=sys_voutb(outbyte, 10)) != OK)
- panic(w_name(),"Couldn't write registers with sys_voutb()",s);
+ panic("Couldn't write registers with sys_voutb(): %d", s);
return(OK);
}
if (n > size)
n= size;
if (n == 0 || (n & 1))
- panic("at_wini", "bad size in iov", iov[i].iov_size);
+ panic("bad size in iov: %d", iov[i].iov_size);
if(proc_nr != SELF) {
r= sys_umap(proc_nr, VM_GRANT, iov[i].iov_addr, n,
&user_phys);
if (r != 0)
- panic("at_wini",
- "can't map user buffer (VM_GRANT)", r);
+ panic("can't map user buffer (VM_GRANT): %d", r);
user_phys += offset + addr_offset;
} else {
r= sys_umap(proc_nr, VM_D,
iov[i].iov_addr+offset+addr_offset, n,
&user_phys);
if (r != 0)
- panic("at_wini",
- "can't map user buffer (VM_D)", r);
+ panic("can't map user buffer (VM_D): %d", r);
}
if (user_phys & 1)
{
if (!bad)
{
if (j <= 0 || j > N_PRDTE)
- panic("at_wini", "bad prdt index", j);
+ panic("bad prdt index: %d", j);
prdt[j-1].prdte_flags |= PRDTE_FL_EOT;
if(verbose) {
r= sys_safecopyfrom(proc_nr, iov->iov_addr,
addr_offset, (vir_bytes)dma_buf+offset,
n, D);
- if (r != OK)
- {
- panic(w_name(),
- "setup_dma: sys_vircopy failed", r);
+ if (r != OK) {
+ panic("setup_dma: sys_vircopy failed: %d", r);
}
} else {
memcpy(dma_buf + offset,
if (phys & 1)
{
/* Two byte alignment is required */
- panic("at_wini", "bad buffer alignment in setup_dma",
- phys);
+ panic("bad buffer alignment in setup_dma: 0x%lx", phys);
}
for (j= 0; j<N_PRDTE; i++)
{
- if (size == 0)
- {
- panic("at_wini", "bad size in setup_dma",
- size);
+ if (size == 0) {
+ panic("bad size in setup_dma: %d", size);
}
if (size & 1)
{
/* Two byte alignment is required for size */
- panic("at_wini",
- "bad size alignment in setup_dma",
- size);
+ panic("bad size alignment in setup_dma: %d", size);
}
n= size;
}
}
if (size != 0)
- panic("at_wini", "size to large for prdt", NO_NUM);
+ panic("size to large for prdt");
if(verbose) {
for (i= 0; i<=j; i++)
/* Verify that the bus master is not active */
r= sys_inb(wn->base_dma + DMA_STATUS, &v);
- if (r != 0) panic("at_wini", "setup_dma: sys_inb failed", r);
+ if (r != 0) panic("setup_dma: sys_inb failed: %d", r);
if (v & DMA_ST_BM_ACTIVE)
- panic("at_wini", "Bus master IDE active", NO_NUM);
+ panic("Bus master IDE active");
if (prdt_phys & 3)
- panic("at_wini", "prdt not aligned", prdt_phys);
+ panic("prdt not aligned: %d", prdt_phys);
r= sys_outl(wn->base_dma + DMA_PRDTP, prdt_phys);
- if (r != 0) panic("at_wini", "setup_dma: sys_outl failed", r);
+ if (r != 0) panic("setup_dma: sys_outl failed: %d", r);
/* Clear interrupt and error flags */
r= sys_outb(wn->base_dma + DMA_STATUS, DMA_ST_INT | DMA_ST_ERROR);
- if (r != 0) panic("at_wini", "setup_dma: sys_outb failed", r);
+ if (r != 0) panic("setup_dma: sys_outb failed: %d", r);
}
/* Strobe reset bit */
if ((s=sys_outb(wn->base_ctl + REG_CTL, CTL_RESET)) != OK)
- panic(w_name(),"Couldn't strobe reset bit",s);
+ panic("Couldn't strobe reset bit: %d", s);
tickdelay(DELAY_TICKS);
if ((s=sys_outb(wn->base_ctl + REG_CTL, 0)) != OK)
- panic(w_name(),"Couldn't strobe reset bit",s);
+ panic("Couldn't strobe reset bit: %d", s);
tickdelay(DELAY_TICKS);
/* Wait for controller ready */
while (w_wn->w_status & (STATUS_ADMBSY|STATUS_BSY)) {
int rr;
if((rr=sef_receive(ANY, &m)) != OK)
- panic("at_wini", "sef_receive(ANY) failed", rr);
+ panic("sef_receive(ANY) failed: %d", rr);
if (is_notify(m.m_type)) {
switch (_ENDPOINT_P(m.m_source)) {
case CLOCK:
r= sys_inb(w_wn->base_cmd +
REG_STATUS, &w_status);
if (r != 0)
- panic("at_wini",
- "sys_inb failed", r);
+ panic("sys_inb failed: %d", r);
w_wn->w_status= w_status;
ack_irqs(m.NOTIFY_ARG);
break;
r = OK;
} else {
if ((s=sys_inb(w_wn->base_cmd + REG_ERROR, &inbval)) != OK)
- panic(w_name(),"Couldn't read register",s);
+ panic("Couldn't read register: %d", s);
if ((w_wn->w_status & STATUS_ERR) && (inbval & ERROR_BB)) {
r = ERR_BAD_SECTOR; /* sector marked bad, retries won't help */
} else {
getuptime(&t0);
do {
if ((s=sys_inb(w_wn->base_cmd + REG_STATUS, &w_status)) != OK)
- panic(w_name(),"Couldn't read register",s);
+ panic("Couldn't read register: %d", s);
w_wn->w_status= w_status;
if ((w_wn->w_status & mask) == value) {
return 1;
getuptime(&t0);
do {
if ((s=sys_inb(w_wn->base_dma + DMA_STATUS, &w_status)) != OK)
- panic(w_name(),"Couldn't read register",s);
+ panic("Couldn't read register: %d", s);
if ((w_status & mask) == value) {
return 1;
}
if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE;
if ((s=sys_insw(wn->base_cmd + REG_DATA,
SELF, tmp_buf, chunk)) != OK)
- panic(w_name(),"Call to sys_insw() failed", s);
+ panic("Call to sys_insw() failed: %d", s);
before -= chunk;
count -= chunk;
}
chunk);
}
if (s != OK)
- panic(w_name(),"Call to sys_insw() failed", s);
+ panic("Call to sys_insw() failed: %d", s);
position= add64ul(position, chunk);
nbytes -= chunk;
count -= chunk;
if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE;
if ((s=sys_insw(wn->base_cmd + REG_DATA,
SELF, tmp_buf, chunk)) != OK)
- panic(w_name(),"Call to sys_insw() failed", s);
+ panic("Call to sys_insw() failed: %d", s);
count -= chunk;
}
}
/* Select Master/Slave drive */
if ((s=sys_outb(wn->base_cmd + REG_DRIVE, wn->ldhpref)) != OK)
- panic(w_name(),"Couldn't select master/ slave drive",s);
+ panic("Couldn't select master/ slave drive: %d", s);
if (!w_waitfor(STATUS_BSY | STATUS_DRQ, 0)) {
printf("%s: atapi_sendpacket: drive not ready\n", w_name());
pv_set(outbyte[5], wn->base_cmd + REG_COMMAND, w_command);
if (atapi_debug) printf("cmd: %x ", w_command);
if ((s=sys_voutb(outbyte,6)) != OK)
- panic(w_name(),"Couldn't write registers with sys_voutb()",s);
+ panic("Couldn't write registers with sys_voutb(): %d", s);
if (!w_waitfor(STATUS_BSY | STATUS_DRQ, STATUS_DRQ)) {
printf("%s: timeout (BSY|DRQ -> DRQ)\n", w_name());
/* Send the command packet to the device. */
if ((s=sys_outsw(wn->base_cmd + REG_DATA, SELF, packet, ATAPI_PACKETSIZE)) != OK)
- panic(w_name(),"sys_outsw() failed", s);
+ panic("sys_outsw() failed: %d", s);
return(OK);
}
if (sys_inb((wini[drive].base_cmd + REG_STATUS),
&w_status) != OK)
{
- panic(w_name(), "couldn't ack irq on drive %d\n",
- drive);
+ panic("couldn't ack irq on drive: %d", drive);
}
wini[drive].w_status= w_status;
sys_inb(wini[drive].base_dma + DMA_STATUS, &w_status);
inbyte[2].port = wn->base_cmd + REG_CNT_HI;
inbyte[3].port = wn->base_cmd + REG_IRR;
if ((s=sys_vinb(inbyte, 4)) != OK)
- panic(w_name(),"ATAPI failed sys_vinb()", s);
+ panic("ATAPI failed sys_vinb(): %d", s);
e = inbyte[0].value;
len = inbyte[1].value;
len |= inbyte[2].value << 8;
printf("at_wini%d: sys_voutb failed: %d pvb (%d):\n", w_instance, s, n);
for(i = 0; i < n; i++)
printf("%2d: %4x -> %4x\n", i, pvb[i].value, pvb[i].port);
- panic(w_name(), "sys_voutb failed", NO_NUM);
+ panic("sys_voutb failed");
}
PRIVATE int at_vinb(int line, pvb_pair_t *pvb, int n)
printf("at_wini%d: sys_vinb failed: %d pvb (%d):\n", w_instance, s, n);
for(i = 0; i < n; i++)
printf("%2d: %4x\n", i, pvb[i].port);
- panic(w_name(), "sys_vinb failed", NO_NUM);
+ panic("sys_vinb failed");
}
PRIVATE int at_out(int line, u32_t port, u32_t value,
return OK;
printf("at_wini%d: line %d: %s failed: %d; %x -> %x\n",
w_instance, line, typename, s, value, port);
- panic(w_name(), "sys_out failed", NO_NUM);
+ panic("sys_out failed");
}
return OK;
printf("at_wini%d: line %d: %s failed: %d; port %x\n",
w_instance, line, typename, s, value, port);
- panic(w_name(), "sys_in failed", NO_NUM);
+ panic("sys_in failed");
}
*/
state.base = vm_map_phys(SELF, (void *) bar, ATL2_MMAP_SIZE);
if (state.base == MAP_FAILED)
- panic("atl2", "unable to map in registers", NO_NUM);
+ panic("unable to map in registers");
if ((r = atl2_alloc_dma()) != OK)
- panic("atl2", "unable to allocate DMA buffers", r);
+ panic("unable to allocate DMA buffers: %d", r);
state.irq = pci_attr_r8(devind, PCI_ILR);
if ((r = sys_irqsetpolicy(state.irq, 0, &state.hook_id)) != OK)
- panic("atl2", "unable to register IRQ", r);
+ panic("unable to register IRQ: %d", r);
if (!atl2_reset())
- panic("atl2", "unable to reset hardware", NO_NUM);
+ panic("unable to reset hardware");
if ((r = sys_irqenable(&state.hook_id)) != OK)
- panic("atl2", "unable to enable IRQ", r);
+ panic("unable to enable IRQ: %d", r);
atl2_get_hwaddr();
m.DL_COUNT));
if ((r = send(state.task_endpt, &m)) != OK)
- panic("atl2", "unable to reply", r);
+ panic("unable to reply: %d", r);
state.flags &= ~(ATL2_FLAG_PACK_SENT | ATL2_FLAG_PACK_RCVD);
state.recv_count = 0;
r = sys_safecopyfrom(m->DL_PROC, m->DL_GRANT, off,
(vir_bytes) iovec, batch * sizeof(iovec[0]), D);
if (r != OK)
- panic("atl2", "vector copy failed", r);
+ panic("vector copy failed: %d", r);
/* Copy out each element in the batch, until we run out. */
for (j = 0, iovp = iovec; j < batch && left > 0; j++, iovp++) {
r = sys_safecopyto(m->DL_PROC, iovp->iov_grant, 0,
(vir_bytes) pos, size, D);
if (r != OK)
- panic("atl2", "safe copy failed", r);
+ panic("safe copy failed: %d", r);
pos += size;
left -= size;
r = sys_safecopyfrom(m->DL_PROC, m->DL_GRANT, off,
(vir_bytes) iovec, batch * sizeof(iovec[0]), D);
if (r != OK)
- panic("atl2", "vector copy failed", r);
+ panic("vector copy failed: %d", r);
/* Copy in each element in the batch. */
for (j = 0, iovp = iovec; j < batch; j++, iovp++) {
(vir_bytes) (state.txd_base + pos),
skip, D);
if (r != OK)
- panic("atl2", "safe copy failed", r);
+ panic("safe copy failed: %d", r);
pos = 0;
}
(vir_bytes) (state.txd_base + pos),
size - skip, D);
if (r != OK)
- panic("atl2", "safe copy failed", r);
+ panic("safe copy failed: %d", r);
pos = (pos + size - skip) % ATL2_TXD_BUFSIZE;
left -= size;
ATL2_WRITE_U32(ATL2_ISR_REG, 0);
if ((r = sys_irqenable(&state.hook_id)) != OK)
- panic("atl2", "unable to enable IRQ", r);
+ panic("unable to enable IRQ: %d", r);
/* Attempt to satisfy pending write and read requests. */
if (try_write)
atl2_stop();
if ((r = sys_irqrmpolicy(&state.hook_id)) != OK)
- panic("atl2", "unable to deregister IRQ", r);
+ panic("unable to deregister IRQ: %d", r);
free_contig(state.txd_base, ATL2_TXD_BUFSIZE);
free_contig(state.txs_base, ATL2_TXS_COUNT * sizeof(u32_t));
devind = atl2_probe(instance);
if (devind < 0)
- panic("atl2", "no matching device found", NO_NUM);
+ panic("no matching device found");
/* Initialize the device. */
atl2_init(devind);
while (TRUE) {
if ((r = sef_receive(ANY, &m)) != OK)
- panic("atl2", "sef_receive failed", r);
+ panic("sef_receive failed: %d", r);
if (is_notify(m.m_type)) {
switch (m.m_source) {
int s, value = -1;
if ((s=sys_inb(port, &value)) != OK)
- panic("SB16DSP","sys_inb() failed", s);
+ panic("sys_inb() failed: %d", s);
return value;
}
int s;
if ((s=sys_outb(port, value)) != OK)
- panic("SB16DSP","sys_outb() failed", s);
+ panic("sys_outb() failed: %d", s);
}
0, (vir_bytes) (bios_buf_v+count),
chunk, D);
if (r != OK)
- panic(ME, "copy failed", r);
+ panic("copy failed: %d", r);
} else {
memcpy(bios_buf_v+count,
(char *) iop->iov_addr, chunk);
r= sys_int86(®86);
if (r != OK)
- panic(ME, "BIOS call failed", r);
+ panic("BIOS call failed: %d", r);
if (reg86.u.w.f & 0x0001) {
/* An error occurred, try again sector by sector unless */
chunk, D);
if (r != OK)
- panic(ME, "sys_vircopy failed", r);
+ panic("sys_vircopy failed: %d", r);
} else {
memcpy((char *) iop->iov_addr,
bios_buf_v+count, chunk);
/* Ask the system task for a suitable buffer */
if(!(bios_buf_v = alloc_contig(BIOSBUF, AC_LOWER1M, &bios_buf_phys))) {
- panic(ME, "allocating bios buffer failed", ENOMEM);
+ panic("allocating bios buffer failed: %d", ENOMEM);
}
if (bios_buf_phys+BIOSBUF > 0x100000)
- panic(ME, "bad BIOS buffer, phys", bios_buf_phys);
+ panic("bad BIOS buffer / phys: %d", bios_buf_phys);
#if 0
printf("bios_wini: got buffer size %d, virtual 0x%x, phys 0x%x\n",
BIOSBUF, bios_buf_v, bios_buf_phys);
reg86.u.b.dl = drive_id;
r= sys_int86(®86);
if (r != OK)
- panic(ME, "BIOS call failed", r);
+ panic("BIOS call failed: %d", r);
nr_drives = !(reg86.u.w.f & 0x0001) ? reg86.u.b.dl : drive;
if (drive_id >= 0x80 + nr_drives) continue;
if (pc_at) {
r= sys_int86(®86);
if (r != OK)
- panic(ME, "BIOS call failed", r);
+ panic("BIOS call failed: %d", r);
}
if (!(reg86.u.w.f & 0x0001) && reg86.u.w.bx == 0xAA55
r= sys_int86(®86);
if (r != OK)
- panic(ME, "BIOS call failed", r);
+ panic("BIOS call failed: %d", r);
if (!(reg86.u.w.f & 0x0001)) {
wn->int13ext = 1; /* Extensions can be used. */
while (TRUE)
{
if ((r= sef_receive(ANY, &m)) != OK)
- panic(str_DevName, "minix msg sef_receive failed", r);
+ panic("minix msg sef_receive failed: %d", r);
if(is_notify(m.m_type)) {
switch(_ENDPOINT_P(m.m_source)) {
default:
printf("message 0x%lx; %d from %d\n",
m.m_type, m.m_type-DL_RQ_BASE, m.m_source);
- panic(str_DevName, "illegal message", m.m_type);
+ panic("illegal message: %d", m.m_type);
}
}
}
port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR)
- panic(str_DevName, str_PortErrMsg, port);
+ panic(str_PortErrMsg, port);
dep = &de_table[port];
dep->de_client = mp->DL_PROC;
if ((rc = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0,
(vir_bytes)&dep->de_stat,
(vir_bytes) sizeof(dep->de_stat), 0)) != OK)
- panic(str_DevName, str_CopyErrMsg, rc);
+ panic(str_CopyErrMsg, rc);
mp->m_type = DL_STAT_REPLY;
mp->DL_PORT = port;
mp->DL_STAT = OK;
rc = send(mp->m_source, mp);
if( rc != OK )
- panic(str_DevName, str_StatErrMsg, rc);
+ panic(str_StatErrMsg, rc);
return;
}
*(ether_addr_t *) reply_mess.m3_ca1 = dep->de_address;
if (send(mp->m_source, &reply_mess) != OK)
- panic(str_DevName, str_SendErrMsg, mp->m_source);
+ panic(str_SendErrMsg, mp->m_source);
return;
}
mp->m_type= DL_NAME_REPLY;
r = send(mp->m_source, mp);
if (r!= OK)
- panic(str_DevName, "do_getname: send failed", r);
+ panic("do_getname: send failed: %d", r);
}
PRIVATE void do_reply(dpeth_t * dep, int err, int may_block)
}
if(status < 0)
- panic(dep->de_name, str_SendErrMsg, status);
+ panic(str_SendErrMsg, status);
dep->de_read_s = 0;
dep->de_flags &= NOT(DEF_ACK_SEND | DEF_ACK_RECV);
dep->de_irq = pci_attr_r8(devind, PCI_ILR);
if (dep->de_base_port < DE_MIN_BASE_ADDR)
- panic(str_DevName,"de_probe: base address invalid ", dep->de_base_port);
+ panic("de_probe: base address invalid: %d", dep->de_base_port);
DEBUG(printf("%s: using I/O address 0x%lx, IRQ %d\n",
dep->de_name, (unsigned long)dep->de_base_port,
iovec_dat_s_t *iovp = NULL;
if (mp->DL_PORT < 0 || mp->DL_PORT >= DE_PORT_NR)
- panic(dep->de_name, str_PortErrMsg, mp->DL_PORT);
+ panic(str_PortErrMsg, mp->DL_PORT);
dep = &de_table[mp->DL_PORT];
dep->de_client = mp->DL_PROC;
dep->de_read_iovec.iod_iovec_offset = 0;
size = de_calc_iov_size(&dep->de_read_iovec);
if (size < ETH_MAX_PACK_SIZE)
- panic(str_DevName, str_SizeErrMsg, size);
+ panic(str_SizeErrMsg, size);
/* Copy buffer to user area and clear ownage */
size = (descr->descr->des[DES0]&DES0_FL)>>DES0_FL_SHIFT;
r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0,
(vir_bytes)buffer, bytes, D);
if (r != OK)
- panic(str_DevName, str_CopyErrMsg, r);
+ panic(str_CopyErrMsg, r);
buffer += bytes;
if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */
/* translate buffers physical address */
r = sys_umap(SELF, VM_D, loc_descr->buf1, temp,
&(loc_descr->descr->des[DES_BUF1]));
- if(r != OK) panic(dep->de_name, "umap failed", r);
+ if(r != OK) panic("umap failed: %d", r);
loc_descr->descr->des[DES_BUF2] = 0;
memset(&loc_descr->descr->des[DES0],0,sizeof(u32_t));
loc_descr->descr->des[DES1] = temp;
/* record physical location of two first descriptor */
r = sys_umap(SELF, VM_D, dep->descr[DESCR_RECV][0].descr,
sizeof(de_descr_t), &dep->sendrecv_descr_phys_addr[DESCR_RECV]);
- if(r != OK) panic(str_DevName, str_UmapErrMsg, r);
+ if(r != OK) panic(str_UmapErrMsg, r);
r = sys_umap(SELF, VM_D, dep->descr[DESCR_TRAN][0].descr,
sizeof(de_descr_t), &dep->sendrecv_descr_phys_addr[DESCR_TRAN]);
- if(r != OK) panic(str_DevName, str_UmapErrMsg, r);
+ if(r != OK) panic(str_UmapErrMsg, r);
DEBUG(printf("Descr: head tran=[%08X] head recv=[%08X]\n",
dep->sendrecv_descr_phys_addr[DESCR_TRAN],
r = sys_umap(SELF, VM_D, &(loc_descr->descr), sizeof(de_descr_t),
&temp);
if(r != OK)
- panic(str_DevName, str_UmapErrMsg, r);
+ panic(str_UmapErrMsg, r);
if( ((loc_descr->descr->des[DES_BUF1] & 0x3) != 0) ||
((loc_descr->descr->des[DES_BUF2] & 0x3) != 0) ||
((temp&0x3)!=0) )
- panic(str_DevName, str_AlignErrMsg, temp);
+ panic(str_AlignErrMsg, temp);
loc_descr++;
}
val = io_inl(CSR_ADDR(dep, CSR5));
if(val & CSR5_AIS){
- panic(dep->de_name, "Abnormal Int CSR5=", val);
+ panic("Abnormal Int CSR5=: %d", val);
}
if( (dep->de_flags & DEF_READING) && (val & CSR5_RI) ){
len = (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_t);
rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len, D);
if (rc != OK)
- panic(str_DevName, str_CopyErrMsg, rc);
+ panic(str_CopyErrMsg, rc);
return;
}
char *buffer = NULL;
if( mp->DL_PORT < 0 || mp->DL_PORT >= DE_PORT_NR)
- panic(str_DevName, str_PortErrMsg, mp->DL_PORT);
+ panic(str_PortErrMsg, mp->DL_PORT);
dep = &de_table[mp->DL_PORT];
dep->de_client = mp->DL_PROC;
if (dep->de_mode == DEM_ENABLED) {
if (!from_int && (dep->de_flags & DEF_SENDING))
- panic(str_DevName, str_BusyErrMsg, NO_NUM);
+ panic(str_BusyErrMsg);
descr = &dep->descr[DESCR_TRAN][dep->cur_descr[DESCR_TRAN]];
iovp->iod_iovec_offset = 0;
totalsize = size = de_calc_iov_size(iovp);
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE)
- panic(str_DevName, str_SizeErrMsg, size);
+ panic(str_SizeErrMsg, size);
dep->bytes_tx += size;
dep->de_stat.ets_packetT++;
r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant,
0, (vir_bytes)buffer, bytes, D);
if (r != OK)
- panic(str_DevName, str_CopyErrMsg, r);
+ panic(str_CopyErrMsg, r);
buffer += bytes;
if (++ix >= IOVEC_NR) {
suspend:
if(from_int)
- panic(str_DevName, "should not happen", 0);
+ panic("should not happen: %d", 0);
dep->de_stat.ets_transDef++;
dep->de_flags |= DEF_SENDING;
/* Set interrupt level for 3c503 */
irq = (dep->de_irq &= ~DEI_DEFAULT); /* Strip the default flag. */
if (irq == 9) irq = 2;
- if (irq < 2 || irq > 5) panic("", "bad 3c503 irq configuration", irq);
+ if (irq < 2 || irq > 5) panic("bad 3c503 irq configuration: %d", irq);
outb_el2(dep, EL2_IDCFG, (0x04 << irq));
outb_el2(dep, EL2_DRQCNT, 0x08); /* Set burst size to 8 */
dp_check_ints(dep);
do_int(dep);
r= sys_irqenable(&dep->de_hook);
- if (r != OK)
- {
- panic("DP8390",
- "unable enable interrupts", r);
+ if (r != OK) {
+ panic("unable enable interrupts: %d", r);
}
}
}
while (TRUE)
{
if ((r= sef_receive(ANY, &m)) != OK)
- panic("", "dp8390: sef_receive failed", r);
+ panic("dp8390: sef_receive failed: %d", r);
if (is_notify(m.m_type)) {
switch (_ENDPOINT_P(m.m_source)) {
printf("dp8390: notify from CLOCK\n");
break;
default:
- panic("", "dp8390: illegal notify from",
- m.m_source);
+ panic("dp8390: illegal notify from: %d",
+ m.m_source);
}
/* done, get a new message */
case DL_GETNAME: do_getname(&m); break;
case DL_STOP: do_stop(&m); break;
default:
- panic("", "dp8390: illegal message", m.m_type);
+ panic("dp8390: illegal message: %d", m.m_type);
}
}
}
system_hz = sys_hz();
- if (env_argc < 1)
- {
- panic("DP8390",
- "A head which at this time has no name", NO_NUM);
+ if (env_argc < 1) {
+ panic("A head which at this time has no name");
}
(progname=strrchr(env_argv[0],'/')) ? progname++
: (progname=env_argv[0]);
port = mp->DL_PORT;
count = mp->DL_COUNT;
if (port < 0 || port >= DE_PORT_NR)
- panic("", "dp8390: illegal port", port);
+ panic("dp8390: illegal port: %d", port);
dep= &de_table[port];
dep->de_client= mp->DL_PROC;
assert(dep->de_mode == DEM_ENABLED);
assert(dep->de_flags & DEF_ENABLED);
if (dep->de_flags & DEF_SEND_AVAIL)
- panic("", "dp8390: send already in progress", NO_NUM);
+ panic("dp8390: send already in progress");
sendq_head= dep->de_sendq_head;
if (dep->de_sendq[sendq_head].sq_filled)
{
if (from_int)
- panic("", "dp8390: should not be sending\n", NO_NUM);
+ panic("dp8390: should not be sending");
dep->de_sendmsg= *mp;
dep->de_flags |= DEF_SEND_AVAIL;
reply(dep, OK, FALSE);
}
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
{
- panic("", "dp8390: invalid packet size", size);
+ panic("dp8390: invalid packet size: %d", size);
}
(dep->de_user2nicf)(dep, &dep->de_write_iovec, 0,
dep->de_sendq[sendq_head].sq_sendpage * DP_PAGESIZE,
port = mp->DL_PORT;
count = mp->DL_COUNT;
if (port < 0 || port >= DE_PORT_NR)
- panic("", "dp8390: illegal port", port);
+ panic("dp8390: illegal port: %d", port);
dep= &de_table[port];
dep->de_client= mp->DL_PROC;
assert(dep->de_mode == DEM_ENABLED);
assert(dep->de_flags & DEF_ENABLED);
if (dep->de_flags & DEF_SEND_AVAIL)
- panic("", "dp8390: send already in progress", NO_NUM);
+ panic("dp8390: send already in progress");
sendq_head= dep->de_sendq_head;
if (dep->de_sendq[sendq_head].sq_filled)
{
if (from_int)
- panic("", "dp8390: should not be sending\n", NO_NUM);
+ panic("dp8390: should not be sending");
dep->de_sendmsg= *mp;
dep->de_flags |= DEF_SEND_AVAIL;
reply(dep, OK, FALSE);
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
{
- panic("", "dp8390: invalid packet size", size);
+ panic("dp8390: invalid packet size: %d", size);
}
(dep->de_user2nicf_s)(dep, &dep->de_write_iovec_s, 0,
dep->de_sendq[sendq_head].sq_sendpage * DP_PAGESIZE,
port = mp->DL_PORT;
count = mp->DL_COUNT;
if (port < 0 || port >= DE_PORT_NR)
- panic("", "dp8390: illegal port", port);
+ panic("dp8390: illegal port: %d", port);
dep= &de_table[port];
dep->de_client= mp->DL_PROC;
if (dep->de_mode == DEM_SINK)
assert(dep->de_flags & DEF_ENABLED);
if(dep->de_flags & DEF_READING)
- panic("", "dp8390: read already in progress", NO_NUM);
+ panic("dp8390: read already in progress");
dep->de_safecopy_read= 0;
size= count;
}
if (size < ETH_MAX_PACK_SIZE_TAGGED)
- panic("", "dp8390: wrong packet size", size);
+ panic("dp8390: wrong packet size: %d", size);
dep->de_flags |= DEF_READING;
dp_recv(dep);
port = mp->DL_PORT;
count = mp->DL_COUNT;
if (port < 0 || port >= DE_PORT_NR)
- panic("", "dp8390: illegal port", port);
+ panic("dp8390: illegal port: %d", port);
dep= &de_table[port];
dep->de_client= mp->DL_PROC;
if (dep->de_mode == DEM_SINK)
dep->de_safecopy_read= 1;
if(dep->de_flags & DEF_READING)
- panic("", "dp8390: read already in progress", NO_NUM);
+ panic("dp8390: read already in progress");
get_userdata_s(mp->DL_PROC, mp->DL_GRANT, 0,
(count > IOVEC_NR ? IOVEC_NR : count) *
size= calc_iovec_size_s(&dep->de_tmp_iovec_s);
if (size < ETH_MAX_PACK_SIZE_TAGGED)
- panic("", "dp8390: wrong packet size", size);
+ panic("dp8390: wrong packet size: %d", size);
dep->de_flags |= DEF_READING;
dp_recv(dep);
port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR)
- panic("", "dp8390: illegal port", port);
+ panic("dp8390: illegal port: %d", port);
dep= &de_table[port];
dep->de_client= mp->DL_PROC;
if (dep->de_mode == DEM_SINK)
mp->DL_STAT= OK;
r= send(mp->m_source, mp);
if (r != OK)
- panic(__FILE__, "do_getstat: send failed: %d\n", r);
+ panic("do_getstat: send failed: %d", r);
return;
}
assert(dep->de_mode == DEM_ENABLED);
mp->DL_STAT= OK;
r= send(mp->m_source, mp);
if (r != OK)
- panic(__FILE__, "do_getstat: send failed: %d\n", r);
+ panic("do_getstat: send failed: %d", r);
}
/*===========================================================================*
port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR)
- panic("", "dp8390: illegal port", port);
+ panic("dp8390: illegal port: %d", port);
dep= &de_table[port];
dep->de_client= mp->DL_PROC;
if (dep->de_mode == DEM_SINK)
mp->DL_STAT= OK;
r= send(mp->m_source, mp);
if (r != OK)
- panic(__FILE__, "do_getstat: send failed: %d\n", r);
+ panic("do_getstat: send failed: %d", r);
return;
}
assert(dep->de_mode == DEM_ENABLED);
mp->DL_STAT= OK;
r= send(mp->m_source, mp);
if (r != OK)
- panic(__FILE__, "do_getstat: send failed: %d\n", r);
+ panic("do_getstat: send failed: %d", r);
}
/*===========================================================================*
mp->m_type= DL_NAME_REPLY;
r= send(mp->m_source, mp);
if (r != OK)
- panic("dp8390", "do_getname: send failed: %d\n", r);
+ panic("do_getname: send failed: %d", r);
}
/*===========================================================================*
port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR)
- panic("", "dp8390: illegal port", port);
+ panic("dp8390: illegal port: %d", port);
dep= &de_table[port];
if (dep->de_mode == DEM_SINK)
return;
dep->de_hook = dep->de_irq;
r= sys_irqsetpolicy(dep->de_irq, 0, &dep->de_hook);
if (r != OK)
- panic("DP8390", "sys_irqsetpolicy failed", r);
+ panic("sys_irqsetpolicy failed: %d", r);
r= sys_irqenable(&dep->de_hook);
if (r != OK)
{
- panic("DP8390", "unable enable interrupts", r);
+ panic("unable enable interrupts: %d", r);
}
}
int size, sendq_tail;
if (!(dep->de_flags & DEF_ENABLED))
- panic("", "dp8390: got premature interrupt", NO_NUM);
+ panic("dp8390: got premature interrupt");
for(;;)
{
case DL_WRITEV: do_vwrite(&dep->de_sendmsg, TRUE, TRUE); break;
case DL_WRITEV_S: do_vwrite_s(&dep->de_sendmsg, TRUE); break;
default:
- panic("", "dp8390: wrong type", dep->de_sendmsg.m_type);
+ panic("dp8390: wrong type: %d", dep->de_sendmsg.m_type);
break;
}
}
iovp->iod_iovec[i].iov_addr + offset,
SELF, D, vir_hw, bytes);
if (r != OK)
- panic("DP8390", "dp_user2nic: sys_vircopy failed", r);
+ panic("dp_user2nic: sys_vircopy failed: %d", r);
count -= bytes;
vir_hw += bytes;
r= sys_safecopyfrom(iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_grant, offset,
vir_hw, bytes, D);
- if (r != OK)
- {
- panic("DP8390",
- "dp_user2nic_s: sys_safecopyfrom failed", r);
+ if (r != OK) {
+ panic("dp_user2nic_s: sys_safecopyfrom failed: %d", r);
}
count -= bytes;
}
if (i == 100)
{
- panic("", "dp8390: remote dma failed to complete", NO_NUM);
+ panic("dp8390: remote dma failed to complete");
}
}
r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_grant, offset, bytes);
- if (r != OK)
- {
- panic(__FILE__,
- "dp_pio8_user2nic_s: sys_safe_outsb failed",
- r);
+ if (r != OK) {
+ panic("dp_pio8_user2nic_s: sys_safe_outsb failed: %d",
+ r);
}
count -= bytes;
offset += bytes;
}
if (i == 100)
{
- panic("", "dp8390: remote dma failed to complete", NO_NUM);
+ panic("dp8390: remote dma failed to complete");
}
}
{
r= sys_vircopy(user_proc, D, vir_user,
SELF, D, (vir_bytes)&two_bytes[1], 1);
- if (r != OK)
- {
- panic("DP8390",
- "dp_pio16_user2nic: sys_vircopy failed",
+ if (r != OK) {
+ panic("dp_pio16_user2nic: sys_vircopy failed: %d",
r);
}
outw(dep->de_data_port, *(u16_t *)two_bytes);
assert(bytes == 1);
r= sys_vircopy(user_proc, D, vir_user,
SELF, D, (vir_bytes)&two_bytes[0], 1);
- if (r != OK)
- {
- panic("DP8390",
- "dp_pio16_user2nic: sys_vircopy failed",
+ if (r != OK) {
+ panic("dp_pio16_user2nic: sys_vircopy failed: %d",
r);
}
count--;
}
if (i == 100)
{
- panic("", "dp8390: remote dma failed to complete", NO_NUM);
+ panic("dp8390: remote dma failed to complete");
}
}
{
r= sys_safecopyfrom(user_proc, gid, offset,
(vir_bytes)&two_bytes[1], 1, D);
- if (r != OK)
- {
- panic("DP8390",
- "dp_pio16_user2nic: sys_safecopyfrom failed",
- r);
+ if (r != OK) {
+ panic("dp_pio16_user2nic: sys_safecopyfrom failed: %d", r);
}
outw(dep->de_data_port, *(u16_t *)two_bytes);
count--;
{
r= sys_safe_outsw(dep->de_data_port, user_proc,
gid, offset, ecount);
- if (r != OK)
- {
- panic("DP8390",
- "dp_pio16_user2nic: sys_safe_outsw failed",
- r);
+ if (r != OK) {
+ panic("dp_pio16_user2nic: sys_safe_outsw failed: %d", r);
}
count -= ecount;
offset += ecount;
assert(bytes == 1);
r= sys_safecopyfrom(user_proc, gid, offset,
(vir_bytes)&two_bytes[0], 1, D);
- if (r != OK)
- {
- panic("DP8390",
- "dp_pio16_user2nic: sys_safecopyfrom failed",
- r);
+ if (r != OK) {
+ panic("dp_pio16_user2nic: sys_safecopyfrom failed: %d", r);
}
count--;
offset++;
}
if (i == 100)
{
- panic("", "dp8390: remote dma failed to complete", NO_NUM);
+ panic("dp8390: remote dma failed to complete");
}
}
iovp->iod_proc_nr, D,
iovp->iod_iovec[i].iov_addr + offset, bytes);
if (r != OK)
- panic("DP8390", "dp_nic2user: sys_vircopy failed", r);
+ panic("dp_nic2user: sys_vircopy failed: %d", r);
count -= bytes;
vir_hw += bytes;
iovp->iod_iovec[i].iov_grant, offset,
vir_hw, bytes, D);
if (r != OK)
- panic("DP8390",
- "dp_nic2user_s: sys_safecopyto failed", r);
+ panic("dp_nic2user_s: sys_safecopyto failed: %d", r);
count -= bytes;
vir_hw += bytes;
r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_grant, offset, bytes);
- if (r != OK)
- {
- panic(__FILE__,
- "dp_pio8_nic2user_s: sys_safe_insb failed", r);
+ if (r != OK) {
+ panic("dp_pio8_nic2user_s: sys_safe_insb failed: %d", r);
}
count -= bytes;
offset += bytes;
{
r= sys_vircopy(SELF, D, (vir_bytes)&two_bytes[1],
user_proc, D, vir_user, 1);
- if (r != OK)
- {
- panic("DP8390",
- "dp_pio16_nic2user: sys_vircopy failed",
+ if (r != OK) {
+ panic("dp_pio16_nic2user: sys_vircopy failed: %d",
r);
}
count--;
*(u16_t *)two_bytes= inw(dep->de_data_port);
r= sys_vircopy(SELF, D, (vir_bytes)&two_bytes[0],
user_proc, D, vir_user, 1);
- if (r != OK)
- {
- panic("DP8390",
- "dp_pio16_nic2user: sys_vircopy failed",
- r);
+ if (r != OK) {
+ panic("dp_pio16_nic2user: sys_vircopy failed: %d", r);
}
count--;
offset++;
{
r= sys_safecopyto(user_proc, gid, offset,
(vir_bytes)&two_bytes[1], 1, D);
- if (r != OK)
- {
- panic("DP8390",
- "dp_pio16_nic2user: sys_safecopyto failed",
- r);
+ if (r != OK) {
+ panic("dp_pio16_nic2user: sys_safecopyto failed: %d", r);
}
count--;
offset++;
{
r= sys_safe_insw(dep->de_data_port, user_proc, gid,
offset, ecount);
- if (r != OK)
- {
- panic("DP8390",
- "dp_pio16_nic2user: sys_safe_insw failed",
- r);
+ if (r != OK) {
+ panic("dp_pio16_nic2user: sys_safe_insw failed: %d",
+ r);
}
count -= ecount;
offset += ecount;
(vir_bytes)&two_bytes[0], 1, D);
if (r != OK)
{
- panic("DP8390",
- "dp_pio16_nic2user: sys_safecopyto failed",
+ panic("dp_pio16_nic2user: sys_safecopyto failed: %d",
r);
}
count--;
*/
buf= malloc(size);
if (buf == NULL)
- panic(__FILE__, "map_hw_buffer: cannot malloc size", size);
+ panic("map_hw_buffer: cannot malloc size: %d", size);
o= I386_PAGE_SIZE - ((vir_bytes)buf % I386_PAGE_SIZE);
abuf= buf + o;
printf("buf at 0x%x, abuf at 0x%x\n", buf, abuf);
r = ENOSYS;
#endif
if (r != OK)
- panic(__FILE__, "map_hw_buffer: sys_vm_map failed", r);
+ panic("map_hw_buffer: sys_vm_map failed: %d", r);
dep->de_locmem = abuf;
}
}
if (r < 0)
- panic("", "dp8390: send failed:", r);
+ panic("dp8390: send failed: %d", r);
dep->de_read_s = 0;
dep->de_flags &= ~(DEF_PACK_SEND | DEF_PACK_RECV);
message *reply_mess;
{
if (send(req->m_source, reply_mess) != OK)
- panic("", "dp8390: unable to mess_reply", NO_NUM);
+ panic("dp8390: unable to mess_reply");
}
/*===========================================================================*
r= sys_vircopy(user_proc, D, user_addr,
SELF, D, (vir_bytes)loc_addr, count);
if (r != OK)
- panic("DP8390", "get_userdata: sys_vircopy failed", r);
+ panic("get_userdata: sys_vircopy failed: %d", r);
}
/*===========================================================================*
r= sys_safecopyfrom(user_proc, grant, offset,
(vir_bytes)loc_addr, count, D);
if (r != OK)
- panic("DP8390", "get_userdata: sys_safecopyfrom failed", r);
+ panic("get_userdata: sys_safecopyfrom failed: %d", r);
}
/*===========================================================================*
r= sys_vircopy(SELF, D, (vir_bytes)loc_addr,
user_proc, D, user_addr, count);
if (r != OK)
- panic("DP8390", "put_userdata: sys_vircopy failed", r);
+ panic("put_userdata: sys_vircopy failed: %d", r);
}
/*===========================================================================*
r= sys_safecopyto(user_proc, grant, 0, (vir_bytes)loc_addr,
count, D);
if (r != OK)
- panic("DP8390", "put_userdata: sys_safecopyto failed", r);
+ panic("put_userdata: sys_safecopyto failed: %d", r);
}
u8_t inb(port_t port)
if (r != OK)
{
printf("inb failed for port 0x%x\n", port);
- panic("DP8390","sys_inb failed", r);
+ panic("sys_inb failed: %d", r);
}
return value;
}
r= sys_inw(port, &value);
if (r != OK)
- panic("DP8390", "sys_inw failed", r);
+ panic("sys_inw failed: %d", r);
return (u16_t) value;
}
r= sys_outb(port, value);
if (r != OK)
- panic("DP8390", "sys_outb failed", r);
+ panic("sys_outb failed: %d", r);
}
void outw(port_t port, u16_t value)
r= sys_outw(port, value);
if (r != OK)
- panic("DP8390", "sys_outw failed", r);
+ panic("sys_outw failed: %d", r);
}
static void insb(port_t port, void *buf, size_t size)
r= sys_insb(port, proc, (void *) buf, size);
if (r != OK)
- panic("DP8390", "sys_sdevio failed", r);
+ panic("sys_sdevio failed: %d", r);
}
static void do_vir_insw(port_t port, int proc, vir_bytes buf, size_t size)
r= sys_insw(port, proc, (void *) buf, size);
if (r != OK)
- panic("DP8390", "sys_sdevio failed", r);
+ panic("sys_sdevio failed: %d", r);
}
static void do_vir_outsb(port_t port, int proc, vir_bytes buf, size_t size)
r= sys_outsb(port, proc, (void *) buf, size);
if (r != OK)
- panic("DP8390", "sys_sdevio failed", r);
+ panic("sys_sdevio failed: %d", r);
}
static void do_vir_outsw(port_t port, int proc, vir_bytes buf, size_t size)
r= sys_outsw(port, proc, (void *) buf, size);
if (r != OK)
- panic("DP8390", "sys_sdevio failed", r);
+ panic("sys_sdevio failed: %d", r);
}
/*
continue;
if (pcitab[i].did != did)
continue;
- if (pcitab[i].checkclass)
- {
- panic("",
- "rtl_probe: class check not implemented",
- NO_NUM);
+ if (pcitab[i].checkclass) {
+ panic("rtl_probe: class check not implemented");
}
break;
}
bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0;
if (bar < 0x400)
- panic("", "base address is not properly configured", NO_NUM);
+ panic("base address is not properly configured");
dep->de_base_port= bar;
micro_delay(1);
}
if (!(inb_reg3(dep, 1) & 1))
- panic("", "set_ee_word: device remains busy", NO_NUM);
+ panic("set_ee_word: device remains busy");
}
static void ee_wds(dep)
txbuff->client = dep->de_client;
user2mem(dep, txbuff);
} else
- panic(dep->de_name, "out of memory for Tx", NO_NUM);
+ panic("out of memory for Tx");
} else if ((txbuff = dep->de_xmitq_head) != NULL) {
pktsize = txbuff->size;
} else
- panic(dep->de_name, "should not be sending ", NO_NUM);
+ panic("should not be sending ");
if ((dep->de_flags & DEF_XMIT_BUSY)) {
- if (from_int) panic(dep->de_name, "should not be sending ", NO_NUM);
+ if (from_int) panic("should not be sending ");
getuptime(&now);
if ((now - dep->de_xmit_start) > 4) {
/* Transmitter timed out */
/* Set interrupt level for 3c503 */
irq = (dep->de_irq &= ~DEI_DEFAULT); /* Strip the default flag. */
if (irq == 9) irq = 2;
- if (irq < 2 || irq > 5) panic(dep->de_name, "bad 3c503 irq configuration", irq);
+ if (irq < 2 || irq > 5) panic("bad 3c503 irq configuration: %d", irq);
outb_el2(dep, EL2_IDCFG, (0x04 << irq));
outb_el2(dep, EL2_DRQCNT, 0x08); /* Set burst size to 8 */
r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[ix].iov_grant, 0, bytes);
if (r != OK)
- panic(__FILE__, "el3_write_fifo: sys_safe_outsb failed", r);
+ panic("el3_write_fifo: sys_safe_outsb failed: %d", r);
if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */
dp_next_iovec(iovp);
AddrCfgReg = ((AddrCfgReg & EL3_CONFIG_IOBASE_MASK) << 4) + EL3_IO_BASE_ADDR;
if (AddrCfgReg != dep->de_base_port)
- panic(dep->de_name, "Bad I/O port for Etherlink board", NO_NUM);
+ panic("Bad I/O port for Etherlink board");
ResCfgReg >>= 12;
dep->de_irq &= NOT(DEI_DEFAULT); /* Strips the default flag */
- if (ResCfgReg != dep->de_irq) panic(dep->de_name, "Bad IRQ for Etherlink board", NO_NUM);
+ if (ResCfgReg != dep->de_irq) panic("Bad IRQ for Etherlink board");
SetWindow(WNO_Setup);
*/
static void mem_getblock(dpeth_t *dep, u16_t offset, int size, void *dst)
{
- panic(__FILE__, "mem_getblock: not converted to safecopies", NO_NUM);
+ panic("mem_getblock: not converted to safecopies");
#if 0
sys_nic2mem(dep->de_linmem + offset, SELF, dst, size);
return;
iovec_dat_s_t *iovp = &dep->de_read_iovec;
int bytes, ix = 0;
- panic(__FILE__, "mem_nic2user: not converted to safecopies", NO_NUM);
+ panic("mem_nic2user: not converted to safecopies");
#if 0
/* Computes shared memory address (skipping receive header) */
iovec_dat_s_t *iovp = &dep->de_write_iovec;
int bytes, ix = 0;
- panic(__FILE__, "mem_user2nic: not converted to safecopies", NO_NUM);
+ panic("mem_user2nic: not converted to safecopies");
#if 0
/* Computes shared memory address */
bytes = dep->de_stoppage * DP_PAGESIZE - offset;
r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[ix].iov_grant, iov_offset, bytes);
- if (r != OK)
- {
- panic(__FILE__, "pio_nic2user: sys_safe_insb failed",
- r);
+ if (r != OK) {
+ panic("pio_nic2user: sys_safe_insb failed: %d", r);
}
pktsize -= bytes;
iov_offset += bytes;
r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[ix].iov_grant, iov_offset, bytes);
if (r != OK)
- panic(__FILE__, "pio_nic2user: sys_safe_insb failed", r);
+ panic("pio_nic2user: sys_safe_insb failed: %d", r);
offset += bytes;
if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */
r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[ix].iov_grant, 0, bytes);
if (r != OK)
- panic(__FILE__, "pio_user2nic: sys_safe_outsb failed", r);
+ panic("pio_user2nic: sys_safe_outsb failed: %d", r);
if (++ix >= IOVEC_NR) { /* Next buffer of I/O vector */
dp_next_iovec(iovp);
if (inb_reg0(dep, DP_ISR) & ISR_RDC) break;
}
if (ix == 100) {
- panic(dep->de_name, RdmaErrMsg, NO_NUM);
+ panic(RdmaErrMsg);
}
return;
}
int queue;
if (queue = dep->de_sendq_head, dep->de_sendq[queue].sq_filled) {
- if (from_int) panic(dep->de_name, "should not be sending ", NO_NUM);
+ if (from_int) panic("should not be sending ");
dep->de_send_s = size;
return;
}
if (bytes > pktsize) bytes = pktsize;
phys_user = numap(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_addr, bytes);
- if (!phys_user) panic(dep->de_name, UmapErrMsg, NO_NUM);
+ if (!phys_user) panic(UmapErrMsg);
if (odd_byte) {
phys_copy(phys_user, phys_2bytes + 1, (phys_bytes) 1);
if (inb_reg0(dep, DP_ISR) & ISR_RDC) break;
}
if (ix == 100) {
- panic(dep->de_name, RdmaErrMsg, NO_NUM);
+ panic(RdmaErrMsg);
}
return;
}
phys_user = numap(iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_addr, bytes);
- if (!phys_user) panic(dep->de_name, UmapErrMsg, NO_NUM);
+ if (!phys_user) panic(UmapErrMsg);
if (odd_byte) {
phys_copy(phys_2bytes + 1, phys_user, (phys_bytes) 1);
count--;
dep->de_flags &= NOT(DEF_ACK_SEND | DEF_ACK_RECV);
} else if (status != ELOCKED || err == OK)
- panic(dep->de_name, SendErrMsg, status);
+ panic(SendErrMsg, status);
return;
}
len = (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_t);
if ((rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len, D)) != OK)
- panic(DevName, CopyErrMsg, rc);
+ panic(CopyErrMsg, rc);
return;
}
reply_mess.m3_i2 = DE_PORT_NR;
DEBUG(printf("\t reply %d\n", reply_mess.m_type));
if (send(mp->m_source, &reply_mess) != OK) /* Can't send */
- panic(portname, SendErrMsg, mp->m_source);
+ panic(SendErrMsg, mp->m_source);
return;
}
port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */
- panic(__FILE__, PortErrMsg, EINVAL);
+ panic(PortErrMsg, EINVAL);
dep = &de_table[port];
dep->de_client = mp->DL_PROC;
if (dep->de_mode == DEM_ENABLED) {
if (dep->de_flags & DEF_SENDING) /* Is sending in progress? */
- panic(dep->de_name, "send already in progress ", NO_NUM);
+ panic("send already in progress ");
dep->de_write_iovec.iod_proc_nr = mp->DL_PROC;
get_userdata_s(mp->DL_PROC, mp->DL_GRANT, 0,
dep->de_write_iovec.iod_iovec_offset = 0;
size = calc_iovec_size(&dep->de_write_iovec);
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE)
- panic(dep->de_name, SizeErrMsg, size);
+ panic(SizeErrMsg, size);
dep->de_flags |= DEF_SENDING;
(*dep->de_sendf) (dep, FALSE, size);
port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */
- panic(__FILE__, PortErrMsg, EINVAL);
+ panic(PortErrMsg, EINVAL);
dep = &de_table[port];
dep->de_client = mp->DL_PROC;
if (dep->de_mode == DEM_ENABLED) {
if (dep->de_flags & DEF_READING) /* Reading in progress */
- panic(dep->de_name, "read already in progress", NO_NUM);
+ panic("read already in progress");
dep->de_read_iovec.iod_proc_nr = mp->DL_PROC;
get_userdata_s(mp->DL_PROC, (cp_grant_id_t) mp->DL_GRANT, 0,
dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
dep->de_read_iovec.iod_iovec_offset = 0;
size = calc_iovec_size(&dep->de_read_iovec);
- if (size < ETH_MAX_PACK_SIZE) panic(dep->de_name, SizeErrMsg, size);
+ if (size < ETH_MAX_PACK_SIZE) panic(SizeErrMsg, size);
dep->de_flags |= DEF_READING;
(*dep->de_recvf) (dep, FALSE, size);
port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */
- panic(__FILE__, PortErrMsg, EINVAL);
+ panic(PortErrMsg, EINVAL);
dep = &de_table[port];
dep->de_client = mp->DL_PROC;
if ((rc = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0,
(vir_bytes)&dep->de_stat,
(vir_bytes) sizeof(dep->de_stat), 0)) != OK)
- panic(DevName, CopyErrMsg, rc);
+ panic(CopyErrMsg, rc);
reply(dep, OK, DL_STAT_REPLY);
return;
}
mp->m_type= DL_NAME_REPLY;
r= send(mp->m_source, mp);
if (r != OK)
- panic("dpeth", "do_getname: send failed: %d\n", r);
+ panic("do_getname: send failed: %d", r);
}
/*
port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */
- panic(__FILE__, PortErrMsg, EINVAL);
+ panic(PortErrMsg, EINVAL);
dep = &de_table[port];
if (dep->de_mode == DEM_ENABLED && (dep->de_flags & DEF_ENABLED)) {
while (TRUE) {
if ((rc = sef_receive(ANY, &m)) != OK){
- panic(__FILE__, RecvErrMsg, rc);
+ panic(RecvErrMsg, rc);
}
DEBUG(printf("eth: got message %d, ", m.m_type));
break;
default:
/* Invalid message type */
- panic(DevName, TypeErrMsg, m.m_type);
+ panic(TypeErrMsg, m.m_type);
break;
}
/* message processed, get another one */
do_stop(&m);
break;
default: /* Invalid message type */
- panic(DevName, TypeErrMsg, m.m_type);
+ panic(TypeErrMsg, m.m_type);
break;
}
}
r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0,
(vir_bytes)buffer, bytes, D);
if (r != OK)
- panic(__FILE__, "mem2user: sys_safecopyto failed", r);
+ panic("mem2user: sys_safecopyto failed: %d", r);
buffer += bytes;
if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */
r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant,
0, (vir_bytes)buffer, bytes, D);
if (r != OK)
- panic(__FILE__, "user2mem: sys_safecopyfrom failed", r);
+ panic("user2mem: sys_safecopyfrom failed: %d", r);
buffer += bytes;
if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */
{
if ((r= sef_receive(ANY, &m)) != OK)
{
- panic("e1000", "sef_receive failed", r);
+ panic("sef_receive failed: %d", r);
}
if (is_notify(m.m_type))
{
case DL_GETSTAT_S: e1000_getstat_s(&m); break;
case DL_GETNAME: e1000_getname(&m); break;
default:
- panic("e1000", "illegal message", m.m_type);
+ panic("illegal message: %d", m.m_type);
}
}
}
/* Verify command-line arguments. */
if (env_argc < 1)
{
- panic("e1000", "no program name given in argc/argv", NO_NUM);
+ panic("no program name given in argc/argv");
}
else
(progname = strrchr(env_argv[0],'/')) ? progname++
/* Perform calibration. */
if((r = tsc_calibrate()) != OK)
{
- panic("e1000", "tsc_calibrate failed", r);
+ panic("tsc_calibrate failed: %d", r);
}
/* Try to notify inet that we are present (again) */
if ((r = ds_retrieve_label_num("inet", &tasknr)) == OK)
/* Reserve PCI resources found. */
if ((r = pci_reserve_ok(devind)) != OK)
{
- panic("e1000", "failed to reserve PCI device", r);
+ panic("failed to reserve PCI device: %d", r);
}
/* Read PCI configuration. */
e->irq = pci_attr_r8(devind, PCI_ILR);
0x20000);
/* Verify mapped registers. */
- if (e->regs == (u8_t *) -1)
- {
- panic("e1000", "failed to map hardware registers from PCI\n",
- NO_NUM);
+ if (e->regs == (u8_t *) -1) {
+ panic("failed to map hardware registers from PCI");
}
/* Optionally map flash memory. */
if (pci_attr_r32(devind, PCI_BAR_3))
*/
if ((r = sys_irqsetpolicy(e->irq, 0, &e->irq_hook)) != OK)
{
- panic(e->name, "sys_irqsetpolicy failed", r);
+ panic("sys_irqsetpolicy failed: %d", r);
}
if ((r = sys_irqenable(&e->irq_hook)) != OK)
{
- panic(e->name, "sys_irqenable failed", r);
+ panic("sys_irqenable failed: %d", r);
}
/* Reset hardware. */
e1000_reset_hw(e);
{
if ((e->rx_desc = alloc_contig(sizeof(e1000_rx_desc_t) *
e->rx_desc_count, AC_ALIGN4K,
- &rx_desc_p)) == NULL)
- {
- panic(e->name, "failed to allocate RX descriptors",
- NO_NUM);
+ &rx_desc_p)) == NULL) {
+ panic("failed to allocate RX descriptors");
}
memset(e->rx_desc, 0, sizeof(e1000_rx_desc_t) * e->rx_desc_count);
if ((e->rx_buffer = alloc_contig(e->rx_buffer_size,
AC_ALIGN4K, &rx_buff_p)) == NULL)
{
- panic(e->name, "failed to allocate RX buffers", NO_NUM);
+ panic("failed to allocate RX buffers");
}
/* Setup receive descriptors. */
for (i = 0; i < E1000_RXDESC_NR; i++)
{
if ((e->tx_desc = alloc_contig(sizeof(e1000_tx_desc_t) *
e->tx_desc_count, AC_ALIGN4K,
- &tx_desc_p)) == NULL)
- {
- panic(e->name, "failed to allocate TX descriptors",
- NO_NUM);
+ &tx_desc_p)) == NULL) {
+ panic("failed to allocate TX descriptors");
}
memset(e->tx_desc, 0, sizeof(e1000_tx_desc_t) * e->tx_desc_count);
if ((e->tx_buffer = alloc_contig(e->tx_buffer_size,
AC_ALIGN4K, &tx_buff_p)) == NULL)
{
- panic(e->name, "failed to allocate TX buffers", NO_NUM);
+ panic("failed to allocate TX buffers");
}
/* Setup transmit descriptors. */
for (i = 0; i < E1000_RXDESC_NR; i++)
(vir_bytes) iovec, e->tx_message.DL_COUNT *
sizeof(iovec_s_t), D)) != OK)
{
- panic(e->name, "sys_safecopyfrom() failed", r);
+ panic("sys_safecopyfrom() failed: %d", r);
}
/* Find the head, tail and current descriptors. */
head = e1000_reg_read(e, E1000_REG_TDH);
(tail * E1000_IOBUF_SIZE),
size, D)) != OK)
{
- panic(e->name, "sys_safecopyfrom() failed", r);
+ panic("sys_safecopyfrom() failed: %d", r);
}
/* Mark this descriptor ready. */
desc->status = 0;
(vir_bytes) iovec, e->rx_message.DL_COUNT *
sizeof(iovec_s_t), D)) != OK)
{
- panic(e->name, "sys_safecopyfrom() failed", r);
+ panic("sys_safecopyfrom() failed: %d", r);
}
/* Find the head, tail and current descriptors. */
head = e1000_reg_read(e, E1000_REG_RDH);
(cur * E1000_IOBUF_SIZE),
size, D)) != OK)
{
- panic(e->name, "sys_safecopyto() failed", r);
+ panic("sys_safecopyto() failed: %d", r);
}
bytes += size;
}
mp->DL_PORT = mp->DL_PORT;
mp->DL_STAT = OK;
if((r=send(mp->m_source, mp)) != OK)
- panic("e1000", "e1000_getstat: send() failed", r);
+ panic("e1000_getstat: send() failed: %d", r);
}
/*===========================================================================*
mp->m_type = DL_NAME_REPLY;
if ((r = send(mp->m_source, mp)) != OK)
{
- panic("e1000", "e1000_getname: send() failed", r);
+ panic("e1000_getname: send() failed: %d", r);
}
}
/* Re-enable interrupts. */
if (sys_irqenable(&e->irq_hook) != OK)
{
- panic("e1000", "failed to re-enable IRQ", NO_NUM);
+ panic("failed to re-enable IRQ");
}
/* Read the Interrupt Cause Read register. */
*/
if (num < 0 || num >= E1000_PORT_NR)
{
- panic("e1000", "invalid port number given", num);
+ panic("invalid port number given: %d", num);
}
/*
*/
if (!(e1000_table[num].status & E1000_DETECTED))
{
- panic("e1000", "inactive port number given", num);
+ panic("inactive port number given: %d", num);
}
return &e1000_table[num];
}
/* Acknowledge to INET. */
if ((r = send(e->client, &msg)) != OK)
{
- panic("e1000", "send() failed", r);
+ panic("send() failed: %d", r);
}
}
{
if (send(req->m_source, reply_mess) != OK)
{
- panic("e1000", "unable to send reply message", NO_NUM);
+ panic("unable to send reply message");
}
}
gid = cpf_grant_direct(driver[which].endpt,
(vir_bytes) &part, sizeof(part), CPF_WRITE);
if(!GRANT_VALID(gid))
- panic(__FILE__, "invalid grant", gid);
+ panic("invalid grant: %d", gid);
msg.m_type = DEV_IOCTL_S;
msg.REQUEST = DIOCGETP;
check_driver(DRIVER_MAIN);
}
else if (driver_open(DRIVER_MAIN) != OK) {
- panic(__FILE__, "unhandled driver_open failure", NO_NUM);
+ panic("unhandled driver_open failure");
}
if(USE_MIRROR) {
if(!strcmp(driver[DRIVER_MAIN].label,
driver[DRIVER_BACKUP].label)) {
- panic(__FILE__, "same driver: not tested", NO_NUM);
+ panic("same driver: not tested");
}
r = ds_retrieve_label_num(driver[DRIVER_BACKUP].label,
check_driver(DRIVER_BACKUP);
}
else if (driver_open(DRIVER_BACKUP) != OK) {
- panic(__FILE__, "unhandled driver_open failure",
- NO_NUM);
+ panic("unhandled driver_open failure");
}
}
}
break;
default:
- panic(__FILE__, "invalid problem", problem);
+ panic("invalid problem: %d", problem);
}
/* At this point, the driver will be restarted. */
r = sendrec(RS_PROC_NR, &msg);
if (r != OK || msg.m_type != OK)
- panic(__FILE__, "RS request failed", r);
+ panic("RS request failed: %d", r);
#if DEBUG
printf("Filter: RS call succeeded\n");
r = senda(amsgtable, 2);
if(r != OK)
- panic(__FILE__, "senda returned error", r);
+ panic("senda returned error: %d", r);
return r;
}
for (;;) {
r = sef_receive(ANY, mess);
if(r != OK)
- panic(__FILE__, "sef_receive returned error", r);
+ panic("sef_receive returned error: %d", r);
if(mess->m_source == CLOCK && is_notify(mess->m_type)) {
if (mess->NOTIFY_TIMESTAMP < flt_alarm(-1)) {
} else if (ma.m_source == driver[DRIVER_BACKUP].endpt) {
which = DRIVER_MAIN;
} else {
- panic(__FILE__, "message from unexpected source",
+ panic("message from unexpected source: %d",
ma.m_source);
}
grant = cpf_grant_direct(endpt, buf, chunk, access);
if (!GRANT_VALID(grant))
- panic(__FILE__, "invalid grant", grant);
+ panic("invalid grant: %d", grant);
vector[count].iov_grant = grant;
vector[count].iov_size = chunk;
sizeof(vector[0]) * count, CPF_READ | CPF_WRITE);
if (!GRANT_VALID(*gid))
- panic(__FILE__, "invalid grant", *gid);
+ panic("invalid grant: %d", *gid);
return count;
}
grants = m_in.COUNT;
if((r = sys_safecopyfrom(who_e, grant_id, 0, (vir_bytes) iov_proc,
grants * sizeof(iovec_t), D)) != OK) {
- panic(__FILE__, "copying in grant vector failed", r);
+ panic("copying in grant vector failed: %d", r);
}
pos = make64(m_in.POSITION, m_in.HIGHPOS);
/* Copy the caller's grant-table back. */
if((r = sys_safecopyto(who_e, grant_id, 0, (vir_bytes) iov_proc,
grants * sizeof(iovec_t), D)) != OK) {
- panic(__FILE__, "copying out grant vector failed", r);
+ panic("copying out grant vector failed: %d", r);
}
flt_free(buffer, size, buf_array);
for (;;) {
/* Wait for request. */
if(sef_receive(ANY, &m_in) != OK) {
- panic(__FILE__, "sef_receive failed", NO_NUM);
+ panic("sef_receive failed");
}
#if DEBUG2
}
if ((buf_array = flt_malloc(BUF_SIZE, NULL, 0)) == NULL)
- panic(__FILE__, "no memory available", NO_NUM);
+ panic("no memory available");
sum_init();
rb1_array = flt_malloc(SBUF_SIZE, NULL, 0);
if (ext_array == NULL || rb0_array == NULL || rb1_array == NULL)
- panic(__FILE__, "no memory available", NO_NUM);
+ panic("no memory available");
}
/*===========================================================================*
break;
default:
- panic(__FILE__, "invalid checksum type", SUM_TYPE);
+ panic("invalid checksum type: %d", SUM_TYPE);
}
}
size = sectors_left * SECTOR_SIZE;
if (group_left != NR_SUM_SEC - sector_in_group)
- panic(__FILE__, "group_left assertion", 0);
+ panic("group_left assertion: %d", 0);
gap = group_left - sectors_left;
if (gap <= 0)
- panic(__FILE__, "gap assertion", 0);
+ panic("gap assertion: %d", 0);
if ((r = read_sectors(extp + size,
LOG2PHYS(current_sector) + sectors_left,
return sbuf;
if(!(p = alloc_contig(size, 0, NULL)))
- panic(__FILE__, "out of memory", size);
+ panic("out of memory: %d", size);
return p;
}
r = sys_setalarm(dt, 0);
if(r != OK)
- panic(__FILE__, "sys_setalarm failed", r);
+ panic("sys_setalarm failed: %d", r);
if(dt == 0) {
if(!next_alarm)
- panic(__FILE__, "clearing unset alarm", r);
+ panic("clearing unset alarm: %d", r);
next_alarm = 0;
} else {
if(next_alarm)
- panic(__FILE__, "overwriting alarm", r);
+ panic("overwriting alarm: %d", r);
if ((r = getuptime(&next_alarm)) != OK)
- panic(__FILE__, "getuptime failed", r);
+ panic("getuptime failed: %d", r);
next_alarm += dt;
}
if(!(floppy_buf = alloc_contig(2*DMA_BUF_SIZE,
AC_LOWER16M | AC_ALIGN4K, &floppy_buf_phys)))
- panic("FLOPPY", "couldn't allocate dma buffer", NO_NUM);
+ panic("couldn't allocate dma buffer");
f_next_timeout = TMR_NEVER;
tmr_inittimer(&f_tmr_timeout);
*/
irq_hook_id = FLOPPY_IRQ;
if ((s=sys_irqsetpolicy(FLOPPY_IRQ, 0, &irq_hook_id )) != OK)
- panic("FLOPPY", "Couldn't set IRQ policy", s);
+ panic("Couldn't set IRQ policy: %d", s);
if ((s=sys_irqenable(&irq_hook_id)) != OK)
- panic("FLOPPY", "Couldn't enable IRQs", s);
+ panic("Couldn't enable IRQs: %d", s);
/* Ignore signals */
signal(SIGHUP, SIG_IGN);
/* Get the current time to compare the timers against. */
if ((s=getuptime(&now)) != OK)
- panic("FLOPPY","Couldn't get uptime from clock.", s);
+ panic("Couldn't get uptime from clock: %d", s);
/* Scan the timers queue for expired timers. Dispatch the watchdog function
* for each expired timers. FLOPPY watchdog functions are f_tmr_timeout()
} else { /* set new sync alarm */
f_next_timeout = f_timers->tmr_exp_time;
if ((s=sys_setalarm(f_next_timeout, 1)) != OK)
- panic("FLOPPY","Couldn't set synchronous alarm.", s);
+ panic("Couldn't set synchronous alarm: %d", s);
}
}
/* Get the current time. */
if ((s=getuptime(&now)) != OK)
- panic("FLOPPY","Couldn't get uptime from clock.", s);
+ panic("Couldn't get uptime from clock: %d", s);
/* Add the timer to the local timer queue. */
tmrs_settimer(&f_timers, tp, now + delta, watchdog, NULL);
if (f_timers->tmr_exp_time != f_next_timeout) {
f_next_timeout = f_timers->tmr_exp_time;
if ((s=sys_setalarm(f_next_timeout, 1)) != OK)
- panic("FLOPPY","Couldn't set synchronous alarm.", s);
+ panic("Couldn't set synchronous alarm: %d", s);
}
}
SECTOR_SIZE + iov_offset, (vir_bytes) &fmt_param,
(phys_bytes) sizeof(fmt_param), D);
if(s != OK)
- panic("FLOPPY", "sys_safecopyfrom failed", s);
+ panic("sys_safecopyfrom failed: %d", s);
} else {
memcpy(&fmt_param, (void *) (iov->iov_addr +
SECTOR_SIZE + iov_offset),
cmd[2] = SPEC2;
(void) fdc_command(cmd, 3);
if ((s=sys_outb(FDC_RATE, f_dp->rate)) != OK)
- panic("FLOPPY","Sys_outb failed", s);
+ panic("Sys_outb failed: %d", s);
prev_dp = f_dp;
}
(vir_bytes) floppy_buf,
(phys_bytes) SECTOR_SIZE, D);
if(s != OK)
- panic("FLOPPY", "sys_safecopyfrom failed", s);
+ panic("sys_safecopyfrom failed: %d", s);
} else {
memcpy(floppy_buf, (void *) (*ug + *up), SECTOR_SIZE);
}
(vir_bytes) floppy_buf,
(phys_bytes) SECTOR_SIZE, D);
if(s != OK)
- panic("FLOPPY", "sys_safecopyto failed", s);
+ panic("sys_safecopyto failed: %d", s);
} else {
memcpy((void *) (*ug + *up), floppy_buf, SECTOR_SIZE);
}
/* First check the DMA memory address not to exceed maximum. */
if (floppy_buf_phys != (floppy_buf_phys & DMA_ADDR_MASK)) {
- report("FLOPPY", "DMA denied because address out of range", NO_NUM);
+ printf("floppy: DMA denied because address out of range");
return(EIO);
}
pv_set(byte_out[8], DMA_INIT, 2); /* some sort of enable */
if ((s=sys_voutb(byte_out, 9)) != OK)
- panic("FLOPPY","Sys_voutb in dma_setup() failed", s);
+ panic("Sys_voutb in dma_setup() failed: %d", s);
return(OK);
}
if ((s=sys_outb(DOR,
(motor_status << MOTOR_SHIFT) | ENABLE_INT | f_drive)) != OK)
- panic("FLOPPY","Sys_outb in start_motor() failed", s);
+ panic("Sys_outb in start_motor() failed: %d", s);
/* If the motor was already running, we don't have to wait for it. */
if (running) return; /* motor was already running */
int s;
motor_status &= ~(1 << tmr_arg(tp)->ta_int);
if ((s=sys_outb(DOR, (motor_status << MOTOR_SHIFT) | ENABLE_INT)) != OK)
- panic("FLOPPY","Sys_outb in stop_motor() failed", s);
+ panic("Sys_outb in stop_motor() failed: %d", s);
}
/*===========================================================================*
int s;
if (sigismember(set, SIGTERM)) {
if ((s=sys_outb(DOR, ENABLE_INT)) != OK)
- panic("FLOPPY","Sys_outb in floppy_stop() failed", s);
+ panic("Sys_outb in floppy_stop() failed: %d", s);
exit(0);
}
}
* the perfection of the mirror.
*/
if ((s=sys_inb(FDC_STATUS, &status)) != OK)
- panic("FLOPPY","Sys_inb in fdc_results() failed", s);
+ panic("Sys_inb in fdc_results() failed: %d", s);
status &= (MASTER | DIRECTION | CTL_BUSY);
if (status == (MASTER | DIRECTION | CTL_BUSY)) {
unsigned long tmp_r;
if (result_nr >= MAX_RESULTS) break; /* too many results */
if ((s=sys_inb(FDC_DATA, &tmp_r)) != OK)
- panic("FLOPPY","Sys_inb in fdc_results() failed", s);
+ panic("Sys_inb in fdc_results() failed: %d", s);
f_results[result_nr] = tmp_r;
result_nr ++;
continue;
}
if (status == MASTER) { /* all read */
if ((s=sys_irqenable(&irq_hook_id)) != OK)
- panic("FLOPPY", "Couldn't enable IRQs", s);
+ panic("Couldn't enable IRQs: %d", s);
return(OK); /* only good exit */
}
need_reset = TRUE; /* controller chip must be reset */
if ((s=sys_irqenable(&irq_hook_id)) != OK)
- panic("FLOPPY", "Couldn't enable IRQs", s);
+ panic("Couldn't enable IRQs: %d", s);
return(ERR_STATUS);
}
return;
}
if ((s=sys_inb(FDC_STATUS, &status)) != OK)
- panic("FLOPPY","Sys_inb in fdc_out() failed", s);
+ panic("Sys_inb in fdc_out() failed: %d", s);
}
while ((status & (MASTER | DIRECTION)) != (MASTER | 0));
if ((s=sys_outb(FDC_DATA, val)) != OK)
- panic("FLOPPY","Sys_outb in fdc_out() failed", s);
+ panic("Sys_outb in fdc_out() failed: %d", s);
}
/*===========================================================================*
pv_set(byte_out[0], DOR, 0); /* strobe reset bit low */
pv_set(byte_out[1], DOR, ENABLE_INT); /* strobe it high again */
if ((s=sys_voutb(byte_out, 2)) != OK)
- panic("FLOPPY", "Sys_voutb in f_reset() failed", s);
+ panic("Sys_voutb in f_reset() failed: %d", s);
/* A synchronous alarm timer was set in fdc_command. Expect an interrupt,
* but be prepared to handle a timeout.
r= sys_irqenable(&fp->fxp_hook);
if (r != OK) {
- panic("FXP", "unable enable interrupts", r);
+ panic("unable enable interrupts: %d", r);
}
if (!fp->fxp_got_int)
while (TRUE)
{
if ((r= sef_receive(ANY, &m)) != OK)
- panic("FXP","sef_receive failed", r);
+ panic("sef_receive failed: %d", r);
if (is_notify(m.m_type)) {
switch (_ENDPOINT_P(m.m_source)) {
fxp_expire_timers();
break;
default:
- panic("FXP"," illegal notify from", m.m_source);
+ panic(" illegal notify from: %d", m.m_source);
}
/* get new message */
case DL_GETSTAT_S: fxp_getstat_s(&m); break;
case DL_GETNAME: fxp_getname(&m); break;
default:
- panic("FXP"," illegal message", m.m_type);
+ panic(" illegal message: %d", m.m_type);
}
}
}
system_hz = sys_hz();
if (env_argc < 1)
- panic("FXP", "A head which at this time has no name", NO_NUM);
+ panic("A head which at this time has no name");
(progname=strrchr(env_argv[0],'/')) ? progname++
: (progname=env_argv[0]);
eth_ign_proto= htons((u16_t) v);
if(!(fxp_table = alloc_contig(ft, 0, &fxp_table_phys)))
- panic("FXP","couldn't allocate table", ENOMEM);
+ panic("couldn't allocate table: %d", ENOMEM);
memset(fxp_table, 0, ft);
if((r=tsc_calibrate()) != OK)
- panic("FXP","tsc_calibrate failed", r);
+ panic("tsc_calibrate failed: %d", r);
/* Try to notify inet that we are present (again) */
r= ds_retrieve_label_num("inet", &tasknr);
continue;
if (pcitab_fxp[i].did != did)
continue;
- if (pcitab_fxp[i].checkclass)
- {
- panic("FXP","fxp_probe: class check not implemented",
- NO_NUM);
+ if (pcitab_fxp[i].checkclass) {
+ panic("fxp_probe: class check not implemented");
}
break;
}
pci_reserve(devind);
bar= pci_attr_r32(devind, PCI_BAR_2) & 0xffffffe0;
- if (bar < 0x400)
- {
- panic("FXP","fxp_probe: base address is not properly configured",
- NO_NUM);
+ if (bar < 0x400) {
+ panic("fxp_probe: base address is not properly configured");
}
fp->fxp_base_port= bar;
}
break;
default:
- panic("FXP","fxp_conf_hw: bad device type", fp->fxp_type);
+ panic("fxp_conf_hw: bad device type: %d", fp->fxp_type);
}
#if VERBOSE
fp->fxp_hook = fp->fxp_irq;
r= sys_irqsetpolicy(fp->fxp_irq, 0, &fp->fxp_hook);
if (r != OK)
- panic("FXP","sys_irqsetpolicy failed", r);
+ panic("sys_irqsetpolicy failed: %d", r);
fxp_reset_hw(fp);
r= sys_irqenable(&fp->fxp_hook);
if (r != OK)
- panic("FXP","sys_irqenable failed", r);
+ panic("sys_irqenable failed: %d", r);
/* Reset PHY? */
r= sys_umap(SELF, VM_D, (vir_bytes)&fp->fxp_stat, sizeof(fp->fxp_stat),
&bus_addr);
if (r != OK)
- panic("FXP","sys_umap failed", r);
+ panic("sys_umap failed: %d", r);
fxp_cu_ptr_cmd(fp, SC_CU_LOAD_DCA, bus_addr, TRUE /* check idle */);
/* Ack previous interrupts */
tot_bufsize += 4096 - (tot_bufsize % 4096);
alloc_bufsize= tot_bufsize;
alloc_buf= alloc_contig(alloc_bufsize, AC_ALIGN4K, &ph);
- if (alloc_buf == NULL)
- {
- panic(__FILE__, "fxp_init_buf: unable to alloc_contig size",
- alloc_bufsize);
+ if (alloc_buf == NULL) {
+ panic("fxp_init_buf: unable to alloc_contig size: %d", alloc_bufsize);
}
buf= (phys_bytes)alloc_buf;
r= sys_umap(SELF, VM_D, (vir_bytes)fp->fxp_rx_buf, rx_totbufsize,
&fp->fxp_rx_busaddr);
if (r != OK)
- panic("FXP","sys_umap failed", r);
+ panic("sys_umap failed: %d", r);
#if 0
printf("fxp_init_buf: got phys 0x%x for vir 0x%x\n",
r= sys_umap(SELF, VM_D, (vir_bytes)&rfdp[1],
sizeof(rfdp[1]), &rfdp->rfd_linkaddr);
if (r != OK)
- panic("FXP","sys_umap failed", r);
+ panic("sys_umap failed: %d", r);
}
else
{
r= sys_umap(SELF, VM_D, (vir_bytes)fp->fxp_tx_buf,
(phys_bytes)tx_totbufsize, &fp->fxp_tx_busaddr);
if (r != OK)
- panic("FXP","sys_umap failed", r);
+ panic("sys_umap failed: %d", r);
for (i= 0, txp= fp->fxp_tx_buf; i<fp->fxp_tx_nbuf; i++, txp++)
{
(phys_bytes)sizeof(txp[1]),
&txp->tx_linkaddr);
if (r != OK)
- panic("FXP","sys_umap failed", r);
+ panic("sys_umap failed: %d", r);
}
else
{
r= sys_umap(SELF, VM_D, (vir_bytes)&tmpbufp->ias,
(phys_bytes)sizeof(tmpbufp->ias), &bus_addr);
if (r != OK)
- panic("FXP","sys_umap failed", r);
+ panic("sys_umap failed: %d", r);
fxp_cu_ptr_cmd(fp, SC_CU_START, bus_addr, TRUE /* check idle */);
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000));
if (!(tmpbufp->ias.ias_status & CBL_F_C))
- panic("FXP","fxp_confaddr: CU command failed to complete", NO_NUM);
+ panic("fxp_confaddr: CU command failed to complete");
if (!(tmpbufp->ias.ias_status & CBL_F_OK))
- panic("FXP","fxp_confaddr: CU command failed", NO_NUM);
+ panic("fxp_confaddr: CU command failed");
#if VERBOSE
printf("%s: hardware ethernet address: ", fp->fxp_name);
dl_port = mp->DL_PORT;
count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR)
- panic("FXP","fxp_writev: illegal port", dl_port);
+ panic("fxp_writev: illegal port: %d", dl_port);
fp= &fxp_table[dl_port];
fxp_client= mp->DL_PROC;
fp->fxp_client= fxp_client;
SELF, D, (vir_bytes)fp->fxp_iovec,
n * sizeof(fp->fxp_iovec[0]));
if (r != OK)
- panic("FXP","fxp_writev: sys_vircopy failed", r);
+ panic("fxp_writev: sys_vircopy failed: %d", r);
for (j= 0, iovp= fp->fxp_iovec; j<n; j++, iovp++)
{
s= iovp->iov_size;
- if (size + s > ETH_MAX_PACK_SIZE_TAGGED)
- {
- panic("FXP","fxp_writev: invalid packet size",
- NO_NUM);
+ if (size + s > ETH_MAX_PACK_SIZE_TAGGED) {
+ panic("fxp_writev: invalid packet size");
}
r= sys_vircopy(fxp_client, D, iovp->iov_addr,
SELF, D, (vir_bytes)(txp->tx_buf+o),
s);
- if (r != OK)
- {
- panic("FXP","fxp_writev: sys_vircopy failed",
- r);
+ if (r != OK) {
+ panic("fxp_writev: sys_vircopy failed: %d", r);
}
size += s;
o += s;
}
}
if (size < ETH_MIN_PACK_SIZE)
- panic("FXP","fxp_writev: invalid packet size", size);
+ panic("fxp_writev: invalid packet size: %d", size);
}
else
{
size= mp->DL_COUNT;
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
- panic("FXP","fxp_writev: invalid packet size", size);
+ panic("fxp_writev: invalid packet size: %d", size);
r= sys_vircopy(fxp_client, D, (vir_bytes)mp->DL_ADDR,
SELF, D, (vir_bytes)txp->tx_buf, size);
if (r != OK)
- panic("FXP","fxp_writev: sys_vircopy failed", r);
+ panic("fxp_writev: sys_vircopy failed: %d", r);
}
txp->tx_status= 0;
suspend:
if (from_int)
- panic("FXP","fxp: should not be sending\n", NO_NUM);
+ panic("fxp: should not be sending");
fp->fxp_tx_mess= *mp;
reply(fp, OK, FALSE);
dl_port = mp->DL_PORT;
count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR)
- panic("FXP","fxp_writev: illegal port", dl_port);
+ panic("fxp_writev: illegal port: %d", dl_port);
fp= &fxp_table[dl_port];
fxp_client= mp->DL_PROC;
fp->fxp_client= fxp_client;
(vir_bytes)fp->fxp_iovec_s,
n * sizeof(fp->fxp_iovec_s[0]), D);
if (r != OK)
- panic("FXP","fxp_writev: sys_safecopyfrom failed", r);
+ panic("fxp_writev: sys_safecopyfrom failed: %d", r);
for (j= 0, iovp= fp->fxp_iovec_s; j<n; j++, iovp++)
{
s= iovp->iov_size;
- if (size + s > ETH_MAX_PACK_SIZE_TAGGED)
- {
- panic("FXP","fxp_writev: invalid packet size",
- size + s);
+ if (size + s > ETH_MAX_PACK_SIZE_TAGGED) {
+ panic("fxp_writev: invalid packet size: %d", size + s);
}
r= sys_safecopyfrom(fxp_client, iovp->iov_grant,
0, (vir_bytes)(txp->tx_buf+o), s, D);
- if (r != OK)
- {
- panic("FXP",
- "fxp_writev_s: sys_safecopyfrom failed",
- r);
+ if (r != OK) {
+ panic("fxp_writev_s: sys_safecopyfrom failed: %d", r);
}
size += s;
o += s;
}
}
if (size < ETH_MIN_PACK_SIZE)
- panic("FXP","fxp_writev: invalid packet size", size);
+ panic("fxp_writev: invalid packet size: %d", size);
txp->tx_status= 0;
txp->tx_command= TXC_EL | CBL_XMIT;
suspend:
if (from_int)
- panic("FXP","fxp: should not be sending\n", NO_NUM);
+ panic("fxp: should not be sending");
fp->fxp_tx_mess= *mp;
reply(fp, OK, FALSE);
dl_port = mp->DL_PORT;
count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR)
- panic("FXP","fxp_readv: illegal port", dl_port);
+ panic("fxp_readv: illegal port: %d", dl_port);
fp= &fxp_table[dl_port];
fxp_client= mp->DL_PROC;
fp->fxp_client= fxp_client;
SELF, D, (vir_bytes)fp->fxp_iovec,
n * sizeof(fp->fxp_iovec[0]));
if (r != OK)
- panic("FXP","fxp_readv: sys_vircopy failed", r);
+ panic("fxp_readv: sys_vircopy failed: %d", r);
for (j= 0, iovp= fp->fxp_iovec; j<n; j++, iovp++)
{
r= sys_vircopy(SELF, D,
(vir_bytes)(rfdp->rfd_buf+o),
fxp_client, D, iovp->iov_addr, s);
- if (r != OK)
- {
- panic("FXP","fxp_readv: sys_vircopy failed",
- r);
+ if (r != OK) {
+ panic("fxp_readv: sys_vircopy failed: %d", r);
}
size += s;
dl_port = mp->DL_PORT;
count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR)
- panic("FXP","fxp_readv: illegal port", dl_port);
+ panic("fxp_readv: illegal port: %d", dl_port);
fp= &fxp_table[dl_port];
fxp_client= mp->DL_PROC;
fp->fxp_client= fxp_client;
(vir_bytes)fp->fxp_iovec_s,
n * sizeof(fp->fxp_iovec_s[0]), D);
if (r != OK)
- panic("FXP","fxp_readv_s: sys_safecopyfrom failed", r);
+ panic("fxp_readv_s: sys_safecopyfrom failed: %d", r);
for (j= 0, iovp= fp->fxp_iovec_s; j<n; j++, iovp++)
{
0, (vir_bytes)(rfdp->rfd_buf+o), s, D);
if (r != OK)
{
- panic("FXP","fxp_readv: sys_safecopyto failed",
- r);
+ panic("fxp_readv: sys_safecopyto failed: %d", r);
}
size += s;
r= sys_umap(SELF, VM_D, (vir_bytes)&tmpbufp->cc,
(phys_bytes)sizeof(tmpbufp->cc), &bus_addr);
if (r != OK)
- panic("FXP","sys_umap failed", r);
+ panic("sys_umap failed: %d", r);
fxp_cu_ptr_cmd(fp, SC_CU_START, bus_addr, TRUE /* check idle */);
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(100000));
if (!(tmpbufp->cc.cc_status & CBL_F_C))
- panic("FXP","fxp_do_conf: CU command failed to complete", NO_NUM);
+ panic("fxp_do_conf: CU command failed to complete");
if (!(tmpbufp->cc.cc_status & CBL_F_OK))
- panic("FXP","fxp_do_conf: CU command failed", NO_NUM);
+ panic("fxp_do_conf: CU command failed");
}
{
/* Consistency check. Make sure that CU is idle */
if ((fxp_inb(port, SCB_STATUS) & SS_CUS_MASK) != SS_CU_IDLE)
- panic("FXP","fxp_cu_ptr_cmd: CU is not idle", NO_NUM);
+ panic("fxp_cu_ptr_cmd: CU is not idle");
}
fxp_outl(port, SCB_POINTER, bus_addr);
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(100000));
if ((scb_cmd & SC_CUC_MASK) != SC_CU_NOP)
- panic("FXP","fxp_cu_ptr_cmd: CU does not accept command", NO_NUM);
+ panic("fxp_cu_ptr_cmd: CU does not accept command");
}
/*===========================================================================*
{
/* Consistency check, make sure that RU is idle */
if ((fxp_inb(port, SCB_STATUS) & SS_RUS_MASK) != SS_RU_IDLE)
- panic("FXP","fxp_ru_ptr_cmd: RU is not idle", NO_NUM);
+ panic("fxp_ru_ptr_cmd: RU is not idle");
}
fxp_outl(port, SCB_POINTER, bus_addr);
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000));
if ((scb_cmd & SC_RUC_MASK) != SC_RU_NOP)
- panic("FXP","fxp_ru_ptr_cmd: RU does not accept command", NO_NUM);
+ panic("fxp_ru_ptr_cmd: RU does not accept command");
}
/*===========================================================================*
/* Make sure that RU is in the 'No resources' state */
if ((fxp_inb(port, SCB_STATUS) & SS_RUS_MASK) != SS_RU_NORES)
- panic("FXP","fxp_restart_ru: RU is in an unexpected state", NO_NUM);
+ panic("fxp_restart_ru: RU is in an unexpected state");
fxp_ru_ptr_cmd(fp, SC_RU_START, fp->fxp_rx_busaddr,
FALSE /* do not check idle */);
dl_port = mp->DL_PORT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR)
- panic("FXP","fxp_getstat: illegal port", dl_port);
+ panic("fxp_getstat: illegal port: %d", dl_port);
fp= &fxp_table[dl_port];
fp->fxp_client= mp->DL_PROC;
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000));
if (*p == 0)
- panic("FXP","fxp_getstat: CU command failed to complete", NO_NUM);
+ panic("fxp_getstat: CU command failed to complete");
if (*p != SCM_DSC)
- panic("FXP","fxp_getstat: bad magic", NO_NUM);
+ panic("fxp_getstat: bad magic");
stats.ets_recvErr=
fp->fxp_stat.sc_rx_crc +
r= sys_vircopy(SELF, D, (vir_bytes)&stats,
mp->DL_PROC, D, (vir_bytes) mp->DL_ADDR, sizeof(stats));
if (r != OK)
- panic(__FILE__,"fxp_getstat: sys_vircopy failed", r);
+ panic("fxp_getstat: sys_vircopy failed: %d", r);
mp->m_type= DL_STAT_REPLY;
mp->DL_PORT= dl_port;
mp->DL_STAT= OK;
r= send(mp->m_source, mp);
if (r != OK)
- panic(__FILE__, "fxp_getstat: send failed: %d\n", r);
+ panic("fxp_getstat: send failed: %d", r);
}
dl_port = mp->DL_PORT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR)
- panic("FXP","fxp_getstat: illegal port", dl_port);
+ panic("fxp_getstat: illegal port: %d", dl_port);
fp= &fxp_table[dl_port];
fp->fxp_client= mp->DL_PROC;
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000));
if (*p == 0)
- panic("FXP","fxp_getstat: CU command failed to complete", NO_NUM);
+ panic("fxp_getstat: CU command failed to complete");
if (*p != SCM_DSC)
- panic("FXP","fxp_getstat: bad magic", NO_NUM);
+ panic("fxp_getstat: bad magic");
stats.ets_recvErr=
fp->fxp_stat.sc_rx_crc +
r= sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, (vir_bytes)&stats,
sizeof(stats), D);
if (r != OK)
- panic(__FILE__,"fxp_getstat_s: sys_safecopyto failed", r);
+ panic("fxp_getstat_s: sys_safecopyto failed: %d", r);
mp->m_type= DL_STAT_REPLY;
mp->DL_PORT= dl_port;
mp->DL_STAT= OK;
r= send(mp->m_source, mp);
if (r != OK)
- panic(__FILE__, "fxp_getstat_s: send failed: %d\n", r);
+ panic("fxp_getstat_s: send failed: %d", r);
}
mp->m_type= DL_NAME_REPLY;
r= send(mp->m_source, mp);
if (r != OK)
- panic("FXP", "fxp_getname: send failed", r);
+ panic("fxp_getname: send failed: %d", r);
}
/*===========================================================================*
}
if (r < 0)
- panic("FXP","fxp: send failed:", r);
+ panic("fxp: send failed: %d", r);
fp->fxp_read_s = 0;
fp->fxp_flags &= ~(FF_PACK_SENT | FF_PACK_RECV);
message *reply_mess;
{
if (send(req->m_source, reply_mess) != OK)
- panic("FXP","fxp: unable to mess_reply", NO_NUM);
+ panic("fxp: unable to mess_reply");
}
/*===========================================================================*
break;
}
if (i >= 32)
- panic("FXP","eeprom_addrsize: failed", NO_NUM);
+ panic("eeprom_addrsize: failed");
fp->fxp_ee_addrlen= i+1;
/* Discard 16 data bits */
fp->fxp_mii_busy++;
if (!(fxp_inl(port, CSR_MDI_CTL) & CM_READY))
- panic("FXP","mii_read: MDI not ready", NO_NUM);
+ panic("mii_read: MDI not ready");
fxp_outl(port, CSR_MDI_CTL, CM_READ | (1 << CM_PHYADDR_SHIFT) |
(reg << CM_REG_SHIFT));
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(100000));
if (!(v & CM_READY))
- panic("FXP","mii_read: MDI not ready after command", NO_NUM);
+ panic("mii_read: MDI not ready after command");
fp->fxp_mii_busy--;
assert(!fp->fxp_mii_busy);
/* Get the current time. */
r= getuptime(&now);
if (r != OK)
- panic("FXP","unable to get uptime from clock", r);
+ panic("unable to get uptime from clock: %d", r);
/* Add the timer to the local timer queue. */
tmrs_settimer(&fxp_timers, tp, now + delta, watchdog, NULL);
#endif
r= sys_setalarm(fxp_next_timeout, 1);
if (r != OK)
- panic("FXP","unable to set synchronous alarm", r);
+ panic("unable to set synchronous alarm: %d", r);
}
}
/* Get the current time to compare the timers against. */
r= getuptime(&now);
if (r != OK)
- panic("FXP","Unable to get uptime from clock.", r);
+ panic("Unable to get uptime from clock: %d", r);
/* Scan the timers queue for expired timers. Dispatch the watchdog function
* for each expired timers. Possibly a new alarm call must be scheduled.
fxp_next_timeout = fxp_timers->tmr_exp_time;
r= sys_setalarm(fxp_next_timeout, 1);
if (r != OK)
- panic("FXP","Unable to set synchronous alarm.", r);
+ panic("Unable to set synchronous alarm: %d", r);
}
}
r= sys_inb(port, &value);
if (r != OK)
- panic("FXP","sys_inb failed", r);
+ panic("sys_inb failed: %d", r);
return value;
}
r= sys_inl(port, &value);
if (r != OK)
- panic("FXP","sys_inl failed", r);
+ panic("sys_inl failed: %d", r);
return value;
}
r= sys_outb(port, value);
if (r != OK)
- panic("FXP","sys_outb failed", r);
+ panic("sys_outb failed: %d", r);
}
static void do_outl(port_t port, u32_t value)
r= sys_outl(port, value);
if (r != OK)
- panic("FXP","sys_outl failed", r);
+ panic("sys_outl failed: %d", r);
}
PRIVATE void tell_dev(buf, size, pci_bus, pci_dev, pci_func)
if ( (r=sys_umap( SELF, VM_D, x, 4, &value )) != OK ) {
printf("lance: umap of 0x%lx failed\n",x );
- panic( "lance", "sys_umap failed", r );
+ panic("sys_umap failed: %d", r);
}
return value;
}
if ((r= sef_receive(ANY, &m)) != OK)
- panic( "lance", "sef_receive failed", r);
+ panic("sef_receive failed: %d", r);
for (i=0;i<EC_PORT_NR_MAX;++i)
{
break;
}
default:
- panic( "lance", "illegal notify source", m.m_source);
+ panic("illegal notify source: %d", m.m_source);
}
/* get next message */
do_getname(&m);
break;
default:
- panic( "lance", "illegal message", m.m_type);
+ panic("illegal message: %d", m.m_type);
}
}
}
pci_init();
if(!lance_buf && !(lance_buf = alloc_contig(LANCE_BUF_SIZE, AC_ALIGN4K|AC_LOWER16M, &lance_buf_phys))) {
- panic( "lance", "alloc_contig failed", LANCE_BUF_SIZE);
+ panic("alloc_contig failed: %d", LANCE_BUF_SIZE);
}
port = mp->DL_PORT;
}
else
{
- report( "LANCE", "DMA denied because address out of range", NO_NUM );
+ printf("LANCE: DMA denied because address out of range\n" );
}
if (ec->mode == EC_DISABLED)
reply.DL_COUNT = ec->read_s;
if ((r=getuptime(&now)) != OK)
- panic("lance", "getuptime() failed:", r);
+ panic("getuptime() failed: %d", r);
reply.DL_CLCK = now;
r = send(ec->client, &reply);
return;
}
if (r < 0)
- panic( "lance", "send failed:", r);
+ panic("send failed: %d", r);
ec->read_s = 0;
ec->flags &= ~(ECF_PACK_SEND | ECF_PACK_RECV);
message *reply_mess;
{
if (send(req->m_source, reply_mess) != OK)
- panic( "lance", "unable to mess_reply", NO_NUM);
+ panic("unable to mess_reply");
}
unsigned short ioaddr = ec->ec_port;
if (!(ec->flags & ECF_ENABLED))
- panic( "lance", "got premature interrupt", NO_NUM);
+ panic("got premature interrupt");
for (;;)
{
}
else
{
- panic( "lance", "got premature TX INT...", NO_NUM);
+ panic("got premature TX INT..");
}
if (check==1)
{
{
case DL_WRITEV_S: do_vwrite_s(&ec->sendmsg, TRUE); break;
default:
- panic( "lance", "wrong type:", ec->sendmsg.m_type);
+ panic("wrong type: %d", ec->sendmsg.m_type);
break;
}
}
(count > IOVEC_NR ? IOVEC_NR : count) *
sizeof(iovec_s_t), D);
if (r != OK)
- panic(__FILE__,
- "do_vread_s: sys_safecopyfrom failed: %d\n", r);
+ panic("do_vread_s: sys_safecopyfrom failed: %d", r);
ec->read_iovec.iod_iovec_s = count;
ec->read_iovec.iod_proc_nr = mp->DL_PROC;
ec->read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
(count > IOVEC_NR ? IOVEC_NR : count) *
sizeof(iovec_s_t), D);
if (r != OK)
- panic(__FILE__,
- "do_vwrite_s: sys_safecopyfrom failed: %d\n", r);
-
+ panic("do_vwrite_s: sys_safecopyfrom failed: %d", r);
ec->write_iovec.iod_iovec_s = count;
ec->write_iovec.iod_proc_nr = mp->DL_PROC;
ec->write_iovec.iod_grant = mp->DL_GRANT;
if ( (r=sys_safecopyfrom(iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_grant, offset,
nic_addr, bytes, D )) != OK )
- panic( __FILE__, "ec_user2nic: sys_safecopyfrom failed", r );
+ panic("ec_user2nic: sys_safecopyfrom failed: %d", r);
count -= bytes;
nic_addr += bytes;
bytes = count;
if ( (r=sys_safecopyto( iovp->iod_proc_nr, iovp->iod_iovec[i].iov_grant,
offset, nic_addr, bytes, D )) != OK )
- panic( __FILE__, "ec_nic2user: sys_safecopyto failed: ", r );
+ panic("ec_nic2user: sys_safecopyto failed: %d", r);
count -= bytes;
nic_addr += bytes;
IOVEC_NR : iovp->iod_iovec_s) *
sizeof(iovec_s_t), D);
if (r != OK)
- panic(__FILE__,
- "ec_next_iovec: sys_safecopyfrom failed: %d\n", r);
+ panic("ec_next_iovec: sys_safecopyfrom failed: %d", r);
}
port = mp->DL_PORT;
if (port < 0 || port >= EC_PORT_NR_MAX)
- panic( "lance", "illegal port", port);
+ panic("illegal port: %d", port);
ec= &ec_table[port];
ec->client= mp->DL_PROC;
(vir_bytes)&ec->eth_stat, sizeof(ec->eth_stat), D);
if (r != OK)
- panic(__FILE__,
- "do_getstat_s: sys_safecopyto failed: %d\n", r);
+ panic("do_getstat_s: sys_safecopyto failed: %d", r);
mp->m_type= DL_STAT_REPLY;
mp->DL_PORT= port;
mp->DL_STAT= OK;
r= send(mp->m_source, mp);
if (r != OK)
- panic(__FILE__, "do_getstat_s: send failed: %d\n", r);
+ panic("do_getstat_s: send failed: %d", r);
}
/*===========================================================================*
port = mp->DL_PORT;
if (port < 0 || port >= EC_PORT_NR_MAX)
- panic( "lance", "illegal port", port);
+ panic("illegal port: %d", port);
ec = &ec_table[port];
if (!(ec->flags & ECF_ENABLED))
continue;
if (pcitab[i].did != did)
continue;
- if (pcitab[i].checkclass)
- {
- panic("lance",
- "class check not implemented", NO_NUM);
+ if (pcitab[i].checkclass) {
+ panic("class check not implemented");
}
break;
}
mp->m_type= DL_NAME_REPLY;
r= send(mp->m_source, mp);
if (r != OK)
- panic("LANCE", "do_getname: send failed", r);
+ panic("do_getname: send failed: %d", r);
}
/*===========================================================================*
r= sys_inb(port, &value);
if (r != OK)
- panic("lance","sys_inb failed", r);
+ panic("sys_inb failed: %d", r);
return value;
}
r= sys_inw(port, &value);
if (r != OK)
- panic("lance","sys_inw failed", r);
+ panic("sys_inw failed: %d", r);
return value;
}
r= sys_outw(port, value);
if (r != OK)
- panic("lance","sys_outw failed", r);
+ panic("sys_outw failed: %d", r);
}
/*===========================================================================*
int s;
/* Wait for a request to read or write a disk block. */
if ((s=sef_receive(ANY, &mess)) != OK)
- panic((*dp->dr_name)(),"sef_receive() failed", s);
+ panic("sef_receive() failed: %d", s);
}
device_caller = mess.m_source;
break;
default:
- panic(__FILE__, "unknown driver type", type);
+ panic("unknown driver type: %d", type);
}
}
}
*/
if(!(tmp_buf = alloc_contig(2*DMA_BUF_SIZE, AC_ALIGN4K, &tmp_phys)))
- panic(__FILE__, "can't allocate tmp_buf", DMA_BUF_SIZE);
+ panic("can't allocate tmp_buf: %d", DMA_BUF_SIZE);
}
/*===========================================================================*
if (OK != sys_safecopyfrom(mp->m_source, (vir_bytes) mp->IO_GRANT,
0, (vir_bytes) iovec, iovec_size, D)) {
- panic((*dp->dr_name)(),"bad I/O vector by", mp->m_source);
+ panic("bad I/O vector by: %d", mp->m_source);
}
/* Prepare for I/O. */
/* Copy the I/O vector back to the caller. */
if (OK != sys_safecopyto(mp->m_source, (vir_bytes) mp->IO_GRANT,
0, (vir_bytes) iovec, iovec_size, D)) {
- panic((*dp->dr_name)(),"couldn't return I/O vector", mp->m_source);
+ panic("couldn't return I/O vector: %d", mp->m_source);
}
return(r);
mq_t *mq, *mi;
if(!(mq = mq_get()))
- panic("libdriver","mq_queue: mq_get failed", NO_NUM);
+ panic("mq_queue: mq_get failed");
memcpy(&mq->mq_mess, m, sizeof(mq->mq_mess));
mq->mq_next = NULL;
if(!queue_head) {
CPF_WRITE);
if (gid == -1)
{
-#if 0
- report("LOG","cpf_grant_direct failed for TTY", errno);
-#endif
return EDONTREPLY;
}
if (r == OK) r= mess.m_type;
if (r != OK)
{
- report("LOG","couldn't get copy of kmessages from TTY", r);
+ printf("log: couldn't get copy of kmessages from TTY: %d\n", r);
return EDONTREPLY;
}
}
{
/* Try to get a fresh copy of the buffer with kernel messages. */
if ((r=sys_getkmessages(&kmess)) != OK) {
- report("LOG","couldn't get copy of kmessages", r);
+ printf("log: couldn't get copy of kmessages: %d\n", r);
return EDONTREPLY;
}
prev_nextp= &kernel_prev_next;
sa.sa_handler = SIG_MESS;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
- if (sigaction(SIGTERM,&sa,NULL)<0) panic("MEM","sigaction failed", errno);
+ if (sigaction(SIGTERM,&sa,NULL)<0) panic("sigaction failed: %d", errno);
/* Initialize all minor devices one by one. */
if (OK != (s=sys_getkinfo(&kinfo))) {
- panic("MEM","Couldn't get kernel information.",s);
+ panic("Couldn't get kernel information: %d", s);
}
#if 0
dev_vaddr + position, count, D);
}
if(r != OK) {
- panic("MEM","I/O copy failed",r);
+ panic("I/O copy failed: %d", r);
}
break;
if(!any_mapped || pagestart_mapped != pagestart) {
if(any_mapped) {
if(vm_unmap_phys(SELF, vaddr, I386_PAGE_SIZE) != OK)
- panic("MEM","vm_unmap_phys failed",NO_NUM);
+ panic("vm_unmap_phys failed");
any_mapped = 0;
}
vaddr = vm_map_phys(SELF, (void *) pagestart, I386_PAGE_SIZE);
s=sys_safecopyto(proc_nr, user_vir,
vir_offset+suboffset, (vir_bytes) dev_zero, chunk, D);
if(s != OK)
- report("MEM","sys_safecopyto failed", s);
+ printf("MEM: sys_safecopyto failed: %d\n", s);
left -= chunk;
suboffset += chunk;
}
}
if(m_device < 0 || m_device >= NR_DEVS) {
- panic("MEM","wrong m_device",m_device);
+ panic("wrong m_device: %d", m_device);
}
openct[m_device]++;
if (m_prepare(m_ptr->DEVICE) == NIL_DEV) return(ENXIO);
if(m_device < 0 || m_device >= NR_DEVS) {
- panic("MEM","wrong m_device",m_device);
+ panic("wrong m_device: %d", m_device);
}
if(openct[m_device] < 1) {
- panic("MEM","closed too often",NO_NUM);
+ panic("closed too often");
}
openct[m_device]--;
if(m_vaddrs[dev]) {
u32_t size;
if(ex64hi(dv->dv_size)) {
- panic("MEM","huge old ramdisk", NO_NUM);
+ panic("huge old ramdisk");
}
size = ex64lo(dv->dv_size);
free((void *) m_vaddrs[dev]);
while (TRUE) {
if ((r = sef_receive (ANY, &m)) != OK)
- panic(__FILE__, "orinoco: sef_receive failed", NO_NUM);
+ panic("orinoco: sef_receive failed");
if (is_notify(m.m_type)) {
switch (_ENDPOINT_P(m.m_source)) {
break;
}
default:
- panic(__FILE__,
- "orinoco: illegal notify from:",
+ panic("orinoco: illegal notify from: %d",
m.m_source);
}
or_getname(&m);
break;
default:
- panic(__FILE__,"orinoco: illegal message:", m.m_type);
+ panic("orinoco: illegal message: %d", m.m_type);
}
}
}
r = send(mp->m_source, mp);
if(r != OK) {
- panic(__FILE__, "or_getname: send failed", r);
+ panic("or_getname: send failed: %d", r);
}
}
u16_t irqmask;
if (OK != (r = getuptime(&now)))
- panic(__FILE__, "orinoco: getuptime() failed:", r);
+ panic("orinoco: getuptime() failed: %d", r);
if(now - last_reset < system_hz * 10) {
printf("Resetting card too often. Going to reset driver\n");
if (pcitab[i].did != did)
continue;
if (pcitab[i].checkclass) {
- panic(__FILE__, "or_probe:class check not implmnted",
- NO_NUM);
+ panic("or_probe:class check not implmnted");
}
/* we have found the card in the pci bus */
break;
buf = (char *)malloc(size);
if(buf == NULL)
- panic(__FILE__, "map_hw_buffer: cannot malloc size:", size);
+ panic("map_hw_buffer: cannot malloc size: %d", size);
/* Let the mapped memory by I386_PAGE_SIZE aligned */
o = I386_PAGE_SIZE - ((vir_bytes)buf % I386_PAGE_SIZE);
#endif
if(r!=OK)
- panic(__FILE__, "map_hw_buffer: sys_vm_map failed:", r);
+ panic("map_hw_buffer: sys_vm_map failed: %d", r);
hw->locmem = abuf;
bar = pci_attr_r32 (devind, PCI_BAR) & 0xffffffe0;
if ((bar & 0x3ff) >= 0x100 - 32 || bar < 0x400)
- panic(__FILE__,"base address isn't properly configured",
- NO_NUM);
+ panic("base address isn't properly configured");
/* In I/O space registers are 2 bytes wide, without any spacing
* in between */
orp->or_name, bar, orp->or_irq);
}
- panic(__FILE__, "Not implemente yet", NO_NUM);
+ panic("Not implemente yet");
/* Although we are able to find the desired bar and irq for an
* I/O spaced card, we haven't implemented the right register
* accessing functions. This wouldn't be difficult, but we were
static void mess_reply (message * req, message * reply_mess) {
if (send (req->m_source, reply_mess) != 0)
- panic(__FILE__, "orinoco: unable to mess_reply", NO_NUM);
+ panic("orinoco: unable to mess_reply");
}
port = mp->DL_PORT;
count = mp->DL_COUNT;
if (port < 0 || port >= OR_PORT_NR)
- panic(__FILE__, "orinoco: illegal port", NO_NUM);
+ panic("orinoco: illegal port");
or_client = mp->DL_PROC;
orp = &or_table[port];
port = mp->DL_PORT;
count = mp->DL_COUNT;
if (port < 0 || port >= OR_PORT_NR)
- panic(__FILE__, "orinoco: illegal port", NO_NUM);
+ panic("orinoco: illegal port");
or_client = mp->DL_PROC;
orp = &or_table[port];
reply.DL_COUNT = orp->or_read_s;
if (OK != (r = getuptime(&now)))
- panic(__FILE__, "orinoco: getuptime() failed:", r);
+ panic("orinoco: getuptime() failed: %d", r);
reply.DL_CLCK = now;
r = send (orp->or_client, &reply);
}
if (r < 0)
- panic(__FILE__, "orinoco: send failed:", r);
+ panic("orinoco: send failed: %d", r);
orp->or_read_s = 0;
orp->or_flags &= ~(OR_F_PACK_SENT | OR_F_PACK_RECV);
dl_port = mp->DL_PORT;
count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= OR_PORT_NR)
- panic(__FILE__, "orinoco: illegal port:", dl_port);
+ panic("orinoco: illegal port: %d", dl_port);
orp = &or_table[dl_port];
or_client = mp->DL_PROC;
dl_port = mp->DL_PORT;
count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= OR_PORT_NR)
- panic(__FILE__, "orinoco: illegal port:", dl_port);
+ panic("orinoco: illegal port: %d", dl_port);
orp = &or_table[dl_port];
or_client = mp->DL_PROC;
(vir_bytes)orp->or_iovec_s,
n * sizeof(orp->or_iovec_s[0]), D);
if (cps != OK)
- panic(__FILE__,
- "orinoco: warning, sys_safecopytp failed:", cps);
+ panic("orinoco: warning: sys_safecopytp failed: %d", cps);
for (j = 0, iovp = orp->or_iovec_s; j < n; j++, iovp++) {
s = iovp->iov_size;
cps = sys_safecopyto(or_client, iovp->iov_grant, 0,
(vir_bytes) databuf + o, s, D);
if (cps != OK)
- panic(__FILE__,
- "orinoco: warning, sys_safecopy failed:",
- cps);
+ panic("orinoco: warning: sys_safecopy failed: %d", cps);
size += s;
if (size == length)
port = mp->DL_PORT;
if (port < 0 || port >= OR_PORT_NR)
- panic(__FILE__, "orinoco: illegal port:", port);
+ panic("orinoco: illegal port: %d", port);
orp = &or_table[port];
orp->or_client = mp->DL_PROC;
r = sys_datacopy(SELF, (vir_bytes)&stats, mp->DL_PROC,
(vir_bytes) mp->DL_ADDR, sizeof(stats));
if(r != OK) {
- panic(__FILE__, "or_getstat: send failed:", r);
+ panic("or_getstat: send failed: %d", r);
}
mp->m_type = DL_STAT_REPLY;
r = send(mp->m_source, mp);
if(r != OK)
- panic(__FILE__, "orinoco: getstat failed:", r);
+ panic("orinoco: getstat failed: %d", r);
/*reply (orp, OK, FALSE);*/
port = mp->DL_PORT;
if (port < 0 || port >= OR_PORT_NR)
- panic(__FILE__, "orinoco: illegal port:", port);
+ panic("orinoco: illegal port: %d", port);
assert(port==0);
orp = &or_table[port];
orp->or_client = mp->DL_PROC;
r = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0,
(vir_bytes) &stats, sizeof(stats), D);
if(r != OK) {
- panic(__FILE__, "or_getstat_s: sys_safecopyto failed:", r);
+ panic("or_getstat_s: sys_safecopyto failed: %d", r);
}
mp->m_type = DL_STAT_REPLY;
r = send(mp->m_source, mp);
if(r != OK)
- panic(__FILE__, "orinoco: getstat_s failed:", r);
+ panic("orinoco: getstat_s failed: %d", r);
}
/* Map all the services in the boot image. */
if((r = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0,
(vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) {
- panic("pci", "sys_safecopyfrom failed", r);
+ panic("sys_safecopyfrom failed: %d", r);
}
for(i=0;i < NR_BOOT_PROCS;i++) {
if(rprocpub[i].in_use) {
if((r = map_service(&rprocpub[i])) != OK) {
- panic("pci", "unable to map service", r);
+ panic("unable to map service: %d", r);
}
}
}
#endif
if (nr_pcibus >= NR_PCIBUS)
- panic("PCI","too many PCI busses", nr_pcibus);
+ panic("too many PCI busses: %d", nr_pcibus);
busind= nr_pcibus;
nr_pcibus++;
pcibus[busind].pb_type= PBT_INTEL_HOST;
printf("probe_bus(%d)\n", busind);
#endif
if (nr_pcidev >= NR_PCIDEV)
- panic("PCI","too many PCI devices", nr_pcidev);
+ panic("too many PCI devices: %d", nr_pcidev);
devind= nr_pcidev;
busnr= pcibus[busind].pb_busnr;
#endif
if (nr_pcidev >= NR_PCIDEV)
- panic("PCI","too many PCI devices", nr_pcidev);
+ panic("too many PCI devices: %d", nr_pcidev);
devind= nr_pcidev;
if (func == 0 && !(headt & PHT_MULTIFUNC))
r= env_get_param("memory", memstr, sizeof(memstr));
if (r != OK)
- panic("pci", "env_get_param failed", r);
+ panic("env_get_param failed: %d", r);
/* Set memgap_low to just above physical memory */
memgap_low= 0;
{
printf("PCI: bad memory gap: [0x%x .. 0x%x>\n",
memgap_low, memgap_high);
- panic(NULL, NULL, NO_NUM);
+ panic(NULL);
}
iogap_high= 0x10000;
printf("iogap_high too low, should panic\n");
}
else
- panic("pci", "iogap_high too low", iogap_high);
+ panic("iogap_high too low: %d", iogap_high);
}
if (debug)
printf("I/O range = [0x%x..0x%x>\n", iogap_low, iogap_high);
base= memgap_high-size;
base &= ~(u32_t)(size-1);
if (base < memgap_low)
- panic("pci", "memory base too low", base);
+ panic("memory base too low: %d", base);
memgap_high= base;
bar_nr= pcidev[i].pd_bar[j].pb_nr;
reg= PCI_BAR + 4*bar_nr;
base &= 0xfcff;
if (base < iogap_low)
- panic("pci", "I/O base too low", base);
+ panic("I/O base too low: %d", base);
iogap_high= base;
bar_nr= pcidev[i].pd_bar[j].pb_nr;
bad_mem_string:
printf("PCI: bad memory environment string '%s'\n", memstr);
- panic(NULL, NULL, NO_NUM);
+ panic(NULL);
}
/*===========================================================================*
return;
}
if (type != PBT_CARDBUS)
- panic("pci", "update_bridge4dev_io: strange bus type", type);
+ panic("update_bridge4dev_io: strange bus type: %d", type);
if (debug)
{
r= do_sis_isabr(bridge_dev);
break;
default:
- panic("PCI","unknown ISA bridge type", type);
+ panic("unknown ISA bridge type: %d", type);
}
return r;
}
sbusn= pci_attr_r8_u(devind, PPB_SECBN);
if (nr_pcibus >= NR_PCIBUS)
- panic("PCI","too many PCI busses", nr_pcibus);
+ panic("too many PCI busses: %d", nr_pcibus);
ind= nr_pcibus;
nr_pcibus++;
pcibus[ind].pb_type= PBT_PCIBRIDGE;
pcibus[ind].pb_wsts= pcibr_via_wsts;
break;
default:
- panic("PCI","unknown PCI-PCI bridge type", type);
+ panic("unknown PCI-PCI bridge type: %d", type);
}
if (debug)
{
if (pcibus[i].pb_busnr == busnr)
return i;
}
- panic("pci", "get_busind: can't find bus", busnr);
+ panic("get_busind: can't find bus: %d", busnr);
}
/*===========================================================================*
/* Fake a device with the required function */
if (nr_pcidev >= NR_PCIDEV)
- panic("PCI","too many PCI devices", nr_pcidev);
+ panic("too many PCI devices: %d", nr_pcidev);
xdevind= nr_pcidev;
pcidev[xdevind].pd_busnr= busnr;
pcidev[xdevind].pd_dev= dev;
sa.sa_handler = SIG_MESS;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
- if (sigaction(SIGTERM,&sa,NULL)<0) panic("PRN","sigaction failed", errno);
+ if (sigaction(SIGTERM,&sa,NULL)<0) panic("sigaction failed: %d", errno);
return(OK);
}
while (--retries > 0) {
if(sys_inb(port_base + 1, &status) != OK) {
printf("printer: sys_inb of %x failed\n", port_base+1);
- panic(__FILE__,"sys_inb failed", NO_NUM);
+ panic("sys_inb failed");
}
if ((status & ON_LINE)) { /* printer online! */
prepare_output();
/* Get the base port for first printer. */
if(sys_vircopy(SELF, BIOS_SEG, LPT1_IO_PORT_ADDR,
SELF, D, (vir_bytes) &port_base, LPT1_IO_PORT_SIZE) != OK) {
- panic(__FILE__, "do_initialize: sys_vircopy failed", NO_NUM);
+ panic("do_initialize: sys_vircopy failed");
}
if(sys_outb(port_base + 2, INIT_PRINTER) != OK) {
printf("printer: sys_outb of %x failed\n", port_base+2);
- panic(__FILE__, "do_initialize: sys_outb init failed", NO_NUM);
+ panic("do_initialize: sys_outb init failed");
}
micro_delay(1000000/20); /* easily satisfies Centronics minimum */
if(sys_outb(port_base + 2, PR_SELECT) != OK) {
printf("printer: sys_outb of %x failed\n", port_base+2);
- panic(__FILE__, "do_initialize: sys_outb select failed", NO_NUM);
+ panic("do_initialize: sys_outb select failed");
}
irq_hook_id = 0;
if(sys_irqsetpolicy(PRINTER_IRQ, 0, &irq_hook_id) != OK ||
sys_irqenable(&irq_hook_id) != OK) {
- panic(__FILE__, "do_initialize: irq enabling failed", NO_NUM);
+ panic("do_initialize: irq enabling failed");
}
}
*/
if(sys_outb(port_base + 2, PR_SELECT) != OK) {
printf("printer: sys_outb of %x failed\n", port_base+2);
- panic(__FILE__,"sys_outb failed", NO_NUM);
+ panic("sys_outb failed");
}
if(sys_irqenable(&irq_hook_id) != OK) {
- panic(__FILE__,"sys_irqenable failed", NO_NUM);
+ panic("sys_irqenable failed");
}
return;
}
*/
if(sys_inb(port_base + 1, &status) != OK) {
printf("printer: sys_inb of %x failed\n", port_base+1);
- panic(__FILE__,"sys_inb failed", NO_NUM);
+ panic("sys_inb failed");
}
if ((status & STATUS_MASK) == BUSY_STATUS) {
/* Still busy with last output. This normally happens
* interrupts. It may happen after a spurious interrupt.
*/
if(sys_irqenable(&irq_hook_id) != OK) {
- panic(__FILE__, "sys_irqenable failed\n", NO_NUM);
+ panic("sys_irqenable failed");
}
return;
}
pv_set(char_out[2], port_base+2, NEGATE_STROBE);
if(sys_voutb(char_out, 3) != OK) {
/* request series of port outb */
- panic(__FILE__, "sys_voutb failed\n", NO_NUM);
+ panic("sys_voutb failed");
}
user_vir_d++;
done_status = status;
output_done();
if(sys_irqenable(&irq_hook_id) != OK) {
- panic(__FILE__, "sys_irqenable failed\n", NO_NUM);
+ panic("sys_irqenable failed");
}
return;
}
done_status = OK;
output_done();
if(sys_irqenable(&irq_hook_id) != OK) {
- panic(__FILE__, "sys_irqenable failed\n", NO_NUM);
+ panic("sys_irqenable failed");
}
}
/* Retrieve first randomness buffer with parameters. */
if (OK != (s=sys_getrandomness(&krandom))) {
- report("RANDOM", "sys_getrandomness failed", s);
+ printf("RANDOM: sys_getrandomness failed: %d\n", s);
exit(1);
}
/* Schedule new alarm for next m_random call. */
if (OK != (s=sys_setalarm(KRANDOM_PERIOD, 0)))
- report("RANDOM", "sys_setalarm failed", s);
+ printf("RANDOM: sys_setalarm failed: %d\n", s);
}
/*============================================================================*
printf("random_update: got %d samples for source %d\n", count, source);
#endif
if (source < 0 || source >= TOTAL_SOURCES)
- panic("memory", "random_update: bad source", source);
+ panic("random_update: bad source: %d", source);
for (i= 0; i<count; i++)
add_sample(source, buf[i]);
reseed();
while (TRUE)
{
if ((r= sef_receive(ANY, &m)) != OK)
- panic("rtl8139","sef_receive failed", r);
+ panic("sef_receive failed: %d", r);
if (is_notify(m.m_type)) {
switch (_ENDPOINT_P(m.m_source)) {
break;
}
default:
- panic("rtl8139","illegal notify from",
- m.m_source);
+ panic("illegal notify from: %d",
+ m.m_source);
}
/* done, get nwe message */
case DL_STOP: do_stop(&m); break;
#endif
default:
- panic("rtl8139","illegal message", m.m_type);
+ panic("illegal message: %d", m.m_type);
}
}
}
continue;
if (pcitab[i].did != did)
continue;
- if (pcitab[i].checkclass)
- {
- panic("rtl_probe",
- "class check not implemented", NO_NUM);
+ if (pcitab[i].checkclass) {
+ panic("class check not implemented");
}
break;
}
pci_reserve(devind);
/* printf("cr = 0x%x\n", pci_attr_r16(devind, PCI_CR)); */
bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0;
- if (bar < 0x400)
- {
- panic("rtl_probe",
- "base address is not properly configured", NO_NUM);
+ if (bar < 0x400) {
+ panic("base address is not properly configured");
}
rep->re_base_port= bar;
#define BUF_ALIGNMENT (64*1024)
if(!(mallocbuf = alloc_contig(BUF_ALIGNMENT + tot_bufsize, 0, &buf))) {
- panic("RTL8139","Couldn't allocate kernel buffer",NO_NUM);
+ panic("Couldn't allocate kernel buffer");
}
/* click-align mallocced buffer. this is what we used to get
break;
} while (getuptime(&t1)==OK && (t1-t0) < system_hz);
if (rl_inb(port, RL_BMCR) & MII_CTRL_RST)
- panic("rtl8139","reset PHY failed to complete", NO_NUM);
+ panic("reset PHY failed to complete");
#endif
/* Reset the device */
dl_port = mp->DL_PORT;
count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= RE_PORT_NR)
- panic("rtl8139"," illegal port", dl_port);
+ panic(" illegal port: %d", dl_port);
rep= &re_table[dl_port];
re_client= mp->DL_PROC;
rep->re_client= re_client;
printf("rxstat = 0x%08lx\n", rxstat);
printf("d_start: 0x%x, d_end: 0x%x, rxstat: 0x%lx\n",
d_start, d_end, rxstat);
- panic("rtl8139","received packet not OK", NO_NUM);
+ panic("received packet not OK");
}
totlen= (rxstat >> RL_RXS_LEN_S);
if (totlen < 8 || totlen > 2*ETH_MAX_PACK_SIZE)
printf(
"d_start: 0x%x, d_end: 0x%x, totlen: %d, rxstat: 0x%lx\n",
d_start, d_end, totlen, rxstat);
- panic(NULL, NULL, NO_NUM);
+ panic(NULL);
}
#if 0
#if 0
size= mp->DL_COUNT;
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
- panic("rtl8139","invalid packet size", size);
+ panic("invalid packet size: %d", size);
if (OK != sys_umap(re_client, D, (vir_bytes)mp->DL_ADDR, size, &phys_user))
- panic("rtl8139","umap_local failed", NO_NUM);
+ panic("umap_local failed");
p= rep->re_tx[tx_head].ret_buf;
cps = sys_abscopy(phys_user, p, size);
dl_port = mp->DL_PORT;
count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= RE_PORT_NR)
- panic("rtl8139"," illegal port", dl_port);
+ panic(" illegal port: %d", dl_port);
rep= &re_table[dl_port];
re_client= mp->DL_PROC;
rep->re_client= re_client;
printf("rxstat = 0x%08lx\n", rxstat);
printf("d_start: 0x%x, d_end: 0x%x, rxstat: 0x%lx\n",
d_start, d_end, rxstat);
- panic("rtl8139","received packet not OK", NO_NUM);
+ panic("received packet not OK");
}
totlen= (rxstat >> RL_RXS_LEN_S);
if (totlen < 8 || totlen > 2*ETH_MAX_PACK_SIZE)
printf(
"d_start: 0x%x, d_end: 0x%x, totlen: %d, rxstat: 0x%lx\n",
d_start, d_end, totlen, rxstat);
- panic(NULL, NULL, NO_NUM);
+ panic(NULL);
}
#if 0
cps = sys_safecopyfrom(re_client, mp->DL_GRANT, iov_offset,
(vir_bytes) rep->re_iovec_s,
n * sizeof(rep->re_iovec_s[0]), D);
- if (cps != OK)
- {
- panic(__FILE__, "rl_readv_s: sys_safecopyfrom failed",
+ if (cps != OK) {
+ panic("rl_readv_s: sys_safecopyfrom failed: %d",
cps);
}
#if 0
if (sys_umap(re_client, D, iovp->iov_addr, s, &dst_phys) != OK)
- panic("rtl8139","umap_local failed\n", NO_NUM);
+ panic("umap_local failed");
#endif
if (o >= RX_BUFSIZE)
cps = sys_safecopyto(re_client,
iovp->iov_grant, 0,
(vir_bytes) rep->v_re_rx_buf+o, s1, D);
- if (cps != OK)
- {
- panic(__FILE__,
- "rl_readv_s: sys_safecopyto failed",
- cps);
+ if (cps != OK) {
+ panic("rl_readv_s: sys_safecopyto failed: %d",
+ cps);
}
cps = sys_safecopyto(re_client,
iovp->iov_grant, s1,
(vir_bytes) rep->v_re_rx_buf, s-s1, S);
- if (cps != OK)
- {
- panic(__FILE__,
- "rl_readv_s: sys_safecopyto failed",
- cps);
+ if (cps != OK) {
+ panic("rl_readv_s: sys_safecopyto failed: %d", cps);
}
}
else
iovp->iov_grant, 0,
(vir_bytes) rep->v_re_rx_buf+o, s, D);
if (cps != OK)
- panic(__FILE__,
- "rl_readv_s: sys_safecopyto failed",
- cps);
+ panic("rl_readv_s: sys_safecopyto failed: %d", cps);
}
size += s;
port = mp->DL_PORT;
count = mp->DL_COUNT;
if (port < 0 || port >= RE_PORT_NR)
- panic("rtl8139","illegal port", port);
+ panic("illegal port: %d", port);
rep= &re_table[port];
re_client= mp->DL_PROC;
rep->re_client= re_client;
for (j= 0, iovp= rep->re_iovec; j<n; j++, iovp++)
{
s= iovp->iov_size;
- if (size + s > ETH_MAX_PACK_SIZE_TAGGED)
- {
- panic("rtl8139","invalid packet size",
- NO_NUM);
+ if (size + s > ETH_MAX_PACK_SIZE_TAGGED) {
+ panic("invalid packet size");
}
if (OK != sys_umap(re_client, D, iovp->iov_addr, s, &phys_user))
- panic("rtl8139","umap_local failed\n", NO_NUM);
+ panic("umap_local failed");
cps = sys_vircopy(re_client, D, iovp->iov_addr,
SELF, D, (vir_bytes) ret, s);
}
}
if (size < ETH_MIN_PACK_SIZE)
- panic("rtl8139","invalid packet size", size);
+ panic("invalid packet size: %d", size);
}
else
{
size= mp->DL_COUNT;
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
- panic("rtl8139","invalid packet size", size);
+ panic("invalid packet size: %d", size);
ret = rep->re_tx[tx_head].v_ret_buf;
cps = sys_vircopy(re_client, D, (vir_bytes)mp->DL_ADDR,
SELF, D, (vir_bytes) ret, size);
#endif
if (from_int)
- panic("rtl8139","should not be sending\n", NO_NUM);
+ panic("should not be sending");
rep->re_tx_mess= *mp;
reply(rep, OK, FALSE);
port = mp->DL_PORT;
count = mp->DL_COUNT;
if (port < 0 || port >= RE_PORT_NR)
- panic("rtl8139","illegal port", port);
+ panic("illegal port: %d", port);
rep= &re_table[port];
re_client= mp->DL_PROC;
rep->re_client= re_client;
cps = sys_safecopyfrom(re_client, mp->DL_GRANT, iov_offset,
(vir_bytes) rep->re_iovec_s,
n * sizeof(rep->re_iovec_s[0]), D);
- if (cps != OK)
- {
- panic(__FILE__, "rl_writev_s: sys_safecopyfrom failed",
- cps);
+ if (cps != OK) {
+ panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
}
for (j= 0, iovp= rep->re_iovec_s; j<n; j++, iovp++)
{
s= iovp->iov_size;
- if (size + s > ETH_MAX_PACK_SIZE_TAGGED)
- {
- panic("rtl8139","invalid packet size",
- NO_NUM);
+ if (size + s > ETH_MAX_PACK_SIZE_TAGGED) {
+ panic("invalid packet size");
}
cps = sys_safecopyfrom(re_client, iovp->iov_grant, 0,
(vir_bytes) ret, s, D);
- if (cps != OK)
- {
- panic(__FILE__,
- "rl_writev_s: sys_safecopyfrom failed",
- cps);
+ if (cps != OK) {
+ panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
}
size += s;
ret += s;
}
}
if (size < ETH_MIN_PACK_SIZE)
- panic("rtl8139","invalid packet size", size);
+ panic("invalid packet size: %d", size);
rl_outl(rep->re_base_port, RL_TSD0+tx_head*4,
rep->re_ertxth | size);
#endif
if (from_int)
- panic("rtl8139","should not be sending\n", NO_NUM);
+ panic("should not be sending");
rep->re_tx_mess= *mp;
reply(rep, OK, FALSE);
break;
} while (getuptime(&t1)==OK && (t1-t0) < system_hz);
if (rl_inb(port, RL_CR) & RL_CR_RE)
- panic("rtl8139","cannot disable receiver", NO_NUM);
+ panic("cannot disable receiver");
#if 0
printf("RBSTART = 0x%08x\n", rl_inl(port, RL_RBSTART));
port = mp->DL_PORT;
if (port < 0 || port >= RE_PORT_NR)
- panic("rtl8139","illegal port", port);
+ panic("illegal port: %d", port);
rep= &re_table[port];
rep->re_client= mp->DL_PROC;
r = sys_datacopy(SELF, (vir_bytes) &stats, mp->DL_PROC,
(vir_bytes) mp->DL_ADDR, sizeof(stats));
if (r != OK)
- panic(__FILE__, "rl_getstat: sys_datacopy failed", r);
+ panic("rl_getstat: sys_datacopy failed: %d", r);
mp->m_type= DL_STAT_REPLY;
mp->DL_PORT= port;
mp->DL_STAT= OK;
r= send(mp->m_source, mp);
if (r != OK)
- panic("RTL8139", "rl_getstat: send failed: %d\n", r);
+ panic("rl_getstat: send failed: %d", r);
}
/*===========================================================================*
port = mp->DL_PORT;
if (port < 0 || port >= RE_PORT_NR)
- panic("rtl8139","illegal port", port);
+ panic("illegal port: %d", port);
rep= &re_table[port];
rep->re_client= mp->DL_PROC;
r = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0,
(vir_bytes) &stats, sizeof(stats), D);
if (r != OK)
- panic(__FILE__, "rl_getstat_s: sys_safecopyto failed", r);
+ panic("rl_getstat_s: sys_safecopyto failed: %d", r);
mp->m_type= DL_STAT_REPLY;
mp->DL_PORT= port;
mp->DL_STAT= OK;
r= send(mp->m_source, mp);
if (r != OK)
- panic("RTL8139", "rl_getstat_s: send failed: %d\n", r);
+ panic("rl_getstat_s: send failed: %d", r);
}
mp->m_type= DL_NAME_REPLY;
r= send(mp->m_source, mp);
if (r != OK)
- panic("RTL8139", "rl_getname: send failed: %d\n", r);
+ panic("rl_getname: send failed: %d", r);
}
reply.DL_STAT = status | ((u32_t) err << 16);
reply.DL_COUNT = rep->re_read_s;
if (OK != (r = getuptime(&now)))
- panic("rtl8139","getuptime() failed:", r);
+ panic("getuptime() failed: %d", r);
reply.DL_CLCK = now;
r= send(rep->re_client, &reply);
if (r < 0) {
printf("RTL8139 tried sending to %d, type %d\n", rep->re_client, reply.m_type);
- panic("rtl8139","send failed:", r);
+ panic("send failed: %d", r);
}
rep->re_read_s = 0;
message *reply_mess;
{
if (send(req->m_source, reply_mess) != OK)
- panic("rtl8139","unable to mess_reply", NO_NUM);
+ panic("unable to mess_reply");
}
#if 0
if (!(rl_inb(port, RL_CR) & RL_CR_TE))
break;
} while (getuptime(&t1)==OK && (t1-t0) < system_hz);
- if (rl_inb(port, RL_CR) & RL_CR_TE)
- {
- panic("rtl8139","cannot disable transmitter",
- NO_NUM);
+ if (rl_inb(port, RL_CR) & RL_CR_TE) {
+ panic("cannot disable transmitter");
}
rl_outb(port, RL_CR, cr | RL_CR_TE);
break;
} while (getuptime(&t1) == OK && (t1 == t0));
if (!(inb_reg3(dep, 1) & 1))
- panic("set_ee_word","device remains busy", NO_NUM);
+ panic("device remains busy");
}
static void ee_wds(dep)
while (TRUE) {
if ((r = sef_receive(ANY, &m)) != OK)
- panic("rtl8169", "sef_receive failed", r);
+ panic("sef_receive failed: %d", r);
if (is_notify(m.m_type)) {
switch (_ENDPOINT_P(m.m_source)) {
break;
}
default:
- panic("rtl8169", "illegal notify from",
- m.m_type);
+ panic("illegal notify from: %d", m.m_type);
}
/* done, get nwe message */
case DL_GETSTAT_S: rl_getstat_s(&m); break;
case DL_GETNAME: rl_getname(&m); break;
default:
- panic("rtl8169", "illegal message", m.m_type);
+ panic("illegal message: %d", m.m_type);
}
}
}
if (pcitab[i].did != did)
continue;
if (pcitab[i].checkclass) {
- panic("rtl_probe",
- "class check not implemented", NO_NUM);
+ panic("class check not implemented");
}
break;
}
pci_reserve(devind);
bar = pci_attr_r32(devind, PCI_BAR) & 0xffffffe0;
if (bar < 0x400) {
- panic("rtl_probe",
- "base address is not properly configured", NO_NUM);
+ panic("base address is not properly configured");
}
rep->re_base_port = bar;
tot_bufsize += 4096 - (tot_bufsize % 4096);
if (!(mallocbuf = alloc_contig(tot_bufsize, AC_ALIGN64K, &buf)))
- panic("RTL8169", "Couldn't allocate kernel buffer", NO_NUM);
+ panic("Couldn't allocate kernel buffer");
/* Rx Descriptor */
rep->re_rx_desc = (re_desc *)mallocbuf;
message m;
int r;
if ((r = sef_receive(ANY, &m)) != OK)
- panic("rtl8169", "sef_receive failed", r);
+ panic("sef_receive failed: %d", r);
} while(m.m_source != HARDWARE);
assert(!(rep->re_flags & REF_SEND_AVAIL));
rep->re_flags |= REF_SEND_AVAIL;
dl_port = mp->DL_PORT;
count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= RE_PORT_NR)
- panic("rtl8169", " illegal port", dl_port);
+ panic(" illegal port: %d", dl_port);
rep = &re_table[dl_port];
re_client = mp->DL_PROC;
rep->re_client = re_client;
/* Someting went wrong */
printf("rl_readv_s: bad length (%u) in status 0x%08lx\n",
totlen, rxstat);
- panic(NULL, NULL, NO_NUM);
+ panic(NULL);
}
/* Should subtract the CRC */
(vir_bytes) rep->re_iovec_s,
n * sizeof(rep->re_iovec_s[0]), D);
if (cps != OK) {
- panic(__FILE__, "rl_readv_s: sys_safecopyfrom failed",
- cps);
+ panic("rl_readv_s: sys_safecopyfrom failed: %d", cps);
}
for (j = 0, iovp = rep->re_iovec_s; j < n; j++, iovp++) {
cps = sys_safecopyto(re_client, iovp->iov_grant, 0,
(vir_bytes) rep->re_rx[index].v_ret_buf + size, s, D);
if (cps != OK)
- panic(__FILE__,
- "rl_readv_s: sys_safecopyto failed", cps);
+ panic("rl_readv_s: sys_safecopyto failed: %d", cps);
size += s;
if (size == packlen)
port = mp->DL_PORT;
count = mp->DL_COUNT;
if (port < 0 || port >= RE_PORT_NR)
- panic("rtl8169", "illegal port", port);
+ panic("illegal port: %d", port);
rep = &re_table[port];
assert(mp);
assert(port >= 0 && port < RE_PORT_NR);
(vir_bytes) rep->re_iovec_s,
n * sizeof(rep->re_iovec_s[0]), D);
if (cps != OK) {
- panic(__FILE__, "rl_writev_s: sys_safecopyfrom failed",
- cps);
+ panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
}
for (j = 0, iovp = rep->re_iovec_s; j < n; j++, iovp++) {
s = iovp->iov_size;
if (size + s > ETH_MAX_PACK_SIZE_TAGGED)
- panic("rtl8169", "invalid packet size", NO_NUM);
+ panic("invalid packet size");
cps = sys_safecopyfrom(re_client, iovp->iov_grant, 0,
(vir_bytes) ret, s, D);
if (cps != OK) {
- panic(__FILE__,
- "rl_writev_s: sys_safecopyfrom failed",
- cps);
+ panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
}
size += s;
ret += s;
}
assert(desc);
if (size < ETH_MIN_PACK_SIZE)
- panic("rtl8169", "invalid packet size", size);
+ panic("invalid packet size: %d", size);
rep->re_tx[tx_head].ret_busy = TRUE;
suspend:
if (from_int)
- panic("rtl8169", "should not be sending\n", NO_NUM);
+ panic("should not be sending");
rep->re_tx_mess = *mp;
reply(rep, OK, FALSE);
port = mp->DL_PORT;
if (port < 0 || port >= RE_PORT_NR)
- panic("rtl8169", "illegal port", port);
+ panic("illegal port: %d", port);
rep = &re_table[port];
rep->re_client = mp->DL_PROC;
r = sys_datacopy(SELF, (vir_bytes) &stats, mp->DL_PROC,
(vir_bytes) mp->DL_ADDR, sizeof(stats));
if (r != OK)
- panic(__FILE__, "rl_getstat: sys_datacopy failed", r);
+ panic("rl_getstat: sys_datacopy failed: %d", r);
mp->m_type = DL_STAT_REPLY;
mp->DL_PORT = port;
mp->DL_STAT = OK;
r = send(mp->m_source, mp);
if (r != OK)
- panic("RTL8169", "rl_getstat: send failed: %d\n", r);
+ panic("rl_getstat: send failed: %d", r);
}
/*===========================================================================*
port = mp->DL_PORT;
if (port < 0 || port >= RE_PORT_NR)
- panic("rtl8169", "illegal port", port);
+ panic("illegal port: %d", port);
rep = &re_table[port];
rep->re_client = mp->DL_PROC;
r = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0,
(vir_bytes) &stats, sizeof(stats), D);
if (r != OK)
- panic(__FILE__, "rl_getstat_s: sys_safecopyto failed", r);
+ panic("rl_getstat_s: sys_safecopyto failed: %d", r);
mp->m_type = DL_STAT_REPLY;
mp->DL_PORT = port;
mp->DL_STAT = OK;
r = send(mp->m_source, mp);
if (r != OK)
- panic("RTL8169", "rl_getstat_s: send failed: %d\n", r);
+ panic("rl_getstat_s: send failed: %d", r);
}
mp->m_type = DL_NAME_REPLY;
r = send(mp->m_source, mp);
if (r != OK)
- panic("RTL8169", "rl_getname: send failed: %d\n", r);
+ panic("rl_getname: send failed: %d", r);
}
reply.DL_STAT = status | ((u32_t) err << 16);
reply.DL_COUNT = rep->re_read_s;
if (OK != (r = getuptime(&now)))
- panic("rtl8169", "getuptime() failed:", r);
+ panic("getuptime() failed: %d", r);
reply.DL_CLCK = now;
r = send(rep->re_client, &reply);
if (r < 0) {
printf("RTL8169 tried sending to %d, type %d\n",
rep->re_client, reply.m_type);
- panic("rtl8169", "send failed:", r);
+ panic("send failed: %d", r);
}
rep->re_read_s = 0;
message *reply_mess;
{
if (send(req->m_source, reply_mess) != OK)
- panic("rtl8169", "unable to mess_reply", NO_NUM);
+ panic("unable to mess_reply");
}
static void dump_phy(re_t *rep)
unsigned long value;
if ((s=sys_inb(port, &value)) != OK)
- panic("SB16DSP","sys_inb() failed", s);
+ panic("sys_inb() failed: %d", s);
return value;
}
int s;
if ((s=sys_outb(port, value)) != OK)
- panic("SB16DSP","sys_outb() failed", s);
+ panic("sys_outb() failed: %d", s);
}
DmaPhys += left;
}
#else /* CHIP != INTEL */
- panic("SB16DSP","initialization failed, CHIP != INTEL", 0);
+ panic("initialization failed: CHIP != INTEL: %d", 0);
#endif /* CHIP == INTEL */
return(OK);
/* register interrupt vector and enable irq */
if ((s=sys_irqsetpolicy(SB_IRQ, IRQ_REENABLE, &irq_hook_id )) != OK)
- panic("SB16DSP", "Couldn't set IRQ policy", s);
+ panic("Couldn't set IRQ policy: %d", s);
if ((s=sys_irqenable(&irq_hook_id)) != OK)
- panic("SB16DSP", "Couldn't enable IRQ", s);
+ panic("Couldn't enable IRQ: %d", s);
DspAvail = 1;
return OK;
{
r= sef_receive(ANY, &m);
if (r != OK)
- panic("ti1225", "sef_receive failed", r);
+ panic("sef_receive failed: %d", r);
printf("ti1225: got message %u from %d\n",
m.m_type, m.m_source);
}
: (progname=env_argv[0]);
if((r=tsc_calibrate()) != OK)
- panic("ti1225", "tsc_calibrate failed", r);
+ panic("tsc_calibrate failed: %d", r);
debug= 0;
while (c= getopt(env_argc, env_argv, "d?"), c != -1)
{
switch(c)
{
- case '?': panic("ti1225", "Usage: ti1225 [-d]", NO_NUM);
+ case '?': panic("Usage: ti1225 [-d]");
case 'd': debug++; break;
- default: panic("ti1225", "getopt failed", NO_NUM);
+ default: panic("getopt failed");
}
}
continue;
if (pcitab_ti[i].did != did)
continue;
- if (pcitab_ti[i].checkclass)
- {
- panic("ti1225",
- "fxp_probe: class check not implemented",
- NO_NUM);
+ if (pcitab_ti[i].checkclass) {
+ panic("fxp_probe: class check not implemented");
}
break;
}
}
if (v32 == 0)
- panic("ti1225", "bad legacy-mode base address 0x%x\n", v32);
+ panic("bad legacy-mode base address: %d", v32);
pp->p_exca_port= v32;
if (debug)
pp->p_hook = pp->p_irq;
r= sys_irqsetpolicy(pp->p_irq, 0, &pp->p_hook);
if (r != OK)
- panic("ti1225","sys_irqsetpolicy failed", r);
+ panic("sys_irqsetpolicy failed: %d", r);
#endif
/* Clear CBB_BC_INTEXCA */
#if USE_INTS
r= sys_irqenable(&pp->p_hook);
if (r != OK)
- panic("ti1225","unable enable interrupts", r);
+ panic("unable enable interrupts: %d", r);
#endif
}
r = ENOSYS;
#endif
if (r != OK)
- panic("ti1225", "map_regs: sys_vm_map failed", r);
+ panic("map_regs: sys_vm_map failed: %d", r);
}
PRIVATE void do_int(pp)
#if USE_INTS
r= sys_irqenable(&pp->p_hook);
if (r != OK)
- panic("ti1225","unable enable interrupts", r);
+ panic("unable enable interrupts: %d", r);
#endif
}
r= sys_inb(port, &value);
if (r != OK)
- panic("ti1225","sys_inb failed", r);
+ panic("sys_inb failed: %d", r);
return value;
}
r= sys_outb(port, value);
if (r != OK)
- panic("ti1225","sys_outb failed", r);
+ panic("sys_outb failed: %d", r);
}
/* Fetch current time in advance to prevent beeping delay. */
if ((s=getuptime(&now)) != OK)
- panic("TTY","Console couldn't get clock's uptime.", s);
+ panic("Console couldn't get clock's uptime: %d", s);
if (!beeping) {
/* Set timer channel 2, square wave, with given frequency. */
pv_set(char_out[0], TIMER_MODE, 0xB6);
if (tty_timers->tmr_exp_time != tty_next_timeout) {
tty_next_timeout = tty_timers->tmr_exp_time;
if ((s=sys_setalarm(tty_next_timeout, 1)) != OK)
- panic("TTY","Console couldn't set alarm.", s);
+ panic("Console couldn't set alarm: %d", s);
}
}
/* Fetch current time in advance to prevent beeping delay. */
if ((s=getuptime(&now)) != OK)
- panic("TTY","Console couldn't get clock's uptime.", s);
+ panic("Console couldn't get clock's uptime: %d", s);
if (!beeping) {
/* Set timer channel 2, square wave, with given frequency. */
pv_set(char_out[0], TIMER_MODE, 0xB6);
if (tty_timers->tmr_exp_time != tty_next_timeout) {
tty_next_timeout = tty_timers->tmr_exp_time;
if ((s=sys_setalarm(tty_next_timeout, 1)) != OK)
- panic("TTY","Console couldn't set alarm.", s);
+ panic("Console couldn't set alarm: %d", s);
}
}
console_memory = vm_map_phys(SELF, (void *) vid_base, vid_size);
if(console_memory == MAP_FAILED)
- panic("TTY","Console couldn't map video memory", NO_NUM);
+ panic("Console couldn't map video memory");
font_memory = vm_map_phys(SELF, (void *)GA_VIDEO_ADDRESS, GA_FONT_SIZE);
if(font_memory == MAP_FAILED)
- panic("TTY","Console couldn't map font memory", NO_NUM);
+ panic("Console couldn't map font memory");
vid_size >>= 1; /* word count */
return;
#endif
-#if 0
- if (panicing)
-#endif
- cons_putk(c);
if (c != 0) {
kmess.km_buf[kmess.km_next] = c; /* put normal char in buffer */
if (kmess.km_size < _KMESS_BUF_SIZE)
if (kbdp->offset + n > KBD_BUFSZ)
n= KBD_BUFSZ-kbdp->offset;
if (n <= 0)
- panic("TTY", "do_kbd(READ): bad n", n);
+ panic("do_kbd(READ): bad n: %d", n);
if(safecopy) {
r= sys_safecopyto(m->IO_ENDPT, (vir_bytes) m->ADDRESS, 0,
(vir_bytes) &kbdp->buf[kbdp->offset], n, D);
if (kbdp->offset + n > KBD_BUFSZ)
n= KBD_BUFSZ-kbdp->offset;
if (n <= 0)
- panic("TTY", "kbd_status: bad n", n);
+ panic("kbd_status: bad n: %d", n);
kbdp->req_size= 0;
if(kbdp->req_safe) {
r= sys_safecopyto(kbdp->req_proc, kbdp->req_addr_g, 0,
if (isaux)
kbdp= &kbdaux;
- else if (kbd.nr_open && !panicing)
+ else if (kbd.nr_open)
kbdp= &kbd;
else
kbdp= NULL;
* alarm.
*/
if ((r= getuptime(&now)) != OK)
- panic("TTY","Keyboard couldn't get clock's uptime.", r);
+ panic("Keyboard couldn't get clock's uptime: %d", r);
tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+system_hz, kbd_watchdog,
NULL);
if (tty_timers->tmr_exp_time != tty_next_timeout) {
tty_next_timeout = tty_timers->tmr_exp_time;
if ((r= sys_setalarm(tty_next_timeout, 1)) != OK)
- panic("TTY","Keyboard couldn't set alarm.", r);
+ panic("Keyboard couldn't set alarm: %d", r);
}
kbd_watchdog_set= 1;
}
#if 0
while (micro_elapsed(&ms) < 1000000);
#endif
- panic("TTY", "kbc_read failed to complete", NO_NUM);
+ panic("kbc_read failed to complete");
return EINVAL;
}
/* Set interrupt handler and enable keyboard IRQ. */
irq_hook_id = KEYBOARD_IRQ; /* id to be returned on interrupt */
if ((i=sys_irqsetpolicy(KEYBOARD_IRQ, IRQ_REENABLE, &irq_hook_id)) != OK)
- panic("TTY", "Couldn't set keyboard IRQ policy", i);
+ panic("Couldn't set keyboard IRQ policy: %d", i);
if ((i=sys_irqenable(&irq_hook_id)) != OK)
- panic("TTY", "Couldn't enable keyboard IRQs", i);
+ panic("Couldn't enable keyboard IRQs: %d", i);
kbd_irq_set |= (1 << KEYBOARD_IRQ);
/* Set AUX interrupt handler and enable AUX IRQ. */
aux_irq_hook_id = KBD_AUX_IRQ; /* id to be returned on interrupt */
if ((i=sys_irqsetpolicy(KBD_AUX_IRQ, IRQ_REENABLE,
&aux_irq_hook_id)) != OK)
- panic("TTY", "Couldn't set AUX IRQ policy", i);
+ panic("Couldn't set AUX IRQ policy: %d", i);
if ((i=sys_irqenable(&aux_irq_hook_id)) != OK)
- panic("TTY", "Couldn't enable AUX IRQs", i);
+ panic("Couldn't enable AUX IRQs: %d", i);
kbd_irq_set |= (1 << KBD_AUX_IRQ);
/* Disable the keyboard and aux */
kbd_alive= 0;
if ((r= getuptime(&now)) != OK)
- panic("TTY","Keyboard couldn't get clock's uptime.", r);
+ panic("Keyboard couldn't get clock's uptime: %d", r);
tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+system_hz, kbd_watchdog,
NULL);
if (tty_timers->tmr_exp_time != tty_next_timeout) {
tty_next_timeout = tty_timers->tmr_exp_time;
if ((r= sys_setalarm(tty_next_timeout, 1)) != OK)
- panic("TTY","Keyboard couldn't set alarm.", r);
+ panic("Keyboard couldn't set alarm: %d", r);
}
kbd_watchdog_set= 1;
}
/* Get a request message. */
r= sef_receive(ANY, &tty_mess);
if (r != 0)
- panic("TTY", "sef_receive failed with %d", r);
+ panic("sef_receive failed with: %d", r);
/* First handle all kernel notification types that the TTY supports.
* - An alarm went off, expire all timers and handle the events.
/* Get kernel environment (protected_mode, pc_at and ega are needed). */
if (OK != (r=sys_getmachine(&machine))) {
- panic("TTY","Couldn't obtain kernel environment.", r);
+ panic("Couldn't obtain kernel environment: %d", r);
}
/* Initialize the TTY driver. */
* placeholder for something that is not supposed to be a message.
*/
if(code == TTY_REVIVE) {
- panicing = 1;
printf("%s:%d: ", file, line);
- panic("TTY","tty_reply sending TTY_REVIVE", NO_NUM);
+ panic("tty_reply sending TTY_REVIVE");
}
status = sendnb(replyee, &tty_mess);
if (tp->tty_pgrp != 0) {
if (OK != (status = sys_kill(tp->tty_pgrp, sig))) {
- panic("TTY","Error, call to sys_kill failed", status);
+ panic("Error; call to sys_kill failed: %d", status);
}
}
/* Get the current time to compare the timers against. */
if ((s=getuptime(&now)) != OK)
- panic("TTY","Couldn't get uptime from clock.", s);
+ panic("Couldn't get uptime from clock: %d", s);
/* Scan the queue of timers for expired timers. This dispatch the watchdog
* functions of expired timers. Possibly a new alarm call must be scheduled.
else { /* set new sync alarm */
tty_next_timeout = tty_timers->tmr_exp_time;
if ((s=sys_setalarm(tty_next_timeout, 1)) != OK)
- panic("TTY","Couldn't set synchronous alarm.", s);
+ panic("Couldn't set synchronous alarm: %d", s);
}
}
/* Get the current time to calculate the timeout time. */
if ((s=getuptime(&now)) != OK)
- panic("TTY","Couldn't get uptime from clock.", s);
+ panic("Couldn't get uptime from clock: %d", s);
if (enable) {
exp_time = now + tty_ptr->tty_termios.c_cc[VTIME] * (system_hz/10);
/* Set a new timer for enabling the TTY events flags. */
else if (tty_timers->tmr_exp_time != tty_next_timeout) {
tty_next_timeout = tty_timers->tmr_exp_time;
if ((s=sys_setalarm(tty_next_timeout, 1)) != OK)
- panic("TTY","Couldn't set synchronous alarm.", s);
+ panic("Couldn't set synchronous alarm: %d", s);
}
}
extern unsigned long kbd_irq_set;
extern unsigned long rs_irq_set;
-extern int panicing; /* From panic.c in sysutil */
-
/* Values for the fields. */
#define NOT_ESCAPED 0 /* previous character is not LNEXT (^V) */
#define ESCAPED 1 /* previous character was LNEXT (^V) */
#define BYTE 0377 /* mask for 8 bits */
#define READING 0 /* copy data to user */
#define WRITING 1 /* copy data from user */
-#define NO_NUM 0x8000 /* used as numerical argument to panic() */
#define NIL_PTR (char *) 0 /* generally useful expression */
#define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
printf("%s:%d: actual port: 0x%x != 0x%lx || " \
"actual value: 0x%x != 0x%lx\n", \
__FILE__, __LINE__, (pv).port, _p, (pv).value, _v); \
- panic(__FILE__, "pv_set(" #pv ", " #p ", " #v ")", NO_NUM); \
+ panic("pv_set(" #pv ", " #p ", " #v ")"); \
} \
} while(0)
_PROTOTYPE( int printf, (const char *fmt, ...));
_PROTOTYPE( void kputc, (int c));
-_PROTOTYPE( void report, (char *who, char *mess, int num));
-_PROTOTYPE( void panic, (char *who, char *mess, int num));
+_PROTOTYPE( void panic, (const char *fmt, ...));
_PROTOTYPE( int getuptime, (clock_t *ticks));
_PROTOTYPE( int getuptime2, (clock_t *ticks, time_t *boottime));
_PROTOTYPE( int tickdelay, (clock_t ticks));
#define asynsend(ep, msg) asynsend3(ep, msg, 0)
_PROTOTYPE( int asynsend3, (endpoint_t ep, message *msg, int flags));
-#define ASSERT(c) if(!(c)) { panic(__FILE__, "assert " #c " failed at line", __LINE__); }
+#define ASSERT(c) if(!(c)) { panic("%s:%d: assert %s failed", __FILE__, __LINE__, #c); }
/* timing library */
#define TIMING_CATEGORIES 20
#define STATICINIT(v, n) \
if(!(v)) { \
if(!((v) = alloc_contig(sizeof(*(v)) * (n), 0, NULL))) { \
- panic(__FILE__, "allocating " #v " failed", n); \
+ panic("allocating " #v " failed: %d", n); \
} \
}
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;
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;
}
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!");
}
}
}
(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");
}
}
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;
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);
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;
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 */
phys = 0;
}
if(phys == 0)
- minix_panic("vm_lookup returned phys", phys);
+ panic("vm_lookup returned phys: %d", phys);
}
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
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);
}
lin = phys_addr[_DST_];
target = procs[_DST_];
} else {
- minix_panic("r strange", r);
+ panic("r strange: %d", r);
}
#if 0
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)
/* 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. */
}
if(fail) {
printf("%d/%d checks failed\n", fail, checked);
- minix_panic("wrong", fail);
+ panic("wrong: %d", fail);
}
}
}
if(desc->granularity & 0x20) { /* reserved */
- minix_panic("granularity reserved field set", NO_NUM);
+ panic("granularity reserved field set");
}
if(!(desc->access & PRESENT))
frame->cs,
frame->eflags
);
- minix_panic("Kernel lockup\n", NO_NUM);
+ panic("Kernel lockup");
}
void i386_watchdog_start(void)
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) {
#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
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];
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;
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;
/*
* 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
#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);
#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. */
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
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 */
}
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);
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. */
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
/*
/* 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
#endif
} else ok = 1;
if(!ok && fatalflag) {
- minix_panic("invalid endpoint ", e);
+ panic("invalid endpoint: %d", e);
}
return ok;
}
_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) );
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);
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);
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)
*/
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. */
* 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
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,
return(EINVAL);
}
- minix_panic("do_sysctl: can't happen", NO_NUM);
+ panic("do_sysctl: can't happen");
return(OK);
}
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))
return(OK);
bad:
- minix_panic("do_vdevio: unaligned port", port);
+ panic("do_vdevio: unaligned port: %d", port);
return EPERM;
}
#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
(void *) rp->p_endpoint;
break;
default:
- minix_panic("VMREQUEST wrong type", NO_NUM);
+ panic("VMREQUEST wrong type");
}
rp->p_vmrequest.vmresult = VMSUSPEND;
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);
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;
/* 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");
}
env_prefix.c \
fkey_ctl.c \
tsc_util.c \
- report.c \
read_tsc.S \
read_tsc_64.c \
ser_putc.c \
sys_hz.c \
timing.c \
profile_extern.c \
- profile.c
+ profile.c \
+ vprintf.c
.include <minix.lib.mk>
/* Get physical address, if requested. */
if(phys != NULL && sys_umap_data_fb(SELF, buf, len, phys) != OK)
- panic("alloc_contig.c", "sys_umap_data_fb failed", NO_NUM);
+ panic("sys_umap_data_fb failed");
return (void *) buf;
}
#include <minix/sysutil.h>
void __bad_assertion(const char *mess) {
- printf("%s", mess);
- panic(NULL, NULL, NO_NUM);
+ panic("%s", mess);
}
/* Tell the kernel to stop processing */
r= senda(NULL, 0);
if (r != OK)
- panic(__FILE__, "asynsend: senda failed", r);
+ panic("asynsend: senda failed: %d", r);
dst_ind= 0;
for (src_ind= first_slot; src_ind<next_slot; src_ind++)
first_slot= 0;
next_slot= dst_ind;
if (next_slot >= ASYN_NR)
- panic(__FILE__, "asynsend: msgtable full", NO_NUM);
+ panic("asynsend: msgtable full");
}
fl |= AMF_VALID;
printf("WARNING: env_get_param() failed in env_panic(): %d\n", s);
}
printf("Bad environment setting: '%s = %s'\n", key, value);
- panic("","", NO_NUM);
+ panic("");
}
*/
#define nil 0
#include <stdarg.h>
+#include <stdio.h>
#include <stddef.h>
#include <limits.h>
-#define isdigit(c) ((unsigned) ((c) - '0') < (unsigned) 10)
-
-#if !__STDC__
-/* Classic C stuff, ignore. */
-void kputc();
-int printf(fmt) char *fmt;
-#else
-
-/* Printf() uses kputc() to print characters. */
-void kputc(int c);
-
-#define count_kputc(c) do { charcount++; kputc(c); } while(0)
-
int printf(const char *fmt, ...)
-#endif
{
- int c, charcount = 0;
- enum { LEFT, RIGHT } adjust;
- enum { LONG, INT } intsize;
- int fill;
- int width, max, len, base;
- static char X2C_tab[]= "0123456789ABCDEF";
- static char x2c_tab[]= "0123456789abcdef";
- char *x2c;
- char *p;
- long i;
- unsigned long u;
- char temp[8 * sizeof(long) / 3 + 2];
-
- va_list argp;
-
- va_start(argp, fmt);
-
- while ((c= *fmt++) != 0) {
- if (c != '%') {
- /* Ordinary character. */
- count_kputc(c);
- continue;
- }
-
- /* Format specifier of the form:
- * %[adjust][fill][width][.max]keys
- */
- c= *fmt++;
-
- adjust= RIGHT;
- if (c == '-') {
- adjust= LEFT;
- c= *fmt++;
- }
-
- fill= ' ';
- if (c == '0') {
- fill= '0';
- c= *fmt++;
- }
-
- width= 0;
- if (c == '*') {
- /* Width is specified as an argument, e.g. %*d. */
- width= va_arg(argp, int);
- c= *fmt++;
- } else
- if (isdigit(c)) {
- /* A number tells the width, e.g. %10d. */
- do {
- width= width * 10 + (c - '0');
- } while (isdigit(c= *fmt++));
- }
-
- max= INT_MAX;
- if (c == '.') {
- /* Max field length coming up. */
- if ((c= *fmt++) == '*') {
- max= va_arg(argp, int);
- c= *fmt++;
- } else
- if (isdigit(c)) {
- max= 0;
- do {
- max= max * 10 + (c - '0');
- } while (isdigit(c= *fmt++));
- }
- }
+ int n;
+ va_list ap;
- /* Set a few flags to the default. */
- x2c= x2c_tab;
- i= 0;
- base= 10;
- intsize= INT;
- if (c == 'l' || c == 'L') {
- /* "Long" key, e.g. %ld. */
- intsize= LONG;
- c= *fmt++;
- }
- if (c == 0) break;
+ va_start(ap, fmt);
+ n = vprintf(fmt, ap);
+ va_end(ap);
- switch (c) {
- /* Decimal. */
- case 'd':
- i= intsize == LONG ? va_arg(argp, long)
- : va_arg(argp, int);
- u= i < 0 ? -i : i;
- goto int2ascii;
-
- /* Octal. */
- case 'o':
- base= 010;
- goto getint;
-
- /* Pointer, interpret as %X or %lX. */
- case 'p':
- if (sizeof(char *) > sizeof(int)) intsize= LONG;
-
- /* Hexadecimal. %X prints upper case A-F, not %lx. */
- case 'X':
- x2c= X2C_tab;
- case 'x':
- base= 0x10;
- goto getint;
-
- /* Unsigned decimal. */
- case 'u':
- getint:
- u= intsize == LONG ? va_arg(argp, unsigned long)
- : va_arg(argp, unsigned int);
- int2ascii:
- p= temp + sizeof(temp)-1;
- *p= 0;
- do {
- *--p= x2c[(ptrdiff_t) (u % base)];
- } while ((u /= base) > 0);
- goto string_length;
-
- /* A character. */
- case 'c':
- p= temp;
- *p= va_arg(argp, int);
- len= 1;
- goto string_print;
-
- /* Simply a percent. */
- case '%':
- p= temp;
- *p= '%';
- len= 1;
- goto string_print;
-
- /* A string. The other cases will join in here. */
- case 's':
- p= va_arg(argp, char *);
-
- string_length:
- for (len= 0; p[len] != 0 && len < max; len++) {}
-
- string_print:
- width -= len;
- if (i < 0) width--;
- if (fill == '0' && i < 0) count_kputc('-');
- if (adjust == RIGHT) {
- while (width > 0) { count_kputc(fill); width--; }
- }
- if (fill == ' ' && i < 0) count_kputc('-');
- while (len > 0) { count_kputc((unsigned char) *p++); len--; }
- while (width > 0) { count_kputc(fill); width--; }
- break;
-
- /* Unrecognized format key, echo it back. */
- default:
- count_kputc('%');
- count_kputc(c);
- }
- }
-
- /* Mark the end with a null (should be something else, like -1). */
- kputc(0);
- va_end(argp);
- return charcount;
+ return n;
}
-/*
- * $PchId: kprintf.c,v 1.5 1996/04/11 06:59:05 philip Exp $
- */
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
+#include <stdarg.h>
#include <minix/sysutil.h>
#include "syslib.h"
-int panicing= 0;
-
/*===========================================================================*
- * panic *
+ * panic *
*===========================================================================*/
-PUBLIC void panic(who, mess, num)
-char *who; /* server identification */
-char *mess; /* message format string */
-int num; /* number to go with format string */
+PUBLIC void panic(const char *fmt, ...)
{
/* Something awful has happened. Panics are caused when an internal
* inconsistency is detected, e.g., a programming error or illegal
endpoint_t me = NONE;
char name[20];
void (*suicide)(void);
+ static int panicing= 0;
+ va_list args;
+
if(panicing) return;
panicing= 1;
if(sys_whoami(&me, name, sizeof(name)) == OK && me != NONE)
- printf("%s(%d): ", name, me);
+ printf("%s(%d): panic: ", name, me);
else
- printf("(sys_whoami failed): ");
+ printf("(sys_whoami failed): panic: ");
+
+ if(fmt) {
+ va_start(args, fmt);
+ vprintf(fmt, args);
+ va_end(fmt);
+ } else {
+ printf("no message\n");
+ }
+ printf("\n");
+
printf("syslib:panic.c: stacktrace: ");
util_stacktrace();
- if (NULL != who && NULL != mess) {
- if (num != NO_NUM) {
- printf("Panic in %s: %s: %d\n", who, mess, num);
- } else {
- printf("Panic in %s: %s\n", who, mess);
- }
- }
-
/* Try exit */
_exit(1);
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_attr_r16: can't talk to PCI", r);
+ panic("pci_attr_r16: can't talk to PCI: %d", r);
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_attr_r16: got bad reply from PCI", m.m_type);
+ panic("pci_attr_r16: got bad reply from PCI: %d", m.m_type);
return m.m2_l1;
}
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_attr_r32: can't talk to PCI", r);
+ panic("pci_attr_r32: can't talk to PCI: %d", r);
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_attr_r32: got bad reply from PCI", m.m_type);
+ panic("pci_attr_r32: got bad reply from PCI: %d", m.m_type);
return m.m2_l1;
}
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_attr_r8: can't talk to PCI", r);
+ panic("pci_attr_r8: can't talk to PCI: %d", r);
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_attr_r8: got bad reply from PCI", m.m_type);
+ panic("pci_attr_r8: got bad reply from PCI: %d", m.m_type);
return m.m2_l1;
}
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_attr_w16: can't talk to PCI", r);
+ panic("pci_attr_w16: can't talk to PCI: %d", r);
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_attr_w16: got bad reply from PCI", m.m_type);
+ panic("pci_attr_w16: got bad reply from PCI: %d", m.m_type);
}
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_attr_w32: can't talk to PCI", r);
+ panic("pci_attr_w32: can't talk to PCI: %d", r);
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_attr_w32: got bad reply from PCI", m.m_type);
+ panic("pci_attr_w32: got bad reply from PCI: %d", m.m_type);
}
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_attr_w8: can't talk to PCI", r);
+ panic("pci_attr_w8: can't talk to PCI: %d", r);
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_attr_w8: got bad reply from PCI", m.m_type);
+ panic("pci_attr_w8: got bad reply from PCI: %d", m.m_type);
}
r= ds_retrieve_label_num("pci", &u32);
if (r != 0)
{
- panic("syslib/" __FILE__,
- "pci_del_acl: _pm_findproc failed for 'pci'",
- r);
+ panic("pci_del_acl: _pm_findproc failed for 'pci': %d", r);
}
pci_procnr = u32;
}
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_del_acl: can't talk to PCI", r);
+ panic("pci_del_acl: can't talk to PCI: %d", r);
return m.m_type;
}
r= sendrec(pci_procnr, &m);
cpf_revoke(gid);
if (r != 0)
- panic("syslib/" __FILE__, "pci_dev_name: can't talk to PCI", r);
+ panic("pci_dev_name: can't talk to PCI: %d", r);
if (m.m_type == ENOENT)
{
return NULL; /* No name for this device */
}
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_dev_name: got bad reply from PCI", m.m_type);
+ panic("pci_dev_name: got bad reply from PCI: %d", m.m_type);
name[sizeof(name)-1]= '\0'; /* Make sure that the string is NUL
* terminated.
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_find_dev: can't talk to PCI", r);
+ panic("pci_find_dev: can't talk to PCI: %d", r);
if (m.m_type == 1)
{
return 1;
}
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_find_dev: got bad reply from PCI", m.m_type);
+ panic("pci_find_dev: got bad reply from PCI: %d", m.m_type);
printf("pci_find_dev: got nothing\n");
return 0;
m.m_type= BUSC_PCI_FIRST_DEV;
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_first_dev: can't talk to PCI", r);
+ panic("pci_first_dev: can't talk to PCI: %d", r);
if (m.m_type == 1)
{
*devindp= m.m1_i1;
return 1;
}
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_first_dev: got bad reply from PCI", m.m_type);
+ panic("pci_first_dev: got bad reply from PCI: %d", m.m_type);
#if DEBUG
printf("pci_first_dev: got nothing\n");
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_ids: can't talk to PCI", r);
+ panic("pci_ids: can't talk to PCI: %d", r);
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_ids: got bad reply from PCI", m.m_type);
+ panic("pci_ids: got bad reply from PCI: %d", m.m_type);
*vidp= m.m1_i1;
*didp= m.m1_i2;
printf("pci_ids: %04x/%04x\n", *vidp, *didp);
r= ds_retrieve_label_num("pci", &u32);
if (r != 0)
- panic("syslib/" __FILE__, "pci_init1: ds_retrieve_label_num failed for 'pci'", r);
+ panic("pci_init1: ds_retrieve_label_num failed for 'pci': %d", r);
pci_procnr= u32;
m.m_type= BUSC_PCI_INIT;
}
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_init1: can't talk to PCI", r);
+ panic("pci_init1: can't talk to PCI: %d", r);
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_init1: got bad reply from PCI", m.m_type);
+ panic("pci_init1: got bad reply from PCI: %d", m.m_type);
}
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_next_dev: can't talk to PCI", r);
+ panic("pci_next_dev: can't talk to PCI: %d", r);
if (m.m_type == 1)
{
return 1;
}
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_next_dev: got bad reply from PCI", m.m_type);
+ panic("pci_next_dev: got bad reply from PCI: %d", m.m_type);
return 0;
}
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_rescan_bus: can't talk to PCI", r);
+ panic("pci_rescan_bus: can't talk to PCI: %d", r);
if (m.m_type != 0)
{
- panic("syslib/" __FILE__, "pci_rescan_bus: got bad reply from PCI",
- m.m_type);
+ panic("pci_rescan_bus: got bad reply from PCI: %d", m.m_type);
}
}
r= sendrec(pci_procnr, &m);
if (r != 0)
- panic("syslib/" __FILE__, "pci_reserve: can't talk to PCI", r);
+ panic("pci_reserve: can't talk to PCI: %d", r);
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_reserve: got bad reply from PCI", m.m_type);
+ panic("pci_reserve: got bad reply from PCI: %d", m.m_type);
}
/*===========================================================================*
r= ds_retrieve_label_num("pci", &u32);
if (r != 0)
{
- panic("syslib/" __FILE__,
- "pci_set_acl: ds_retrieve_label_num failed for 'pci'",
- r);
+ panic("pci_set_acl: ds_retrieve_label_num failed for 'pci': %d", r);
}
pci_procnr = u32;
}
r= sendrec(pci_procnr, &m);
cpf_revoke(gid);
if (r != 0)
- panic("syslib/" __FILE__, "pci_set_acl: can't talk to PCI", r);
+ panic("pci_set_acl: can't talk to PCI: %d", r);
return m.m_type;
}
r= sendrec(pci_procnr, &m);
cpf_revoke(gid);
if (r != 0)
- panic("syslib/" __FILE__, "pci_slot_name: can't talk to PCI", r);
+ panic("pci_slot_name: can't talk to PCI: %d", r);
if (m.m_type != 0)
- panic("syslib/" __FILE__, "pci_slot_name: got bad reply from PCI", m.m_type);
+ panic("pci_slot_name: got bad reply from PCI: %d", m.m_type);
name[sizeof(name)-1]= '\0'; /* Make sure that the string is NUL
* terminated.
+++ /dev/null
-#include "sysutil.h"
-
-/*===========================================================================*
- * report *
- *===========================================================================*/
-PUBLIC void report(who, mess, num)
-char *who; /* server identification */
-char *mess; /* message format to print */
-int num; /* number to go with the message */
-{
-/* Display a message for a server. */
-
- if (num != NO_NUM) {
- printf("%s: %s %d\n", who, mess, num);
- } else {
- printf("%s: %s\n", who, mess);
- }
-}
-
-
/* Intercept SEF Init requests. */
if(sef_self_endpoint == RS_PROC_NR) {
if((r = do_sef_rs_init()) != OK) {
- panic("SEF", "unable to complete init", r);
+ panic("unable to complete init: %d", r);
}
}
else {
message m;
if((r = receive(RS_PROC_NR, &m)) != OK) {
- panic("SEF", "unable to receive from RS", r);
+ panic("unable to receive from RS: %d", r);
}
if(IS_SEF_INIT_REQUEST(&m)) {
if((r = do_sef_init_request(&m)) != OK) {
- panic("SEF", "unable to process init request", r);
+ panic("unable to process init request: %d", r);
}
}
else {
- panic("SEF", "unable to receive init request", NO_NUM);
+ panic("unable to receive init request");
}
}
#endif
m.RS_LU_RESULT = result;
r = sendrec(RS_PROC_NR, &m);
if ( r != OK) {
- panic("SEF", "sendrec failed", r);
+ panic("sendrec failed: %d", r);
}
}
}
if (timingdata->starttimes[HIGHCOUNT]) {
- panic(__FILE__, "restart timer?", NO_NUM);
+ panic("restart timer?");
return;
}
read_tsc(&h, &l);
if (!timingdata->starttimes[HIGHCOUNT]) {
- panic(__FILE__, "timer stopped but not started", NO_NUM);
+ panic("timer stopped but not started");
return;
}
if (timingdata->starttimes[HIGHCOUNT] == h) {
timingdata->binsize;
if (bin < 0 || bin >= TIMING_POINTS) {
/* not serious, but can't happen, so shouldn't */
- panic(__FILE__, "bin out of range", bin);
+ panic("bin out of range: %d", bin);
} else {
timingdata->lock_timings[bin]++;
timingdata->measurements++;
if(!calibrated) { \
int r; \
if((r=tsc_calibrate()) != OK) \
- panic(__FILE__, "calibrate failed\n", r); \
+ panic("calibrate failed: %d", r); \
}
static u32_t calib_tsc, Hz = 0;
diff = sub64(end, start);
if(ex64hi(diff) != 0)
- panic(__FILE__,
- "tsc_calibrate: CALIBRATE_TICKS too high "
- "for TSC frequency\n", NO_NUM);
+ panic("tsc_calibrate: CALIBRATE_TICKS too high for TSC frequency");
calib_tsc = ex64lo(diff);
#if 0
printf("tsc_calibrate: "
--- /dev/null
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <ctype.h>
+#include <limits.h>
+
+/* vprintf() uses kputc() to print characters. */
+void kputc(int c);
+
+#define count_kputc(c) do { charcount++; kputc(c); } while(0)
+
+int vprintf(const char *fmt, va_list argp)
+{
+ int c, charcount = 0;
+ enum { LEFT, RIGHT } adjust;
+ enum { LONG, INT } intsize;
+ int fill;
+ int width, max, len, base;
+ static char X2C_tab[]= "0123456789ABCDEF";
+ static char x2c_tab[]= "0123456789abcdef";
+ char *x2c;
+ char *p;
+ long i;
+ unsigned long u;
+ char temp[8 * sizeof(long) / 3 + 2];
+
+ while ((c= *fmt++) != 0) {
+ if (c != '%') {
+ /* Ordinary character. */
+ count_kputc(c);
+ continue;
+ }
+
+ /* Format specifier of the form:
+ * %[adjust][fill][width][.max]keys
+ */
+ c= *fmt++;
+
+ adjust= RIGHT;
+ if (c == '-') {
+ adjust= LEFT;
+ c= *fmt++;
+ }
+
+ fill= ' ';
+ if (c == '0') {
+ fill= '0';
+ c= *fmt++;
+ }
+
+ width= 0;
+ if (c == '*') {
+ /* Width is specified as an argument, e.g. %*d. */
+ width= va_arg(argp, int);
+ c= *fmt++;
+ } else
+ if (isdigit(c)) {
+ /* A number tells the width, e.g. %10d. */
+ do {
+ width= width * 10 + (c - '0');
+ } while (isdigit(c= *fmt++));
+ }
+
+ max= INT_MAX;
+ if (c == '.') {
+ /* Max field length coming up. */
+ if ((c= *fmt++) == '*') {
+ max= va_arg(argp, int);
+ c= *fmt++;
+ } else
+ if (isdigit(c)) {
+ max= 0;
+ do {
+ max= max * 10 + (c - '0');
+ } while (isdigit(c= *fmt++));
+ }
+ }
+
+ /* Set a few flags to the default. */
+ x2c= x2c_tab;
+ i= 0;
+ base= 10;
+ intsize= INT;
+ if (c == 'l' || c == 'L') {
+ /* "Long" key, e.g. %ld. */
+ intsize= LONG;
+ c= *fmt++;
+ }
+ if (c == 0) break;
+
+ switch (c) {
+ /* Decimal. */
+ case 'd':
+ i= intsize == LONG ? va_arg(argp, long)
+ : va_arg(argp, int);
+ u= i < 0 ? -i : i;
+ goto int2ascii;
+
+ /* Octal. */
+ case 'o':
+ base= 010;
+ goto getint;
+
+ /* Pointer, interpret as %X or %lX. */
+ case 'p':
+ if (sizeof(char *) > sizeof(int)) intsize= LONG;
+
+ /* Hexadecimal. %X prints upper case A-F, not %lx. */
+ case 'X':
+ x2c= X2C_tab;
+ case 'x':
+ base= 0x10;
+ goto getint;
+
+ /* Unsigned decimal. */
+ case 'u':
+ getint:
+ u= intsize == LONG ? va_arg(argp, unsigned long)
+ : va_arg(argp, unsigned int);
+ int2ascii:
+ p= temp + sizeof(temp)-1;
+ *p= 0;
+ do {
+ *--p= x2c[(ptrdiff_t) (u % base)];
+ } while ((u /= base) > 0);
+ goto string_length;
+
+ /* A character. */
+ case 'c':
+ p= temp;
+ *p= va_arg(argp, int);
+ len= 1;
+ goto string_print;
+
+ /* Simply a percent. */
+ case '%':
+ p= temp;
+ *p= '%';
+ len= 1;
+ goto string_print;
+
+ /* A string. The other cases will join in here. */
+ case 's':
+ p= va_arg(argp, char *);
+
+ string_length:
+ for (len= 0; p[len] != 0 && len < max; len++) {}
+
+ string_print:
+ width -= len;
+ if (i < 0) width--;
+ if (fill == '0' && i < 0) count_kputc('-');
+ if (adjust == RIGHT) {
+ while (width > 0) { count_kputc(fill); width--; }
+ }
+ if (fill == ' ' && i < 0) count_kputc('-');
+ while (len > 0) { count_kputc((unsigned char) *p++); len--; }
+ while (width > 0) { count_kputc(fill); width--; }
+ break;
+
+ /* Unrecognized format key, echo it back. */
+ default:
+ count_kputc('%');
+ count_kputc(c);
+ }
+ }
+
+ /* Mark the end with a null (should be something else, like -1). */
+ kputc(0);
+ return charcount;
+}
+
+/*
+ * $PchId: kprintf.c,v 1.5 1996/04/11 06:59:05 philip Exp $
+ */
sig_handler();
break;
default:
- report("DS","warning, got illegal notify from:",
+ printf("DS: warning, got illegal notify from: %d\n",
m.m_source);
result = EINVAL;
goto send_reply;
result = do_getsysinfo(&m);
break;
default:
- report("DS","warning, got illegal request from:", m.m_source);
+ printf("DS: warning, got illegal request from %d\n", m.m_source);
result = EINVAL;
}
int status = 0;
status = sef_receive(ANY, m_ptr); /* this blocks until message arrives */
if (OK != status)
- panic("DS","failed to receive message!", status);
+ panic("failed to receive message!: %d", status);
who_e = m_ptr->m_source; /* message arrived! set sender */
callnr = m_ptr->m_type; /* set function call number */
}
/* Map all the services in the boot image. */
if((r = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0,
(vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) {
- panic("DS", "sys_safecopyfrom failed", r);
+ panic("sys_safecopyfrom failed: %d", r);
}
for(i=0;i < NR_BOOT_PROCS;i++) {
if(rprocpub[i].in_use) {
if((r = map_service(&rprocpub[i])) != OK) {
- panic("DS", "unable to map service", r);
+ panic("unable to map service: %d", r);
}
}
}
ino->i_ref++;
if (ino->i_ref == 0)
- panic("HGFS", "inode reference count wrapped", NO_NUM);
+ panic("inode reference count wrapped");
}
/*===========================================================================*
int r;
if ((r = sef_receive(ANY, &m_in)) != OK)
- panic("HGFS", "receive failed", r);
+ panic("receive failed: %d", r);
*who_e = m_in.m_source;
{
printf("\ninet stacktrace: ");
util_stacktrace();
- (panic)("INET","aborted due to a panic",NO_NUM);
+ (panic)("aborted due to a panic");
for(;;);
}
else s = fkey_unmap(&fkeys, &sfkeys);
if (s != OK)
- report("IS", "warning, fkey_ctl failed:", s);
+ printf("IS: warning, fkey_ctl failed: %d\n", s);
}
/*===========================================================================*
m->m_type = FKEY_CONTROL;
m->FKEY_REQUEST = FKEY_EVENTS;
if (OK != (s=sendrec(TTY_PROC_NR, m)))
- report("IS", "warning, sendrec to TTY failed", s);
+ printf("IS: warning, sendrec to TTY failed: %d\n", s);
/* Now check which keys were pressed: F1-F12, SF1-SF12. */
for(h=0; h < NHOOKS; h++)
static int offsetlines = 0;
if ((r = sys_getlocktimings(&timingdata[0])) != OK) {
- report("IS","warning: couldn't get copy of lock timings", r);
+ printf("IS: warning: couldn't get copy of lock timings: %d\n", r);
return;
}
/* Try to get a copy of the kernel messages. */
if ((r = sys_getkmessages(&kmess)) != OK) {
- report("IS","warning: couldn't get copy of kmessages", r);
+ printf("IS: warning: couldn't get copy of kmessages: %d\n", r);
return;
}
/* Try to get a copy of the boot monitor parameters. */
if ((r = sys_getmonparams(val, sizeof(val))) != OK) {
- report("IS","warning: couldn't get copy of monitor params", r);
+ printf("IS: warning: couldn't get copy of monitor params: %d\n", r);
return;
}
struct irq_hook *e; /* irq tab entry */
if ((r = sys_getirqhooks(irq_hooks)) != OK) {
- report("IS","warning: couldn't get copy of irq hooks", r);
+ printf("IS: warning: couldn't get copy of irq hooks: %d\n", r);
return;
}
if ((r = sys_getirqactids(irq_actids)) != OK) {
- report("IS","warning: couldn't get copy of irq mask", r);
+ printf("IS: warning: couldn't get copy of irq mask: %d\n", r);
return;
}
struct boot_image *ip;
if ((r = sys_getimage(image)) != OK) {
- report("IS","warning: couldn't get copy of image table", r);
+ printf("IS: warning: couldn't get copy of image table: %d\n", r);
return;
}
printf("Image table dump showing all processes included in system image.\n");
struct machine machine;
int r;
if ((r = sys_getkinfo(&kinfo)) != OK) {
- report("IS","warning: couldn't get copy of kernel info struct", r);
+ printf("IS: warning: couldn't get copy of kernel info struct: %d\n", r);
return;
}
if ((r = sys_getmachine(&machine)) != OK) {
- report("IS","warning: couldn't get copy of kernel machine struct", r);
+ printf("IS: warning: couldn't get copy of kernel machine struct: %d\n", r);
return;
}
/* First obtain a fresh copy of the current process and system table. */
if ((r = sys_getprivtab(priv)) != OK) {
- report("IS","warning: couldn't get copy of system privileges table", r);
+ printf("IS: warning: couldn't get copy of system privileges table: %d\n", r);
return;
}
if ((r = sys_getproctab(proc)) != OK) {
- report("IS","warning: couldn't get copy of process table", r);
+ printf("IS: warning: couldn't get copy of process table: %d\n", r);
return;
}
/* First obtain a fresh copy of the current process table. */
if ((r = sys_getproctab(proc)) != OK) {
- report("IS","warning: couldn't get copy of process table", r);
+ printf("IS: warning: couldn't get copy of process table: %d\n", r);
return;
}
/* First obtain a fresh copy of the current process table. */
if ((r = sys_getproctab(proc)) != OK) {
- report("IS","warning: couldn't get copy of process table", r);
+ printf("IS: warning: couldn't get copy of process table: %d\n", r);
return;
}
/* First obtain a fresh copy of the current process table. */
if ((r = sys_getproctab(proc)) != OK) {
- report("IS","warning: couldn't get copy of process table", r);
+ printf("IS: warning: couldn't get copy of process table: %d\n", r);
return;
}
if (prev_i == -1) {
if ((r = vm_info_stats(&vsi)) != OK) {
- report("IS", "warning: couldn't talk to VM", r);
+ printf("IS: warning: couldn't talk to VM: %d\n", r);
return;
}
}
if ((r = sys_getproctab(proc)) != OK) {
- report("IS", "warning: couldn't get copy of process table", r);
+ printf("IS: warning: couldn't get copy of process table: %d\n", r);
return;
}
sigact.sa_mask = ~0; /* block all other signals */
sigact.sa_flags = 0; /* default behaviour */
if (sigaction(SIGTERM, &sigact, NULL) < 0)
- report("IS","warning, sigaction() failed", errno);
+ printf("IS: warning, sigaction() failed: %d\n", errno);
/* Set key mappings. */
map_unmap_fkeys(TRUE /*map*/);
int status = 0;
status = sef_receive(ANY, &m_in); /* this blocks until message arrives */
if (OK != status)
- panic("IS","sef_receive failed!", status);
+ panic("sef_receive failed!: %d", status);
who_e = m_in.m_source; /* message arrived! set sender */
callnr = m_in.m_type; /* set function call number */
}
m_out.m_type = result; /* build reply message */
send_status = send(who, &m_out); /* send the message */
if (OK != send_status)
- panic("IS", "unable to send reply!", send_status);
+ panic("unable to send reply!: %d", send_status);
}
if((*gid=cpf_grant_direct(driver, (vir_bytes) *buf,
bytes, *op == DEV_READ_S ? CPF_WRITE :
CPF_READ)) < 0) {
- panic(__FILE__,
- "cpf_grant_magic of buffer failed\n", NO_NUM);
+ panic("cpf_grant_magic of buffer failed");
}
break;
if((*gid = cpf_grant_direct(driver,
(vir_bytes) new_iovec, bytes * sizeof(iovec_t),
CPF_READ | CPF_WRITE)) < 0) {
- panic(__FILE__,
- "cpf_grant_direct of vector failed", NO_NUM);
+ panic("cpf_grant_direct of vector failed");
}
v = (iovec_t *) *buf;
/* Grant access to i/o buffers. */
for(j = 0; j < bytes; j++) {
if(j >= NR_IOREQS)
- panic(__FILE__, "vec too big", bytes);
+ panic("vec too big: %d", bytes);
new_iovec[j].iov_addr = gids[j] =
cpf_grant_direct(driver, (vir_bytes)
v[j].iov_addr, v[j].iov_size,
*op == DEV_GATHER_S ? CPF_WRITE : CPF_READ);
if(!GRANT_VALID(gids[j])) {
- panic(__FILE__, "mfs: grant to iovec buf failed",
- NO_NUM);
+ panic("mfs: grant to iovec buf failed");
}
new_iovec[j].iov_size = v[j].iov_size;
(*vec_grants)++;
major = (dev >> MAJOR) & BYTE;
if (major >= NR_DEVICES) major = 0;
r = gen_opcl(driver_e, DEV_OPEN, dev, proc, flags);
- if (r == SUSPEND) panic(__FILE__,"suspend on open from", NO_NUM);
+ if (r == SUSPEND) panic("suspend on open from");
return(r);
}
/* The io vector copying relies on this I/O being for FS itself. */
if(proc_e != SELF_E) {
printf("ISOFS(%d) doing block_dev_io for non-self %d\n", SELF_E, proc_e);
- panic(__FILE__, "doing block_dev_io for non-self", proc_e);
+ panic("doing block_dev_io for non-self: %d", proc_e);
}
/* By default, these are right. */
return(r);
}
else
- panic(__FILE__,"call_task: can't send/receive", r);
+ panic("call_task: can't send/receive: %d", r);
} else {
/* Did the process we did the sendrec() for get a result? */
if (m.REP_ENDPT != proc_e) {
/* Task has completed. See if call completed. */
if (m.REP_STATUS == SUSPEND) {
- panic(__FILE__, "ISOFS block_dev_io: driver returned SUSPEND", NO_NUM);
+ panic("ISOFS block_dev_io: driver returned SUSPEND");
}
if(buf != buf_used && r == OK) {
if (r != OK) {
if (r == EDEADSRCDST) {
printf("fs: dead driver %d\n", task_nr);
- panic(__FILE__, "should handle crashed drivers",
- NO_NUM);
+ panic("should handle crashed drivers");
/* dmap_unmap_by_endpt(task_nr); */
return r;
}
printf("fs: ELOCKED talking to %d\n", task_nr);
return r;
}
- panic(__FILE__,"call_task: can't send/receive", r);
+ panic("call_task: can't send/receive: %d", r);
}
/* Did the process we did the sendrec() for get a result? */
fs_m_in.m_type = FS_READY;
if ((r = send(FS_PROC_NR, &fs_m_in)) != OK) {
- panic("ISOFS", "Error sending login to VFS", r);
+ panic("Error sending login to VFS: %d", r);
}
return(OK);
{
int s; /* receive status */
if (OK != (s = sef_receive(ANY, m_in))) /* wait for message */
- panic("ISOFS","sef_receive failed", s);
+ panic("sef_receive failed: %d", s);
}
/*===========================================================================*
/* utility.c */
_PROTOTYPE(int no_sys, (void));
-_PROTOTYPE(void panic, (char *who, char *mess, int num));
(vir_bytes)getdents_buf, tmpbuf_offset, D);
if (r != OK)
- panic(__FILE__,
- "fs_getdents: sys_safecopyto failed\n",r);
-
+ panic("fs_getdents: sys_safecopyto failed: %d", r);
userbuf_off += tmpbuf_offset;
tmpbuf_offset= 0;
}
r = sys_safecopyto(FS_PROC_NR, gid, userbuf_off,
(vir_bytes) getdents_buf, tmpbuf_offset, D);
if (r != OK)
- panic(__FILE__, "fs_getdents: sys_safecopyto failed\n", r);
+ panic("fs_getdents: sys_safecopyto failed: %d", r);
userbuf_off += tmpbuf_offset;
}
/* In all cases, bp now points to a valid buffer. */
if (bp == NIL_BUF) {
- panic(__FILE__,"bp not valid in rw_chunk, this can't happen", NO_NUM);
+ panic("bp not valid in rw_chunk; this can't happen");
}
r = sys_safecopyto(FS_PROC_NR, gid, buf_off,
#include <minix/callnr.h>
#include <minix/vfsif.h>
-static int panicking;
-
/*===========================================================================*
* no_sys *
*===========================================================================*/
return(EINVAL);
}
-/*===========================================================================*
- * panic *
- *===========================================================================*/
-PUBLIC void panic(who, mess, num)
-char *who; /* who caused the panic */
-char *mess; /* panic message string */
-int num; /* number to go with it */
-{
-/* Something awful has happened. Panics are caused when an internal
- * inconsistency is detected, e.g., a programming error or illegal value of a
- * defined constant.
- */
- if (panicking) return; /* do not panic during a sync */
- panicking = TRUE; /* prevent another panic during the sync */
-
- printf("FS panic (%s): %s ", who, mess);
- if (num != NO_NUM) printf("%d",num);
- exit(1);
-}
}
/* Desired block is not on available chain. Take oldest block ('front'). */
- if ((bp = front) == NIL_BUF) panic(__FILE__,"all buffers in use", NR_BUFS);
+ if ((bp = front) == NIL_BUF) panic("all buffers in use: %d", NR_BUFS);
if(bp->b_bytes < fs_block_size) {
ASSERT(!bp->bp);
bp && bp->b_bytes < fs_block_size; bp = bp->b_next)
;
if(!bp) {
- panic("MFS", "no buffer available", NO_NUM);
+ panic("no buffer available");
}
} else {
bp->b_bytes = fs_block_size;
for (bp = &buf[0]; bp < &buf[NR_BUFS]; bp++)
if(bp->b_count != 0)
- panic("MFS", "change blocksize with buffer in use",
- NO_NUM);
+ panic("change blocksize with buffer in use");
for (rip = &inode[0]; rip < &inode[NR_INODES]; rip++)
if (rip->i_count > 0)
- panic("MFS", "change blocksize with inode in use",
- NO_NUM);
+ panic("change blocksize with inode in use");
fs_sync();
if((*gid=cpf_grant_direct(driver, (vir_bytes) *buf, bytes,
*op == DEV_READ_S?CPF_WRITE:CPF_READ))<0) {
- panic(__FILE__,"cpf_grant_magic of buffer failed\n", NO_NUM);
+ panic("cpf_grant_magic of buffer failed");
}
break;
if((*gid = cpf_grant_direct(driver, (vir_bytes) new_iovec,
bytes * sizeof(iovec_t),
CPF_READ | CPF_WRITE)) < 0) {
- panic(__FILE__, "cpf_grant_direct of vector failed", NO_NUM);
+ panic("cpf_grant_direct of vector failed");
}
v = (iovec_t *) *buf;
/* Grant access to i/o buffers. */
for(j = 0; j < bytes; j++) {
if(j >= NR_IOREQS)
- panic(__FILE__, "vec too big", bytes);
+ panic("vec too big: %d", bytes);
new_iovec[j].iov_addr = gids[j] =
cpf_grant_direct(driver, (vir_bytes) v[j].iov_addr,
v[j].iov_size,
*op == DEV_GATHER_S ? CPF_WRITE : CPF_READ);
if(!GRANT_VALID(gids[j])) {
- panic(__FILE__, "mfs: grant to iovec buf failed",
- NO_NUM);
+ panic("mfs: grant to iovec buf failed");
}
new_iovec[j].iov_size = v[j].iov_size;
(*vec_grants)++;
/* The io vector copying relies on this I/O being for FS itself. */
if(proc_e != SELF_E) {
printf("MFS(%d) doing block_dev_io for non-self %d\n", SELF_E, proc_e);
- panic(__FILE__, "doing block_dev_io for non-self", proc_e);
+ panic("doing block_dev_io for non-self: %d", proc_e);
}
/* By default, these are right. */
return r;
}
else
- panic(__FILE__,"call_task: can't send/receive", r);
+ panic("call_task: can't send/receive: %d", r);
}
else {
/* Did the process we did the sendrec() for get a result? */
/* Task has completed. See if call completed. */
if (m.REP_STATUS == SUSPEND) {
- panic(__FILE__, "MFS block_dev_io: driver returned SUSPEND", NO_NUM);
+ panic("MFS block_dev_io: driver returned SUSPEND");
}
if(buf != buf_used && r == OK) {
major = (dev >> MAJOR) & BYTE;
if (major >= NR_DEVICES) major = 0;
r = gen_opcl(driver_e, DEV_OPEN, dev, proc, flags);
- if (r == SUSPEND) panic(__FILE__,"suspend on open from", NO_NUM);
+ if (r == SUSPEND) panic("suspend on open from");
return(r);
}
if (r != OK) {
if (r == EDEADSRCDST) {
printf("fs: dead driver %d\n", task_nr);
- panic(__FILE__, "should handle crashed drivers",
- NO_NUM);
+ panic("should handle crashed drivers");
/* dmap_unmap_by_endpt(task_nr); */
return r;
}
printf("fs: ELOCKED talking to %d\n", task_nr);
return r;
}
- panic(__FILE__,"call_task: can't send/receive", r);
+ panic("call_task: can't send/receive: %d", r);
}
/* Did the process we did the sendrec() for get a result? */
if(!rip) {
printf("%s:%d put_inode: inode #%d dev: %d not found\n", __FILE__,
__LINE__, fs_m_in.REQ_INODE_NR, fs_dev);
- panic(__FILE__, "fs_putnode failed", NO_NUM);
+ panic("fs_putnode failed");
}
count = fs_m_in.REQ_COUNT;
if (count <= 0) {
printf("%s:%d put_inode: bad value for count: %d\n", __FILE__,
__LINE__, count);
- panic(__FILE__, "fs_putnode failed", NO_NUM);
+ panic("fs_putnode failed");
} else if(count > rip->i_count) {
printf("%s:%d put_inode: count too high: %d > %d\n", __FILE__,
__LINE__, count, rip->i_count);
- panic(__FILE__, "fs_putnode failed", NO_NUM);
+ panic("fs_putnode failed");
}
/* Decrease reference counter, but keep one reference; it will be consumed by
if (rip == NIL_INODE) return; /* checking here is easier than in caller */
if (rip->i_count < 1)
- panic(__FILE__, "put_inode: i_count already below 1", rip->i_count);
+ panic("put_inode: i_count already below 1: %d", rip->i_count);
if (--rip->i_count == 0) { /* i_count == 0 means no one is using it now */
if (rip->i_nlinks == 0) {
if( (b = read_map(rip, pos)) == NO_BLOCK) return;
while (len > 0) {
if( (bp = get_block(rip->i_dev, b, NORMAL)) == NIL_BUF)
- panic(__FILE__, "zerozone_range: no block", NO_NUM);
+ panic("zerozone_range: no block");
offset = pos % block_size;
bytes = block_size - offset;
if (bytes > len)
fs_m_in.m_type = FS_READY;
if ((r = send(FS_PROC_NR, &fs_m_in)) != OK) {
- panic("MFS", "Error sending login to VFS", r);
+ panic("Error sending login to VFS: %d", r);
}
return(OK);
do {
if ((r = sef_receive(ANY, m_in)) != OK) /* wait for message */
- panic("MFS","sef_receive failed", r);
+ panic("sef_receive failed: %d", r);
src = fs_m_in.m_source;
if (src != FS_PROC_NR) {
if ((root_ip = find_inode(fs_dev, ROOT_INODE)) == NIL_INODE) {
printf("MFS: couldn't find root inode. Unmount failed.\n");
- panic(__FILE__, "MFS: couldn't find root inode", EINVAL);
+ panic("MFS: couldn't find root inode: %d", EINVAL);
return(EINVAL);
}
/* It was not possible to enter . or .. probably disk was full -
* links counts haven't been touched. */
if(search_dir(ldirp, lastc, (ino_t *) 0, DELETE, IGN_PERM) != OK)
- panic(__FILE__, "Dir disappeared ", rip->i_num);
+ panic("Dir disappeared: %d", rip->i_num);
rip->i_nlinks--; /* undo the increment done in new_node() */
}
rip->i_dirt = DIRTY; /* either way, i_nlinks has changed */
if(search_dir(ldirp, string, (ino_t *) 0, DELETE,
IGN_PERM) != OK)
- panic(__FILE__, "Symbolic link vanished", NO_NUM);
+ panic("Symbolic link vanished");
}
}
if (slen > 0) { /* Do we have path after the link? */
/* For simplicity we require that suffix starts with a slash */
if (suffix[0] != '/') {
- panic(__FILE__,
- "ltraverse: suffix does not start with a slash",
- NO_NUM);
+ panic("ltraverse: suffix does not start with a slash");
}
/* To be able to expand the <link>, we have to move the 'suffix'
bp = get_block(ldir_ptr->i_dev, b, NORMAL); /* get a dir block */
if (bp == NO_BLOCK)
- panic(__FILE__,"get_block returned NO_BLOCK", NO_NUM);
+ panic("get_block returned NO_BLOCK");
/* Search a directory block. */
for (dp = &bp->b_dir[0];
dev = (dev_t) rip->i_zone[0];
} else {
if (ex64hi(position) != 0)
- panic(__FILE__, "rw_chunk: position too high", NO_NUM);
+ panic("rw_chunk: position too high");
b = read_map(rip, ex64lo(position));
dev = rip->i_dev;
}
/* In all cases, bp now points to a valid buffer. */
if (bp == NIL_BUF)
- panic(__FILE__,"bp not valid in rw_chunk, this can't happen", NO_NUM);
+ panic("bp not valid in rw_chunk; this can't happen");
if (rw_flag == WRITING && chunk != block_size && !block_spec &&
ex64lo(position) >= rip->i_size && off == 0) {
zone_t zone; /* V2 zones are longs (shorts in V1) */
if(bp == NIL_BUF)
- panic(__FILE__, "rd_indir() on NIL_BUF", NO_NUM);
+ panic("rd_indir() on NIL_BUF");
sp = get_super(bp->b_dev); /* need super block to find file sys type */
(zone < (zone_t) sp->s_firstdatazone || zone >= sp->s_zones)) {
printf("Illegal zone number %ld in indirect block, index %d\n",
(long) zone, index);
- panic(__FILE__,"check file system", NO_NUM);
+ panic("check file system");
}
return(zone);
bp = get_block(rip->i_dev, b, NORMAL); /* get a dir block */
if(bp == NO_BLOCK)
- panic(__FILE__,"get_block returned NO_BLOCK", NO_NUM);
+ panic("get_block returned NO_BLOCK");
/* Search a directory block. */
if (block_pos < pos)
(vir_bytes)getdents_buf,
tmpbuf_off, D);
if (r != OK)
- panic(__FILE__,
- "fs_getdents: sys_safecopyto failed\n",
- r);
+ panic("fs_getdents: sys_safecopyto failed: %d", r);
userbuf_off += tmpbuf_off;
tmpbuf_off = 0;
r = sys_safecopyto(FS_PROC_NR, gid, userbuf_off,
(vir_bytes) getdents_buf, tmpbuf_off, D);
if (r != OK)
- panic(__FILE__, "fs_getdents: sys_safecopyto failed\n", r);
+ panic("fs_getdents: sys_safecopyto failed: %d", r);
userbuf_off += tmpbuf_off;
}
bit_t i, b;
if (sp->s_rd_only)
- panic(__FILE__,"can't allocate bit on read-only filesys.", NO_NUM);
+ panic("can't allocate bit on read-only filesys");
if (map == IMAP) {
start_block = START_BLOCK;
block_t start_block;
if (sp->s_rd_only)
- panic(__FILE__,"can't free bit on read-only filesys.", NO_NUM);
+ panic("can't free bit on read-only filesys");
if (map == IMAP) {
start_block = START_BLOCK;
k = conv2(sp->s_native, (int) bp->b_bitmap[word]);
if (!(k & mask)) {
- panic(__FILE__,map == IMAP ? "tried to free unused inode" :
- "tried to free unused block", bit_returned);
+ panic(map == IMAP ? "tried to free unused inode" : "tried to free unused block: %d", bit_returned);
}
k &= ~mask;
dev_t dev; /* device number whose super_block is sought */
{
if (dev == NO_DEV)
- panic(__FILE__,"request for super_block of NO_DEV", NO_NUM);
+ panic("request for super_block of NO_DEV");
if(superblock.s_dev != dev)
- panic(__FILE__,"wrong superblock", (int) dev);
+ panic("wrong superblock: %d", (int) dev);
return(&superblock);
}
PUBLIC int get_block_size(dev_t dev)
{
if (dev == NO_DEV)
- panic(__FILE__,"request for block size of NO_DEV", NO_NUM);
+ panic("request for block size of NO_DEV");
return(fs_block_size);
dev = sp->s_dev; /* save device (will be overwritten by copy) */
if (dev == NO_DEV)
- panic(__FILE__,"request for super_block of NO_DEV", NO_NUM);
+ panic("request for super_block of NO_DEV");
r = block_dev_io(MFS_DEV_READ, dev, SELF_E,
sbbuf, cvu64(SUPER_BLOCK_BYTES), _MIN_BLOCK_SIZE, 0);
if (use_getuptime2) {
if ( (k=getuptime2(&uptime,&boottime)) != OK)
- panic(__FILE__,"clock_time: getuptme2 failed", k);
+ panic("clock_time: getuptme2 failed: %d", k);
} else {
if ( (k=getuptime(&uptime)) != OK)
- panic(__FILE__,"clock_time err", k);
+ panic("clock_time err: %d", k);
}
return( (time_t) (boottime + (uptime/sys_hz())));
if(v1 < 0 || v2 < 0) {
printf("mfs:%s:%d: strange string lengths: %d, %d\n",
file, line, v1, v2);
- panic(file, "strange string lengths", NO_NUM);
+ panic("strange string lengths");
}
if(v2 >= v1) return v1;
{
if(len < 1) {
printf("mfs:%s:%d: %d-length string?!\n", file, line, len);
- panic(file, "strange string length", NO_NUM);
+ panic("strange string length");
}
if(len < maxlen && str[len-1] != '\0') {
printf("mfs:%s:%d: string (length %d, maxlen %d) "
}
#define MYASSERT(c) if(!(c)) { printf("MFS:%s:%d: sanity check: %s failed\n", \
- file, line, #c); panic("MFS", "sanity check " #c " failed", __LINE__); }
+ file, line, #c); panic("sanity check " #c " failed: %d", __LINE__); }
/*===========================================================================*
struct super_block *sp;
if(bp == NIL_BUF)
- panic(__FILE__, "wr_indir() on NIL_BUF", NO_NUM);
+ panic("wr_indir() on NIL_BUF");
sp = get_super(bp->b_dev); /* need super block to find file sys type */
if(!rip) {
printf("%s:%d put_inode: inode #%d dev: %d not found\n", __FILE__,
__LINE__, fs_m_in.REQ_INODE_NR, fs_m_in.REQ_DEV);
- panic(__FILE__, "fs_putnode failed", NO_NUM);
+ panic("fs_putnode failed");
}
count = fs_m_in.REQ_COUNT;
if (count <= 0) {
printf("%s:%d put_inode: bad value for count: %d\n", __FILE__,
__LINE__, count);
- panic(__FILE__, "fs_putnode failed", NO_NUM);
+ panic("fs_putnode failed");
} else if(count > rip->i_count) {
printf("%s:%d put_inode: count too high: %d > %d\n", __FILE__,
__LINE__, count, rip->i_count);
- panic(__FILE__, "fs_putnode failed", NO_NUM);
+ panic("fs_putnode failed");
}
/* Decrease reference counter, but keep one reference; it will be consumed by
if (rip == NIL_INODE) return; /* checking here is easier than in caller */
if (rip->i_count < 1)
- panic(__FILE__, "put_inode: i_count already below 1", rip->i_count);
+ panic("put_inode: i_count already below 1: %d", rip->i_count);
if (--rip->i_count == 0) { /* i_count == 0 means no one is using it now */
if (rip->i_nlinks == 0) {
do {
if ((r = sef_receive(ANY, m_in)) != OK) /* wait for message */
- panic("PFS","sef_receive failed", r);
+ panic("sef_receive failed: %d", r);
src = fs_m_in.m_source;
if (src != VFS_PROC_NR) {
clock_t uptime, boottime;
if ((r = getuptime2(&uptime,&boottime)) != OK)
- panic(__FILE__,"clock_time: getuptme2 failed", r);
+ panic("clock_time: getuptme2 failed: %d", r);
return( (time_t) (boottime + (uptime/sys_hz())));
}
break;
default:
- panic(__FILE__, "invalid timer type", m_in.which_timer);
+ panic("invalid timer type: %d", m_in.which_timer);
}
/* If requested, copy the old interval timer to user space. */
switch (which) {
case ITIMER_VIRTUAL: num = VT_VIRTUAL; break;
case ITIMER_PROF: num = VT_PROF; break;
- default: panic(__FILE__, "invalid vtimer type", which);
+ default: panic("invalid vtimer type: %d", which);
}
/* Make the kernel call. If requested, also retrieve and store
* the old timer value.
*/
if ((r = sys_vtimer(rmp->mp_endpoint, num, nptr, optr)) != OK)
- panic(__FILE__, "sys_vtimer failed", r);
+ panic("sys_vtimer failed: %d", r);
if (ovalue != NULL) {
/* If the alarm expired already, we should take into account the
switch (sig) {
case SIGVTALRM: which = ITIMER_VIRTUAL; num = VT_VIRTUAL; break;
case SIGPROF: which = ITIMER_PROF; num = VT_PROF; break;
- default: panic(__FILE__, "invalid vtimer signal", sig);
+ default: panic("invalid vtimer signal: %d", sig);
}
/* If a repetition interval was set for this virtual timer, tell the
/* First determine remaining time, in ticks, of previous alarm, if set. */
if (rmp->mp_flags & ALARM_ON) {
if ( (s = getuptime(&uptime)) != OK)
- panic(__FILE__, "get_realtimer couldn't get uptime", s);
+ panic("get_realtimer couldn't get uptime: %d", s);
exptime = *tmr_exp_time(&rmp->mp_timer);
remaining = exptime - uptime;
return EPERM;
proc_e= m_in.EXC_NM_PROC;
- if (pm_isokendpt(proc_e, &proc_n) != OK)
- {
- panic(__FILE__, "do_exec_newmem: got bad endpoint",
- proc_e);
+ if (pm_isokendpt(proc_e, &proc_n) != OK) {
+ panic("do_exec_newmem: got bad endpoint: %d", proc_e);
}
rmp= &mproc[proc_n];
ptr= m_in.EXC_NM_PTR;
r= sys_datacopy(who_e, (vir_bytes)ptr,
SELF, (vir_bytes)&args, sizeof(args));
if (r != OK)
- panic(__FILE__, "do_exec_newmem: sys_datacopy failed", r);
+ panic("do_exec_newmem: sys_datacopy failed: %d", r);
if((r=vm_exec_newmem(proc_e, &args, sizeof(args), &stack_top, &flags)) == OK) {
allow_setuid= 0; /* Do not allow setuid execution */
return EPERM;
proc_e= m_in.EXC_RS_PROC;
- if (pm_isokendpt(proc_e, &proc_n) != OK)
- {
- panic(__FILE__, "do_execrestart: got bad endpoint",
- proc_e);
+ if (pm_isokendpt(proc_e, &proc_n) != OK) {
+ panic("do_execrestart: got bad endpoint: %d", proc_e);
}
rmp= &mproc[proc_n];
result= m_in.EXC_RS_RESULT;
new_sp= (char *)rmp->mp_procargs;
pc= 0; /* for now */
r= sys_exec(rmp->mp_endpoint, new_sp, rmp->mp_name, pc);
- if (r != OK) panic(__FILE__, "sys_exec failed", r);
+ if (r != OK) panic("sys_exec failed: %d", r);
}
n++;
} while((mproc[next_child].mp_flags & IN_USE) && n <= NR_PROCS);
if(n > NR_PROCS)
- panic(__FILE__,"do_fork can't find child slot", NO_NUM);
+ panic("do_fork can't find child slot");
if(next_child < 0 || next_child >= NR_PROCS
|| (mproc[next_child].mp_flags & IN_USE))
- panic(__FILE__,"do_fork finds wrong child slot", next_child);
+ panic("do_fork finds wrong child slot: %d", next_child);
/* Memory part of the forking. */
if((s=vm_fork(rmp->mp_endpoint, next_child, &child_ep)) != OK) {
n++;
} while((mproc[next_child].mp_flags & IN_USE) && n <= NR_PROCS);
if(n > NR_PROCS)
- panic(__FILE__,"do_fork can't find child slot", NO_NUM);
+ panic("do_fork can't find child slot");
if(next_child < 0 || next_child >= NR_PROCS
|| (mproc[next_child].mp_flags & IN_USE))
- panic(__FILE__,"do_fork finds wrong child slot", next_child);
+ panic("do_fork finds wrong child slot: %d", next_child);
if((s=vm_fork(rmp->mp_endpoint, next_child, &child_ep)) != OK) {
printf("PM: vm_fork failed: %d\n", s);
/* Do accounting: fetch usage times and accumulate at parent. */
if((r=sys_times(proc_nr_e, &user_time, &sys_time, NULL, NULL)) != OK)
- panic(__FILE__,"exit_proc: sys_times failed", r);
+ panic("exit_proc: sys_times failed: %d", r);
p_mp = &mproc[rmp->mp_parent]; /* process' parent */
p_mp->mp_child_utime += user_time + rmp->mp_child_utime; /* add user time */
* such as copying to/ from the exiting process, before it is gone.
*/
if ((r = sys_stop(proc_nr_e)) != OK) /* stop the process */
- panic(__FILE__, "sys_stop failed", r);
+ panic("sys_stop failed: %d", r);
if((r=vm_willexit(proc_nr_e)) != OK) {
- panic(__FILE__, "exit_proc: vm_willexit failed", r);
+ panic("exit_proc: vm_willexit failed: %d", r);
}
vm_notify_sig_wrapper(rmp->mp_endpoint);
}
if (proc_nr_e == FS_PROC_NR)
{
- panic(__FILE__, "exit_proc: FS died", r);
+ panic("exit_proc: FS died: %d", r);
}
/* Tell FS about the exiting process. */
* driver that FS is blocked waiting on.
*/
if((r= sys_exit(rmp->mp_endpoint)) != OK)
- panic(__FILE__, "exit_proc: sys_exit failed", r);
+ panic("exit_proc: sys_exit failed: %d", r);
}
/* Clean up most of the flags describing the process's state before the exit,
{
/* destroy the (user) process */
if((r=sys_exit(rmp->mp_endpoint)) != OK)
- panic(__FILE__, "exit_restart: sys_exit failed", r);
+ panic("exit_restart: sys_exit failed: %d", r);
}
/* Release the memory occupied by the child. */
if((r=vm_exit(rmp->mp_endpoint)) != OK) {
- panic(__FILE__, "exit_restart: vm_exit failed", r);
+ panic("exit_restart: vm_exit failed: %d", r);
}
if (rmp->mp_flags & TRACE_EXIT)
struct mproc *t_mp;
if (rmp->mp_flags & (TRACE_ZOMBIE | ZOMBIE))
- panic(__FILE__, "zombify: process was already a zombie", NO_NUM);
+ panic("zombify: process was already a zombie");
/* See if we have to notify a tracer process first. */
if (rmp->mp_tracer != NO_TRACER && rmp->mp_tracer != rmp->mp_parent) {
mp_parent= child->mp_parent;
if (mp_parent <= 0)
- panic(__FILE__, "tell_parent: bad value in mp_parent", mp_parent);
+ panic("tell_parent: bad value in mp_parent: %d", mp_parent);
if(!(child->mp_flags & ZOMBIE))
- panic(__FILE__, "tell_parent: child not a zombie", NO_NUM);
+ panic("tell_parent: child not a zombie");
if(child->mp_flags & TOLD_PARENT)
- panic(__FILE__, "tell_parent: telling parent again", NO_NUM);
+ panic("tell_parent: telling parent again");
parent = &mproc[mp_parent];
/* Wake up the parent by sending the reply message. */
mp_tracer = child->mp_tracer;
if (mp_tracer <= 0)
- panic(__FILE__, "tell_tracer: bad value in mp_tracer", mp_tracer);
+ panic("tell_tracer: bad value in mp_tracer: %d", mp_tracer);
if(!(child->mp_flags & TRACE_ZOMBIE))
- panic(__FILE__, "tell_tracer: child not a zombie", NO_NUM);
+ panic("tell_tracer: child not a zombie");
tracer = &mproc[mp_tracer];
exitstatus = (child->mp_exitstatus << 8) | (child->mp_sigstatus & 0377);
* reported, but it must be corrected for the kernel and system processes.
*/
if ((s=sys_getmonparams(monitor_params, sizeof(monitor_params))) != OK)
- panic(__FILE__,"get monitor params failed",s);
+ panic("get monitor params failed: %d", s);
if ((s=sys_getkinfo(&kinfo)) != OK)
- panic(__FILE__,"get kernel info failed",s);
+ panic("get kernel info failed: %d", s);
/* Initialize PM's process table. Request a copy of the system image table
* that is defined at the kernel level to see which slots to fill in.
*/
if (OK != (s=sys_getimage(image)))
- panic(__FILE__,"couldn't get image table: %d\n", s);
+ panic("couldn't get image table: %d", s);
procs_in_use = 0; /* start populating table */
for (ip = &image[0]; ip < &image[NR_BOOT_PROCS]; ip++) {
if (ip->proc_nr >= 0) { /* task have negative nrs */
mess.PM_PID = rmp->mp_pid;
mess.PM_PROC = rmp->mp_endpoint;
if (OK != (s=send(FS_PROC_NR, &mess)))
- panic(__FILE__,"can't sync up with FS", s);
+ panic("can't sync up with FS: %d", s);
}
}
/* Tell FS that no more system processes follow and synchronize. */
mess.PR_ENDPT = NONE;
if (sendrec(FS_PROC_NR, &mess) != OK || mess.m_type != OK)
- panic(__FILE__,"can't sync up with FS", NO_NUM);
+ panic("can't sync up with FS");
#if (CHIP == INTEL)
uts_val.machine[0] = 'i';
{
/* Wait for the next message and extract useful information from it. */
if (sef_receive(ANY, &m_in) != OK)
- panic(__FILE__,"PM sef_receive error", NO_NUM);
+ panic("PM sef_receive error");
who_e = m_in.m_source; /* who sent the message */
if(pm_isokendpt(who_e, &who_p) != OK)
- panic(__FILE__, "PM got message from invalid endpoint", who_e);
+ panic("PM got message from invalid endpoint: %d", who_e);
call_nr = m_in.m_type; /* system call number */
/* Process slot of caller. Misuse PM's own process slot if the kernel is
*/
mp = &mproc[who_p < 0 ? PM_PROC_NR : who_p];
if(who_p >= 0 && mp->mp_endpoint != who_e) {
- panic(__FILE__, "PM endpoint number out of sync with source",
- mp->mp_endpoint);
+ panic("PM endpoint number out of sync with source: %d", mp->mp_endpoint);
}
}
register struct mproc *rmp = &mproc[proc_nr];
if(proc_nr < 0 || proc_nr >= NR_PROCS)
- panic(__FILE__,"setreply arg out of range", proc_nr);
+ panic("setreply arg out of range: %d", proc_nr);
rmp->mp_reply.reply_res = result;
rmp->mp_flags |= REPLY; /* reply pending */
boned=1;
}
}
- if(boned) panic(__FILE__, "corrupt mp_endpoint?", NO_NUM);
+ if(boned) panic("corrupt mp_endpoint?");
}
}
proc_e = m_in.PM_PROC;
if (pm_isokendpt(proc_e, &proc_n) != OK) {
- panic(__FILE__, "handle_fs_reply: got bad endpoint from FS", proc_e);
+ panic("handle_fs_reply: got bad endpoint from FS: %d", proc_e);
}
rmp = &mproc[proc_n];
/* Now that FS replied, mark the process as FS-idle again */
if (!(rmp->mp_flags & FS_CALL))
- panic(__FILE__, "handle_fs_reply: reply without request", call_nr);
+ panic("handle_fs_reply: reply without request: %d", call_nr);
rmp->mp_flags &= ~FS_CALL;
if (rmp->mp_flags & UNPAUSED)
- panic(__FILE__, "handle_fs_reply: UNPAUSED set on entry", call_nr);
+ panic("handle_fs_reply: UNPAUSED set on entry: %d", call_nr);
/* Call-specific handler code */
switch (call_nr) {
break;
default:
- panic(__FILE__, "handle_fs_reply: unknown reply code", call_nr);
+ panic("handle_fs_reply: unknown reply code: %d", call_nr);
}
/* Now that the process is idle again, look at pending signals */
int r;
/* get an arbitrary pending signal */
if((r=sys_getksig(&proc_nr_e, &sig_map)) != OK)
- panic(__FILE__,"sys_getksig failed", r);
+ panic("sys_getksig failed: %d", r);
if (NONE == proc_nr_e) { /* stop if no more pending signals */
break;
} else {
int proc_nr_p;
if(pm_isokendpt(proc_nr_e, &proc_nr_p) != OK)
- panic(__FILE__,"sys_getksig strange process", proc_nr_e);
+ panic("sys_getksig strange process: %d", proc_nr_e);
handle_ksig(proc_nr_e, sig_map); /* handle the received signal */
/* If the process still exists to the kernel after the signal
* has been handled ...
if ((mproc[proc_nr_p].mp_flags & (IN_USE | EXITING)) == IN_USE)
{
if((r=sys_endksig(proc_nr_e)) != OK) /* ... tell kernel it's done */
- panic(__FILE__,"sys_endksig failed", r);
+ panic("sys_endksig failed: %d", r);
}
}
}
rmp->mp_flags &= ~DELAY_CALL;
if (rmp->mp_flags & (FS_CALL | PM_SIG_PENDING))
- panic(__FILE__, "handle_ksig: bad process state", NO_NUM);
+ panic("handle_ksig: bad process state");
/* Process as many normal signals as possible. */
check_pending(rmp);
if (rmp->mp_flags & DELAY_CALL)
- panic(__FILE__, "handle_ksig: multiple delay calls?", NO_NUM);
+ panic("handle_ksig: multiple delay calls?");
}
}
slot = (int) (rmp - mproc);
if ((rmp->mp_flags & (IN_USE | EXITING)) != IN_USE) {
printf("PM: signal %d sent to exiting process %d\n", signo, slot);
- panic(__FILE__,"", NO_NUM);
+ panic("");
}
if (trace == TRUE && rmp->mp_tracer != NO_TRACER && signo != SIGKILL) {
if (!(rmp->mp_flags & PM_SIG_PENDING)) {
/* No delay calls: FS_CALL implies the process called us. */
if ((r = sys_stop(rmp->mp_endpoint)) != OK)
- panic(__FILE__, "sys_stop failed", r);
+ panic("sys_stop failed: %d", r);
rmp->mp_flags |= PM_SIG_PENDING;
}
rmp->mp_flags &= ~(PM_SIG_PENDING | UNPAUSED);
if ((r = sys_resume(rmp->mp_endpoint)) != OK)
- panic(__FILE__, "sys_resume failed", r);
+ panic("sys_resume failed: %d", r);
}
}
}
if (rmp->mp_flags & (PAUSED | WAITING | SIGSUSPENDED)) {
/* Stop process from running. No delay calls: it called us. */
if ((r = sys_stop(rmp->mp_endpoint)) != OK)
- panic(__FILE__, "sys_stop failed", r);
+ panic("sys_stop failed: %d", r);
rmp->mp_flags |= UNPAUSED;
return;
}
- else if (r != OK) panic(__FILE__, "sys_stop failed", r);
+ else if (r != OK) panic("sys_stop failed: %d", r);
rmp->mp_flags |= PM_SIG_PENDING;
}
int r, sigflags, slot;
if (!(rmp->mp_flags & UNPAUSED))
- panic(__FILE__, "sig_send: process not unpaused", NO_NUM);
+ panic("sig_send: process not unpaused");
sigflags = rmp->mp_sigact[signo].sa_flags;
slot = (int) (rmp - mproc);
/* Ask the kernel to deliver the signal */
r = sys_sigsend(rmp->mp_endpoint, &sigmsg);
if (r != OK)
- panic(__FILE__, "sys_sigsend failed", r);
+ panic("sys_sigsend failed: %d", r);
/* Was the process suspended in PM? Then interrupt the blocking call. */
if (rmp->mp_flags & (PAUSED | WAITING | SIGSUSPENDED)) {
rmp->mp_flags &= ~UNPAUSED;
if ((r = sys_resume(rmp->mp_endpoint)) != OK)
- panic(__FILE__, "sys_resume failed", r);
+ panic("sys_resume failed: %d", r);
}
return(TRUE);
int s;
if ( (s=getuptime2(&uptime, &boottime)) != OK)
- panic(__FILE__,"do_time couldn't get uptime", s);
+ panic("do_time couldn't get uptime: %d", s);
mp->mp_reply.reply_time = (time_t) (boottime + (uptime/system_hz));
mp->mp_reply.reply_utime = (uptime%system_hz)*1000000/system_hz;
return(EPERM);
}
if ( (s=getuptime(&uptime)) != OK)
- panic(__FILE__,"do_stime couldn't get uptime", s);
+ panic("do_stime couldn't get uptime: %d", s);
boottime = (long) m_in.stime - (uptime/system_hz);
s= sys_stime(boottime); /* Tell kernel about boottime */
if (s != OK)
- panic(__FILE__, "pm: sys_stime failed", s);
+ panic("pm: sys_stime failed: %d", s);
return(OK);
}
int s;
if (OK != (s=sys_times(who_e, &user_time, &sys_time, &uptime, NULL)))
- panic(__FILE__,"do_times couldn't get times", s);
+ panic("do_times couldn't get times: %d", s);
rmp->mp_reply.reply_t1 = user_time; /* user time */
rmp->mp_reply.reply_t2 = sys_time; /* system time */
rmp->mp_reply.reply_t3 = rmp->mp_child_utime; /* child user time */
clock_t now, prev_time = 0, next_time;
if ((r = getuptime(&now)) != OK)
- panic(__FILE__, "PM couldn't get uptime", NO_NUM);
+ panic("PM couldn't get uptime");
/* Set timer argument and add timer to the list. */
tmr_arg(tp)->ta_int = arg;
/* Reschedule our synchronous alarm if necessary. */
if (pm_expiring == 0 && (! prev_time || prev_time > next_time)) {
if (sys_setalarm(next_time, 1) != OK)
- panic(__FILE__, "PM set timer couldn't set alarm.", NO_NUM);
+ panic("PM set timer couldn't set alarm");
}
return;
/* Reschedule an alarm if necessary. */
if (next_time > 0) {
if (sys_setalarm(next_time, 1) != OK)
- panic(__FILE__, "PM expire timer couldn't set alarm.", NO_NUM);
+ panic("PM expire timer couldn't set alarm");
}
}
*/
if (pm_expiring == 0 && (prev_time < next_time || ! next_time)) {
if (sys_setalarm(next_time, 1) != OK)
- panic(__FILE__, "PM expire timer couldn't set alarm.", NO_NUM);
+ panic("PM expire timer couldn't set alarm");
}
}
int r;
r = sys_trace(T_STOP, rmp->mp_endpoint, 0L, (long *) 0);
- if (r != OK) panic("pm", "sys_trace failed", r);
+ if (r != OK) panic("sys_trace failed: %d", r);
rmp->mp_flags |= STOPPED;
if (wait_test(rpmp, rmp)) {
int r;
if (rmp->mp_flags & FS_CALL)
- panic(__FILE__, "tell_fs: not idle", m_ptr->m_type);
+ panic("tell_fs: not idle: %d", m_ptr->m_type);
r = asynsend3(FS_PROC_NR, m_ptr, AMF_NOREPLY);
if (r != OK)
- panic(__FILE__, "unable to send to FS", r);
+ panic("unable to send to FS: %d", r);
rmp->mp_flags |= FS_CALL;
}
who_e = m.m_source;
who_p = _ENDPOINT_P(who_e);
if(who_p < -NR_TASKS || who_p >= NR_PROCS)
- panic("RS","message from bogus source", who_e);
+ panic("message from bogus source: %d", who_e);
call_nr = m.m_type;
rinit.rproctab_gid = cpf_grant_direct(ANY, (vir_bytes) rprocpub,
sizeof(rprocpub), CPF_READ);
if(!GRANT_VALID(rinit.rproctab_gid)) {
- panic("RS", "unable to create rprocpub table grant", rinit.rproctab_gid);
+ panic("unable to create rprocpub table grant: %d", rinit.rproctab_gid);
}
/* Initialize the global update descriptor. */
/* Get a copy of the boot image table. */
if ((s = sys_getimage(image)) != OK) {
- panic("RS", "unable to get copy of boot image table", s);
+ panic("unable to get copy of boot image table: %d", s);
}
/* Determine the number of system services in the boot image table and
*/
if(boot_image_sys->flags & SF_USE_COPY) {
if((s = sys_getaoutheader(&header, i)) != OK) {
- panic("RS", "unable to get copy of a.out header", s);
+ panic("unable to get copy of a.out header: %d", s);
}
boot_image_buffer_size += header.a_hdrlen
+ header.a_text + header.a_data;
nr_image_priv_srvs++;
}
if(nr_image_srvs != nr_image_priv_srvs) {
- panic("RS", "boot image table and boot image priv table mismatch",
- NO_NUM);
+ panic("boot image table and boot image priv table mismatch");
}
/* Allocate boot image buffer. */
if(boot_image_buffer_size > 0) {
boot_image_buffer = rs_startup_sbrk(boot_image_buffer_size);
if(boot_image_buffer == (char *) -1) {
- panic("RS", "unable to allocate boot image buffer", NO_NUM);
+ panic("unable to allocate boot image buffer");
}
}
/* Set the privilege structure. */
if ((s = sys_privctl(ip->endpoint, SYS_PRIV_SET_SYS, &(rp->r_priv)))
!= OK) {
- panic("RS", "unable to set privilege structure", s);
+ panic("unable to set privilege structure: %d", s);
}
}
/* Synch the privilege structure with the kernel. */
if ((s = sys_getpriv(&(rp->r_priv), ip->endpoint)) != OK) {
- panic("RS", "unable to synch privilege structure", s);
+ panic("unable to synch privilege structure: %d", s);
}
/*
/* Allow the service to run. */
if ((s = sys_privctl(rpub->endpoint, SYS_PRIV_ALLOW, NULL)) != OK) {
- panic("RS", "unable to initialize privileges", s);
+ panic("unable to initialize privileges: %d", s);
}
/* Initialize service. We assume every service will always get
*/
if(boot_image_priv->flags & SYS_PROC) {
if ((s = init_service(rp, SEF_INIT_FRESH)) != OK) {
- panic("RS", "unable to initialize service", s);
+ panic("unable to initialize service: %d", s);
}
if(rpub->sys_flags & SF_SYNCH_BOOT) {
/* Catch init ready message now to synchronize. */
* with other system processes.
*/
if ((s = getsysinfo(PM_PROC_NR, SI_PROC_TAB, mproc)) != OK) {
- panic("RS", "unable to get copy of PM process table", s);
+ panic("unable to get copy of PM process table: %d", s);
}
for (i=0; boot_image_priv_table[i].endpoint != NULL_BOOT_NR; i++) {
boot_image_priv = &boot_image_priv_table[i];
}
}
if(j == NR_PROCS) {
- panic("RS", "unable to get pid", NO_NUM);
+ panic("unable to get pid");
}
}
if(boot_image_buffer_size > 0) {
boot_image_buffer = rs_startup_sbrk_synch(boot_image_buffer_size);
if(boot_image_buffer == (char *) -1) {
- panic("RS", "unable to synch boot image buffer", NO_NUM);
+ panic("unable to synch boot image buffer");
}
}
/* Set alarm to periodically check service status. */
if (OK != (s=sys_setalarm(RS_DELTA_T, 0)))
- panic("RS", "couldn't set alarm", s);
+ panic("couldn't set alarm: %d", s);
/* Install signal handlers. Ask PM to transform signal into message. */
sa.sa_handler = SIG_MESS;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
- if (sigaction(SIGCHLD,&sa,NULL)<0) panic("RS","sigaction failed", errno);
- if (sigaction(SIGTERM,&sa,NULL)<0) panic("RS","sigaction failed", errno);
+ if (sigaction(SIGCHLD,&sa,NULL)<0) panic("sigaction failed: %d", errno);
+ if (sigaction(SIGTERM,&sa,NULL)<0) panic("sigaction failed: %d", errno);
/* Initialize the exec pipe. */
if (pipe(exec_pipe) == -1)
- panic("RS", "pipe failed", errno);
+ panic("pipe failed: %d", errno);
if (fcntl(exec_pipe[0], F_SETFD,
fcntl(exec_pipe[0], F_GETFD) | FD_CLOEXEC) == -1)
{
- panic("RS", "fcntl set FD_CLOEXEC on pipe input failed", errno);
+ panic("fcntl set FD_CLOEXEC on pipe input failed: %d", errno);
}
if (fcntl(exec_pipe[1], F_SETFD,
fcntl(exec_pipe[1], F_GETFD) | FD_CLOEXEC) == -1)
{
- panic("RS", "fcntl set FD_CLOEXEC on pipe output failed", errno);
+ panic("fcntl set FD_CLOEXEC on pipe output failed: %d", errno);
}
if (fcntl(exec_pipe[0], F_SETFL,
fcntl(exec_pipe[0], F_GETFL) | O_NONBLOCK) == -1)
{
- panic("RS", "fcntl set O_NONBLOCK on pipe input failed", errno);
+ panic("fcntl set O_NONBLOCK on pipe input failed: %d", errno);
}
/* Map out our own text and data. This is normally done in crtso.o
if(boot_image_ptr == NULL) {
boot_image_ptr = boot_image_buffer;
}
- s = NO_NUM;
/* Get a.out header. */
if(boot_image_buffer+boot_image_buffer_size - boot_image_ptr < sizeof(header)
|| (s = sys_getaoutheader(&header, boot_proc_idx)) != OK) {
- panic("RS", "unable to get copy of a.out header", s);
+ panic("unable to get copy of a.out header: %d", s);
}
memcpy(boot_image_ptr, &header, header.a_hdrlen);
boot_image_ptr += header.a_hdrlen;
if(boot_image_buffer+boot_image_buffer_size - boot_image_ptr < header.a_text
|| (s = rs_startup_segcopy(ip->endpoint, T, D, (vir_bytes) boot_image_ptr,
header.a_text)) != OK) {
- panic("RS", "unable to get copy of text segment", s);
+ panic("unable to get copy of text segment: %d", s);
}
boot_image_ptr += header.a_text;
if(boot_image_buffer+boot_image_buffer_size - boot_image_ptr < header.a_data
|| (s = rs_startup_segcopy(ip->endpoint, D, D, (vir_bytes) boot_image_ptr,
header.a_data)) != OK) {
- panic("RS", "unable to get copy of data segment", s);
+ panic("unable to get copy of data segment: %d", s);
}
boot_image_ptr += header.a_data;
}
}
if(i == NR_BOOT_PROCS) {
- panic("RS", "boot image table lookup failed", NO_NUM);
+ panic("boot image table lookup failed");
}
}
}
}
if(i == NULL_BOOT_NR) {
- panic("RS", "boot image priv table lookup failed", NO_NUM);
+ panic("boot image priv table lookup failed");
}
}
/* Receive init ready message. */
if ((r = receive(endpoint, &m)) != OK) {
- panic("RS", "unable to receive init reply", r);
+ panic("unable to receive init reply: %d", r);
}
if(m.m_type != RS_INIT) {
- panic("RS", "unexpected reply from service", m.m_source);
+ panic("unexpected reply from service: %d", m.m_source);
}
result = m.RS_INIT_RESULT;
rp = rproc_ptr[_ENDPOINT_P(m.m_source)];
/* Check result. */
if(result != OK) {
- panic("RS", "unable to complete init for service", m.m_source);
+ panic("unable to complete init for service: %d", m.m_source);
}
/* Mark the slot as no longer initializing. */
{
int s; /* receive status */
if (OK != (s=sef_receive(ANY, m_in))) /* wait for message */
- panic("RS", "sef_receive failed", s);
+ panic("sef_receive failed: %d", s);
}
/*===========================================================================*
}
if (r != sizeof(slot_nr))
{
- panic("RS", "do_exit: unaligned read from exec pipe",
- r);
+ panic("do_exit: unaligned read from exec pipe: %d", r);
}
printf("do_exit: got slot %d\n", slot_nr);
if (slot_nr < 0 || slot_nr >= NR_SYS_PROCS)
{
- panic("RS", "do_exit: bad slot number from exec pipe",
- slot_nr);
+ panic("do_exit: bad slot number from exec pipe: %d", slot_nr);
}
rp= &rproc[slot_nr];
rp->r_flags |= RS_EXITING;
/* Reschedule a synchronous alarm for the next period. */
if (OK != (s=sys_setalarm(RS_DELTA_T, 0)))
- panic("RS", "couldn't set alarm", s);
+ panic("couldn't set alarm: %d", s);
}
switch(child_pid) { /* see fork(2) */
case -1: /* fork failed */
- report("RS", "warning, fork() failed", errno); /* shouldn't happen */
+ printf("RS: warning, fork() failed: %d\n", errno); /* shouldn't happen */
return(errno); /* return error */
case 0: /* child process */
s = dev_execve(child_proc_nr_e, rp->r_exec, rp->r_exec_len, rp->r_argv,
environ);
if (s != OK) {
- report("RS", "dev_execve call failed", s);
+ printf("RS: dev_execve call failed: %d\n", s);
kill(child_pid, SIGKILL);
rp->r_flags |= RS_EXITING; /* don't try again */
return(s);
/* Tell VM about allowed calls. */
vm_mask = &rpub->vm_call_mask[0];
if ((s = vm_set_priv(child_proc_nr_e, vm_mask)) < 0) {
- report("RS", "vm_set_priv call failed", s);
+ printf("RS: vm_set_priv call failed: %d\n", s);
kill(child_pid, SIGKILL);
rp->r_flags |= RS_EXITING;
return (s);
/* Set and synch the privilege structure for the new service. */
if ((s = sys_privctl(child_proc_nr_e, SYS_PRIV_SET_SYS, &rp->r_priv)) != OK
|| (s = sys_getpriv(&rp->r_priv, child_proc_nr_e)) != OK) {
- report("RS","unable to set privileges", s);
+ printf("RS: unable to set privileges: %d\n", s);
kill(child_pid, SIGKILL); /* kill the service */
rp->r_flags |= RS_EXITING; /* expect exit */
return(s); /* return error */
* publishing is made fully asynchronous in RS.
*/
if ((s = sys_privctl(child_proc_nr_e, SYS_PRIV_ALLOW, NULL)) != OK) {
- report("RS","unable to allow the service to run", s);
+ printf("RS: unable to allow the service to run: %d\n", s);
kill(child_pid, SIGKILL); /* kill the service */
rp->r_flags |= RS_EXITING; /* expect exit */
return(s); /* return error */
/* Initialize service. */
init_type = rp->r_restarts > 0 ? SEF_INIT_RESTART : SEF_INIT_FRESH;
if((s = init_service(rp, init_type)) != OK) {
- panic("RS", "unable to initialize service", s);
+ panic("unable to initialize service: %d", s);
}
/* The purpose of non-blocking forks is to avoid involving VFS in the forking
if (rpub->dev_nr > 0) { /* set driver map */
if ((s=mapdriver(rpub->label,
rpub->dev_nr, rpub->dev_style, !!use_copy /* force */)) < 0) {
- report("RS", "couldn't map driver (continuing)", errno);
+ printf("RS: couldn't map driver (continuing): %d\n", errno);
}
}
dp = &dmap[major];
if (dp->dmap_driver == NONE) return(ENXIO);
r = (*dp->dmap_opcl)(DEV_REOPEN, dev, filp_no, flags);
- if (r == OK) panic(__FILE__,"OK on reopen from", dp->dmap_driver);
+ if (r == OK) panic("OK on reopen from: %d", dp->dmap_driver);
if (r == SUSPEND) r = OK;
return(r);
}
if ((r = sendrec(m->m_source, &st)) != OK) {
printf("DEV_STATUS failed to %d: %d\n", m->m_source, r);
if (r == EDEADSRCDST) return;
- panic(__FILE__,"couldn't sendrec for DEV_STATUS", r);
+ panic("couldn't sendrec for DEV_STATUS: %d", r);
}
switch(st.m_type) {
*gid = cpf_grant_magic(driver, *io_ept, (vir_bytes) *buf, bytes,
*op == DEV_READ_S ? CPF_WRITE : CPF_READ);
if (*gid < 0)
- panic(__FILE__, "cpf_grant_magic of buffer failed\n", NO_NUM);
+ panic("cpf_grant_magic of buffer failed");
break;
case VFS_DEV_GATHER:
case VFS_DEV_SCATTER:
*gid = cpf_grant_direct(driver, (vir_bytes) new_iovec,
bytes * sizeof(iovec_t), CPF_READ|CPF_WRITE);
if (*gid < 0)
- panic(__FILE__, "cpf_grant_direct of vector failed", NO_NUM);
+ panic("cpf_grant_direct of vector failed");
v = (iovec_t *) *buf;
/* Grant access to i/o buffers. */
for(j = 0; j < bytes; j++) {
- if(j >= NR_IOREQS) panic(__FILE__, "vec too big", bytes);
+ if(j >= NR_IOREQS) panic("vec too big: %d", bytes);
new_iovec[j].iov_addr =
gids[j] =
*op == DEV_GATHER_S ? CPF_WRITE : CPF_READ);
if(!GRANT_VALID(gids[j]))
- panic(__FILE__, "grant to iovec buf failed", NO_NUM);
+ panic("grant to iovec buf failed");
new_iovec[j].iov_size = v[j].iov_size;
(*vec_grants)++;
*gid = cpf_grant_magic(driver, *io_ept, (vir_bytes) *buf, size,
access);
if (*gid < 0)
- panic(__FILE__, "cpf_grant_magic failed (ioctl)\n", NO_NUM);
+ panic("cpf_grant_magic failed (ioctl)");
break;
case VFS_DEV_SELECT:
*op = DEV_SELECT;
break;
default:
- panic(__FILE__,"safe_io_conversion: unknown operation", *op);
+ panic("safe_io_conversion: unknown operation: %d", *op);
}
/* If we have converted to a safe operation, I/O
&vec_grants, bytes, &pos_lo);
if(buf != buf_used)
- panic(__FILE__,"dev_io: safe_io_conversion changed buffer", NO_NUM);
+ panic("dev_io: safe_io_conversion changed buffer");
/* If the safe conversion was done, set the ADDRESS to
* the grant id.
/* Task has completed. See if call completed. */
if (dev_mess.REP_STATUS == SUSPEND) {
- if(vec_grants > 0) panic(__FILE__,"SUSPEND on vectored i/o", NO_NUM);
+ if(vec_grants > 0) panic("SUSPEND on vectored i/o");
/* fp is uninitialized at init time. */
- if(!fp) panic(__FILE__,"SUSPEND on NULL fp", NO_NUM);
+ if(!fp) panic("SUSPEND on NULL fp");
if ((flags & O_NONBLOCK) && !dp->dmap_async_driver) {
/* Not supposed to block. */
printf("fs: ELOCKED talking to %d\n", task_nr);
return(r);
}
- panic(__FILE__,"call_task: can't send/receive", r);
+ panic("call_task: can't send/receive: %d", r);
}
/* Did the process we did the sendrec() for get a result? */
int r;
r = asynsend(task_nr, mess_ptr);
- if (r != OK) panic(__FILE__, "asyn_io: asynsend failed", r);
+ if (r != OK) panic("asyn_io: asynsend failed: %d", r);
/* Fake a SUSPEND */
mess_ptr->REP_STATUS = SUSPEND;
fd_nr = (rfp->fp_fd >> 8);
fp = rfp->fp_filp[fd_nr];
vp = fp->filp_vno;
- if (!vp) panic(__FILE__, "restart_reopen: no vp", NO_NUM);
+ if (!vp) panic("restart_reopen: no vp");
if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL) continue;
if (((vp->v_sdev >> MAJOR) & BYTE) != maj) continue;
}
vp = fp->filp_vno;
- if (!vp) panic(__FILE__, "restart_reopen: no vp", NO_NUM);
+ if (!vp) panic("restart_reopen: no vp");
if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL) continue;
if (((vp->v_sdev >> MAJOR) & BYTE) != maj) continue;
/* Tell the kernel to stop processing */
r= senda(NULL, 0);
if (r != OK)
- panic(__FILE__, "asynsend: senda failed", r);
+ panic("asynsend: senda failed: %d", r);
dst_ind= 0;
for (src_ind= first_slot; src_ind<next_slot; src_ind++)
first_slot= 0;
next_slot= dst_ind;
if (next_slot >= ASYN_NR)
- panic(__FILE__, "asynsend: msgtable full", NO_NUM);
+ panic("asynsend: msgtable full");
}
msgtable[next_slot].dst= dst;
if (label != NULL) {
len= strlen(label);
if (len+1 > sizeof(dp->dmap_label))
- panic(__FILE__, "map_driver: label too long", len);
+ panic("map_driver: label too long: %d", len);
strcpy(dp->dmap_label, label);
}
if(!check_vrefs() || !check_pipe()) { \
printf("VFS:%s:%d: call_nr %d who_e %d\n", \
__FILE__, __LINE__, call_nr, who_e); \
- panic(__FILE__, "sanity check failed", NO_NUM); \
+ panic("sanity check failed"); \
} \
} while(0)
#else
*/
if (depth == 0)
- panic("VFS", "Popping from empty globals stack!", NO_NUM);
+ panic("Popping from empty globals stack!");
depth--;
case SEEK_SET: first = 0; break;
case SEEK_CUR:
if (ex64hi(f->filp_pos) != 0)
- panic(__FILE__, "lock_op: position in file too high", NO_NUM);
+ panic("lock_op: position in file too high");
first = ex64lo(f->filp_pos);
break;
case SEEK_END: first = f->filp_vno->v_size; break;
if(fp_is_blocked(fp)) {
printf("VFS: requester %d call %d: suspended\n",
who_e, call_nr);
- panic(__FILE__, "requester suspended", NO_NUM);
+ panic("requester suspended");
}
#endif
*/
do {
if (OK != (s=sef_receive(PM_PROC_NR, &mess)))
- panic(__FILE__,"FS couldn't receive from PM", s);
+ panic("FS couldn't receive from PM: %d", s);
if (mess.m_type != PM_INIT)
- panic(__FILE__, "unexpected message from PM", mess.m_type);
+ panic("unexpected message from PM: %d", mess.m_type);
if (NONE == mess.PM_PROC) break;
* Certain relations must hold for the file system to work at all. Some
* extra block_size requirements are checked at super-block-read-in time.
*/
- if (OPEN_MAX > 127) panic(__FILE__,"OPEN_MAX > 127", NO_NUM);
+ if (OPEN_MAX > 127) panic("OPEN_MAX > 127");
/* The following initializations are needed to let dev_opcl succeed .*/
fp = (struct fproc *) NULL;
vmp = &vmnt[0]; /* Should be the root filesystem */
if (vmp->m_dev == NO_DEV)
- panic(__FILE__, "vfs: no root filesystem", NO_NUM);
+ panic("vfs: no root filesystem");
root_vp= vmp->m_root_node;
/* The root device can now be accessed; set process directories. */
return;
}
if (!found_one)
- panic(__FILE__,"get_work couldn't revive anyone", NO_NUM);
+ panic("get_work couldn't revive anyone");
}
for(;;) {
int r;
/* Normal case. No one to revive. */
if ((r=sef_receive(ANY, &m_in)) != OK)
- panic(__FILE__,"fs sef_receive error", r);
+ panic("fs sef_receive error: %d", r);
who_e = m_in.m_source;
who_p = _ENDPOINT_P(who_e);
* (kernel tasks) are treated in a special way
*/
if(who_p >= (int)(sizeof(fproc) / sizeof(struct fproc)))
- panic(__FILE__,"receive process out of range", who_p);
+ panic("receive process out of range: %d", who_p);
if(who_p >= 0 && fproc[who_p].fp_endpoint == NONE) {
printf("FS: ignoring request from %d, endpointless slot %d (%d)\n",
m_in.m_source, who_p, m_in.m_type);
printf("FS: receive endpoint inconsistent (source %d, who_p %d, stored ep %d, who_e %d).\n",
m_in.m_source, who_p, fproc[who_p].fp_endpoint, who_e);
#if 0
- panic(__FILE__, "FS: inconsistent endpoint ", NO_NUM);
+ panic("FS: inconsistent endpoint ");
#endif
continue;
}
if (sef_receive(ROOT_FS_E, &m) != OK) {
printf("VFS: Error receiving login request from FS_e %d\n",
ROOT_FS_E);
- panic(__FILE__, "Error receiving login request from root filesystem\n", ROOT_FS_E);
+ panic("Error receiving login request from root filesystem: %d", ROOT_FS_E);
}
if (m.m_type != FS_READY) {
printf("VFS: Invalid login request from FS_e %d\n",
ROOT_FS_E);
- panic(__FILE__, "Error receiving login request from root filesystem\n", ROOT_FS_E);
+ panic("Error receiving login request from root filesystem: %d", ROOT_FS_E);
}
}
last_login_fs_e = NONE;
/* We'll need a vnode for the root inode, check whether there is one */
if ((root_node = get_free_vnode()) == NIL_VNODE)
- panic(__FILE__,"Cannot get free vnode", r);
+ panic("Cannot get free vnode: %d", r);
/* Get driver process' endpoint */
dp = &dmap[(root_dev >> MAJOR) & BYTE];
if (dp->dmap_driver == NONE) {
- panic(__FILE__,"No driver for root device", r);
+ panic("No driver for root device: %d", r);
}
label= dp->dmap_label;
if (strlen(label) == 0)
{
- panic(__FILE__, "vfs:init_root: no label for major", root_dev >> MAJOR);
+ panic("vfs:init_root: no label for major: %d", root_dev >> MAJOR);
}
/* Issue request */
r = req_readsuper(ROOT_FS_E, label, root_dev, 0 /*!readonly*/,
1 /*isroot*/, &res);
if (r != OK) {
- panic(__FILE__,"Cannot read superblock from root", r);
+ panic("Cannot read superblock from root: %d", r);
}
/* Fill in root node's fields */
r = send(PM_PROC_NR, &m_out);
if (r != OK)
- panic(__FILE__, "service_pm: send failed", r);
+ panic("service_pm: send failed: %d", r);
}
case SEEK_SET: start = 0; break;
case SEEK_CUR:
if (ex64hi(f->filp_pos) != 0)
- panic(__FILE__, "do_fcntl: position in file too high",
- NO_NUM);
-
+ panic("do_fcntl: position in file too high");
start = ex64lo(f->filp_pos);
break;
case SEEK_END: start = f->filp_vno->v_size; break;
*/
childno = _ENDPOINT_P(cproc);
if(childno < 0 || childno >= NR_PROCS)
- panic(__FILE__, "FS: bogus child for forking", m_in.child_endpt);
+ panic("FS: bogus child for forking: %d", m_in.child_endpt);
if(fproc[childno].fp_pid != PID_FREE)
- panic(__FILE__, "FS: forking on top of in-use child", childno);
+ panic("FS: forking on top of in-use child: %d", childno);
/* Copy the parent's fproc struct to the child. */
fproc[childno] = fproc[parentno];
*/
if(GRANT_VALID(fp->fp_grant)) {
printf("vfs: fork: fp (endpoint %d) has grant %d\n", fp->fp_endpoint, fp->fp_grant);
- panic(__FILE__, "fp contains valid grant", NO_NUM);
+ panic("fp contains valid grant");
}
if(GRANT_VALID(cp->fp_grant)) {
printf("vfs: fork: cp (endpoint %d) has grant %d\n", cp->fp_endpoint, cp->fp_grant);
- panic(__FILE__, "cp contains valid grant", NO_NUM);
+ panic("cp contains valid grant");
}
/* A child is not a process leader. */
fp = exiter; /* get_filp() needs 'fp' */
if(fp->fp_endpoint == NONE) {
- panic(__FILE__, "free_proc: already free", NO_NUM);
+ panic("free_proc: already free");
}
if (fp_is_blocked(fp)) {
okendpt(proc_e, &slot);
rfp = &fproc[slot];
if (ngroups * sizeof(gid_t) > sizeof(rfp->fp_sgroups))
- panic(__FILE__, "VFS: pm_setgroups: too much data to copy\n", NO_NUM);
+ panic("VFS: pm_setgroups: too much data to copy");
if(sys_datacopy(who_e, (vir_bytes) groups, SELF, (vir_bytes) rfp->fp_sgroups,
ngroups * sizeof(gid_t)) == OK) {
rfp->fp_ngroups = ngroups;
} else
- panic(__FILE__, "VFS: pm_setgroups: datacopy failed\n", NO_NUM);
+ panic("VFS: pm_setgroups: datacopy failed");
}
label = dp->dmap_label;
if (strlen(label) == 0)
- panic(__FILE__, "VFS mount_fs: no label for major",
- dev >> MAJOR);
+ panic("VFS mount_fs: no label for major: 0x%x", dev >> MAJOR);
}
/* Tell FS which device to mount */
/* Find vmnt that is to be unmounted */
for(vmp_i = &vmnt[0]; vmp_i < &vmnt[NR_MNTS]; ++vmp_i) {
if (vmp_i->m_dev == dev) {
- if(vmp) panic(__FILE__,"device mounted more than once", dev);
+ if(vmp) panic("device mounted more than once: %d", dev);
vmp = vmp_i;
}
}
/* Tell FS to unmount */
if(vmp->m_fs_e <= 0 || vmp->m_fs_e == NONE)
- panic(__FILE__, "unmount: strange fs endpoint", vmp->m_fs_e);
+ panic("unmount: strange fs endpoint: %d", vmp->m_fs_e);
if ((r = req_unmount(vmp->m_fs_e)) != OK) /* Not recoverable. */
printf("VFS: ignoring failed umount attempt (%d)\n", r);
new_vp->v_sdev = res.dev;
if( (vmp = find_vmnt(new_vp->v_fs_e)) == NIL_VMNT)
- panic(__FILE__, "VFS advance: vmnt not found", NO_NUM);
+ panic("VFS advance: vmnt not found");
new_vp->v_vmnt = vmp;
new_vp->v_dev = vmp->m_dev;
}
if (!dir_vp) {
- panic(__FILE__,
- "VFS lookup: can't find mounted partition",
- NO_NUM);
+ panic("VFS lookup: can't find mounted partition");
}
} else {
/* Climbing up mount */
/* Find the vmnt that represents the partition on
* which we "climb up". */
if ((vmp = find_vmnt(res.fs_e)) == NIL_VMNT) {
- panic(__FILE__,
- "VFS lookup: can't find parent vmnt",NO_NUM);
+ panic("VFS lookup: can't find parent vmnt");
}
/* Make sure that the child FS does not feed a bogus path
int r = OK;
if (ex64hi(position) != 0)
- panic(__FILE__, "pipe_check: position too large in pipe", NO_NUM);
+ panic("pipe_check: position too large in pipe");
pos = ex64lo(position);
/* If reading, check for empty pipe. */
#if DO_SANITYCHECKS
if (why == FP_BLOCKED_ON_PIPE)
- panic(__FILE__, "suspend: called for FP_BLOCKED_ON_PIPE", NO_NUM);
+ panic("suspend: called for FP_BLOCKED_ON_PIPE");
if(fp_is_blocked(fp))
- panic(__FILE__, "suspend: called for suspended process", NO_NUM);
+ panic("suspend: called for suspended process");
if(why == FP_BLOCKED_ON_NONE)
- panic(__FILE__, "suspend: called for FP_BLOCKED_ON_NONE", NO_NUM);
+ panic("suspend: called for FP_BLOCKED_ON_NONE");
#endif
if (why == FP_BLOCKED_ON_POPEN)
PUBLIC void wait_for(endpoint_t who)
{
if(who == NONE || who == ANY)
- panic(__FILE__,"suspend on NONE or ANY",NO_NUM);
+ panic("suspend on NONE or ANY");
suspend(FP_BLOCKED_ON_OTHER);
fp->fp_task = who;
}
*/
#if DO_SANITYCHECKS
if(fp_is_blocked(fp))
- panic(__FILE__, "pipe_suspend: called for suspended process", NO_NUM);
+ panic("pipe_suspend: called for suspended process");
#endif
susp_count++; /* #procs susp'ed on pipe*/
revive(rp->fp_endpoint, 0);
susp_count--; /* keep track of who is suspended */
if(susp_count < 0)
- panic("vfs", "susp_count now negative", susp_count);
+ panic("susp_count now negative: %d", susp_count);
if (--count == 0) return;
}
}
rfp->fp_filp[fd_nr] = NIL_FILP;
FD_CLR(fd_nr, &rfp->fp_filp_inuse);
if (fil_ptr->filp_count != 1) {
- panic(__FILE__, "revive: bad count in filp",
+ panic("revive: bad count in filp: %d",
fil_ptr->filp_count);
}
fil_ptr->filp_count = 0;
*/
if(GRANT_VALID(rfp->fp_grant)) {
if(cpf_revoke(rfp->fp_grant)) {
- panic(__FILE__,"FS: revoke failed for grant",
+ panic("FS: revoke failed for grant: %d",
rfp->fp_grant);
}
rfp->fp_grant = GRANT_INVALID;
fild = (rfp->fp_fd >> 8) & BYTE;/* extract file descriptor */
if (fild < 0 || fild >= OPEN_MAX)
- panic(__FILE__,"unpause err 2",NO_NUM);
+ panic("unpause err 2");
f = rfp->fp_filp[fild];
dev = (dev_t) f->filp_vno->v_sdev; /* device hung on */
mess.TTY_LINE = (dev >> MINOR) & BYTE;
if(status == EAGAIN) status = EINTR;
if(GRANT_VALID(rfp->fp_grant)) {
if(cpf_revoke(rfp->fp_grant)) {
- panic(__FILE__,"FS: revoke failed for grant (cancel)",
+ panic("FS: revoke failed for grant (cancel): %d",
rfp->fp_grant);
}
rfp->fp_grant = GRANT_INVALID;
}
break;
default :
- panic(__FILE__,"FS: unknown value", blocked_on);
+ panic("FS: unknown value: %d", blocked_on);
}
rfp->fp_blocked_on = FP_BLOCKED_ON_NONE;
_PROTOTYPE( int fetch_name, (char *path, int len, int flag) );
_PROTOTYPE( int no_sys, (void) );
_PROTOTYPE( int isokendpt_f, (char *f, int l, int e, int *p, int ft));
-_PROTOTYPE( void panic, (char *who, char *mess, int num) );
#define okendpt(e, p) isokendpt_f(__FILE__, __LINE__, (e), (p), 1)
#define isokendpt(e, p) isokendpt_f(__FILE__, __LINE__, (e), (p), 0)
if (vp->v_pipe == I_PIPE) {
if (fp->fp_cum_io_partial != 0) {
- panic(__FILE__, "read_write: fp_cum_io_partial not clear",
- NO_NUM);
+ panic("read_write: fp_cum_io_partial not clear");
}
return rw_pipe(rw_flag, who_e, m_in.fd, f, m_in.buffer, m_in.nbytes);
}
if ((char_spec = (mode_word == I_CHAR_SPECIAL ? 1 : 0))) {
if (vp->v_sdev == NO_DEV)
- panic(__FILE__, "read_write tries to read from "
- "character device NO_DEV", NO_NUM);
-
+ panic("read_write tries to read from character device NO_DEV");
}
if ((block_spec = (mode_word == I_BLOCK_SPECIAL ? 1 : 0))) {
if (vp->v_sdev == NO_DEV)
- panic(__FILE__, "read_write tries to read from "
- " block device NO_DEV", NO_NUM);
+ panic("read_write tries to read from block device NO_DEV");
}
if (char_spec) { /* Character special files. */
if (r >= 0) {
if (ex64hi(new_pos))
- panic(__FILE__, "read_write: bad new pos", NO_NUM);
+ panic("read_write: bad new pos");
position = new_pos;
cum_io += cum_io_incr;
if (regular || mode_word == I_DIRECTORY) {
if (cmp64ul(position, vp->v_size) > 0) {
if (ex64hi(position) != 0) {
- panic(__FILE__,
- "read_write: file size too big ", NO_NUM);
+ panic("read_write: file size too big ");
}
vp->v_size = ex64lo(position);
}
return(EBADF);
if (ex64hi(rfilp->filp_pos) != 0)
- panic(__FILE__, "do_getdents: should handle large offsets", NO_NUM);
+ panic("do_getdents: should handle large offsets");
r = req_getdents(rfilp->filp_vno->v_fs_e, rfilp->filp_vno->v_inode_nr,
rfilp->filp_pos, m_in.buffer, m_in.nbytes, &new_pos);
}
if (vp->v_mapfs_e == 0)
- panic(__FILE__, "unmapped pipe", NO_NUM);
+ panic("unmapped pipe");
r = req_readwrite(vp->v_mapfs_e, vp->v_mapinode_nr, position, rw_flag, usr_e,
buf, size, &new_pos, &cum_io_incr);
if (r >= 0) {
if (ex64hi(new_pos))
- panic(__FILE__, "rw_pipe: bad new pos", NO_NUM);
+ panic("rw_pipe: bad new pos");
position = new_pos;
cum_io += cum_io_incr;
if (rw_flag == WRITING) {
if (cmp64ul(position, vp->v_size) > 0) {
if (ex64hi(position) != 0) {
- panic(__FILE__,
- "read_write: file size too big for v_size",
- NO_NUM);
+ panic("read_write: file size too big for v_size");
}
vp->v_size = ex64lo(position);
}
grant_id = cpf_grant_magic(fs_e, user_e, (vir_bytes) user_addr, num_of_bytes,
(rw_flag == READING ? CPF_WRITE : CPF_READ));
if(grant_id == -1)
- panic(__FILE__, "req_breadwrite: cpf_grant_magic failed", NO_NUM);
+ panic("req_breadwrite: cpf_grant_magic failed");
/* Fill in request message */
m.m_type = rw_flag == READING ? REQ_BREAD : REQ_BWRITE;
message m;
if (path[0] == '/')
- panic(__FILE__, "req_create: filename starts with '/'", NO_NUM);
+ panic("req_create: filename starts with '/'");
len = strlen(path) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes) path, len, CPF_READ);
if (grant_id == -1)
- panic(__FILE__, "req_create: cpf_grant_direct failed", NO_NUM);
+ panic("req_create: cpf_grant_direct failed");
/* Fill in request message */
m.m_type = REQ_CREATE;
grant_id = cpf_grant_magic(fs_e, who_e, (vir_bytes) buf, sizeof(struct statfs),
CPF_WRITE);
if(grant_id == -1)
- panic(__FILE__, "req_fstatfs: cpf_grant_magic failed", NO_NUM);
+ panic("req_fstatfs: cpf_grant_magic failed");
/* Fill in request message */
m.m_type = REQ_FSTATFS;
grant_id = cpf_grant_magic(fs_e, who_e, (vir_bytes) buf, size, CPF_WRITE);
if (grant_id < 0)
- panic(__FILE__, "req_getdents: cpf_grant_magic failed", grant_id);
+ panic("req_getdents: cpf_grant_magic failed: %d", grant_id);
m.m_type = REQ_GETDENTS;
m.REQ_INODE_NR = inode_nr;
len = strlen(lastc) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ);
if(grant_id == -1)
- panic(__FILE__, "req_link: cpf_grant_direct failed", NO_NUM);
+ panic("req_link: cpf_grant_direct failed");
/* Fill in request message */
m.m_type = REQ_LINK;
grant_id = cpf_grant_direct(fs_e, (vir_bytes) user_fullpath,
sizeof(user_fullpath), CPF_READ | CPF_WRITE);
if(grant_id == -1)
- panic(__FILE__, "req_lookup: cpf_grant_direct failed", NO_NUM);
+ panic("req_lookup: cpf_grant_direct failed");
len = strlen(user_fullpath) + 1;
grant_id2 = cpf_grant_direct(fs_e, (vir_bytes) &credentials,
sizeof(credentials), CPF_READ);
if(grant_id2 == -1)
- panic(__FILE__, "req_lookup: cpf_grant_direct failed", NO_NUM);
+ panic("req_lookup: cpf_grant_direct failed");
m.REQ_GRANT2 = grant_id2;
m.REQ_UCRED_SIZE= sizeof(credentials);
len = strlen(lastc) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ);
if(grant_id == -1)
- panic(__FILE__, "req_mkdir: cpf_grant_direct failed", NO_NUM);
+ panic("req_mkdir: cpf_grant_direct failed");
/* Fill in request message */
m.m_type = REQ_MKDIR;
len = strlen(lastc) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ);
if(grant_id == -1)
- panic(__FILE__, "req_mknod: cpf_grant_direct failed", NO_NUM);
+ panic("req_mknod: cpf_grant_direct failed");
/* Fill in request message */
m.m_type = REQ_MKNOD;
grant_id = cpf_grant_magic(fs_e, who_e, (vir_bytes) buf, len, CPF_WRITE);
if(grant_id == -1)
- panic(__FILE__, "req_rdlink: cpf_grant_magic failed", NO_NUM);
+ panic("req_rdlink: cpf_grant_magic failed");
/* Fill in request message */
m.m_type = REQ_RDLINK;
len = strlen(label)+1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes) label, len, CPF_READ);
if (grant_id == -1)
- panic(__FILE__, "req_readsuper: cpf_grant_direct failed", NO_NUM);
+ panic("req_readsuper: cpf_grant_direct failed");
/* Fill in request message */
m.m_type = REQ_READSUPER;
message m;
if (ex64hi(pos) != 0)
- panic(__FILE__, "req_readwrite: pos too large", NO_NUM);
+ panic("req_readwrite: pos too large");
grant_id = cpf_grant_magic(fs_e, user_e, (vir_bytes) user_addr, num_of_bytes,
(rw_flag==READING ? CPF_WRITE:CPF_READ));
if (grant_id == -1)
- panic(__FILE__, "req_readwrite: cpf_grant_magic failed", NO_NUM);
+ panic("req_readwrite: cpf_grant_magic failed");
/* Fill in request message */
m.m_type = rw_flag == READING ? REQ_READ : REQ_WRITE;
len_old = strlen(old_name) + 1;
gid_old = cpf_grant_direct(fs_e, (vir_bytes) old_name, len_old, CPF_READ);
if(gid_old == -1)
- panic(__FILE__, "req_rename: cpf_grant_direct failed", NO_NUM);
+ panic("req_rename: cpf_grant_direct failed");
len_new = strlen(new_name) + 1;
gid_new = cpf_grant_direct(fs_e, (vir_bytes) new_name, len_new, CPF_READ);
if(gid_new == -1)
- panic(__FILE__, "req_rename: cpf_grant_direct failed", NO_NUM);
+ panic("req_rename: cpf_grant_direct failed");
/* Fill in request message */
m.m_type = REQ_RENAME;
len = strlen(lastc) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes) lastc, len, CPF_READ);
if(grant_id == -1)
- panic(__FILE__, "req_rmdir: cpf_grant_direct failed", NO_NUM);
+ panic("req_rmdir: cpf_grant_direct failed");
/* Fill in request message */
m.m_type = REQ_RMDIR;
len = strlen(lastc) + 1;
gid_name = cpf_grant_direct(fs_e, (vir_bytes) lastc, len, CPF_READ);
if(gid_name == -1)
- panic(__FILE__, "req_slink: cpf_grant_direct failed", NO_NUM);
+ panic("req_slink: cpf_grant_direct failed");
gid_buf = cpf_grant_magic(fs_e, who_e, (vir_bytes) path_addr, path_length,
CPF_READ);
if(gid_buf == -1) {
cpf_revoke(gid_name);
- panic(__FILE__, "req_slink: cpf_grant_magic failed", NO_NUM);
+ panic("req_slink: cpf_grant_magic failed");
}
/* Fill in request message */
sizeof(struct stat), CPF_WRITE);
if (grant_id < 0)
- panic(__FILE__, "req_stat: cpf_grant_* failed", NO_NUM);
+ panic("req_stat: cpf_grant_* failed");
/* Fill in request message */
m.m_type = REQ_STAT;
len = strlen(lastc) + 1;
grant_id = cpf_grant_direct(fs_e, (vir_bytes) lastc, len, CPF_READ);
if(grant_id == -1)
- panic(__FILE__, "req_unlink: cpf_grant_direct failed", NO_NUM);
+ panic("req_unlink: cpf_grant_direct failed");
/* Fill in request message */
m.m_type = REQ_UNLINK;
struct vmnt *vmp;
if(fs_e <= 0 || fs_e == NONE)
- panic(__FILE__, "talking to bogus endpoint", fs_e);
+ panic("talking to bogus endpoint: %d", fs_e);
/* Make a copy of the request so that we can load it back in
* case of a dead driver */
/* No FS ?? */
if (old_driver_e == NONE)
- panic(__FILE__, "VFSdead_driver: couldn't find FS\n", fs_e);
+ panic("VFSdead_driver: couldn't find FS: %d", fs_e);
/* Wait for a new driver. */
for (;;) {
printf("VFSdead_driver: waiting for new driver\n");
r = sef_receive(RS_PROC_NR, &m);
if (r != OK) {
- panic(__FILE__, "VFSdead_driver: unable to receive from RS",
- r);
+ panic("VFSdead_driver: unable to receive from RS: %d", r);
}
if (m.m_type == DEVCTL) {
/* Map new driver */
}
}
else {
- panic(__FILE__, "VFSdead_driver: got message from RS, type",
- m.m_type);
+ panic("VFSdead_driver: got message from RS type: %d", m.m_type);
}
m.m_type = r;
if ((r = send(RS_PROC_NR, &m)) != OK) {
- panic(__FILE__, "VFSdead_driver: unable to send to RS",
- r);
+ panic("VFSdead_driver: unable to send to RS: %d", r);
}
/* New driver is ready */
if (new_driver_e) break;
}
printf("fs_sendrec: unhandled error %d sending to %d\n", r, fs_e);
- panic(__FILE__, "fs_sendrec: unhandled error", NO_NUM);
+ panic("fs_sendrec: unhandled error");
}
#endif
return(SEL_ERR);
if (r != SUSPEND)
- panic(__FILE__, "select_request_asynch: expected SUSPEND got", r);
+ panic("select_request_asynch: expected SUSPEND got: %d", r);
f->filp_count++;
dp->dmap_sel_filp = f;
fd_set *src_fds, *dst_fds;
if(nfds < 0 || nfds > OPEN_MAX)
- panic(__FILE__, "select copy_fdsets: nfds wrong", nfds);
+ panic("select copy_fdsets: nfds wrong: %d", nfds);
/* Only copy back as many bits as the user expects. */
fd_setsize = _FDSETWORDS(nfds) * _FDSETBITSPERWORD/8;
}
if (!(fp->filp_select_flags & FSF_BUSY))
- panic(__FILE__, "select_reply1: strange, not FSF_BUSY", NO_NUM);
+ panic("select_reply1: strange; not FSF_BUSY");
vp= fp->filp_vno;
if (!vp)
- panic(__FILE__, "select_reply1: FSF_BUSY but no vp", NO_NUM);
+ panic("select_reply1: FSF_BUSY but no vp");
- if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL)
- {
- panic(__FILE__, "select_reply1: FSF_BUSY but not char special",
- NO_NUM);
+ if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL) {
+ panic("select_reply1: FSF_BUSY but not char special");
}
if (vp->v_sdev != dev)
fp->filp_count--;
else
{
- if (fp->filp_count != 1)
- {
- panic(__FILE__, "select_reply1: bad filp_count",
- fp->filp_count);
+ if (fp->filp_count != 1) {
+ panic("select_reply1: bad filp_count: %d", fp->filp_count);
}
close_filp(fp);
}
continue;
vp= fp->filp_vno;
- if (!vp)
- {
- panic(__FILE__,
- "sel_restart_dev: FSF_UPDATE but no vp",
- NO_NUM);
+ if (!vp) {
+ panic("sel_restart_dev: FSF_UPDATE but no vp");
}
- if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL)
- {
- panic(__FILE__,
- "sel_restart_dev: FSF_UPDATE but not char special",
- NO_NUM);
+ if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL) {
+ panic("sel_restart_dev: FSF_UPDATE but not char special");
}
dp = &dmap[((vp->v_sdev) >> MAJOR) & BYTE];
if (rfilp->filp_vno->v_pipe == I_PIPE) {
if (rfilp->filp_mode & R_BIT)
if (ex64hi(rfilp->filp_pos) != 0) {
- panic(__FILE__, "do_fstat: bad position in pipe",
- NO_NUM);
+ panic("do_fstat: bad position in pipe");
}
pipe_pos = ex64lo(rfilp->filp_pos);
}
clock_t now, old_head = 0, new_head;
if ((r = getuptime(&now)) != OK)
- panic(__FILE__, "FS couldn't get uptime from system task.", NO_NUM);
+ panic("FS couldn't get uptime from system task");
tmr_arg(tp)->ta_int = arg;
/* reschedule our synchronous alarm if necessary */
if (!old_head || old_head > new_head) {
if (sys_setalarm(new_head, 1) != OK)
- panic(__FILE__, "FS set timer "
- "couldn't set synchronous alarm.", NO_NUM);
+ panic("FS set timer couldn't set synchronous alarm");
}
return;
tmrs_exptimers(&fs_timers, now, &new_head);
if (new_head > 0) {
if (sys_setalarm(new_head, 1) != OK)
- panic(__FILE__, "FS expire timer couldn't set "
- "synchronous alarm.", NO_NUM);
+ panic("FS expire timer couldn't set synchronous alarm");
}
}
*/
if (old_head < new_head || !new_head) {
if (sys_setalarm(new_head, 1) != OK)
- panic(__FILE__,
- "FS expire timer couldn't set synchronous alarm.",
- NO_NUM);
+ panic("FS expire timer couldn't set synchronous alarm");
}
}
}
if(len >= sizeof(user_fullpath))
- panic(__FILE__, "fetch_name: len too much for user_fullpath", len);
+ panic("fetch_name: len too much for user_fullpath: %d", len);
/* Check name length for validity. */
if (len <= 0) {
}
if(failed && fatal)
- panic(__FILE__, "isokendpt_f failed", NO_NUM);
+ panic("isokendpt_f failed");
return(failed ? EDEADSRCDST : OK);
}
r = getuptime2(&uptime, &boottime);
if (r != OK)
- panic(__FILE__,"clock_time err", r);
+ panic("clock_time err: %d", r);
return( (time_t) (boottime + (uptime/system_hz)));
}
/* vp check that panics */
#define ASSERTVP(v) if(!SANEVP(v)) { \
- BADVP(v, __FILE__, __LINE__); panic("vfs", "bad vp", NO_NUM); }
+ BADVP(v, __FILE__, __LINE__); panic("bad vp"); }
/*===========================================================================*
* get_free_vnode *
/* A vnode that's not in use can't be put. */
if (vp->v_ref_count <= 0) {
printf("put_vnode: bad v_ref_count %d\n", vp->v_ref_count);
- panic(__FILE__, "put_vnode failed", NO_NUM);
+ panic("put_vnode failed");
}
/* fs_count should indicate that the file is in use. */
if (vp->v_fs_count <= 0) {
printf("put_vnode: bad v_fs_count %d\n", vp->v_fs_count);
- panic(__FILE__, "put_vnode failed", NO_NUM);
+ panic("put_vnode failed");
}
/* Tell FS we don't need this inode to be open anymore. */
if(!(c)) { \
printf("holes_sanity_f:%s:%d: %s failed\n", file, line, #c); \
util_stacktrace(); \
- vm_panic("assert failed.", NO_NUM); } \
+ panic("assert failed"); } \
}
int h, c = 0, n = 0;
if(memflags & PAF_CLEAR) {
if ((s= sys_memset(0, CLICK_SIZE*old_base,
CLICK_SIZE*clicks)) != OK) {
- vm_panic("alloc_mem: sys_memset failed", s);
+ panic("alloc_mem: sys_memset failed: %d", s);
}
}
}
if ( (new_ptr = free_slots) == NIL_HOLE)
- vm_panic("hole table full", NO_NUM);
+ panic("hole table full");
new_ptr->h_base = base;
new_ptr->h_len = clicks;
free_slots = new_ptr->h_next;
printmemstats();
#if SANITYCHECKS
if(largest >= pages) {
- vm_panic("no memory but largest was enough", NO_NUM);
+ panic("no memory but largest was enough");
}
#endif
return NO_MEM;
int s;
if ((s= sys_memset(0, CLICK_SIZE*mem,
VM_PAGE_SIZE*pages)) != OK)
- vm_panic("alloc_mem: sys_memset failed", s);
+ panic("alloc_mem: sys_memset failed: %d", s);
}
#if SANITYCHECKS
pr->size += npages;);
} else {
if(!SLABALLOC(pr))
- vm_panic("alloc_pages: can't alloc", NO_NUM);
+ panic("alloc_pages: can't alloc");
#if SANITYCHECKS
memstats(&firstnodes, &firstpages, &largest);
dmatab[i].dt_base,
dmatab[i].dt_size);
}
- vm_panic("adddma: table full", NO_NUM);
+ panic("adddma: table full");
return ENOSPC;
}
{
int i, found_one;
- vm_panic("release_dma not done", NO_NUM);
+ panic("release_dma not done");
#if 0
found_one= FALSE;
}
new_clicks -= vmp->vm_arch.vm_seg[D].mem_vir;
if ((r=get_stack_ptr(vmp->vm_endpoint, &new_sp)) != OK)
- vm_panic("couldn't get stack pointer", r);
+ panic("couldn't get stack pointer: %d", r);
r = adjust(vmp, new_clicks, new_sp);
return r;
}
r= sys_datacopy(msg->m_source, (vir_bytes)ptr,
SELF, (vir_bytes)&args, sizeof(args));
if (r != OK)
- vm_panic("exec_newmem: sys_datacopy failed", r);
+ panic("exec_newmem: sys_datacopy failed: %d", r);
/* Minimum stack region (not preallocated)
* Stopgap for better rlimit-based stack size system
/* We secretly know that making a new pagetable
* in the same slot if one was there will never fail.
*/
- vm_panic("new_mem: pt_new failed", ENOMEM);
+ panic("new_mem: pt_new failed: %d", ENOMEM);
}
rmp->vm_flags |= VMF_HASPT;
SANITYCHECK(SCL_DETAIL);
*/
base = (phys_bytes)(new_base+text_clicks-1) << CLICK_SHIFT;
if ((s= sys_memset(0, base, CLICK_SIZE)) != OK)
- vm_panic("new_mem: sys_memset failed", s);
+ panic("new_mem: sys_memset failed: %d", s);
}
}
if((r2=sys_newmap(rmp->vm_endpoint, rmp->vm_arch.vm_seg)) != OK) {
/* report new map to the kernel */
- vm_panic("sys_newmap failed", r2);
+ panic("sys_newmap failed: %d", r2);
}
/* Zero the bss, gap, and stack segment. */
bytes -= bss_offset;
if ((s=sys_memset(0, base, bytes)) != OK) {
- vm_panic("new_mem can't zero", s);
+ panic("new_mem can't zero: %d", s);
}
/* Tell kernel this thing has no page table. */
if((s=pt_bind(NULL, rmp)) != OK)
- vm_panic("exec_newmem: pt_bind failed", s);
+ panic("exec_newmem: pt_bind failed: %d", s);
*stack_top= ((vir_bytes)rmp->vm_arch.vm_seg[S].mem_vir << CLICK_SHIFT) +
((vir_bytes)rmp->vm_arch.vm_seg[S].mem_len << CLICK_SHIFT);
}
if(!map_page_region(vmp, vstart + text_bytes + data_bytes + hole_bytes,
0, stack_bytes + gap_bytes, MAP_NONE,
VR_ANON | VR_WRITABLE, 0) != OK) {
- vm_panic("map_page_region failed for stack", NO_NUM);
+ panic("map_page_region failed for stack");
}
vmp->vm_arch.vm_seg[D].mem_phys = ABS2CLICK(vstart + text_bytes);
vmp->vm_flags |= VMF_HASPT;
if((s=sys_newmap(vmp->vm_endpoint, vmp->vm_arch.vm_seg)) != OK)
- vm_panic("sys_newmap (vm) failed", s);
+ panic("sys_newmap (vm) failed: %d", s);
if((s=pt_bind(&vmp->vm_pt, vmp)) != OK)
- vm_panic("exec_newmem: pt_bind failed", s);
+ panic("exec_newmem: pt_bind failed: %d", s);
return OK;
}
child_abs = (phys_bytes) child_base << CLICK_SHIFT;
parent_abs = (phys_bytes) vmp->vm_arch.vm_seg[D].mem_phys << CLICK_SHIFT;
s = sys_abscopy(parent_abs, child_abs, prog_bytes);
- if (s < 0) vm_panic("do_fork can't copy", s);
+ if (s < 0) panic("do_fork can't copy: %d", s);
/* A separate I&D child keeps the parents text segment. The data and stack
* segments must refer to the new copy.
if((r=sys_fork(vmp->vm_endpoint, childproc,
&vmc->vm_endpoint, vmc->vm_arch.vm_seg,
PFF_VMINHIBIT, &msgaddr)) != OK) {
- vm_panic("do_fork can't sys_fork", r);
+ panic("do_fork can't sys_fork: %d", r);
}
NOTRUNNABLE(vmp->vm_endpoint);
}
if((r=pt_bind(&vmc->vm_pt, vmc)) != OK)
- vm_panic("fork can't pt_bind", r);
+ panic("fork can't pt_bind: %d", r);
/* Inform caller of new child endpoint. */
msg->VMF_CHILD_ENDPOINT = vmc->vm_endpoint;
}
if(slot >= ELEMENTS(vmproc)) {
- vm_panic("pt_sanitycheck: passed pt not in any proc", NO_NUM);
+ panic("pt_sanitycheck: passed pt not in any proc");
}
MYASSERT(usedpages_add(pt->pt_dir_phys, I386_PAGE_SIZE) == OK);
u32_t b;
b = (u32_t) malloc(I386_PAGE_SIZE + bytes);
- if(!b) vm_panic("aalloc: out of memory", bytes);
+ if(!b) panic("aalloc: out of memory: %d", bytes);
b += I386_PAGE_SIZE - (b % I386_PAGE_SIZE);
return (void *) b;
FREE_MEM(ABS2CLICK(phys), pages);
if(pt_writemap(&vmp->vm_pt, arch_vir2map(vmp, vir),
MAP_NONE, pages*I386_PAGE_SIZE, 0, WMF_OVERWRITE) != OK)
- vm_panic("vm_freepages: pt_writemap failed",
- NO_NUM);
+ panic("vm_freepages: pt_writemap failed");
} else {
printf("VM: vm_freepages not freeing VM heap pages (%d)\n",
pages);
}
if((r=sys_vmctl(SELF, VMCTL_FLUSHTLB, 0)) != OK) {
- vm_panic("VMCTL_FLUSHTLB failed", r);
+ panic("VMCTL_FLUSHTLB failed: %d", r);
}
level--;
/* Update flags. */
if((r=pt_writemap(pt, m, 0, I386_PAGE_SIZE,
flags, WMF_OVERWRITE | WMF_WRITEFLAGSONLY)) != OK) {
- vm_panic("vm_lockpage: pt_writemap failed\n", NO_NUM);
+ panic("vm_lockpage: pt_writemap failed");
}
if((r=sys_vmctl(SELF, VMCTL_FLUSHTLB, 0)) != OK) {
- vm_panic("VMCTL_FLUSHTLB failed", r);
+ panic("VMCTL_FLUSHTLB failed: %d", r);
}
return;
*/
#if SANITYCHECKS
if(physaddr != MAP_NONE && !(flags & I386_VM_PRESENT)) {
- vm_panic("pt_writemap: writing dir with !P\n", NO_NUM);
+ panic("pt_writemap: writing dir with !P");
}
if(physaddr == MAP_NONE && flags) {
- vm_panic("pt_writemap: writing 0 with flags\n", NO_NUM);
+ panic("pt_writemap: writing 0 with flags");
}
#endif
if(pt->pt_dir[pdecheck] & I386_VM_BIGPAGE) {
printf("pt_writemap: trying to write 0x%lx into 0x%lx\n",
physaddr, v);
- vm_panic("pt_writemap: BIGPAGE found", NO_NUM);
+ panic("pt_writemap: BIGPAGE found");
}
if(!(pt->pt_dir[pdecheck] & I386_VM_PRESENT)) {
int r;
/* Map in kernel. */
if(pt_mapkernel(pt) != OK)
- vm_panic("pt_new: pt_mapkernel failed", NO_NUM);
+ panic("pt_new: pt_mapkernel failed");
return OK;
}
/* Get ourselves spare pages. */
if(!(sparepages_mem = (vir_bytes) aalloc(I386_PAGE_SIZE*SPAREPAGES)))
- vm_panic("pt_init: aalloc for spare failed", NO_NUM);
+ panic("pt_init: aalloc for spare failed");
if((r=sys_umap(SELF, VM_D, (vir_bytes) sparepages_mem,
I386_PAGE_SIZE*SPAREPAGES, &sparepages_ph)) != OK)
- vm_panic("pt_init: sys_umap failed", r);
+ panic("pt_init: sys_umap failed: %d", r);
for(s = 0; s < SPAREPAGES; s++) {
sparepages[s].page = (void *) (sparepages_mem + s*I386_PAGE_SIZE);
* from the current one.
*/
if(pt_new(newpt) != OK)
- vm_panic("pt_init: pt_new failed", NO_NUM);
+ panic("pt_init: pt_new failed");
/* Set up mappings for VM process. */
for(v = lo; v < hi; v += I386_PAGE_SIZE) {
*/
if(pt_writemap(newpt, v+moveup, v, I386_PAGE_SIZE,
I386_VM_PRESENT|I386_VM_WRITE|I386_VM_USER, 0) != OK)
- vm_panic("pt_init: pt_writemap failed", NO_NUM);
+ panic("pt_init: pt_writemap failed");
}
/* Move segments up too. */
*/
if(!(page_directories = vm_allocpage(&page_directories_phys,
VMP_PAGETABLE)))
- vm_panic("no virt addr for vm mappings", NO_NUM);
+ panic("no virt addr for vm mappings");
memset(page_directories, 0, I386_PAGE_SIZE);
&flags) == OK) {
vir_bytes vir;
if(index >= MAX_KERNMAPPINGS)
- vm_panic("VM: too many kernel mappings", index);
+ panic("VM: too many kernel mappings: %d", index);
kern_mappings[index].phys_addr = addr;
kern_mappings[index].len = len;
kern_mappings[index].flags = flags;
kern_mappings[index].flags |=
I386_VM_PWT | I386_VM_PCD;
if(addr % I386_PAGE_SIZE)
- vm_panic("VM: addr unaligned", addr);
+ panic("VM: addr unaligned: %d", addr);
if(len % I386_PAGE_SIZE)
- vm_panic("VM: len unaligned", len);
+ panic("VM: len unaligned: %d", len);
vir = arch_map2vir(&vmproc[VMP_SYSTEM], offset);
if(sys_vmctl_reply_mapping(index, vir) != OK)
- vm_panic("VM: reply failed", NO_NUM);
+ panic("VM: reply failed");
offset += len;
index++;
kernmappings++;
/* Tell kernel about free pde's. */
while(free_pde*I386_BIG_PAGE_SIZE < VM_PROCSTART) {
if((r=sys_vmctl(SELF, VMCTL_I386_FREEPDE, free_pde++)) != OK) {
- vm_panic("VMCTL_I386_FREEPDE failed", r);
+ panic("VMCTL_I386_FREEPDE failed: %d", r);
}
}
/* Increase kernel segment to address this memory. */
if((r=sys_vmctl(SELF, VMCTL_I386_KERNELLIMIT, kernlimit)) != OK) {
- vm_panic("VMCTL_I386_KERNELLIMIT failed", r);
+ panic("VMCTL_I386_KERNELLIMIT failed: %d", r);
}
kpagedir = arch_map2vir(&vmproc[VMP_SYSTEM],
/* Tell kernel how to get at the page directories. */
if((r=sys_vmctl(SELF, VMCTL_I386_PAGEDIRS, kpagedir)) != OK) {
- vm_panic("VMCTL_I386_PAGEDIRS failed", r);
+ panic("VMCTL_I386_PAGEDIRS failed: %d", r);
}
/* Give our process the new, copied, private page table. */
/* Now actually enable paging. */
if(sys_vmctl_enable_paging(vmp->vm_arch.vm_seg) != OK)
- vm_panic("pt_init: enable paging failed", NO_NUM);
+ panic("pt_init: enable paging failed");
/* Back to reality - this is where the stack actually is. */
vmp->vm_arch.vm_seg[S].mem_len -= extra_clicks;
I386_VM_WRITE | global_bit;
}
} else {
- vm_panic("VM: pt_mapkernel: no bigpage", NO_NUM);
+ panic("VM: pt_mapkernel: no bigpage");
}
if(pagedir_pde >= 0) {
kern_mappings[i].phys_addr,
kern_mappings[i].len,
kern_mappings[i].flags, 0) != OK) {
- vm_panic("pt_mapkernel: pt_writemap failed", NO_NUM);
+ panic("pt_mapkernel: pt_writemap failed");
}
}
SANITYCHECK(SCL_DETAIL);
if ((r=sef_receive(ANY, &msg)) != OK)
- vm_panic("sef_receive() error", r);
+ panic("sef_receive() error: %d", r);
SANITYCHECK(SCL_DETAIL);
if((r=send(who_e, &msg)) != OK) {
printf("VM: couldn't send %d to %d (err %d)\n",
msg.m_type, who_e, r);
- vm_panic("send() error", NO_NUM);
+ panic("send() error");
}
SANITYCHECK(SCL_DETAIL);
}
* slots to fill in.
*/
if (OK != (s=sys_getimage(image)))
- vm_panic("couldn't get image table: %d\n", s);
+ panic("couldn't get image table: %d", s);
/* Set table to 0. This invalidates all slots (clear VMF_INUSE). */
memset(vmproc, 0, sizeof(vmproc));
phys_bytes proclimit;
struct vmproc *vmp;
- if(ip->proc_nr >= _NR_PROCS) { vm_panic("proc", ip->proc_nr); }
+ if(ip->proc_nr >= _NR_PROCS) { panic("proc: %d", ip->proc_nr); }
if(ip->proc_nr < 0 && ip->proc_nr != SYSTEM) continue;
#define GETVMP(v, nr) \
} else if(nr == SYSTEM) { \
vmp = &vmproc[VMP_SYSTEM]; \
} else { \
- vm_panic("init: crazy proc_nr", nr); \
+ panic("init: crazy proc_nr: %d", nr); \
}
/* Initialize normal process table slot or special SYSTEM
/* Get memory map for this process from the kernel. */
if ((s=get_mem_map(ip->proc_nr, vmp->vm_arch.vm_seg)) != OK)
- vm_panic("couldn't get process mem_map",s);
+ panic("couldn't get process mem_map: %d", s);
/* Remove this memory from the free list. */
reserve_proc_mem(mem_chunks, vmp->vm_arch.vm_seg);
vmp->vm_arch.vm_seg[D].mem_len;
if(pt_new(&vmp->vm_pt) != OK)
- vm_panic("VM: no new pagetable", NO_NUM);
+ panic("VM: no new pagetable");
#define BASICSTACK VM_PAGE_SIZE
old_stacktop = CLICK2ABS(vmp->vm_arch.vm_seg[S].mem_vir +
vmp->vm_arch.vm_seg[S].mem_len);
if(sys_vmctl(vmp->vm_endpoint, VMCTL_INCSP,
VM_STACKTOP - old_stacktop) != OK) {
- vm_panic("VM: vmctl for new stack failed", NO_NUM);
+ panic("VM: vmctl for new stack failed");
}
FREE_MEM(vmp->vm_arch.vm_seg[D].mem_phys +
CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys),
CLICK2ABS(vmp->vm_arch.vm_seg[D].mem_phys),
VM_STACKTOP) != OK) {
- vm_panic("failed proc_new for boot process", NO_NUM);
+ panic("failed proc_new for boot process");
}
}
/* Set up table of calls. */
#define CALLMAP(code, func) { int i; \
- if((i=CALLNUMBER(code)) < 0) { vm_panic(#code " invalid", (code)); } \
- if(i >= NR_VM_CALLS) { vm_panic(#code " invalid", (code)); } \
+ if((i=CALLNUMBER(code)) < 0) { panic(#code " invalid: %d", (code)); } \
+ if(i >= NR_VM_CALLS) { panic(#code " invalid: %d", (code)); } \
vm_calls[i].vmc_func = (func); \
vm_calls[i].vmc_name = #code; \
}
/* Sanity checks */
if(find_kernel_top() >= VM_PROCSTART)
- vm_panic("kernel loaded too high", NO_NUM);
+ panic("kernel loaded too high");
/* Initialize the structures for queryexit */
init_query_exit();
/* Map all the services in the boot image. */
if((s = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0,
(vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) {
- panic("VM", "sys_safecopyfrom failed", s);
+ panic("sys_safecopyfrom failed: %d", s);
}
for(i=0;i < NR_BOOT_PROCS;i++) {
if(rprocpub[i].in_use) {
if((s = map_service(&rprocpub[i])) != OK) {
- vm_panic("unable to map service", s);
+ panic("unable to map service: %d", s);
}
}
}
int n, r;
if ((r = vm_isokendpt(caller, &n)) != OK)
- vm_panic("VM: from strange source.", caller);
+ panic("VM: from strange source: %d", caller);
/* See if the call is allowed. */
if (!GET_BIT(vmproc[n].vm_call_mask, call)) {
physr_start_iter(vrs->phys, &iter, offset_s, AVL_EQUAL);
prs = physr_get_iter(&iter);
if(!prs)
- vm_panic("map_memory: no aligned phys region.", 0);
+ panic("map_memory: no aligned phys region: %d", 0);
/* flag: 0 -> read-only
* 1 -> writable
int r;
if(vm_isokendpt(sour, &p) != OK)
- vm_panic("handle_memory: endpoint wrong", sour);
+ panic("handle_memory: endpoint wrong: %d", sour);
vms = &vmproc[p];
if(vm_isokendpt(dest, &p) != OK)
- vm_panic("handle_memory: endpoint wrong", dest);
+ panic("handle_memory: endpoint wrong: %d", dest);
vmd = &vmproc[p];
vrs = map_lookup(vms, virt_s);
/* Use information on the destination process to unmap. */
if(vm_isokendpt(dest, &p) != OK)
- vm_panic("handle_memory: endpoint wrong", dest);
+ panic("handle_memory: endpoint wrong: %d", dest);
vmd = &vmproc[p];
vrd = map_lookup(vmd, virt_d);
physr_start_iter(vrd->phys, &iter, off, AVL_EQUAL);
pr = physr_get_iter(&iter);
if(!pr)
- vm_panic("map_memory: no aligned phys region.", 0);
+ panic("map_memory: no aligned phys region: %d", 0);
/* Copy the phys block now rather than doing COW. */
end = off + length;
struct vir_region *vr = NULL;
if((r=vm_isokendpt(m->m_source, &n)) != OK) {
- vm_panic("do_mmap: message from strange source", m->m_source);
+ panic("do_mmap: message from strange source: %d", m->m_source);
}
vmp = &vmproc[n];
}
if(map_unmap_region(vmp, vr, vr->length) != OK)
- vm_panic("do_shared_unmap: map_unmap_region failed", NO_NUM);
+ panic("do_shared_unmap: map_unmap_region failed");
return OK;
}
struct vir_region *vr;
if((r=vm_isokendpt(m->m_source, &n)) != OK) {
- vm_panic("do_mmap: message from strange source", m->m_source);
+ panic("do_mmap: message from strange source: %d", m->m_source);
}
vmp = &vmproc[n];
} else if(m->m_type == VM_MUNMAP_TEXT) {
addr = (vir_bytes) arch_vir2map_text(vmp, (vir_bytes) m->VMUM_ADDR);
} else {
- vm_panic("do_munmap: strange type", NO_NUM);
+ panic("do_munmap: strange type");
}
if(!(vr = map_lookup(vmp, addr))) {
}
if(map_unmap_region(vmp, vr, len) != OK)
- vm_panic("do_munmap: map_unmap_region failed", NO_NUM);
+ panic("do_munmap: map_unmap_region failed");
return OK;
}
int p, wr = PFERR_WRITE(err);
if(vm_isokendpt(ep, &p) != OK)
- vm_panic("do_pagefaults: endpoint wrong", ep);
+ panic("do_pagefaults: endpoint wrong: %d", ep);
vmp = &vmproc[p];
vm_assert(vmp->vm_flags & VMF_INUSE);
ep, arch_map2vir(vmp, addr), pf_errstr(err));
sys_sysctl_stacktrace(vmp->vm_endpoint);
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
- vm_panic("sys_kill failed", s);
+ panic("sys_kill failed: %d", s);
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK)
- vm_panic("do_pagefaults: sys_vmctl failed", ep);
+ panic("do_pagefaults: sys_vmctl failed: %d", ep);
continue;
}
ep, arch_map2vir(vmp, addr), pf_errstr(err));
sys_sysctl_stacktrace(vmp->vm_endpoint);
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
- vm_panic("sys_kill failed", s);
+ panic("sys_kill failed: %d", s);
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK)
- vm_panic("do_pagefaults: sys_vmctl failed", ep);
+ panic("do_pagefaults: sys_vmctl failed: %d", ep);
continue;
}
printf("VM: pagefault: SIGSEGV %d pagefault not handled\n", ep);
sys_sysctl_stacktrace(vmp->vm_endpoint);
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
- vm_panic("sys_kill failed", s);
+ panic("sys_kill failed: %d", s);
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK)
- vm_panic("do_pagefaults: sys_vmctl failed", ep);
+ panic("do_pagefaults: sys_vmctl failed: %d", ep);
continue;
}
/* Pagefault is handled, so now reactivate the process. */
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK)
- vm_panic("do_pagefaults: sys_vmctl failed", ep);
+ panic("do_pagefaults: sys_vmctl failed: %d", ep);
}
switch(r) {
case VMPTYPE_CHECK:
if(vm_isokendpt(who, &p) != OK)
- vm_panic("do_memory: bad endpoint", who);
+ panic("do_memory: bad endpoint: %d", who);
vmp = &vmproc[p];
r = handle_memory(vmp, mem, len, wrflag);
}
if(sys_vmctl(requestor, VMCTL_MEMREQ_REPLY, r) != OK)
- vm_panic("do_memory: sys_vmctl failed", r);
+ panic("do_memory: sys_vmctl failed: %d", r);
}
}
case VR_DIRECT:
return "direct";
default:
- vm_panic("unknown mapping type", type);
+ panic("unknown mapping type: %d", type);
}
return "NOTREACHED";
} else if(region->flags & VR_DIRECT) {
; /* No action required. */
} else {
- vm_panic("strange phys flags", NO_NUM);
+ panic("strange phys flags");
}
SLABFREE(pb);
}
SANITYCHECK(SCL_FUNCTIONS);
if(!vmp->vm_regions)
- vm_panic("process has no regions", vmp->vm_endpoint);
+ panic("process has no regions: %d", vmp->vm_endpoint);
for(r = vmp->vm_regions; r; r = r->next) {
if(offset >= r->vaddr && offset < r->vaddr + r->length)
*/
r = map_ph_writept(vmp, region, ph);
if(r != OK)
- vm_panic("map_copy_ph_block: map_ph_writept failed", r);
+ panic("map_copy_ph_block: map_ph_writept failed: %d", r);
return OK;
}
#if SANITYCHECKS
if(OK != pt_checkrange(&vmp->vm_pt, region->vaddr+offset, VM_PAGE_SIZE, write)) {
- vm_panic("map_pf: pt_checkrange failed", r);
+ panic("map_pf: pt_checkrange failed: %d", r);
}
#endif
#define RESET_ITER(it, where, what) { \
physr_start_iter(region->phys, &it, where, AVL_EQUAL); \
what = physr_get_iter(&it); \
- if(!what) vm_panic("thing missing", NO_NUM); \
- if(what->offset != where) vm_panic("thing wrong", NO_NUM); \
+ if(!what) panic("thing missing"); \
+ if(what->offset != where) panic("thing wrong"); \
}
FREE_RANGE_HERE(NULL, physr);
printf("handle mem %s-", arch_map2str(vmp, region->vaddr+offset));
printf("%s failed\n", arch_map2str(vmp, region->vaddr+offset+length));
map_printregion(vmp, region);
- vm_panic("checkrange failed", NO_NUM);
+ panic("checkrange failed");
}
#endif
SANITYCHECK(SCL_DETAIL);
if(r == NULL)
- vm_panic("map_unmap_region: region not found\n", NO_NUM);
+ panic("map_unmap_region: region not found");
if(len > r->length || (len % VM_PAGE_SIZE)) {
printf("VM: bogus length 0x%lx\n", len);
struct phys_block *pb = ph->ph;
USE(pb, pb->refcount++;);
if(map_ph_writept(dvmp, vr, ph) != OK) {
- vm_panic("map_remap: map_ph_writept failed", NO_NUM);
+ panic("map_remap: map_ph_writept failed");
}
physr_incr_iter(&iter);
*/
#define MYASSERT(c) do { if(!(c)) { \
printf("VM:%s:%d: %s failed\n", file, line, #c); \
- vm_panic("sanity check failed", NO_NUM); } } while(0)
+ panic("sanity check failed"); } } while(0)
#define SLABSANITYCHECK(l) if((l) <= vm_sanitychecklevel) { \
slab_sanitycheck(__FILE__, __LINE__); }
#define SLABSANE(ptr) { \
if(!slabsane_f(__FILE__, __LINE__, ptr, sizeof(*(ptr)))) { \
printf("VM:%s:%d: SLABSANE(%s)\n", __FILE__, __LINE__, #ptr); \
- vm_panic("SLABSANE failed", NO_NUM); \
+ panic("SLABSANE failed"); \
} \
}
#define NOTRUNNABLE(ep) { \
struct proc pr; \
if(sys_getproc(&pr, ep) != OK) { \
- vm_panic("VM: sys_getproc failed", ep); \
+ panic("VM: sys_getproc failed: %d", ep); \
} \
if(!pr.p_rts_flags) { \
- vm_panic("VM: runnable", ep); \
+ panic("VM: runnable: %d", ep); \
} \
}
vmp = &vmproc[n];
if ((r=get_stack_ptr(ep, &sp)) != OK)
- vm_panic("couldn't get new stack pointer (for sig)",r);
+ panic("couldn't get new stack pointer (for sig): %d", r);
/* Save old SP for caller */
msg->VMPS_OLD_SP = (char *) sp;
printf("slaballoc: odd, bytes %d?\n", bytes);
}
if(!slabsane_f(__FILE__, __LINE__, ret, bytes))
- vm_panic("slaballoc: slabsane failed", NO_NUM);
+ panic("slaballoc: slabsane failed");
#endif
return ret;
}
SLABSANITYCHECK(SCL_FUNCTIONS);
- vm_panic("slaballoc: no space in 'used' slabdata", NO_NUM);
+ panic("slaballoc: no space in 'used' slabdata");
/* Not reached. */
return NULL;
SLABSANITYCHECK(SCL_FUNCTIONS);
if(objstats(mem, bytes, &s, &f, &i) != OK) {
- vm_panic("slabfree objstats failed", NO_NUM);
+ panic("slabfree objstats failed");
}
#if SANITYCHECKS
struct slabdata *f;
if(objstats(mem, bytes, &s, &f, &i) != OK)
- vm_panic("slablock objstats failed", NO_NUM);
+ panic("slablock objstats failed");
SLABDATAUNWRITABLE(f);
struct slabdata *f;
if(objstats(mem, bytes, &s, &f, &i) != OK)
- vm_panic("slablock objstats failed", NO_NUM);
+ panic("slablock objstats failed");
SLABDATAWRITABLE(f, i);
if(vm_sanitychecklevel > 0 && !(cond)) { \
printf("VM:%s:%d: assert failed: %s\n", \
__FILE__, __LINE__, #cond); \
- panic("VM", "assert failed", NO_NUM); \
+ panic("assert failed"); \
} \
}
#else
#define vm_assert(cond) ;
#endif
-#define vm_panic(str, n) { char _pline[100]; \
- sprintf(_pline, "%s:%d: %s", __FILE__, __LINE__, (str)); \
- panic("VM", _pline, (n)); \
- }
-
#endif
/* Obtain and parse memory from system environment. */
if(env_memory_parse(mem_chunks, NR_MEMS) != OK)
- vm_panic("couldn't obtain memory chunks", NO_NUM);
+ panic("couldn't obtain memory chunks");
/* Round physical memory to clicks. Round start up, round end down. */
for (i = 0; i < NR_MEMS; i++) {
}
if (memp >= &mem_chunks[NR_MEMS])
{
- vm_panic("reserve_proc_mem: can't find map in mem_chunks ",
- map_ptr[T].mem_phys);
+ panic("reserve_proc_mem: can't find map in mem_chunks: 0x%lx",
+ map_ptr[T].mem_phys);
}
}
/* VM wants to call brk() itself. */
if((r=real_brk(vmm, (vir_bytes) brk_addr)) != OK)
- vm_panic("VM: brk() on myself failed\n", NO_NUM);
+ panic("VM: brk() on myself failed");
_brksize = brk_addr;
return 0;
}
#define FIFO_WAIT(fid) { \
int a; \
if(read(fid, &a, sizeof(a)) != sizeof(a)) \
- panic(__FILE__, "FIFO_WAIT failed", NO_NUM); \
+ panic("FIFO_WAIT failed"); \
}
#define FIFO_NOTIFY(fid) { \
int a = 1; \
if(write(fid, &a, sizeof(a)) != sizeof(a)) \
- panic(__FILE__, "FIFO_NOTIFY failed", NO_NUM); \
+ panic("FIFO_NOTIFY failed"); \
}
#define DEBUG 0
#define FIFO_WAIT(fid) { \
int a; \
if(read(fid, &a, sizeof(a)) != sizeof(a)) \
- panic(__FILE__, "FIFO_WAIT failed", NO_NUM); \
+ panic( "FIFO_WAIT failed"); \
}
#define FIFO_NOTIFY(fid) { \
int a = 1; \
if(write(fid, &a, sizeof(a)) != sizeof(a)) \
- panic(__FILE__, "FIFO_NOTIFY failed", NO_NUM); \
+ panic( "FIFO_NOTIFY failed"); \
}
#define CHECK_TEST(who, result, expected, test_name) { \
#define FIFO_WAIT(fid) { \
int a; \
if(read(fid, &a, sizeof(a)) != sizeof(a)) \
- panic(__FILE__, "FIFO_WAIT failed", NO_NUM); \
+ panic( "FIFO_WAIT failed"); \
}
#define FIFO_NOTIFY(fid) { \
int a = 1; \
if(write(fid, &a, sizeof(a)) != sizeof(a)) \
- panic(__FILE__, "FIFO_NOTIFY failed", NO_NUM); \
+ panic( "FIFO_NOTIFY failed"); \
}
#define REPORT_TEST(who, test_name, diff) { \
char c;
if(size % CLICK_SIZE != 0) {
- panic("REQUESTOR", "buff_size not page aligned", NO_NUM);
+ panic("buff_size not page aligned");
}
if(is_write) {
for(i=0;i<size;i+=CLICK_SIZE) buff[i] = 1;