Minor cleanups.
static void init_domain(int index)
{
- size_t o, size, memsize;
+ size_t size, memsize;
phys_bytes busaddr;
size= 0x100000 / 8;
static int do_add_phys(message *m)
{
- int i, r;
+ int i;
phys_bytes start;
size_t size;
static int do_del_phys(message *m)
{
- int r;
phys_bytes start;
size_t size;
struct wini *wn = w_wn;
struct command cmd;
- int i, s;
+ int s;
u16_t w;
unsigned long size;
int prev_wakeup;
struct wini *wn = w_wn;
iovec_t *iop, *iov_end = iov + nr_req;
int n, r, s, errors, do_dma, do_write, do_copyout;
- unsigned long v, block, w_status;
+ unsigned long block, w_status;
u64_t dv_size = w_dv->dv_size;
- unsigned cylinder, head, sector, nbytes;
+ unsigned nbytes;
unsigned dma_buf_offset;
size_t addr_offset = 0;
unsigned base_ctl = wn->base_ctl;
pvb_pair_t outbyte[11]; /* vector for sys_voutb() */
int s; /* status for sys_(v)outb() */
- unsigned long w_status;
if (w_wn->state & IGNORING) return ERR;
int drv_start(int sub_dev, int DmaMode) {
u32_t enable_bit, result = 0;
- u32_t debug;
/* Write default values to device in case user failed to configure.
If user did configure properly, everything is written twice.
int drv_int(int sub_dev) {
u32_t int_status;
u32_t bit;
- u32_t debug;
/* return status of interrupt bit of specified channel*/
switch (sub_dev) {
PUBLIC int drv_init_hw (void) {
u16_t i, j;
- u16_t chip_sel_ctrl_reg;
/* First, detect the hardware */
if (detect_hw() != OK) {
int drv_start(int sub_dev, int DmaMode) {
u32_t enable_bit, result = 0;
- u32_t debug;
/* Write default values to device in case user failed to configure.
If user did configure properly, everything is written twice.
int drv_int(int sub_dev) {
u32_t int_status;
u32_t bit;
- u32_t debug;
/* return status of interrupt bit of specified channel*/
switch (sub_dev) {
PUBLIC void main(void)
{
- int r, caller, proc_nr, chan;
+ int r, caller, proc_nr;
message mess, repl_mess;
/* SEF local startup. */
PRIVATE int open_sub_dev(int sub_dev_nr, int dma_mode) {
- sub_dev_t* sub_dev_ptr; int i;
+ sub_dev_t* sub_dev_ptr;
sub_dev_ptr = &sub_dev[sub_dev_nr];
/* Only one open at a time per sub device */
PRIVATE int msg_ioctl(message *m_ptr)
{
int status, len, chan;
- phys_bytes user_phys;
sub_dev_t *sub_dev_ptr;
special_file_t* special_file_ptr;
PRIVATE void msg_write(message *m_ptr)
{
- int s, chan; sub_dev_t *sub_dev_ptr;
+ int chan; sub_dev_t *sub_dev_ptr;
special_file_t* special_file_ptr;
dprint("%s: msg_write() device %d\n", drv.DriverName, m_ptr->DEVICE);
PRIVATE void msg_read(message *m_ptr)
{
- int s, chan; sub_dev_t *sub_dev_ptr;
+ int chan; sub_dev_t *sub_dev_ptr;
special_file_t* special_file_ptr;
dprint("%s: msg_read() device %d\n", drv.DriverName, m_ptr->DEVICE);
*/
static void el3_write_fifo(dpeth_t * dep, int pktsize)
{
- phys_bytes phys_user;
int bytes, ix = 0;
iovec_dat_s_t *iovp = &dep->de_write_iovec;
int r, padding = pktsize;
*/
static void mem_nic2user(dpeth_t * dep, int pageno, int pktsize)
{
- phys_bytes offset, phys_user;
+ phys_bytes offset;
iovec_dat_s_t *iovp = &dep->de_read_iovec;
int bytes, ix = 0;
*/
static void pio_nic2user(dpeth_t *dep, int pageno, int pktsize)
{
- phys_bytes phys_user;
iovec_dat_s_t *iovp = &dep->de_read_iovec;
unsigned offset, iov_offset; int r, bytes, ix = 0;
*/
static void pio_user2nic(dpeth_t *dep, int pageno, int pktsize)
{
- phys_bytes phys_user;
iovec_dat_s_t *iovp = &dep->de_write_iovec;
int r, bytes, ix = 0;
static void ns_interrupt(dpeth_t * dep)
{
int isr, tsr;
- int size, queue;
+ int queue;
while ((isr = inb_reg0(dep, DP_ISR)) != 0) {
e1000_t *e;
{
int r, i;
- u16_t word;
e->status |= E1000_ENABLED;
e->irq_hook = e->irq;
* timers. Possibly reschedule the next alarm.
*/
clock_t now; /* current time */
- timer_t *tp;
int s;
/* Get the current time to compare the timers against. */
* timers. Possibly reschedule the next alarm.
*/
clock_t now; /* current time */
- timer_t *tp;
int r;
/* Get the current time to compare the timers against. */
static int lance_probe(ec)
ether_card_t *ec;
{
- unsigned short pci_cmd, attached = 0;
+ unsigned short pci_cmd;
unsigned short ioaddr;
int lance_version, chip_version;
int devind, just_one, i, r;
u16_t vid, did;
- u32_t bar;
- u8_t ilr;
char *dname;
if ((ec->ec_pcibus | ec->ec_pcidev | ec->ec_pcifunc) != 0)
* 'tmp_phys', the normal address is 'tmp_buf'.
*/
- unsigned left;
-
if(!(tmp_buf = alloc_contig(2*DMA_BUF_SIZE, AC_ALIGN4K, &tmp_phys)))
panic(__FILE__, "can't allocate tmp_buf", DMA_BUF_SIZE);
}
/* Carry out a single read or write request. */
iovec_t iovec1;
int r, opcode;
- phys_bytes phys_addr;
u64_t position;
/* Disk address? Address and length of the user buffer? */
static iovec_t iovec[NR_IOREQS];
phys_bytes iovec_size;
unsigned nr_req;
- int r, j, opcode;
+ int r, opcode;
u64_t position;
nr_req = mp->COUNT; /* Length of I/O vector */
unsigned long dv_size;
int accumulated_read = 0;
struct logdevice *log;
- static int f;
size_t vir_offset = 0;
if(log_device < 0 || log_device >= NR_DEVS)
PUBLIC int lapic_enable(void)
{
u32_t val, nlvt;
- u32_t timeout = 0xFFFF;
- u32_t errstatus = 0;
- int i;
unsigned cpu = cpuid;
if (!lapic_addr)
}
case VMCTL_I386_PAGEDIRS:
{
- int pde;
vm_pagedirs = (u32_t *) m_ptr->SVMCTL_VALUE;
return OK;
}
struct proc *rp;
struct priv *privp;
struct io_range *iorp;
- int rem;
- vir_bytes addr;
struct proc *destproc;
/* Allow safe copies and accesses to SELF */
struct exception_frame * frame,
int is_nested)
{
- int s;
- vir_bytes ph;
- u32_t pte;
- int procok = 0, pcok = 0, rangeok = 0;
int in_physcopy = 0;
reg_t pagefaultcr2;
{
/* An exception or unexpected interrupt has occurred. */
-struct proc *t;
-
struct ex_s {
char *msg;
int signum;
*===========================================================================*/
PUBLIC void proc_stacktrace(struct proc *whichproc)
{
- reg_t bp, v_bp, v_pc, v_hbp;
+ reg_t v_bp, v_pc, v_hbp;
int iskernel;
v_bp = whichproc->p_reg.fp;
* use the BIOS locations instead. The flag "mine" is set if the 8259s are
* to be programmed for MINIX, or to be reset to what the BIOS expects.
*/
- int i;
-
if (!intr_disabled())
intr_disable();
PUBLIC void vm_init(struct proc *newptproc)
{
- int i;
if(vm_running)
minix_panic("vm_init: vm_running", NO_NUM);
vm_set_cr3(newptproc);
struct proc *dstproc, vir_bytes dstlinaddr, vir_bytes bytes)
{
u32_t addr;
- int o1, o2;
int procslot;
- int firstloop = 1;
NOREC_ENTER(linlincopy);
bytes -= chunk;
srclinaddr += chunk;
dstlinaddr += chunk;
-
- firstloop = 0;
}
NOREC_RETURN(linlincopy, OK);
void vm_pt_print(u32_t *pagetable, u32_t v)
{
- int pte, l = 0;
+ int pte;
int col = 0;
vmassert(!((u32_t) pagetable % I386_PAGE_SIZE));
*===========================================================================*/
int vm_phys_memset(phys_bytes ph, u8_t c, phys_bytes bytes)
{
- char *v;
u32_t p;
NOREC_ENTER(physmemset);
struct vir_addr *vir_addr[2]; /* virtual source and destination address */
phys_bytes phys_addr[2]; /* absolute source and destination */
int seg_index;
- int i, r;
+ int i;
struct proc *procs[2];
NOREC_ENTER(virtualcopy);
caller = proc_addr(who_p);
if(RTS_ISSET(caller, RTS_VMREQUEST)) {
- struct proc *target;
- int pn;
vmassert(caller->p_vmrequest.vmresult != VMSUSPEND);
RTS_LOCK_UNSET(caller, RTS_VMREQUEST);
if(caller->p_vmrequest.vmresult != OK) {
/* Set up tables for protected mode.
* All GDT slots are allocated at compile time.
*/
- struct gate_table_s *gtp;
struct desctableptr_s *dtp;
unsigned ldt_index;
register struct proc *rp;
PUBLIC int prot_set_kern_seg_limit(vir_bytes limit)
{
struct proc *rp;
- vir_bytes prev;
int orig_click;
int incr_clicks;
struct boot_image *ip; /* boot image pointer */
register struct proc *rp; /* process pointer */
register struct priv *sp; /* privilege structure pointer */
- register int i, j, s;
+ register int i, j;
int hdrindex; /* index to array of a.out headers */
phys_clicks text_base;
vir_clicks text_clicks, data_clicks, st_clicks;
for (i=0; i < NR_BOOT_PROCS; ++i) {
int schedulable_proc, proc_nr;
int ipc_to_m, kcalls;
- bitchunk_t fv;
ip = &image[i]; /* process' attributes */
rp = proc_addr(ip->proc_nr); /* get process pointer */
{
/* This function prepares to shutdown MINIX. */
static timer_t shutdown_timer;
- register struct proc *rp;
- message m;
/* Continue after 1 second, to give processes a chance to get scheduled to
* do shutdown work. Set a watchog timer to call shutdown(). The timer
*===========================================================================*/
PUBLIC void init_profile_clock(u32_t freq)
{
- int r, irq;
+ int irq;
intr_disable();
#include <minix/endpoint.h>
#include <minix/safecopies.h>
#include <minix/portio.h>
-#include <minix/u64.h>
-#include <sys/vm_i386.h>
/* Declaration of the call vector that defines the mapping of system calls
* to handler functions. The vector is initialized in sys_init() with map(),
register struct proc *caller_ptr;
int s;
int call_nr;
- int n = 0;
/* Initialize the system task. */
initialize();
{
register struct proc *rp; /* iterate over process table */
register struct proc **xpp; /* iterate over caller queue */
- struct proc *np;
if(isemptyp(rc)) minix_panic("clear_proc: empty process", rc->p_endpoint);
*===========================================================================*/
PRIVATE struct proc *vmrestart_check(message *m)
{
- int type, r;
+ int type;
struct proc *restarting;
/* Anyone waiting to be vm-restarted? */
* in the PM (normal abort or panic) or TTY (after CTRL-ALT-DEL).
*/
int how = m_ptr->ABRT_HOW;
- int length;
- phys_bytes src_phys;
/* See if the monitor is to run the specified instructions. */
if (how == RBT_MONITOR) {
PUBLIC int do_cprofile(m_ptr)
register message *m_ptr; /* pointer to request message */
{
- int proc_nr, i, err = 0, k = 0;
+ int proc_nr, i;
phys_bytes len;
- vir_bytes vir_dst, vir_src;
+ vir_bytes vir_dst;
switch (m_ptr->PROF_ACTION) {
{
/* Handle sys_exec(). A process has done a successful EXEC. Patch it up. */
register struct proc *rp;
- phys_bytes phys_name;
- char *np;
int proc_nr;
if(!isokendpt(m_ptr->PR_ENDPT, &proc_nr))
PRIVATE void clear_proc(rc)
register struct proc *rc; /* slot of process to clean up */
{
- register struct proc *rp; /* iterate over process table */
- register struct proc **xpp; /* iterate over caller queue */
int i;
- int sys_id;
/* Don't clear if already cleared. */
if(isemptyp(rc)) return;
/* Check the table with IRQ hooks to see if hooks should be released. */
for (i=0; i < NR_IRQ_HOOKS; i++) {
- int proc;
if (rc->p_endpoint == irq_hooks[i].proc_nr_e) {
rm_irq_handler(&irq_hooks[i]); /* remove interrupt handler */
irq_hooks[i].proc_nr_e = NONE; /* mark hook as free */
register struct proc *rpc; /* child process pointer */
struct proc *rpp; /* parent process pointer */
struct mem_map *map_ptr; /* virtual address of map inside caller (PM) */
- int i, gen, r;
+ int gen, r;
int p_proc;
if(!isokendpt(m_ptr->PR_ENDPT, &p_proc))
*/
size_t length;
vir_bytes src_vir;
- int proc_nr, nr_e, nr, r;
+ int nr_e, nr, r;
struct proc *caller;
int wipe_rnd_bin = -1;
struct exec e_hdr;
break;
}
case GET_RANDOMNESS_BIN: {
- int i, bin = m_ptr->I_VAL_LEN2_E;
+ int bin = m_ptr->I_VAL_LEN2_E;
if(bin < 0 || bin >= RANDOM_SOURCES) {
kprintf("SYSTEM: GET_RANDOMNESS_BIN: %d out of range\n", bin);
/* Handle sys_newmap(). Fetch the memory map. */
register struct proc *rp; /* process whose map is to be loaded */
struct mem_map *map_ptr; /* virtual address of map inside caller */
- phys_bytes src_phys; /* physical address of map at the */
int proc_nr;
map_ptr = (struct mem_map *) m_ptr->PR_MEM_PTR;
* which is used to enable the kernel to have the tables cleared.
*/
int proc_nr;
- vir_bytes vir_dst;
struct proc *rp;
/* Store process name, control struct, table locations. */
PUBLIC int do_sprofile(m_ptr)
register message *m_ptr; /* pointer to request message */
{
- int proc_nr, i;
- vir_bytes vir_dst;
- phys_bytes length;
+ int proc_nr;
switch(m_ptr->PROF_ACTION) {
*/
#include "../system.h"
-#include "../vm.h"
/*===========================================================================*
{
vir_bytes len, buf;
static char mybuf[DIAG_BUFSIZE];
- struct proc *caller, *target;
+ struct proc *caller;
int s, i, proc_nr;
caller = proc_addr(who_p);
#include "../vm.h"
#include "../debug.h"
#include <minix/type.h>
-#include <minix/config.h>
/*===========================================================================*
* do_vmctl *
PUBLIC int do_vmctl(m_ptr)
register message *m_ptr; /* pointer to request message */
{
- int proc_nr, i;
+ int proc_nr;
endpoint_t ep = m_ptr->SVMCTL_WHO;
struct proc *p, *rp, *target;
int err;
char key_name[DS_MAX_KEYLEN];
int flags = m_ptr->DS_FLAGS;
size_t length;
- int nr, r;
+ int r;
/* MAP should not be overwritten. */
if((flags & DSF_TYPE_MAP) && (flags & DSF_OVERWRITE))
int fd;
unsigned operations;
{
- int i;
unsigned resops;
eth_fd_t *eth_fd;
PRIVATE int eth_sel_read (eth_fd)
eth_fd_t *eth_fd;
{
- acc_t *pack, *tmp_acc, *next_acc;
- int result;
+ acc_t *tmp_acc, *next_acc;
if (!(eth_fd->ef_flags & EFF_OPTSET))
return 1; /* Read will not block */
int *bytesp;
{
tcp_conn_t *tcp_conn;
- size_t data_size, read_size;
- acc_t *data;
- int fin_recv, urg, push, result;
- i32_t old_window, new_window;
- u16_t mss;
+ size_t data_size;
+ int fin_recv, urg, push;
*bytesp= 0; /* The default is that nothing is available */
int fd;
unsigned operations;
{
- int i;
unsigned resops;
udp_fd_t *udp_fd;