$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
$m/syslib.h $s/types.h \
- $m/utils.h $m/serverassert.h $m/devio.h
+ $m/utils.h $m/devio.h
l = $d/libdriver/driver.h $d/libdriver/driver.c $m/partition.h $m/u64.h
/* Get the number of drives from the BIOS data area */
if ((s=sys_vircopy(SELF, BIOS_SEG, NR_HD_DRIVES_ADDR,
SELF, D, (vir_bytes) params, NR_HD_DRIVES_SIZE)) != OK)
- server_panic(w_name(), "Couldn't read BIOS", s);
+ panic(w_name(), "Couldn't read BIOS", s);
if ((nr_drives = params[0]) > 2) nr_drives = 2;
for (drive = 0, wn = wini; drive < MAX_DRIVES; drive++, wn++) {
size = (drive == 0) ? BIOS_HD0_PARAMS_SIZE:BIOS_HD1_PARAMS_SIZE;
if ((s=sys_vircopy(SELF, BIOS_SEG, vector,
SELF, D, (vir_bytes) parv, size)) != OK)
- server_panic(w_name(), "Couldn't read BIOS", s);
+ panic(w_name(), "Couldn't read BIOS", s);
/* Calculate the address of the parameters and copy them */
if ((s=sys_vircopy(
SELF, BIOS_SEG, hclick_to_physb(parv[1]) + parv[0],
SELF, D, (phys_bytes) params, 16L))!=OK)
- server_panic(w_name(),"Couldn't copy parameters", s);
+ panic(w_name(),"Couldn't copy parameters", s);
/* Copy the parameters to the structures of the drive */
wn->lcylinders = bp_cylinders(params);
/* Device information. */
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, SECTOR_SIZE)) != OK)
- server_panic(w_name(),"Call to sys_insw() failed", s);
+ panic(w_name(),"Call to sys_insw() failed", s);
/* Why are the strings byte swapped??? */
for (i = 0; i < 40; i++) id_string[i] = id_byte(27)[i^1];
/* Device information. */
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, 512)) != OK)
- server_panic(w_name(),"Call to sys_insw() failed", s);
+ panic(w_name(),"Call to sys_insw() failed", s);
/* Why are the strings byte swapped??? */
for (i = 0; i < 40; i++) id_string[i] = id_byte(27)[i^1];
/* Everything looks OK; register IRQ so we can stop polling. */
wn->irq = w_drive < 2 ? AT_WINI_0_IRQ : AT_WINI_1_IRQ;
if ((s=sys_irqsetpolicy(wn->irq, IRQ_REENABLE, &wn->irq_hook_id)) != OK)
- server_panic("AT", "coudn't set IRQ policy", s);
+ panic(w_name(), "coudn't set IRQ policy", s);
if ((s=sys_irqenable(&wn->irq_hook_id)) != OK)
- server_panic("AT", "coudn't enable IRQ line", s);
+ panic(w_name(), "coudn't enable IRQ line", s);
return(OK);
}
/* An error, send data to the bit bucket. */
if (w_status & STATUS_DRQ) {
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, SECTOR_SIZE)) != OK)
- server_panic(w_name(),"Call to sys_insw() failed", s);
+ panic(w_name(),"Call to sys_insw() failed", s);
}
break;
}
/* Copy bytes to or from the device's buffer. */
if (opcode == DEV_GATHER) {
if ((s=sys_insw(wn->base + REG_DATA, proc_nr, (void *) iov->iov_addr, SECTOR_SIZE)) != OK)
- server_panic(w_name(),"Call to sys_insw() failed", s);
+ panic(w_name(),"Call to sys_insw() failed", s);
} else {
if ((s=sys_outsw(wn->base + REG_DATA, proc_nr, (void *) iov->iov_addr, SECTOR_SIZE)) != OK)
- server_panic(w_name(),"Call to sys_insw() failed", s);
+ panic(w_name(),"Call to sys_insw() failed", s);
/* Data sent, wait for an interrupt. */
if ((r = at_intr_wait()) != OK) break;
/* Select drive. */
if ((s=sys_outb(base + REG_LDH, cmd->ldh)) != OK)
- server_panic(w_name(),"Couldn't write register to select drive",s);
+ panic(w_name(),"Couldn't write register to select drive",s);
if (!w_waitfor(STATUS_BSY, 0)) {
printf("%s: com_out: drive not ready\n", w_name());
pv_set(outbyte[5], base + REG_CYL_HI, cmd->cyl_hi);
pv_set(outbyte[6], base + REG_COMMAND, cmd->command);
if ((s=sys_voutb(outbyte,7)) != OK)
- server_panic("AT_WINI","Couldn't write registers with sys_voutb()",s);
+ panic(w_name(),"Couldn't write registers with sys_voutb()",s);
return(OK);
}
struct wini *wn;
/* Wait for any internal drive recovery. */
- tick_delay(RECOVERY_TICKS);
-
+ tickdelay(RECOVERY_TICKS);
/* Strobe reset bit */
if ((s=sys_outb(wn->base + REG_CTL, CTL_RESET)) != OK)
- server_panic("AT_WINI","Couldn't strobe reset bit",s);
- tick_delay(DELAY_TICKS);
+ panic(w_name(),"Couldn't strobe reset bit",s);
+ tickdelay(DELAY_TICKS);
if ((s=sys_outb(wn->base + REG_CTL, 0)) != OK)
- server_panic("AT_WINI","Couldn't strobe reset bit",s);
- tick_delay(DELAY_TICKS);
+ panic(w_name(),"Couldn't strobe reset bit",s);
+ tickdelay(DELAY_TICKS);
/* Wait for controller ready */
if (!w_waitfor(STATUS_BSY, 0)) {
r = OK;
} else {
if ((s=sys_inb(w_wn->base + REG_ERROR, &inbval)) != OK)
- server_panic(w_name(),"Couldn't read register",s);
+ panic(w_name(),"Couldn't read register",s);
if ((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 + REG_STATUS, &w_status)) != OK)
- server_panic(w_name(),"Couldn't read register",s);
+ panic(w_name(),"Couldn't read register",s);
if ((w_status & mask) == value) {
return 1;
}
if (chunk > count) chunk = count;
if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE;
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, chunk)) != OK)
- server_panic(w_name(),"Call to sys_insw() failed", s);
+ panic(w_name(),"Call to sys_insw() failed", s);
before -= chunk;
count -= chunk;
}
if (chunk > count) chunk = count;
if (chunk > iov->iov_size) chunk = iov->iov_size;
if ((s=sys_insw(wn->base + REG_DATA, proc_nr, (void *) iov->iov_addr, chunk)) != OK)
- server_panic(w_name(),"Call to sys_insw() failed", s);
+ panic(w_name(),"Call to sys_insw() failed", s);
position += chunk;
nbytes -= chunk;
count -= chunk;
chunk = count;
if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE;
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, chunk)) != OK)
- server_panic(w_name(),"Call to sys_insw() failed", s);
+ panic(w_name(),"Call to sys_insw() failed", s);
count -= chunk;
}
}
/* Select Master/Slave drive */
if ((s=sys_outb(wn->base + REG_DRIVE, wn->ldhpref)) != OK)
- server_panic("AT_WINI","Couldn't select master/ slave drive",s);
+ panic(w_name(),"Couldn't select master/ slave drive",s);
if (!w_waitfor(STATUS_BSY | STATUS_DRQ, 0)) {
printf("%s: atapi_sendpacket: drive not ready\n", w_name());
pv_set(outbyte[4], wn->base + REG_CNT_HI, (cnt >> 8) & 0xFF);
pv_set(outbyte[5], wn->base + REG_COMMAND, w_command);
if ((s=sys_voutb(outbyte,6)) != OK)
- server_panic("AT_WINI","Couldn't write registers with sys_voutb()",s);
+ panic(w_name(),"Couldn't write registers with sys_voutb()",s);
if (!w_waitfor(STATUS_BSY | STATUS_DRQ, STATUS_DRQ)) {
printf("%s: timeout (BSY|DRQ -> DRQ)\n");
/* Send the command packet to the device. */
if ((s=sys_outsw(wn->base + REG_DATA, SELF, packet, 12)) != OK)
- server_panic(w_name(),"sys_outsw() failed", s);
+ panic(w_name(),"sys_outsw() failed", s);
return(OK);
}
inbyte[2].port = wn->base + REG_CNT_HI;
inbyte[3].port = wn->base + REG_IRR;
if ((s=sys_vinb(inbyte, 4)) != OK)
- server_panic(w_name(),"ATAPI failed sys_vinb()", s);
+ panic(w_name(),"ATAPI failed sys_vinb()", s);
e = inbyte[0].value;
len = inbyte[1].value;
len |= inbyte[2].value << 8;
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
$m/syslib.h $s/types.h \
- $m/utils.h $m/serverassert.h $m/devio.h
+ $m/utils.h $m/devio.h
l = $d/libdriver/driver.h $d/libdriver/driver.c $m/partition.h $m/u64.h
/* Set IRQ policy, only request notifications. */
if ((s=sys_irqsetpolicy(FLOPPY_IRQ, 0, &irq_hook_id )) != OK)
- server_panic("FLOPPY", "Couldn't set IRQ policy", s);
+ panic("FLOPPY", "Couldn't set IRQ policy", s);
if ((s=sys_irqenable(&irq_hook_id)) != OK)
- server_panic("FLOPPY", "Couldn't enable IRQs", s);
+ panic("FLOPPY", "Couldn't enable IRQs", s);
printf("FLOPPY: user-level floppy disk driver initialized\n");
driver_task(&f_dtab);
/* Get the current time to compare the timers against. */
if ((s=sys_getuptime(&now)) != OK)
- server_panic("FLOPPY","Couldn't get uptime from clock.", s);
+ panic("FLOPPY","Couldn't get uptime from clock.", 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_syncalrm(SELF, f_next_timeout, 1)) != OK)
- server_panic("FLOPPY","Couldn't set synchronous alarm.", s);
+ panic("FLOPPY","Couldn't set synchronous alarm.", s);
}
}
/* Get the current time. */
if ((s=sys_getuptime(&now)) != OK)
- server_panic("FLOPPY","Couldn't get uptime from clock.", s);
+ panic("FLOPPY","Couldn't get uptime from clock.", s);
/* Add the timer to the local timer queue. */
tmrs_settimer(&f_timers, tp, now + delta, watchdog);
if (f_timers->tmr_exp_time != f_next_timeout) {
f_next_timeout = f_timers->tmr_exp_time;
if ((s=sys_syncalrm(SELF, f_next_timeout, 1)) != OK)
- server_panic("FLOPPY","Couldn't set synchronous alarm.", s);
+ panic("FLOPPY","Couldn't set synchronous alarm.", s);
}
}
if ((s=sys_datacopy(proc_nr, iov->iov_addr + SECTOR_SIZE,
SELF, (vir_bytes) &fmt_param,
(phys_bytes) sizeof(fmt_param))) != OK)
- server_panic("FLOPPY", "Sys_vircopy failed", s);
+ panic("FLOPPY", "Sys_vircopy failed", s);
/* Check that the number of sectors in the data is reasonable,
* to avoid division by 0. Leave checking of other data to
cmd[2] = SPEC2;
(void) fdc_command(cmd, 3);
if ((s=sys_outb(FDC_RATE, f_dp->rate)) != OK)
- server_panic("FLOPPY","Sys_outb failed", s);
+ panic("FLOPPY","Sys_outb failed", s);
prev_dp = f_dp;
}
if((s=sys_datacopy(proc_nr, *up, SELF,
(vir_bytes) tmp_buf,
(phys_bytes) SECTOR_SIZE)) != OK)
- server_panic("FLOPPY", "Sys_vircopy failed", s);
+ panic("FLOPPY", "Sys_vircopy failed", s);
}
/* Set up the DMA chip and perform the transfer. */
if((s=sys_datacopy(SELF, (vir_bytes) tmp_buf,
proc_nr, *up,
(phys_bytes) SECTOR_SIZE)) != OK)
- server_panic("FLOPPY", "Sys_vircopy failed", s);
+ panic("FLOPPY", "Sys_vircopy failed", s);
}
if (r != OK) {
pv_set(byte_out[8], DMA_INIT, 2); /* some sort of enable */
if ((s=sys_voutb(byte_out, 9)) != OK)
- server_panic("FLOPPY","Sys_voutb in dma_setup() failed", s);
+ panic("FLOPPY","Sys_voutb in dma_setup() failed", s);
}
if ((s=sys_outb(DOR,
(motor_status << MOTOR_SHIFT) | ENABLE_INT | f_drive)) != OK)
- server_panic("FLOPPY","Sys_outb in start_motor() failed", s);
+ panic("FLOPPY","Sys_outb in start_motor() failed", 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)
- server_panic("FLOPPY","Sys_outb in stop_motor() failed", s);
+ panic("FLOPPY","Sys_outb in stop_motor() failed", s);
}
/* Stop all activity and cleanly exit with the system. */
int s;
if ((s=sys_outb(DOR, ENABLE_INT)) != OK)
- server_panic("FLOPPY","Sys_outb in floppy_stop() failed", s);
+ panic("FLOPPY","Sys_outb in floppy_stop() failed", s);
sys_exit(0);
}
* the perfection of the mirror.
*/
if ((s=sys_inb(FDC_STATUS, &status)) != OK)
- server_panic("FLOPPY","Sys_inb in fdc_results() failed", s);
+ panic("FLOPPY","Sys_inb in fdc_results() failed", s);
status &= (MASTER | DIRECTION | CTL_BUSY);
if (status == (MASTER | DIRECTION | CTL_BUSY)) {
if (result_nr >= MAX_RESULTS) break; /* too many results */
if ((s=sys_inb(FDC_DATA, &f_results[result_nr])) != OK)
- server_panic("FLOPPY","Sys_inb in fdc_results() failed", s);
+ panic("FLOPPY","Sys_inb in fdc_results() failed", s);
result_nr ++;
continue;
}
if (status == MASTER) { /* all read */
if ((s=sys_irqenable(&irq_hook_id)) != OK)
- server_panic("FLOPPY", "Couldn't enable IRQs", s);
+ panic("FLOPPY", "Couldn't enable IRQs", s);
return(OK); /* only good exit */
}
need_reset = TRUE; /* controller chip must be reset */
if ((s=sys_irqenable(&irq_hook_id)) != OK)
- server_panic("FLOPPY", "Couldn't enable IRQs", s);
+ panic("FLOPPY", "Couldn't enable IRQs", s);
return(ERR_STATUS);
}
return;
}
if ((s=sys_inb(FDC_STATUS, &status)) != OK)
- server_panic("FLOPPY","Sys_inb in fdc_out() failed", s);
+ panic("FLOPPY","Sys_inb in fdc_out() failed", s);
}
while ((status & (MASTER | DIRECTION)) != (MASTER | 0));
if ((s=sys_outb(FDC_DATA, val)) != OK)
- server_panic("FLOPPY","Sys_outb in fdc_out() failed", s);
+ panic("FLOPPY","Sys_outb in fdc_out() failed", 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)
- server_panic("FLOPPY", "Sys_voutb in f_reset() failed", s);
+ panic("FLOPPY", "Sys_voutb in f_reset() failed", s);
/* A synchronous alarm timer was set in fdc_command. Expect a HARD_INT
* message to collect the reset interrupt, but be prepared to handle the
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
$m/syslib.h $s/types.h \
- $m/utils.h $m/serverassert.h $m/devio.h
+ $m/utils.h $m/devio.h
fxp.o: $a
#define structof(type, field, ptr) \
((type *) (((char *) (ptr)) - offsetof(type, field)))
-#define panic(m,n) server_panic("FXP",(m),(n))
#define MICROS_TO_TICKS(m) (((m)*HZ/1000000)+1)
static timer_t *fxp_timers= NULL;
while (TRUE)
{
if ((r= receive(ANY, &m)) != OK)
- panic("fxp: receive failed", r);
+ panic("FXP","receive failed", r);
switch (m.m_type)
{
r= sys_irqenable(&fp->fxp_hook);
if (r != OK)
- panic("unable enable interrupts", r);
+ panic("FXP","unable enable interrupts", r);
if (!fp->fxp_got_int)
continue;
case HARD_STOP: fxp_stop(); break;
case SYN_ALARM: fxp_expire_timers(); break;
default:
- panic("fxp: illegal message", m.m_type);
+ panic("FXP"," illegal message", m.m_type);
}
}
}
continue;
if (pcitab_fxp[i].checkclass)
{
- panic("fxp_probe: class check not implemented",
+ panic("FXP","fxp_probe: class check not implemented",
NO_NUM);
}
break;
bar= pci_attr_r32(devind, PCI_BAR_2) & 0xffffffe0;
if ((bar & 0x3ff) >= 0x100-32 || bar < 0x400)
{
- panic("fxp_probe: base address is not properly configured",
+ panic("FXP","fxp_probe: base address is not properly configured",
NO_NUM);
}
fp->fxp_base_port= bar;
fp->fxp_conf_bytes[18] |= CCB18_LROK;
break;
default:
- panic("fxp_conf_hw: bad device type", fp->fxp_type);
+ panic("FXP","fxp_conf_hw: bad device type", fp->fxp_type);
}
for (i= 0; i<CC_BYTES_NR; i++)
/* set the interrupt handler */
r= sys_irqsetpolicy(fp->fxp_irq, 0, &fp->fxp_hook);
if (r != OK)
- panic("sys_irqsetpolicy failed", r);
+ panic("FXP","sys_irqsetpolicy failed", r);
fxp_reset_hw(fp);
r= sys_irqenable(&fp->fxp_hook);
if (r != OK)
- panic("sys_irqenable failed", r);
+ panic("FXP","sys_irqenable failed", r);
/* Reset PHY? */
r= sys_umap(SELF, D, (vir_bytes)&fp->fxp_stat, sizeof(fp->fxp_stat),
&bus_addr);
if (r != OK)
- panic("sys_umap failed", r);
+ panic("FXP","sys_umap failed", r);
fxp_cu_ptr_cmd(fp, SC_CU_LOAD_DCA, bus_addr, TRUE /* check idle */);
/* Ack previous interrupts */
assert(first_time);
first_time= 0;
+#if 0
assert(tot_bufsize <= buffer);
+#endif
buf= (phys_bytes)buffer;
}
r= sys_umap(SELF, D, (vir_bytes)buf, rx_totbufsize,
&fp->fxp_rx_busaddr);
if (r != OK)
- panic("sys_umap failed", r);
+ panic("FXP","sys_umap failed", r);
for (i= 0, rfdp= fp->fxp_rx_buf; i<fp->fxp_rx_nbuf; i++, rfdp++)
{
rfdp->rfd_status= 0;
r= sys_umap(SELF, D, (vir_bytes)&rfdp[1],
sizeof(rfdp[1]), &rfdp->rfd_linkaddr);
if (r != OK)
- panic("sys_umap failed", r);
+ panic("FXP","sys_umap failed", r);
}
else
{
r= sys_umap(SELF, D, (vir_bytes)fp->fxp_tx_buf,
(phys_bytes)tx_totbufsize, &fp->fxp_tx_busaddr);
if (r != OK)
- panic("sys_umap failed", r);
+ panic("FXP","sys_umap failed", 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("sys_umap failed", r);
+ panic("FXP","sys_umap failed", r);
}
else
{
/* Reset device */
fxp_outl(port, CSR_PORT, CP_CMD_SOFT_RESET);
- tick_delay(MICROS_TO_TICKS(CSR_PORT_RESET_DELAY));
+ tickdelay(MICROS_TO_TICKS(CSR_PORT_RESET_DELAY));
/* Disable interrupts */
fxp_outb(port, SCB_INT_MASK, SIM_M);
r= sys_umap(SELF, D, (vir_bytes)&ias, (phys_bytes)sizeof(ias),
&bus_addr);
if (r != OK)
- panic("sys_umap failed", r);
+ panic("FXP","sys_umap failed", 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 (!(ias.ias_status & CBL_F_C))
- panic("fxp_confaddr: CU command failed to complete", NO_NUM);
+ panic("FXP","fxp_confaddr: CU command failed to complete", NO_NUM);
if (!(ias.ias_status & CBL_F_OK))
- panic("fxp_confaddr: CU command failed", NO_NUM);
+ panic("FXP","fxp_confaddr: CU command failed", NO_NUM);
printf("%s: hardware ethernet address: ", fp->fxp_name);
for (i= 0; i<6; i++)
dl_port = mp->DL_PORT;
count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR)
- panic("fxp_writev: illegal port", dl_port);
+ panic("FXP","fxp_writev: illegal port", 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_writev: sys_vircopy failed", r);
+ panic("FXP","fxp_writev: sys_vircopy failed", 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_writev: invalid packet size",
+ panic("FXP","fxp_writev: invalid packet size",
NO_NUM);
}
s);
if (r != OK)
{
- panic("fxp_writev: sys_vircopy failed",
+ panic("FXP","fxp_writev: sys_vircopy failed",
r);
}
size += s;
}
}
if (size < ETH_MIN_PACK_SIZE)
- panic("fxp_writev: invalid packet size", size);
+ panic("FXP","fxp_writev: invalid packet size", size);
}
else
{
size= mp->DL_COUNT;
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
- panic("fxp_writev: invalid packet size", size);
+ panic("FXP","fxp_writev: invalid packet size", 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_writev: sys_vircopy failed", r);
+ panic("FXP","fxp_writev: sys_vircopy failed", r);
}
txp->tx_status= 0;
suspend:
if (from_int)
- panic("fxp: should not be sending\n", NO_NUM);
+ panic("FXP","fxp: should not be sending\n", NO_NUM);
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_readv: illegal port", dl_port);
+ panic("FXP","fxp_readv: illegal port", 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_readv: sys_vircopy failed", r);
+ panic("FXP","fxp_readv: sys_vircopy failed", r);
for (j= 0, iovp= fp->fxp_iovec; j<n; j++, iovp++)
{
fxp_client, D, iovp->iov_addr, s);
if (r != OK)
{
- panic("fxp_readv: sys_vircopy failed",
+ panic("FXP","fxp_readv: sys_vircopy failed",
r);
}
r= sys_umap(SELF, D, (vir_bytes)&cc, (phys_bytes)sizeof(cc),
&bus_addr);
if (r != OK)
- panic("sys_umap failed", r);
+ panic("FXP","sys_umap failed", 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 (!(cc.cc_status & CBL_F_C))
- panic("fxp_do_conf: CU command failed to complete", NO_NUM);
+ panic("FXP","fxp_do_conf: CU command failed to complete", NO_NUM);
if (!(cc.cc_status & CBL_F_OK))
- panic("fxp_do_conf: CU command failed", NO_NUM);
+ panic("FXP","fxp_do_conf: CU command failed", NO_NUM);
}
{
/* Consistency check. Make sure that CU is idle */
if ((fxp_inb(port, SCB_STATUS) & SS_CUS_MASK) != SS_CU_IDLE)
- panic("fxp_cu_ptr_cmd: CU is not idle", NO_NUM);
+ panic("FXP","fxp_cu_ptr_cmd: CU is not idle", NO_NUM);
}
fxp_outl(port, SCB_POINTER, bus_addr);
} while (getuptime(&t1)==OK && (t1-t0) < MICROS_TO_TICKS(1000));
if ((scb_cmd & SC_CUC_MASK) != SC_CU_NOP)
- panic("fxp_cu_ptr_cmd: CU does not accept command", NO_NUM);
+ panic("FXP","fxp_cu_ptr_cmd: CU does not accept command", NO_NUM);
}
{
/* Consistency check, make sure that RU is idle */
if ((fxp_inb(port, SCB_STATUS) & SS_RUS_MASK) != SS_RU_IDLE)
- panic("fxp_ru_ptr_cmd: RU is not idle", NO_NUM);
+ panic("FXP","fxp_ru_ptr_cmd: RU is not idle", NO_NUM);
}
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_ru_ptr_cmd: RU does not accept command", NO_NUM);
+ panic("FXP","fxp_ru_ptr_cmd: RU does not accept command", NO_NUM);
}
/* Make sure that RU is in the 'No resources' state */
if ((fxp_inb(port, SCB_STATUS) & SS_RUS_MASK) != SS_RU_NORES)
- panic("fxp_restart_ru: RU is in an unexpected state", NO_NUM);
+ panic("FXP","fxp_restart_ru: RU is in an unexpected state", NO_NUM);
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_getstat: illegal port", dl_port);
+ panic("FXP","fxp_getstat: illegal port", 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_getstat: CU command failed to complete", NO_NUM);
+ panic("FXP","fxp_getstat: CU command failed to complete", NO_NUM);
if (*p != SCM_DSC)
- panic("fxp_getstat: bad magic", NO_NUM);
+ panic("FXP","fxp_getstat: bad magic", NO_NUM);
stats.ets_recvErr=
fp->fxp_stat.sc_rx_crc +
}
if (r < 0)
- panic("fxp: send failed:", r);
+ panic("FXP","fxp: send failed:", 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: unable to mess_reply", NO_NUM);
+ panic("FXP","fxp: unable to mess_reply", NO_NUM);
}
r= sys_vircopy(SELF, D, (vir_bytes)loc_addr,
user_proc, D, user_addr, count);
if (r != OK)
- panic("put_userdata: sys_vircopy failed", r);
+ panic("FXP","put_userdata: sys_vircopy failed", r);
}
break;
}
if (i >= 32)
- panic("eeprom_addrsize: failed", NO_NUM);
+ panic("FXP","eeprom_addrsize: failed", NO_NUM);
fp->fxp_ee_addrlen= i+1;
/* Discard 16 data bits */
fp->fxp_mii_busy++;
if (!(fxp_inl(port, CSR_MDI_CTL) & CM_READY))
- panic("mii_read: MDI not ready", NO_NUM);
+ panic("FXP","mii_read: MDI not ready", NO_NUM);
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(1000));
if (!(v & CM_READY))
- panic("mii_read: MDI not ready after command", NO_NUM);
+ panic("FXP","mii_read: MDI not ready after command", NO_NUM);
fp->fxp_mii_busy--;
assert(!fp->fxp_mii_busy);
/* Get the current time. */
r= sys_getuptime(&now);
if (r != OK)
- panic("unable to get uptime from clock", r);
+ panic("FXP","unable to get uptime from clock", r);
/* Add the timer to the local timer queue. */
tmrs_settimer(&fxp_timers, tp, now + delta, watchdog);
fxp_next_timeout, fxp_next_timeout-now);
r= sys_syncalrm(SELF, fxp_next_timeout, 1);
if (r != OK)
- panic("unable to set synchronous alarm", r);
+ panic("FXP","unable to set synchronous alarm", r);
}
}
/* Get the current time to compare the timers against. */
r= sys_getuptime(&now);
if (r != OK)
- panic("Unable to get uptime from clock.", r);
+ panic("FXP","Unable to get uptime from clock.", 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_syncalrm(SELF, fxp_next_timeout, 1);
if (r != OK)
- panic("Unable to set synchronous alarm.", r);
+ panic("FXP","Unable to set synchronous alarm.", r);
}
}
static void micro_delay(unsigned long usecs)
{
- tick_delay(MICROS_TO_TICKS(usecs));
+ tickdelay(MICROS_TO_TICKS(usecs));
}
static u8_t do_inb(port_t port)
r= sys_inb(port, &value);
if (r != OK)
- panic("sys_inb failed", r);
+ panic("FXP","sys_inb failed", r);
return value;
}
r= sys_inl(port, &value);
if (r != OK)
- panic("sys_inl failed", r);
+ panic("FXP","sys_inl failed", r);
return value;
}
r= sys_outb(port, value);
if (r != OK)
- panic("sys_outb failed", r);
+ panic("FXP","sys_outb failed", r);
}
static void do_outl(port_t port, u32_t value)
r= sys_outl(port, value);
if (r != OK)
- panic("sys_outl failed", r);
+ panic("FXP","sys_outl failed", r);
}
#endif /* ENABLE_FXP */
if (OK != sys_datacopy(mp->m_source, (vir_bytes) mp->ADDRESS,
SELF, (vir_bytes) iovec, iovec_size))
- server_panic((*dp->dr_name)(),"bad I/O vector by", mp->m_source);
+ panic((*dp->dr_name)(),"bad I/O vector by", mp->m_source);
iov = iovec;
}
*/
#include "../drivers.h"
+#define NDEBUG /* disable assertions */
+#include <assert.h>
#include <minix/com.h>
#include <minix/syslib.h>
#include <stdio.h>
#include <string.h>
#include <minix/utils.h>
-INIT_SERVER_ASSERT
#define NR_PCIBUS 2
#define NR_PCIDEV 40
return;
/* We don't expect to interrupted */
- server_assert(first_time == 1);
+ assert(first_time == 1);
first_time= -1;
/* Only Intel (compatible) PCI controllers are supported at the
PUBLIC void pci_reserve(devind)
int devind;
{
- server_assert(devind <= nr_pcidev);
- server_assert(!pcidev[devind].pd_inuse);
+ assert(devind <= nr_pcidev);
+ assert(!pcidev[devind].pd_inuse);
pcidev[devind].pd_inuse= 1;
}
u16_t *vidp;
u16_t *didp;
{
- server_assert(devind <= nr_pcidev);
+ assert(devind <= nr_pcidev);
*vidp= pcidev[devind].pd_vid;
*didp= pcidev[devind].pd_did;
}
}
if (nr_pcibus >= NR_PCIBUS)
- server_panic("PCI","too many PCI busses", nr_pcibus);
+ panic("PCI","too many PCI busses", nr_pcibus);
busind= nr_pcibus;
nr_pcibus++;
pcibus[busind].pb_type= PBT_INTEL;
printf("probe_bus(%d)\n", busind);
#endif
if (nr_pcidev >= NR_PCIDEV)
- server_panic("PCI","too many PCI devices", nr_pcidev);
+ panic("PCI","too many PCI devices", nr_pcidev);
devind= nr_pcidev;
for (dev= 0; dev<32; dev++)
pcidev[devind].pd_inuse= 0;
if (nr_pcidev >= NR_PCIDEV)
- server_panic("PCI","too many PCI devices", nr_pcidev);
+ panic("PCI","too many PCI devices", nr_pcidev);
devind= nr_pcidev;
if (func == 0 && !(headt & PHT_MULTIFUNC))
r= do_sis_isabr(bridge_dev);
break;
default:
- server_panic("PCI","unknown ISA bridge type", type);
+ panic("PCI","unknown ISA bridge type", type);
}
return r;
}
#endif
if (nr_pcibus >= NR_PCIBUS)
- server_panic("PCI","too many PCI busses", nr_pcibus);
+ panic("PCI","too many PCI busses", nr_pcibus);
ind= nr_pcibus;
nr_pcibus++;
pcibus[ind].pb_type= PBT_PCIBRIDGE;
pcibus[ind].pb_wsts= pcibr_via_wsts;
break;
default:
- server_panic("PCI","unknown PCI-PCI bridge type", type);
+ panic("PCI","unknown PCI-PCI bridge type", type);
}
probe_bus(ind);
{
printf("IRQ %d is not level triggered\n",
irq);
- server_panic(NULL,NULL, NO_NUM);
+ panic(NULL,NULL, NO_NUM);
}
irq_mode_pci(irq);
}
/* Fake a device with the required function */
if (nr_pcidev >= NR_PCIDEV)
- server_panic("PCI","too many PCI devices", nr_pcidev);
+ panic("PCI","too many PCI devices", nr_pcidev);
xdevind= nr_pcidev;
pcidev[xdevind].pd_busind= bus;
pcidev[xdevind].pd_dev= dev;
{
printf("IRQ %d is not level triggered\n",
irq);
- server_panic(NULL, NULL, NO_NUM);
+ panic(NULL, NULL, NO_NUM);
}
irq_mode_pci(irq);
}
irq= pci_attr_r8(devind, VIA_ISABR_IRQ_R1) >> 4;
break;
default:
- server_assert(0);
+ assert(0);
}
irq &= 0xf;
if (!irq)
{
printf("IRQ %d is not level triggered\n",
irq);
- server_panic(NULL, NULL, NO_NUM);
+ panic(NULL, NULL, NO_NUM);
}
irq_mode_pci(irq);
}
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
$m/syslib.h $s/types.h \
- $m/utils.h $m/serverassert.h $m/devio.h
+ $m/utils.h $m/devio.h
l = $d/libdriver/driver.h $d/libdriver/driver.c $m/partition.h $m/u64.h
/* Get memory addresses from the kernel. */
if (OK != (s=sys_getmemchunks(&mem))) {
- server_panic("MEM","Couldn't get memory chunks.",s);
+ panic("MEM","Couldn't get memory chunks.",s);
}
if (OK != (s=sys_getkinfo(&kinfo))) {
- server_panic("MEM","Couldn't get kernel information.",s);
+ panic("MEM","Couldn't get kernel information.",s);
}
/* Install remote segment for /dev/kmem memory. */
m_geom[KMEM_DEV].dv_size = cvul64(kinfo.kmem_size);
if (OK != (s=sys_segctl(&m_seg[KMEM_DEV], (u16_t *) &s, (vir_bytes *) &s,
kinfo.kmem_base, kinfo.kmem_size))) {
- server_panic("MEM","Couldn't install remote segment.",s);
+ panic("MEM","Couldn't install remote segment.",s);
}
/* Install remote segment for /dev/boot memory, if enabled. */
if (kinfo.bootdev_base > 0) {
if (OK != (s=sys_segctl(&m_seg[BOOT_DEV], (u16_t *) &s, (vir_bytes *) &s,
kinfo.bootdev_base, kinfo.bootdev_size))) {
- server_panic("MEM","Couldn't install remote segment.",s);
+ panic("MEM","Couldn't install remote segment.",s);
}
}
/* Set up memory ranges for /dev/mem. */
#if (CHIP == INTEL)
if (OK != (s=sys_getmachine(&machine))) {
- server_panic("MEM","Couldn't get machine information.",s);
+ panic("MEM","Couldn't get machine information.",s);
}
if (! machine.protected) {
m_geom[MEM_DEV].dv_size = cvul64(0x100000); /* 1M for 8086 systems */
/* Try to allocate a piece of memory for the RAM disk. */
ramdev_size = m_ptr->POSITION;
if (OK != (s=alloc_mem(ramdev_size, &ramdev_base)))
- server_panic("MEM","Couldn't allocate kernel memory", s);
+ panic("MEM","Couldn't allocate kernel memory", s);
dv->dv_base = cvul64(ramdev_base);
dv->dv_size = cvul64(ramdev_size);
printf("Test MEM: base 0x%06x, size 0x%06x\n", dv->dv_base, dv->dv_size);
if (OK != (s=sys_kmalloc(ramdev_size, &ramdev_base)))
- server_panic("MEM","Couldn't allocate kernel memory", s);
+ panic("MEM","Couldn't allocate kernel memory", s);
dv->dv_base = cvul64(ramdev_base);
dv->dv_size = cvul64(ramdev_size);
printf("Real MEM: base 0x%06x, size 0x%06x\n", dv->dv_base, dv->dv_size);
if (OK != (s=sys_segctl(&m_seg[RAM_DEV], (u16_t *) &s, (vir_bytes *) &s,
ramdev_base, ramdev_size))) {
- server_panic("MEM","Couldn't install remote segment.",s);
+ panic("MEM","Couldn't install remote segment.",s);
}
break;
}
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
$m/syslib.h $s/types.h \
- $m/utils.h $m/serverassert.h $m/devio.h
+ $m/utils.h $m/devio.h
printer.o: $a
do_printer_output();
return;
}
- tick_delay(30); /* wait before retry */
+ tickdelay(30); /* wait before retry */
}
/* If we reach this point, the printer was not online in time. */
done_status = status;
sys_vircopy(SELF, BIOS_SEG, LPT1_IO_PORT_ADDR,
SELF, D, (vir_bytes) &port_base, LPT1_IO_PORT_SIZE);
sys_outb(port_base + 2, INIT_PRINTER);
- tick_delay(1); /* easily satisfies Centronics minimum */
+ tickdelay(1); /* easily satisfies Centronics minimum */
/* was 2 millisecs; now is ~17 millisecs */
sys_outb(port_base + 2, SELECT);
sys_irqsetpolicy(PRINTER_IRQ, 0, &irq_hook_id);
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
$m/syslib.h $s/types.h \
- $m/utils.h $m/serverassert.h $m/devio.h
+ $m/utils.h $m/devio.h
l = $d/libpci/pci.h $d/libpci/pci.c $d/libpci/pci_table.c
#include <stdio.h>
#include <string.h>
#include <stddef.h>
+#define NDEBUG /* disable assertions */
+#include <assert.h>
#include <minix/com.h>
#include <minix/keymap.h>
#include <minix/syslib.h>
#include "../libpci/pci.h"
#include "rtl8139.h"
-INIT_SERVER_ASSERT
#define RX_BUFSIZE RL_RCR_RBLEN_64K_SIZE
#define RX_BUFBITS RL_RCR_RBLEN_64K
long v;
if ((v=get_proc_nr(&rl_tasknr, NULL)) != OK)
- server_panic("RTL8139", "Couldn't get own proc nr", v);
+ panic("RTL8139", "Couldn't get own proc nr", v);
v= 0;
(void) env_parse("ETH_IGN_PROTO", "x", 0, &v, 0x0000L, 0xFFFFL);
while (TRUE)
{
if ((r= receive(ANY, &m)) != OK)
- server_panic("rtl8139","receive failed", r);
+ panic("rtl8139","receive failed", r);
switch (m.m_type)
{
case FKEY_PRESSED: rtl8139_dump(&m); break;
case HARD_STOP: rtl8139_stop(); break;
default:
- server_panic("rtl8139","illegal message", m.m_type);
+ panic("rtl8139","illegal message", m.m_type);
}
}
}
if (!rep->re_got_int)
continue;
rep->re_got_int= 0;
- server_assert(rep->re_flags & REF_ENABLED);
+ assert(rep->re_flags & REF_ENABLED);
rl_check_ints(rep);
}
}
rl_report_link(rep);
}
- server_assert(rep->re_mode == REM_ENABLED);
- server_assert(rep->re_flags & REF_ENABLED);
+ assert(rep->re_mode == REM_ENABLED);
+ assert(rep->re_flags & REF_ENABLED);
rep->re_flags &= ~(REF_PROMISC | REF_MULTI | REF_BROAD);
continue;
if (pcitab[i].checkclass)
{
- server_panic("rtl_probe",
+ panic("rtl_probe",
"class check not implemented", NO_NUM);
}
break;
/* printf("cr = 0x%x\n", pci_attr_r16(devind, PCI_CR)); */
bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0;
if ((bar & 0x3ff) >= 0x100-32 || bar < 0x400)
- server_panic("rtl_probe",
+ panic("rtl_probe",
"base address is not properly configured", NO_NUM);
rep->re_base_port= bar;
#endif
if (OK != (i=sys_kmalloc(tot_bufsize, &buf)))
- server_panic("RTL8139","Couldn't allocate kernel buffer",i);
+ panic("RTL8139","Couldn't allocate kernel buffer",i);
printf("RTL8139: real %uK buffer at 0x%06x\n", tot_bufsize, buf);
#endif
for (i= 0; i<N_TX_BUF; i++)
break;
} while (getuptime(&t1)==OK && (t1-t0) < HZ);
if (rl_inb(port, RL_BMCR) & MII_CTRL_RST)
- server_panic("rtl8139","reset PHY failed to complete", NO_NUM);
+ panic("rtl8139","reset PHY failed to complete", NO_NUM);
#endif
/* Reset the device */
break;
} while (getuptime(&t1)==OK && (t1-t0) < HZ);
if (rl_inb(port, RL_CR) & RL_CR_RST)
- server_panic("rtl8139","reset failed to complete", NO_NUM);
+ panic("rtl8139","reset failed to complete", NO_NUM);
t= rl_inl(port, RL_TCR);
switch(t & (RL_TCR_HWVER_AM | RL_TCR_HWVER_BM))
bus_buf= vm_1phys2bus(rep->re_tx[i].ret_buf);
rl_outl(port, RL_TSAD0+i*4, bus_buf);
t= rl_inl(port, RL_TSD0+i*4);
- server_assert(t & RL_TSD_OWN);
+ assert(t & RL_TSD_OWN);
}
#if 0
dl_port = mp->DL_PORT;
count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= RE_PORT_NR)
- server_panic("rtl8139"," illegal port", dl_port);
+ panic("rtl8139"," illegal port", dl_port);
rep= &re_table[dl_port];
re_client= mp->DL_PROC;
rep->re_client= re_client;
if (rep->re_clear_rx)
goto suspend; /* Buffer overflow */
- server_assert(rep->re_mode == REM_ENABLED);
- server_assert(rep->re_flags & REF_ENABLED);
+ assert(rep->re_mode == REM_ENABLED);
+ assert(rep->re_flags & REF_ENABLED);
port= rep->re_base_port;
printf("rxstat = 0x%08lx\n", rxstat);
printf("d_start: 0x%x, d_end: 0x%x, rxstat: 0x%lx\n",
d_start, d_end, rxstat);
- server_panic("rtl8139","received packet not OK", NO_NUM);
+ panic("rtl8139","received packet not OK", NO_NUM);
}
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);
- server_panic(NULL, NULL, NO_NUM);
+ panic(NULL, NULL, NO_NUM);
}
#if 0
s= iovp->iov_size;
if (size + s > packlen)
{
- server_assert(packlen > size);
+ assert(packlen > size);
s= packlen-size;
}
if (sys_umap(re_client, D, iovp->iov_addr, s, &dst_phys) != OK)
- server_panic("rtl8139","umap_local failed\n", NO_NUM);
+ panic("rtl8139","umap_local failed\n", NO_NUM);
if (o >= RX_BUFSIZE)
{
o -= RX_BUFSIZE;
- server_assert(o < RX_BUFSIZE);
+ assert(o < RX_BUFSIZE);
}
if (o+s > RX_BUFSIZE)
{
- server_assert(o<RX_BUFSIZE);
+ assert(o<RX_BUFSIZE);
s1= RX_BUFSIZE-o;
cps = sys_abscopy(src_phys+o, dst_phys, s1);
}
if (size < packlen)
{
- server_assert(0);
+ assert(0);
}
}
else
{
- server_assert(0);
+ assert(0);
#if 0
size= mp->DL_COUNT;
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
- server_panic("rtl8139","invalid packet size", size);
+ panic("rtl8139","invalid packet size", size);
if (OK != sys_umap(re_client, D, (vir_bytes)mp->DL_ADDR, size, &phys_user))
- server_panic("rtl8139","umap_local failed", NO_NUM);
+ panic("rtl8139","umap_local failed", NO_NUM);
p= rep->re_tx[tx_head].ret_buf;
cps = sys_abscopy(phys_user, p, size);
if (l >= RX_BUFSIZE)
{
l -= RX_BUFSIZE;
- server_assert(l < RX_BUFSIZE);
+ assert(l < RX_BUFSIZE);
}
rl_outw(port, RL_CAPR, l-RL_CAPR_DATA_OFF);
suspend:
if (from_int)
{
- server_assert(rep->re_flags & REF_READING);
+ assert(rep->re_flags & REF_READING);
/* No need to store any state */
return;
}
rep->re_rx_mess= *mp;
- server_assert(!(rep->re_flags & REF_READING));
+ assert(!(rep->re_flags & REF_READING));
rep->re_flags |= REF_READING;
reply(rep, OK, FALSE);
port = mp->DL_PORT;
count = mp->DL_COUNT;
if (port < 0 || port >= RE_PORT_NR)
- server_panic("rtl8139","illegal port", port);
+ panic("rtl8139","illegal port", port);
rep= &re_table[port];
re_client= mp->DL_PROC;
rep->re_client= re_client;
- server_assert(rep->re_mode == REM_ENABLED);
- server_assert(rep->re_flags & REF_ENABLED);
+ assert(rep->re_mode == REM_ENABLED);
+ assert(rep->re_flags & REF_ENABLED);
if (from_int)
{
- server_assert(rep->re_flags & REF_SEND_AVAIL);
+ assert(rep->re_flags & REF_SEND_AVAIL);
rep->re_flags &= ~REF_SEND_AVAIL;
rep->re_send_int= FALSE;
rep->re_tx_alive= TRUE;
tx_head= rep->re_tx_head;
if (rep->re_tx[tx_head].ret_busy)
{
- server_assert(!(rep->re_flags & REF_SEND_AVAIL));
+ assert(!(rep->re_flags & REF_SEND_AVAIL));
rep->re_flags |= REF_SEND_AVAIL;
if (rep->re_tx[tx_head].ret_busy)
goto suspend;
rep->re_send_int= FALSE;
}
- server_assert(!(rep->re_flags & REF_SEND_AVAIL));
- server_assert(!(rep->re_flags & REF_PACK_SENT));
+ assert(!(rep->re_flags & REF_SEND_AVAIL));
+ assert(!(rep->re_flags & REF_PACK_SENT));
if (vectored)
{
if (OK != sys_umap(re_client, D, (vir_bytes)mp->DL_ADDR,
count * sizeof(rep->re_iovec[0]), &iov_src))
- server_panic("rtl8139","umap_local failed", NO_NUM);
+ panic("rtl8139","umap_local failed", NO_NUM);
size= 0;
p= rep->re_tx[tx_head].ret_buf;
s= iovp->iov_size;
if (size + s > ETH_MAX_PACK_SIZE_TAGGED)
{
- server_panic("rtl8139","invalid packet size",
+ panic("rtl8139","invalid packet size",
NO_NUM);
}
if (OK != sys_umap(re_client, D, iovp->iov_addr, s, &phys_user))
- server_panic("rtl8139","umap_local failed\n", NO_NUM);
+ panic("rtl8139","umap_local failed\n", NO_NUM);
cps = sys_abscopy(phys_user, p, s);
if (cps != OK) printf("RTL8139: warning, sys_abscopy failed: %d\n", cps);
}
}
if (size < ETH_MIN_PACK_SIZE)
- server_panic("rtl8139","invalid packet size", size);
+ panic("rtl8139","invalid packet size", size);
}
else
{
size= mp->DL_COUNT;
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
- server_panic("rtl8139","invalid packet size", size);
+ panic("rtl8139","invalid packet size", size);
if (OK != sys_umap(re_client, D, (vir_bytes)mp->DL_ADDR, size, &phys_user))
- server_panic("rtl8139","umap_local failed\n", NO_NUM);
+ panic("rtl8139","umap_local failed\n", NO_NUM);
p= rep->re_tx[tx_head].ret_buf;
cps = sys_abscopy(phys_user, p, size);
if (++tx_head == N_TX_BUF)
tx_head= 0;
- server_assert(tx_head < RL_N_TX);
+ assert(tx_head < RL_N_TX);
rep->re_tx_head= tx_head;
rep->re_flags |= REF_PACK_SENT;
#endif
if (from_int)
- server_panic("rtl8139","should not be sending\n", NO_NUM);
+ panic("rtl8139","should not be sending\n", NO_NUM);
rep->re_tx_mess= *mp;
reply(rep, OK, FALSE);
}
else
{
- server_assert(rep->re_rx_mess.m_type == DL_READ);
+ assert(rep->re_rx_mess.m_type == DL_READ);
rl_readv(&rep->re_rx_mess, TRUE /* from int */,
FALSE /* !vectored */);
}
}
else
{
- server_assert(rep->re_tx_mess.m_type == DL_WRITE);
+ assert(rep->re_tx_mess.m_type == DL_WRITE);
rl_writev(&rep->re_tx_mess, TRUE /* from int */,
FALSE /* !vectored */);
}
break;
} while (getuptime(&t1)==OK && (t1-t0) < HZ);
if (rl_inb(port, RL_CR) & RL_CR_RE)
- server_panic("rtl8139","cannot disable receiver", NO_NUM);
+ panic("rtl8139","cannot disable receiver", NO_NUM);
#if 0
printf("RBSTART = 0x%08x\n", rl_inl(port, RL_RBSTART));
port = mp->DL_PORT;
if (port < 0 || port >= RE_PORT_NR)
- server_panic("rtl8139","illegal port", port);
+ panic("rtl8139","illegal port", port);
rep= &re_table[port];
rep->re_client= mp->DL_PROC;
- server_assert(rep->re_mode == REM_ENABLED);
- server_assert(rep->re_flags & REF_ENABLED);
+ assert(rep->re_mode == REM_ENABLED);
+ assert(rep->re_flags & REF_ENABLED);
stats= rep->re_stat;
reply.DL_STAT = status | ((u32_t) err << 16);
reply.DL_COUNT = rep->re_read_s;
if (OK != (r = sys_getuptime(&now)))
- server_panic("dp8390","sys_getuptime() failed:", r);
+ panic("dp8390","sys_getuptime() failed:", r);
reply.DL_CLCK = now;
r= send(rep->re_client, &reply);
}
if (r < 0)
- server_panic("dp8390","send failed:", r);
+ panic("dp8390","send failed:", r);
rep->re_read_s = 0;
rep->re_flags &= ~(REF_PACK_SENT | REF_PACK_RECV);
message *reply_mess;
{
if (send(req->m_source, reply_mess) != OK)
- server_panic("rtl8139","unable to mess_reply", NO_NUM);
+ panic("rtl8139","unable to mess_reply", NO_NUM);
}
/*===========================================================================*
} while (getuptime(&t1)==OK && (t1-t0) < HZ);
if (rl_inb(port, RL_CR) & RL_CR_TE)
{
- server_panic("rtl8139","cannot disable transmitter",
+ panic("rtl8139","cannot disable transmitter",
NO_NUM);
}
rl_outb(port, RL_CR, cr | RL_CR_TE);
break;
if (++tx_tail >= N_TX_BUF)
tx_tail= 0;
- server_assert(tx_tail < RL_N_TX);
+ assert(tx_tail < RL_N_TX);
rep->re_tx_tail= tx_tail;
continue;
}
{
printf("rl_handler, TABT, TSD%d = 0x%04lx\n",
tx_tail, tsd);
- server_assert(0); /* CLRABT is not all that
+ assert(0); /* CLRABT is not all that
* effective, why not?
*/
rep->re_stat.ets_transAb++;
if (++tx_tail >= N_TX_BUF)
tx_tail= 0;
- server_assert(tx_tail < RL_N_TX);
+ assert(tx_tail < RL_N_TX);
rep->re_tx_tail= tx_tail;
if (rep->re_flags & REF_SEND_AVAIL)
}
}
}
- server_assert(i < 2*N_TX_BUF);
+ assert(i < 2*N_TX_BUF);
}
if (isr)
{
#if __minix_vmd
tmr_arg_ut t_arg;
- server_assert(tp == &rl_watchdog);
+ assert(tp == &rl_watchdog);
t_arg.ta_int= 0;
tmra_settimer(&rl_watchdog, get_uptime()+HZ, rl_watchdog_f, t_arg);
#else
ee_wds(dep);
- server_assert(get_ee_word(dep, 0x78/2) == 0x10ec);
- server_assert(get_ee_word(dep, 0x7A/2) == 0x8029);
- server_assert(get_ee_word(dep, 0x7C/2) == 0x10ec);
- server_assert(get_ee_word(dep, 0x7E/2) == 0x8029);
+ assert(get_ee_word(dep, 0x78/2) == 0x10ec);
+ assert(get_ee_word(dep, 0x7A/2) == 0x8029);
+ assert(get_ee_word(dep, 0x7C/2) == 0x10ec);
+ assert(get_ee_word(dep, 0x7E/2) == 0x8029);
}
if (0 == sys_getkenv("RTL8029XXX",10+1, val, sizeof(val)))
ee_wds(dep);
- server_assert(get_ee_word(dep, 0x76/2) == 0x8029);
+ assert(get_ee_word(dep, 0x76/2) == 0x8029);
}
}
break;
} while (getuptime(&t1) == OK && (t1 == t0));
if (!(inb_reg3(dep, 1) & 1))
- server_panic("set_ee_word","device remains busy", NO_NUM);
+ panic("set_ee_word","device remains busy", NO_NUM);
}
static void ee_wds(dep)
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
$m/syslib.h $s/types.h \
- $m/utils.h $m/serverassert.h $m/devio.h
+ $m/utils.h $m/devio.h
tty.o: tty.h $a
console.o: tty.h $a
/* Fetch current time in advance to prevent beeping delay. */
if ((s=sys_getuptime(&now)) != OK)
- server_panic("TTY","Console couldn't get clock's uptime.", s);
+ panic("TTY","Console couldn't get clock's uptime.", 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_syncalrm(SELF, tty_next_timeout, 1)) != OK)
- server_panic("TTY","Console couldn't set syn alarm.", s);
+ panic("TTY","Console couldn't set syn alarm.", s);
}
}
#include <minix/keymap.h>
#include "tty.h"
#include "keymaps/us-std.src"
-#include "../../kernel/kernel.h"
+#include "../../kernel/const.h"
+#include "../../kernel/type.h"
#include "../../kernel/proc.h"
int irq_hook_id = -1;
/* Set interrupt handler and enable keyboard IRQ. */
if ((i=sys_irqsetpolicy(KEYBOARD_IRQ, IRQ_REENABLE, &irq_hook_id)) != OK)
- server_panic("TTY", "Couldn't set keyboard IRQ policy", i);
+ panic("TTY", "Couldn't set keyboard IRQ policy", i);
if ((i=sys_irqenable(&irq_hook_id)) != OK)
- server_panic("TTY", "Couldn't enable keyboard IRQs", i);
+ panic("TTY", "Couldn't enable keyboard IRQs", i);
}
}
(void) scan_keyboard(); /* ack any old input */
quiet = scan_keyboard();/* quiescent value (0 on PC, last code on AT)*/
for (;;) {
- tick_delay(10);
+ tickdelay(10);
/* See if there are pending request for output, but don't block.
* Diagnostics can span multiple printf()s, so do it in a loop.
*/
case DIAGNOSTICS: do_diagnostics(m); break;
default: ; /* do nothing */
}
- tick_delay(1); /* allow more */
+ tickdelay(1); /* allow more */
}
code = scan_keyboard();
if (code != quiet) {
/* Get kernel environment (protected_mode, pc_at and ega are needed). */
if (OK != (s=sys_getmachine(&machine))) {
- server_panic("TTY","Couldn't obtain kernel environment.", s);
+ panic("TTY","Couldn't obtain kernel environment.", s);
}
printf("User-level TTY driver alive!\n");
tty_mess.REP_PROC_NR = proc_nr;
tty_mess.REP_STATUS = status;
if ((status = send(replyee, &tty_mess)) != OK) {
- server_panic("TTY","tty_reply failed, status\n", status);
+ panic("TTY","tty_reply failed, status\n", status);
}
}
if (tp->tty_pgrp != 0)
if (OK != (status = sys_kill(tp->tty_pgrp, sig)))
- server_panic("TTY","Error, call to sys_kill failed", status);
+ panic("TTY","Error, call to sys_kill failed", status);
if (!(tp->tty_termios.c_lflag & NOFLSH)) {
tp->tty_incount = tp->tty_eotct = 0; /* kill earlier input */
/* Get the current time to compare the timers against. */
if ((s=sys_getuptime(&now)) != OK)
- server_panic("TTY","Couldn't get uptime from clock.", s);
+ panic("TTY","Couldn't get uptime from clock.", 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_syncalrm(SELF, tty_next_timeout, 1)) != OK)
- server_panic("TTY","Couldn't set synchronous alarm.", s);
+ panic("TTY","Couldn't set synchronous alarm.", s);
}
}
/* Get the current time to calculate the timeout time. */
if ((s=sys_getuptime(&now)) != OK)
- server_panic("TTY","Couldn't get uptime from clock.", s);
+ panic("TTY","Couldn't get uptime from clock.", s);
if (enable) {
exp_time = now + tty_ptr->tty_termios.c_cc[VTIME] * (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_syncalrm(SELF, tty_next_timeout, 1)) != OK)
- server_panic("TTY","Couldn't set synchronous alarm.", s);
+ panic("TTY","Couldn't set synchronous alarm.", s);
}
}
#include <ansi.h>
#include <minix/const.h>
+#include <minix/com.h>
#include <minix/type.h>
#include <minix/callnr.h>
#include <minix/ipc.h>
-#define MM 0
-#define FS 1
+#define MM PM_PROC_NR
+#define FS FS_PROC_NR
_PROTOTYPE( int __execve, (const char *_path, char *const _argv[],
char *const _envp[], int _nargs, int _nenvps) );
_PROTOTYPE( int _syscall, (int _who, int _syscallnr, message *_msgptr) );
_PROTOTYPE( void _loadname, (const char *_name, message *_msgptr) );
_PROTOTYPE( int _len, (const char *_s) );
-_PROTOTYPE( void panic, (const char *_message, int _errnum) );
_PROTOTYPE( void _begsig, (int _dummy) );
#endif /* _LIB_H */
# define DL_BROAD_REQ 0x8
-/*===========================================================================*
- * CLOCK request types and field names *
- *===========================================================================*/
-
-/* Clock library calls are dispatched via a call vector, so be careful when
- * modifying the clock call numbers. The numbers here determine which call
- * is made from the call vector.
- */
-# define CLK_SIGNALRM 1 /* clk_signalrm(proc_nr, ticks) */
-# define CLK_SYNCALRM 6 /* clk_syncalrm(proc_nr,exp_time,abs_time) */
-# define CLK_FLAGALRM 7 /* clk_flagalrm(ticks, flag_ptr) */
-
/*===========================================================================*
* SYSTASK request types and field names *
*===========================================================================*/
# define SYS_SIGNALRM 15 /* sys_signalrm(proc_nr, ticks) */
# define SYS_SYNCALRM 16 /* sys_syncalrm(proc_nr,exp_time,abs_time) */
-# define SYS_FLAGALRM 17 /* sys_flagalrm(ticks, flag_ptr) */
+
# define SYS_PHYSVCOPY 18 /* sys_physvcopy(vec_ptr, vec_size) */
# define SYS_SVRCTL 19 /* sys_svrctl(proc_nr, req, argp) */
# define SYS_SDEVIO 20 /* sys_sdevio(port, proc_nr, buf, count) */
+++ /dev/null
-#ifndef __SERVERASSERT_H
-#define __SERVERASSERT_H
-
-/* This file contains functions and macros used for debugging within
- * system servers. Also see <assert.h> which is used in regular programs.
- */
-
-#ifndef NDEBUG /* 8086 must do without training wheels. */
-#define NDEBUG (_WORD_SIZE == 2)
-#endif
-
-#if !NDEBUG
-
-#define INIT_SERVER_ASSERT static char *server_assert_file= __FILE__;
-
-void server_assert_failed(char *file, int line, char *what);
-void server_compare_failed(char *file, int line, int lhs, char *what, int rhs);
-
-#define server_assert(x) (!(x) ? server_assert_failed( \
- server_assert_file, __LINE__, #x) : (void) 0)
-#define server_compare(a,t,b) (!((a) t (b)) ? server_compare_failed( \
- server_assert_file, __LINE__, (a), #a " " #t " " #b, (b)) : (void) 0)
-
-
-#else /* NDEBUG */
-
-#define INIT_SERVER_ASSERT /* nothing */
-
-#define server_assert(x) (void) 0
-#define server_compare(a,t,b) (void) 0
-
-#endif /* NDEBUG */
-
-
-#endif /* __SERVERASSERT_H */
-
* Mar 15, 2004 by Jorrit N. Herder
*
* Changes:
- * Mar 18, 2005: added tick_delay
+ * May 31, 2005: added getuptime
+ * Mar 18, 2005: added tickdelay
* Mar 15, 2005: added get_proc_nr
* Oct 01, 2004: added env_parse, env_prefix, env_panic
* Jul 13, 2004: added fkey_ctl
- * Apr 28, 2004: added server_report, server_panic, server_assert
+ * Apr 28, 2004: added report, panic
* Mar 31, 2004: setup like other libraries, such as syslib
*/
* Miscellaneous helper functions.
*==========================================================================*/
-#include <minix/serverassert.h>
-
/* Environment parsing return values. */
#define EP_BUF_SIZE 128 /* local buffer for env value */
#define EP_UNSET 0 /* variable not set */
#define fkey_disable(fkey) fkey_ctl(fkey, 0)
_PROTOTYPE(int fkey_ctl, (int fkey_code, int enable_disable) );
-_PROTOTYPE(void server_report, (char *who, char *mess, int num) );
-_PROTOTYPE(void server_panic, (char *who, char *mess, int num) );
_PROTOTYPE(int get_proc_nr, (int *proc_nr, char *proc_name) );
+_PROTOTYPE(void report, (char *who, char *mess, int num));
+_PROTOTYPE(void panic, (char *who, char *mess, int num));
+
_PROTOTYPE(int getuptime, (clock_t *ticks));
-_PROTOTYPE(int tick_delay, (clock_t ticks));
+_PROTOTYPE(int tickdelay, (clock_t ticks));
#endif /* _EXTRALIB_H */
#include <string.h>
#include <signal.h>
-#define IDLE 0
-#define INPROGRESS 1
-#define RESULT 2
+#define IO_IDLE 0
+#define IO_INPROGRESS 1
+#define IO_RESULT 2
#define OP_NOOP 0
#define OP_READ 1
void asyn_init(asynchio_t *asyn)
{
- asyn->state= IDLE;
+ asyn->state= IO_IDLE;
asyn->op= OP_NOOP;
}
void *data, ssize_t count)
{
switch (asyn->state) {
- case INPROGRESS:
+ case IO_INPROGRESS:
if (asyn_current != asyn && asyn->op != op) abort();
/*FALL THROUGH*/
- case IDLE:
+ case IO_IDLE:
asyn_current= asyn;
asyn->op= op;
asyn->fd= fd;
asyn->req= req;
asyn->data= data;
asyn->count= count;
- asyn->state= INPROGRESS;
+ asyn->state= IO_INPROGRESS;
errno= EINPROGRESS;
return -1;
- case RESULT:
+ case IO_RESULT:
if (asyn_current != asyn && asyn->op != op) abort();
errno= asyn->errno;
return asyn->count;
if (asyn_current != asyn) abort();
if (flags & ASYN_NONBLOCK) abort();
- if (asyn->state == RESULT) {
- asyn->state= IDLE;
+ if (asyn->state == IO_RESULT) {
+ asyn->state= IO_IDLE;
asyn->op= OP_NOOP;
return 0;
}
errno= EINTR;
return -1;
} else {
- asyn->state= RESULT;
+ asyn->state= IO_RESULT;
return 0;
}
}
$(LIBSYS)(sys_voutw.o) \
$(LIBSYS)(sys_voutl.o) \
$(LIBSYS)(sys_signalrm.o) \
- $(LIBSYS)(sys_flagalrm.o) \
$(LIBSYS)(sys_syncalrm.o) \
$(LIBSYS)(sys_physzero.o) \
$(LIBSYS)(taskcall.o) \
$(LIBSYS)(sys_signalrm.o): sys_signalrm.c
$(CC1) sys_signalrm.c
-$(LIBSYS)(sys_flagalrm.o): sys_flagalrm.c
- $(CC1) sys_flagalrm.c
-
$(LIBSYS)(sys_syncalrm.o): sys_syncalrm.c
$(CC1) sys_syncalrm.c
+++ /dev/null
-#include "syslib.h"
-
-/*===========================================================================*
- * sys_flagalrm *
- *===========================================================================*/
-PUBLIC int sys_flagalrm(ticks, flag_ptr)
-clock_t ticks; /* number of ticks until the flag is set */
-int *flag_ptr; /* pointer to timeout flag to be set */
-{
-/* Make a call to the clock to schedule a timeout flag alarm for the caller. */
- message m;
-
- if (flag_ptr != NULL) /* expect the worst */
- *flag_ptr = 0; /* reset timeout flag first */
- m.m_type = SYS_FLAGALRM; /* alarm type requested */
- m.ALRM_PROC_NR = SELF; /* m_source will be used */
- m.ALRM_EXP_TIME = ticks; /* alarm is due after ticks */
- m.ALRM_ABS_TIME = 0; /* ticks are relative to now */
- m.ALRM_FLAG_PTR = (char *) flag_ptr;
- return _taskcall(SYSTASK, SYS_FLAGALRM, &m);
-}
-
-
all: $(LIBUTILS)
OBJECTS = \
- $(LIBUTILS)(tick_delay.o) \
- $(LIBUTILS)(get_upt.o) \
+ $(LIBUTILS)(tickdelay.o) \
+ $(LIBUTILS)(getuptime.o) \
$(LIBUTILS)(get_mon_prm.o) \
$(LIBUTILS)(env_parse.o) \
$(LIBUTILS)(env_panic.o) \
$(LIBUTILS)(env_prefix.o) \
$(LIBUTILS)(fkey_ctl.o) \
$(LIBUTILS)(get_proc_nr.o) \
- $(LIBUTILS)(srvr_assert.o) \
- $(LIBUTILS)(srvr_panic.o) \
- $(LIBUTILS)(srvr_report.o) \
+ $(LIBUTILS)(panic.o) \
+ $(LIBUTILS)(report.o) \
$(LIBUTILS)(taskcall.o) \
aal cr $@ *.o
rm *.o
-$(LIBUTILS)(get_upt.o): get_upt.c
- $(CC1) get_upt.c
+$(LIBUTILS)(getuptime.o): getuptime.c
+ $(CC1) getuptime.c
-$(LIBUTILS)(tick_delay.o): tick_delay.c
- $(CC1) tick_delay.c
+$(LIBUTILS)(tickdelay.o): tickdelay.c
+ $(CC1) tickdelay.c
$(LIBUTILS)(get_mon_prm.o): get_mon_prm.c
$(CC1) get_mon_prm.c
$(LIBUTILS)(get_proc_nr.o): get_proc_nr.c
$(CC1) get_proc_nr.c
-$(LIBUTILS)(srvr_assert.o): srvr_assert.c
- $(CC1) srvr_assert.c
+$(LIBUTILS)(panic.o): panic.c
+ $(CC1) panic.c
-$(LIBUTILS)(srvr_panic.o): srvr_panic.c
- $(CC1) srvr_panic.c
-
-$(LIBUTILS)(srvr_report.o): srvr_report.c
- $(CC1) srvr_report.c
+$(LIBUTILS)(report.o): report.c
+ $(CC1) report.c
$(LIBUTILS)(taskcall.o): taskcall.c
$(CC1) taskcall.c
printf("WARNING: sys_getkenv() failed in env_panic(): %d\n", s);
}
printf("Bad environment setting: '%s = %s'\n", key, value);
- server_panic("","", NO_NUM);
+ panic("","", NO_NUM);
}
long newpar;
int s, i = 0, radix, r;
-#if DEAD_CODE
- if ((s=sys_getkenv(env, strlen(env), value, sizeof(value))) != 0) {
-#endif
if ((s=get_mon_param(env, value, sizeof(value))) != 0) {
if (s == ESRCH) return(EP_UNSET); /* only error allowed */
printf("WARNING: sys_getkenv() failed in env_parse(): %d\n",s);
#include "utils.h"
-#include <unistd.h> /* need RBT_PANIC flag */
-
-PRIVATE int panicking; /* inhibits recursive panics */
/*===========================================================================*
- * server_panic *
+ * panic *
*===========================================================================*/
-PUBLIC void server_panic(who, mess, num)
+PUBLIC void panic(who, mess, num)
char *who; /* server identification */
char *mess; /* message format string */
int num; /* number to go with format string */
*/
message m;
- if (panicking) return; /* already a panic */
- panicking = TRUE; /* prevent recursive panics */
if (NULL != who && NULL != mess) {
if (num != NO_NUM) {
printf("Panic in %s: %s: %d\n", who, mess, num);
#include "utils.h"
/*===========================================================================*
- * server_report *
+ * report *
*===========================================================================*/
-PUBLIC void server_report(who, mess, num)
+PUBLIC void report(who, mess, num)
char *who; /* server identification */
char *mess; /* message format to print */
int num; /* number to go with the message */
+++ /dev/null
-#include "utils.h"
-
-/* This file contains two very related procedures for debugging purposes:
- * server_assert_failed
- * server_compare_failed
- * Also see <minix/serverassert.h>.
- */
-
-#if !NDEBUG
-/*=========================================================================*
- * server_assert_failed *
- *=========================================================================*/
-PUBLIC void server_assert_failed(file, line, what)
-char *file;
-int line;
-char *what;
-{
- printf("server panic at %s(%d): assertion \"%s\" failed\n",
- file, line, what);
- server_panic(NULL, NULL, NO_NUM);
-}
-
-/*=========================================================================*
- * server_compare_failed *
- *=========================================================================*/
-PUBLIC void server_compare_failed(file, line, lhs, what, rhs)
-char *file;
-int line;
-int lhs;
-char *what;
-int rhs;
-{
- printf("server panic at %s(%d): compare (%d) %s (%d) failed\n",
- file, line, lhs, what, rhs);
- server_panic(NULL, NULL, NO_NUM);
-}
-#endif /* !NDEBUG */
-
#include "utils.h"
/*===========================================================================*
- * tick_delay *
+ * tickdelay *
*===========================================================================*/
-PUBLIC int tick_delay(ticks)
+PUBLIC int tickdelay(ticks)
long ticks; /* number of ticks to wait */
{
/* This function uses the synchronous alarm to delay for a while. This works
}
/* Desired block is not on available chain. Take oldest block ('front'). */
- if ((bp = front) == NIL_BUF) panic("all buffers in use", NR_BUFS);
+ if ((bp = front) == NIL_BUF) panic(__FILE__,"all buffers in use", NR_BUFS);
rm_lru(bp);
/* Remove the block that was just taken from its hash chain. */
if (major >= max_major) major = 0;
dp = &dmap[major];
r = (*dp->dmap_opcl)(DEV_OPEN, dev, proc, flags);
- if (r == SUSPEND) panic("Suspend on open from", dp->dmap_driver);
+ if (r == SUSPEND) panic(__FILE__,"suspend on open from", dp->dmap_driver);
return(r);
}
for (;;) {
if (r != OK) {
if (r == EDEADDST) return; /* give up */
- else panic("call_task: can't send/receive", r);
+ else panic(__FILE__,"call_task: can't send/receive", r);
}
/* Did the process we did the sendrec() for get a result? */
reviving--;
return;
}
- panic("get_work couldn't revive anyone", NO_NUM);
+ panic(__FILE__,"get_work couldn't revive anyone", NO_NUM);
}
/* Normal case. No one to revive. */
- if (receive(ANY, &m_in) != OK) panic("fs receive error", NO_NUM);
+ if (receive(ANY, &m_in) != OK) panic(__FILE__,"fs receive error", NO_NUM);
who = m_in.m_source;
call_nr = m_in.m_type;
}
/* 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("OPEN_MAX > 127", NO_NUM);
- if (NR_BUFS < 6) panic("NR_BUFS < 6", NO_NUM);
- if (V1_INODE_SIZE != 32) panic("V1 inode size != 32", NO_NUM);
- if (V2_INODE_SIZE != 64) panic("V2 inode size != 64", NO_NUM);
- if (OPEN_MAX > 8 * sizeof(long)) panic("Too few bits in fp_cloexec", NO_NUM);
+ if (OPEN_MAX > 127) panic(__FILE__,"OPEN_MAX > 127", NO_NUM);
+ if (NR_BUFS < 6) panic(__FILE__,"NR_BUFS < 6", NO_NUM);
+ if (V1_INODE_SIZE != 32) panic(__FILE__,"V1 inode size != 32", NO_NUM);
+ if (V2_INODE_SIZE != 64) panic(__FILE__,"V2 inode size != 64", NO_NUM);
+ if (OPEN_MAX > 8 * sizeof(long)) panic(__FILE__,"Too few bits in fp_cloexec", NO_NUM);
/* The following initializations are needed to let dev_opcl succeed .*/
fp = (struct fproc *) NULL;
*/
do {
if (OK != (s=receive(PM_PROC_NR, &mess)))
- panic("FS couldn't receive from PM", s);
+ panic(__FILE__,"FS couldn't receive from PM", s);
if (NONE == mess.PR_PROC_NR) break;
fp = &fproc[mess.PR_PROC_NR];
/* Open the root device. */
if (dev_open(root_dev, FS_PROC_NR, R_BIT|W_BIT) != OK) {
- panic("Cannot open root device",NO_NUM);
+ panic(__FILE__,"Cannot open root device",NO_NUM);
}
/* If we must initialize a ram disk, get details from the image device. */
if (root_dev == DEV_RAM || root_dev != image_dev) {
u32_t fsmax;
if (dev_open(image_dev, FS_PROC_NR, R_BIT) != OK)
- panic("Cannot open RAM image device", NO_NUM);
+ panic(__FILE__,"Cannot open RAM image device", NO_NUM);
/* Get size of RAM disk image from the super block. */
sp = &super_block[0];
sp->s_dev = image_dev;
- if (read_super(sp) != OK) panic("Bad RAM disk image FS", NO_NUM);
+ if (read_super(sp) != OK)
+ panic(__FILE__,"Bad RAM disk image FS", NO_NUM);
lcount = sp->s_zones << sp->s_log_zone_size; /* # blks on root dev*/
m_out.REQUEST = MIOCRAMSIZE;
m_out.POSITION = ram_size_kb*1024;
if (sendrec(MEMORY, &m_out) != OK || m_out.REP_STATUS != OK)
- panic("Can't set RAM disk size", NO_NUM);
+ panic(__FILE__,"can't set RAM disk size", NO_NUM);
#if ENABLE_CACHE2
if(block_size_ram != block_size_image) {
printf("ram block size: %d image block size: %d\n",
block_size_ram, block_size_image);
- panic("Sorry, ram disk and image disk block sizes have to be the same.", NO_NUM);
+ panic(__FILE__,"ram disk and image disk block sizes must match", NO_NUM);
}
for (b = 0; b < (block_t) lcount; b++) {
rip = get_inode(super_dev, ROOT_INODE); /* inode for root dir */
if ( (rip->i_mode & I_TYPE) != I_DIRECTORY || rip->i_nlinks < 3) bad++;
}
- if (bad) panic("Invalid root file system", NO_NUM);
+ if (bad) panic(__FILE__,"Invalid root file system", NO_NUM);
sp->s_imount = rip;
dup_inode(rip);
bp = get_block(ldir_ptr->i_dev, b, NORMAL); /* get a dir block */
if(bp == NO_BLOCK)
- panic("get_block returned NO_BLOCK", NO_NUM);
+ panic(__FILE__,"get_block returned NO_BLOCK", NO_NUM);
/* Search a directory block. */
for (dp = &bp->b_dir[0]; dp < &bp->b_dir[NR_DIR_ENTRIES(ldir_ptr->i_sp->s_block_size)]; dp++) {
return(err_code);
}
- if (read_only(rip) != OK) panic("pipe device is read only", NO_NUM);
+ if (read_only(rip) != OK)
+ panic(__FILE__,"pipe device is read only", NO_NUM);
rip->i_pipe = I_PIPE;
rip->i_mode &= ~I_REGULAR;
register struct fproc *rfp;
register int task;
- if (proc_nr < 0 || proc_nr >= NR_PROCS) panic("revive err", proc_nr);
+ if (proc_nr < 0 || proc_nr >= NR_PROCS) panic(__FILE__,"revive err", proc_nr);
rfp = &fproc[proc_nr];
if (rfp->fp_suspended == NOT_SUSPENDED || rfp->fp_revived == REVIVING)return;
if (who > PM_PROC_NR) return(EPERM);
proc_nr = m_in.pro;
- if (proc_nr < 0 || proc_nr >= NR_PROCS) panic("unpause err 1", proc_nr);
+ if (proc_nr < 0 || proc_nr >= NR_PROCS) panic(__FILE__,"unpause err 1", proc_nr);
rfp = &fproc[proc_nr];
if (rfp->fp_suspended == NOT_SUSPENDED) return(OK);
task = -rfp->fp_task;
default: /* process trying to do device I/O (e.g. tty)*/
fild = (rfp->fp_fd >> 8) & BYTE;/* extract file descriptor */
- if (fild < 0 || fild >= OPEN_MAX)panic("unpause err 2",NO_NUM);
+ if (fild < 0 || fild >= OPEN_MAX)
+ panic(__FILE__,"unpause err 2",NO_NUM);
f = rfp->fp_filp[fild];
dev = (dev_t) f->filp_ino->i_zone[0]; /* device hung on */
mess.TTY_LINE = (dev >> MINOR) & BYTE;
_PROTOTYPE( long conv4, (int norm, long x) );
_PROTOTYPE( int fetch_name, (char *path, int len, int flag) );
_PROTOTYPE( int no_sys, (void) );
-_PROTOTYPE( void panic, (char *format, int num) );
+_PROTOTYPE( void panic, (char *who, char *mess, int num) );
/* write.c */
_PROTOTYPE( void clear_zone, (struct inode *rip, off_t pos, int flag) );
* it means something has gone wrong we can't repair now.
*/
if(copy_queue_used != 0) {
- panic("copy queue size nonzero when entering read_write().",
+ panic(__FILE__,"copy queue size nonzero when entering read_write().",
copy_queue_used);
}
if((char_spec = (mode_word == I_CHAR_SPECIAL ? 1 : 0))) {
if(rip->i_zone[0] == NO_DEV)
- panic("read_write tries to read from character device NO_DEV", NO_NUM);
+ panic(__FILE__,"read_write tries to read from character device NO_DEV", NO_NUM);
block_size = get_block_size(rip->i_zone[0]);
}
if((block_spec = (mode_word == I_BLOCK_SPECIAL ? 1 : 0))) {
f_size = LONG_MAX;
if(rip->i_zone[0] == NO_DEV)
- panic("read_write tries to read from block device NO_DEV", NO_NUM);
+ panic(__FILE__,"read_write tries to read from block device NO_DEV", NO_NUM);
block_size = get_block_size(rip->i_zone[0]);
}
/* In all cases, bp now points to a valid buffer. */
if(bp == NIL_BUF) {
- panic("bp not valid in rw_chunk, this can't happen", NO_NUM);
+ panic(__FILE__,"bp not valid in rw_chunk, this can't happen", NO_NUM);
}
if (rw_flag == WRITING && chunk != block_size && !block_spec &&
position >= rip->i_size && off == 0) {
#else
/* have to copy a buffer now. remember to do it. */
if(copy_queue_used < 0 || copy_queue_used > COPY_QUEUE_LEN) {
- panic("copy_queue_used illegal size", copy_queue_used);
+ panic(__FILE__,"copy_queue_used illegal size", copy_queue_used);
}
if(copy_queue_used == COPY_QUEUE_LEN) {
r = rw_chunk_finish(completed);
if(copy_queue_used != 0) {
- panic("copy_queue_used nonzero", copy_queue_used);
+ panic(__FILE__,"copy_queue_used nonzero", copy_queue_used);
}
}
entry = copy_queue_used++;
if(entry < 0 || entry >= COPY_QUEUE_LEN) {
- panic("entry illegal slot", entry);
+ panic(__FILE__,"entry illegal slot", entry);
}
copy_queue[entry].bp = bp;
m.VCP_VEC_ADDR = (char *) vir_cp_req;
if((r=sendrec(SYSTASK, &m)) < 0) {
- panic("rw_chunk_finish: virvcopy sendrec failed", r);
+ panic(__FILE__,"rw_chunk_finish: virvcopy sendrec failed", r);
}
*completed = total;
(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("check file system", NO_NUM);
+ panic(__FILE__,"check file system", NO_NUM);
}
return(zone);
}
bit_t i, b;
if (sp->s_rd_only)
- panic("can't allocate bit on read-only filesys.", NO_NUM);
+ panic(__FILE__,"can't allocate bit on read-only filesys.", NO_NUM);
if (map == IMAP) {
start_block = START_BLOCK;
block_t start_block;
if (sp->s_rd_only)
- panic("can't free bit on read-only filesys.", NO_NUM);
+ panic(__FILE__,"can't free bit on read-only filesys.", NO_NUM);
if (map == IMAP) {
start_block = START_BLOCK;
k = conv2(sp->s_native, (int) bp->b_bitmap[word]);
if (!(k & mask)) {
- panic(map == IMAP ? "tried to free unused inode" :
+ panic(__FILE__,map == IMAP ? "tried to free unused inode" :
"tried to free unused block", NO_NUM);
}
register struct super_block *sp;
if(dev == NO_DEV)
- panic("request for super_block of NO_DEV in get_super()", NO_NUM);
+ panic(__FILE__,"request for super_block of NO_DEV", NO_NUM);
for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++)
if (sp->s_dev == dev) return(sp);
/* Search failed. Something wrong. */
- panic("can't find superblock for device (in decimal)", (int) dev);
+ panic(__FILE__,"can't find superblock for device (in decimal)", (int) dev);
return(NIL_SUPER); /* to keep the compiler and lint quiet */
}
register struct super_block *sp;
if(dev == NO_DEV)
- panic("request for block size of NO_DEV in get_block_size()", NO_NUM);
+ panic(__FILE__,"request for block size of NO_DEV", NO_NUM);
for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++)
if (sp->s_dev == dev)
dev = sp->s_dev; /* save device (will be overwritten by copy) */
if(dev == NO_DEV)
- panic("request for super_block of NO_DEV in read_super()", NO_NUM);
+ panic(__FILE__,"request for super_block of NO_DEV", NO_NUM);
r = dev_io(DEV_READ, dev, FS_PROC_NR,
sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0);
if(r != MIN_BLOCK_SIZE) {
register int k;
clock_t uptime;
- if ( (k=sys_getuptime(&uptime)) != OK) panic("clock_time err", k);
+ if ( (k=sys_getuptime(&uptime)) != OK) panic(__FILE__,"clock_time err", k);
return( (time_t) (boottime + (uptime/HZ)));
}
/*===========================================================================*
* panic *
*===========================================================================*/
-PUBLIC void panic(format, num)
-char *format; /* format string */
-int num; /* number to go with format string */
+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
if (panicking) return; /* do not panic during a sync */
panicking = TRUE; /* prevent another panic during the sync */
- printf("File system panic: %s ", format);
+ printf("FS panic (%s): %s ", who, mess);
if (num != NO_NUM) printf("%d",num);
(void) do_sync(); /* flush everything to the disk */
sys_exit(1);
- printf("FS: I'm still alive after exit!\n");
- while(1) ;
}
printf("panic at %s, %d: ", file, line);
}
-PUBLIC void panic()
+PUBLIC void inet_panic()
{
printf("\ninet stacktrace: ");
stacktrace();
- server_panic("INET","aborted due to a panic",NO_NUM);
+ panic("INET","aborted due to a panic",NO_NUM);
}
#else /* CRAMPED */
-PUBLIC void panic(file, line)
+PUBLIC void inet_panic(file, line)
char *file;
int line;
{
printf("panic at %s, %d\n", file, line);
- server_panic("INET","aborted due to a panic",NO_NUM);
+ panic("INET","aborted due to a panic",NO_NUM);
}
#endif
{
panic0(file, line);
printf("assertion \"%s\" failed", what);
- panic();
+ inet_panic();
}
{
panic0(file, line);
printf("compare (%d) %s (%d) failed", lhs, what, rhs);
- panic();
+ inet_panic();
}
#endif /* !NDEBUG */
#if CRAMPED
/* Minimum panic info. */
-#define ip_panic(print_list) panic(this_file, __LINE__)
-_PROTOTYPE( void panic, (char *file, int line) );
+#define ip_panic(print_list) inet_panic(this_file, __LINE__)
+_PROTOTYPE( void inet_panic, (char *file, int line) );
#else /* !CRAMPED */
/* Maximum panic info. */
#define ip_panic(print_list) \
- (panic0(this_file, __LINE__), printf print_list, panic())
+ (panic0(this_file, __LINE__), printf print_list, inet_panic())
_PROTOTYPE( void panic0, (char *file, int line) );
-_PROTOTYPE( void panic, (void) );
+_PROTOTYPE( void inet_panic, (void) );
#endif /* !CRAMPED */
$i/unistd.h $i/stdlib.h $i/stdio.h $i/ansi.h $i/limits.h $i/errno.h \
$s/types.h $m/config.h $m/type.h $m/const.h $m/com.h $m/keymap.h \
$m/syslib.h $s/types.h \
- $m/utils.h $m/serverassert.h $m/devio.h
+ $m/utils.h $m/devio.h
main.o: $a
/* Try to get a fresh copy of the buffer with kernel messages. */
if ((r=sys_getkmessages(&kmess)) != OK) {
- report("Couldn't get copy of kmessages", r);
+ report("IS","couldn't get copy of kmessages", r);
return;
}
/* Try to get a copy of the kernel messages. */
if ((r = sys_getkmessages(&kmess)) != OK) {
- report("warning: couldn't get copy of kmessages", r);
+ report("IS","warning: couldn't get copy of kmessages", r);
return;
}
/* Try to get a copy of the boot monitor parameters. */
if ((r = sys_getmonparams(val, sizeof(val))) != OK) {
- report("warning: couldn't get copy of monitor params", r);
+ report("IS","warning: couldn't get copy of monitor params", r);
return;
}
};
if ((r = sys_getirqhooks(irq_hooks)) != OK) {
- report("warning: couldn't get copy of irq hooks", r);
+ report("IS","warning: couldn't get copy of irq hooks", r);
return;
}
char* priorities[] = {"task", "higher","high", "normal", "low", "lower", "user","idle"};
if ((r = sys_getimage(image)) != OK) {
- report("warning: couldn't get copy of image table", r);
+ report("IS","warning: couldn't get copy of image table", r);
return;
}
printf("Image table dump showing all processes included in system image.\n");
/* First obtain a scheduling information. */
if ((r = sys_getschedinfo(proc, rdy_head)) != OK) {
- report("warning: couldn't get copy of process table", r);
+ report("IS","warning: couldn't get copy of process table", r);
return;
}
/* Then obtain kernel addresses to correct pointer information. */
if ((r = sys_getkinfo(&kinfo)) != OK) {
- report("warning: couldn't get kernel addresses", r);
+ report("IS","warning: couldn't get kernel addresses", r);
return;
}
struct machine machine;
int r;
if ((r = sys_getkinfo(&kinfo)) != OK) {
- report("warning: couldn't get copy of kernel info struct", r);
+ report("IS","warning: couldn't get copy of kernel info struct", r);
return;
}
if ((r = sys_getmachine(&machine)) != OK) {
- report("warning: couldn't get copy of kernel machine struct", r);
+ report("IS","warning: couldn't get copy of kernel machine struct", r);
return;
}
int i,r;
struct memory mem[NR_MEMS];
if ((r = sys_getmemchunks(mem)) != OK) {
- report("warning: couldn't get copy of mem chunks", r);
+ report("IS","warning: couldn't get copy of mem chunks", r);
return;
}
/* First obtain a fresh copy of the current process table. */
if ((r = sys_getproctab(proc)) != OK) {
- report("warning: couldn't get copy of process table", r);
+ report("IS","warning: couldn't get copy of process table", r);
return;
}
/* First obtain a fresh copy of the current process table. */
if ((r = sys_getproctab(proc)) != OK) {
- report("warning: couldn't get copy of process table", r);
+ report("IS","warning: couldn't get copy of process table", r);
return;
}
/* First obtain a fresh copy of the current process table. */
if ((r = sys_getproctab(proc)) != OK) {
- report("warning: couldn't get copy of process table", r);
+ report("IS","warning: couldn't get copy of process table", r);
return;
}
}
-/*===========================================================================*
- * report *
- *===========================================================================*/
-PUBLIC void report(mess, num)
-char *mess; /* message format to print */
-int num; /* number to go with the message */
-{
- if (num != NO_NUM) {
- printf("IS: %s %d\n", mess, num);
- } else {
- printf("IS: %s\n", mess);
- }
-}
-
-
/*===========================================================================*
* init_server *
*===========================================================================*/
int status = 0;
status = receive(ANY, &m_in); /* this blocks until message arrives */
if (OK != status)
- server_panic("IS","failed to receive message!", status);
+ panic("IS","failed to receive message!", status);
who = 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)
- server_panic("IS", "unable to send reply!", send_status);
+ panic("IS", "unable to send reply!", send_status);
}
/* main.c */
_PROTOTYPE( void main, (void) );
-_PROTOTYPE( void report, (char *, int n) );
/* putk.c */
_PROTOTYPE( void kputc, (int c) );
register struct hole *hp, *new_ptr, *prev_ptr;
if (clicks == 0) return;
- if ( (new_ptr = free_slots) == NIL_HOLE) panic("Hole table full", NO_NUM);
+ if ( (new_ptr = free_slots) == NIL_HOLE)
+ panic(__FILE__,"hole table full", NO_NUM);
new_ptr->h_base = base;
new_ptr->h_len = clicks;
free_slots = new_ptr->h_next;
/* Get a copy of the physical memory chunks found at the kernel. */
if ((i=sys_getmemchunks(mem)) != OK)
- panic("PM couldn't get mem chunks",i);
+ panic(__FILE__,"couldn't get mem chunks",i);
/* Put all holes on the free list. */
for (hp = &hole[0]; hp < &hole[NR_HOLES]; hp++) hp->h_next = hp + 1;
}
new_clicks -= rmp->mp_seg[D].mem_vir;
if ((r=get_stack_ptr(who, &new_sp)) != OK) /* ask kernel for sp value */
- panic("PM couldn't get stack pointer", r);
+ panic(__FILE__,"couldn't get stack pointer", r);
r = adjust(rmp, new_clicks, new_sp);
rmp->mp_reply.reply_ptr = (r == OK ? m_in.addr : (char *) -1);
return(r); /* return new address or -1 */
src = (vir_bytes) mbuf;
r = sys_datacopy(PM_PROC_NR, (vir_bytes) src,
who, (vir_bytes) vsp, (phys_bytes)stk_bytes);
- if (r != OK) panic("do_exec stack copy err on", who);
+ if (r != OK) panic(__FILE__,"do_exec stack copy err on", who);
/* Read in text and data segments. */
if (sh_mp != NULL) {
count = MIN(bytes, (phys_bytes) sizeof(zero));
if ((s=sys_physcopy(PM_PROC_NR, D, (phys_bytes) zero,
NONE, PHYS_SEG, base, count)) != OK) {
- panic("new_mem can't zero", s);
+ panic(__FILE__,"new_mem can't zero", s);
}
base += count;
bytes -= count;
child_abs = (phys_bytes) child_base << CLICK_SHIFT;
parent_abs = (phys_bytes) rmp->mp_seg[D].mem_phys << CLICK_SHIFT;
i = sys_abscopy(parent_abs, child_abs, prog_bytes);
- if (i < 0) panic("do_fork can't copy", i);
+ if (i < 0) panic(__FILE__,"do_fork can't copy", i);
/* Find a slot in 'mproc' for the child process. A slot must exist. */
for (rmc = &mproc[0]; rmc < &mproc[NR_PROCS]; rmc++)
for (proc_nr=0, rmp=mproc; proc_nr < NR_PROCS; proc_nr++, rmp++) {
if ((rmp->mp_flags & (REPLY | ONSWAP)) == REPLY) {
if ((s=send(proc_nr, &rmp->mp_reply)) != OK) {
- panic("PM can't reply to", proc_nr);
+ panic(__FILE__,"PM can't reply to", proc_nr);
}
rmp->mp_flags &= ~REPLY;
}
PRIVATE void get_work()
{
/* Wait for the next message and extract useful information from it. */
- if (receive(ANY, &m_in) != OK) panic("PM receive error", NO_NUM);
+ if (receive(ANY, &m_in) != OK) panic(__FILE__,"PM receive error", NO_NUM);
who = m_in.m_source; /* who sent the message */
call_nr = m_in.m_type; /* system call number */
/* Get the memory map of the kernel to see how much memory it uses. */
if ((s=get_mem_map(SYSTASK, kernel_map)) != OK)
- panic("PM couldn't get proc entry of SYSTASK",s);
+ panic(__FILE__,"PM couldn't get proc entry of SYSTASK",s);
minix_clicks = (kernel_map[S].mem_phys + kernel_map[S].mem_len)
- kernel_map[T].mem_phys;
/* Get memory map for this process from the kernel. */
if ((s=get_mem_map(ip->proc_nr, rmp->mp_seg)) != OK)
- panic("couldn't get process entry",s);
+ panic(__FILE__,"couldn't get process entry",s);
if (rmp->mp_seg[T].mem_len != 0) rmp->mp_flags |= SEPARATE;
minix_clicks += rmp->mp_seg[S].mem_phys +
rmp->mp_seg[S].mem_len - rmp->mp_seg[T].mem_phys;
mess.PR_PROC_NR = ip->proc_nr;
mess.PR_PID = rmp->mp_pid;
if (OK != (s=send(FS_PROC_NR, &mess)))
- panic("PM can't sync up with FS", s);
+ panic(__FILE__,"PM can't sync up with FS", s);
}
}
/* Tell FS no more SYSTEM processes follow and synchronize. */
mess.PR_PROC_NR = NONE;
if (sendrec(FS_PROC_NR, &mess) != OK || mess.m_type != OK)
- panic("PM can't sync up with FS", NO_NUM);
+ panic(__FILE__,"PM can't sync up with FS", NO_NUM);
/* INIT process is somewhat special. */
sigemptyset(&mproc[INIT_PROC_NR].mp_ignore);
/* signal.c */
_PROTOTYPE( int do_alarm, (void) );
_PROTOTYPE( int do_kill, (void) );
-_PROTOTYPE( int ksig_pending, (void) );
+_PROTOTYPE( int ksig_pending, (void) );
_PROTOTYPE( int do_pause, (void) );
_PROTOTYPE( int set_alarm, (int proc_nr, int sec) );
_PROTOTYPE( int check_sig, (pid_t proc_id, int signo) );
/* time.c */
_PROTOTYPE( int do_stime, (void) );
_PROTOTYPE( int do_time, (void) );
-_PROTOTYPE( int do_times, (void) );
+_PROTOTYPE( int do_times, (void) );
/* trace.c */
_PROTOTYPE( int do_trace, (void) );
_PROTOTYPE( pid_t get_free_pid, (void) );
_PROTOTYPE( int allowed, (char *name_buf, struct stat *s_buf, int mask) );
_PROTOTYPE( int no_sys, (void) );
-_PROTOTYPE( void panic, (char *format, int num) );
+_PROTOTYPE( void panic, (char *who, char *mess, int num) );
_PROTOTYPE( void tell_fs, (int what, int p1, int p2, int p3) );
-_PROTOTYPE( int get_stack_ptr, (int proc_nr, vir_bytes *sp) );
+_PROTOTYPE( int get_stack_ptr, (int proc_nr, vir_bytes *sp) );
_PROTOTYPE( int get_mem_map, (int proc_nr, struct mem_map *mem_map) );
ticks = LONG_MAX; /* eternity (really TMR_NEVER) */
if ((s=sys_signalrm(proc_nr, &ticks)) != OK)
- panic("PM couldn't set signal alarm", s);
+ panic(__FILE__,"couldn't set signal alarm", s);
remaining = (int) ((ticks + (HZ-1))/HZ);
if (remaining < 0) remaining = INT_MAX; /* true value is too large */
if ((rmp->mp_flags & (IN_USE | ZOMBIE)) != IN_USE) {
printf("PM: signal %d sent to %s process %d\n",
(rmp->mp_flags & ZOMBIE) ? "zombie" : "dead", signo, slot);
- panic("", NO_NUM);
+ panic(__FILE__,"", NO_NUM);
}
if ((rmp->mp_flags & TRACED) && signo != SIGKILL) {
/* A traced process has special handling. */
sm.sm_sighandler = (vir_bytes) rmp->mp_sigact[signo].sa_handler;
sm.sm_sigreturn = rmp->mp_sigreturn;
if ((s=get_stack_ptr(slot, &new_sp)) != OK)
- panic("PM couldn't get new stack pointer",s);
+ panic(__FILE__,"couldn't get new stack pointer",s);
sm.sm_stkptr = new_sp;
/* Make room for the sigcontext and sigframe struct. */
* Maybe make SAFETY_BYTES a parameter.
*/
if ((s=get_stack_ptr(slot, ¤t_sp)) != OK)
- panic("PM couldn't get new stack pointer",s);
+ panic(__FILE__,"couldn't get new stack pointer",s);
adjust(rmp, rmp->mp_seg[D].mem_len, current_sp);
/* Write the memory map of all segments to begin the core file. */
int s;
if ( (s=sys_getuptime(&uptime)) != OK)
- panic("PM: warning, do_time couldn't get uptime", s);
+ panic(__FILE__,"do_time couldn't get uptime", s);
mp->mp_reply.reply_time = (time_t) (boottime + (uptime/HZ));
return(OK);
return(EPERM);
}
if ( (s=sys_getuptime(&uptime)) != OK)
- panic("PM: warning, do_stime couldn't get uptime", s);
+ panic(__FILE__,"do_stime couldn't get uptime", s);
boottime = (long) m_in.stime - (uptime/HZ);
/* Also inform FS about the new system time. */
int s;
if (OK != (s=sys_times(who, t)))
- panic("PM: warning, do_times couldn't get times", s);
+ panic(__FILE__,"do_times couldn't get times", s);
rmp->mp_reply.reply_t1 = t[0]; /* user time */
rmp->mp_reply.reply_t2 = t[1]; /* system time */
rmp->mp_reply.reply_t3 = rmp->mp_child_utime; /* child user time */
save_errno = errno; /* open might fail, e.g. from ENFILE */
tell_fs(SETUID, PM_PROC_NR, (int) mp->mp_effuid, (int) mp->mp_effuid);
if (fd < 0) return(-save_errno);
- if (fstat(fd, s_buf) < 0) panic("allowed: fstat failed", NO_NUM);
+ if (fstat(fd, s_buf) < 0) panic(__FILE__,"allowed: fstat failed", NO_NUM);
/* Only regular files can be executed. */
if (mask == X_BIT && (s_buf->st_mode & I_TYPE) != I_REGULAR) {
/*===========================================================================*
* panic *
*===========================================================================*/
-PUBLIC void panic(format, num)
-char *format; /* format string */
-int num; /* number to go with format string */
+PUBLIC void panic(who, mess, num)
+char *who; /* who caused the panic */
+char *mess; /* panic message string */
+int num; /* number to go with it */
{
/* An unrecoverable error has occurred. Panics are caused when an internal
* inconsistency is detected, e.g., a programming error or illegal value of a
* defined constant. The process manager decides to shut down. This results
* in a HARD_STOP notification to all system processes to allow local cleanup.
*/
- printf("Process manager panic: %s", format);
+ printf("PM panic (%s): %s", who, mess);
if (num != NO_NUM) printf(": %d",num);
printf("\n");
sys_abort(RBT_PANIC);