From 5ae6f98dea14390d65c1cd75e481e21efb5b07e3 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Sun, 11 Sep 2005 16:44:06 +0000 Subject: [PATCH] Andy's formatting fixes. --- kernel/config.h | 62 ++++++++++++------------ kernel/debug.c | 44 ++++++++--------- kernel/exception.c | 6 +-- kernel/i8259.c | 30 ++++++------ kernel/ipc.h | 16 +++--- kernel/main.c | 20 ++++---- kernel/mpx386.s | 2 +- kernel/proc.c | 26 +++++----- kernel/protect.c | 54 ++++++++++----------- kernel/protect.h | 118 ++++++++++++++++++++++----------------------- kernel/proto.h | 6 +-- kernel/start.c | 14 +++--- kernel/system.c | 18 +++---- kernel/utility.c | 4 +- 14 files changed, 210 insertions(+), 210 deletions(-) diff --git a/kernel/config.h b/kernel/config.h index e50eac077..5ffe84c5f 100644 --- a/kernel/config.h +++ b/kernel/config.h @@ -15,39 +15,39 @@ * the system binary, making it smaller. If you are not sure, it is best * to keep all kernel calls enabled. */ -#define USE_FORK 1 /* fork a new process */ -#define USE_NEWMAP 1 /* set a new memory map */ -#define USE_EXEC 1 /* update process after execute */ -#define USE_EXIT 1 /* clean up after process exit */ -#define USE_TRACE 1 /* process information and tracing */ -#define USE_GETKSIG 1 /* retrieve pending kernel signals */ -#define USE_ENDKSIG 1 /* finish pending kernel signals */ -#define USE_KILL 1 /* send a signal to a process */ -#define USE_SIGSEND 1 /* send POSIX-style signal */ -#define USE_SIGRETURN 1 /* sys_sigreturn(proc_nr, ctxt_ptr, flags) */ -#define USE_ABORT 1 /* shut down MINIX */ -#define USE_GETINFO 1 /* retrieve a copy of kernel data */ -#define USE_TIMES 1 /* get process and system time info */ -#define USE_SETALARM 1 /* schedule a synchronous alarm */ -#define USE_DEVIO 1 /* read or write a single I/O port */ -#define USE_VDEVIO 1 /* process vector with I/O requests */ -#define USE_SDEVIO 1 /* perform I/O request on a buffer */ -#define USE_IRQCTL 1 /* set an interrupt policy */ -#define USE_SEGCTL 1 /* set up a remote segment */ -#define USE_PRIVCTL 1 /* system privileges control */ -#define USE_NICE 1 /* change scheduling priority */ -#define USE_UMAP 1 /* map virtual to physical address */ -#define USE_VIRCOPY 1 /* copy using virtual addressing */ -#define USE_VIRVCOPY 1 /* vector with virtual copy requests */ -#define USE_PHYSCOPY 1 /* copy using physical addressing */ -#define USE_PHYSVCOPY 1 /* vector with physical copy requests */ -#define USE_MEMSET 1 /* write char to a given memory area */ +#define USE_FORK 1 /* fork a new process */ +#define USE_NEWMAP 1 /* set a new memory map */ +#define USE_EXEC 1 /* update process after execute */ +#define USE_EXIT 1 /* clean up after process exit */ +#define USE_TRACE 1 /* process information and tracing */ +#define USE_GETKSIG 1 /* retrieve pending kernel signals */ +#define USE_ENDKSIG 1 /* finish pending kernel signals */ +#define USE_KILL 1 /* send a signal to a process */ +#define USE_SIGSEND 1 /* send POSIX-style signal */ +#define USE_SIGRETURN 1 /* sys_sigreturn(proc_nr, ctxt_ptr, flags) */ +#define USE_ABORT 1 /* shut down MINIX */ +#define USE_GETINFO 1 /* retrieve a copy of kernel data */ +#define USE_TIMES 1 /* get process and system time info */ +#define USE_SETALARM 1 /* schedule a synchronous alarm */ +#define USE_DEVIO 1 /* read or write a single I/O port */ +#define USE_VDEVIO 1 /* process vector with I/O requests */ +#define USE_SDEVIO 1 /* perform I/O request on a buffer */ +#define USE_IRQCTL 1 /* set an interrupt policy */ +#define USE_SEGCTL 1 /* set up a remote segment */ +#define USE_PRIVCTL 1 /* system privileges control */ +#define USE_NICE 1 /* change scheduling priority */ +#define USE_UMAP 1 /* map virtual to physical address */ +#define USE_VIRCOPY 1 /* copy using virtual addressing */ +#define USE_VIRVCOPY 1 /* vector with virtual copy requests */ +#define USE_PHYSCOPY 1 /* copy using physical addressing */ +#define USE_PHYSVCOPY 1 /* vector with physical copy requests */ +#define USE_MEMSET 1 /* write char to a given memory area */ /* Length of program names stored in the process table. This is only used * for the debugging dumps that can be generated with the IS server. The PM * server keeps its own copy of the program name. */ -#define P_NAME_LEN 8 +#define P_NAME_LEN 8 /* Kernel diagnostics are written to a circular buffer. After each message, * a system server is notified and a copy of the buffer can be retrieved to @@ -75,9 +75,9 @@ /* This section allows to enable kernel debugging and timing functionality. * For normal operation all options should be disabled. */ -#define DEBUG_SCHED_CHECK 0 /* sanity check of scheduling queues */ -#define DEBUG_LOCK_CHECK 0 /* kernel lock() sanity check */ -#define DEBUG_TIME_LOCKS 0 /* measure time spent in locks */ +#define DEBUG_SCHED_CHECK 0 /* sanity check of scheduling queues */ +#define DEBUG_LOCK_CHECK 0 /* kernel lock() sanity check */ +#define DEBUG_TIME_LOCKS 0 /* measure time spent in locks */ #endif /* CONFIG_H */ diff --git a/kernel/debug.c b/kernel/debug.c index d3af33324..dd7303d5d 100644 --- a/kernel/debug.c +++ b/kernel/debug.c @@ -23,15 +23,15 @@ void timer_start(int cat, char *name) unsigned long h, l; int i; - if(cat < 0 || cat >= TIMING_CATEGORIES) return; + if (cat < 0 || cat >= TIMING_CATEGORIES) return; for(i = 0; i < sizeof(timingdata[0].names) && *name; i++) timingdata[cat].names[i] = *name++; timingdata[0].names[sizeof(timingdata[0].names)-1] = '\0'; - if(starttimes[cat][HIGHCOUNT]) { return; } + if (starttimes[cat][HIGHCOUNT]) { return; } - if(!init) { + if (!init) { int t, f; init = 1; for(t = 0; t < TIMING_CATEGORIES; t++) { @@ -50,14 +50,14 @@ void timer_end(int cat) int bin; read_tsc(&h, &l); - if(cat < 0 || cat >= TIMING_CATEGORIES) return; - if(!starttimes[cat][HIGHCOUNT]) { + if (cat < 0 || cat >= TIMING_CATEGORIES) return; + if (!starttimes[cat][HIGHCOUNT]) { timingdata[cat].misses++; return; } - if(starttimes[cat][HIGHCOUNT] == h) { + if (starttimes[cat][HIGHCOUNT] == h) { d = (l - starttimes[cat][1]); - } else if(starttimes[cat][HIGHCOUNT] == h-1 && + } else if (starttimes[cat][HIGHCOUNT] == h-1 && starttimes[cat][LOWCOUNT] > l) { d = ((ULONG_MAX - starttimes[cat][LOWCOUNT]) + l); } else { @@ -65,14 +65,14 @@ void timer_end(int cat) return; } starttimes[cat][HIGHCOUNT] = 0; - if(!timingdata[cat].lock_timings_range[0] || + if (!timingdata[cat].lock_timings_range[0] || d < timingdata[cat].lock_timings_range[0] || d > timingdata[cat].lock_timings_range[1]) { int t; - if(!timingdata[cat].lock_timings_range[0] || + if (!timingdata[cat].lock_timings_range[0] || d < timingdata[cat].lock_timings_range[0]) timingdata[cat].lock_timings_range[0] = d; - if(!timingdata[cat].lock_timings_range[1] || + if (!timingdata[cat].lock_timings_range[1] || d > timingdata[cat].lock_timings_range[1]) timingdata[cat].lock_timings_range[1] = d; for(t = 0; t < TIMING_POINTS; t++) @@ -80,13 +80,13 @@ void timer_end(int cat) timingdata[cat].binsize = (timingdata[cat].lock_timings_range[1] - timingdata[cat].lock_timings_range[0])/(TIMING_POINTS+1); - if(timingdata[cat].binsize < 1) + if (timingdata[cat].binsize < 1) timingdata[cat].binsize = 1; timingdata[cat].resets++; } bin = (d-timingdata[cat].lock_timings_range[0]) / timingdata[cat].binsize; - if(bin < 0 || bin >= TIMING_POINTS) { + if (bin < 0 || bin >= TIMING_POINTS) { int t; /* this indicates a bug, but isn't really serious */ for(t = 0; t < TIMING_POINTS; t++) @@ -114,19 +114,19 @@ check_runqueues(char *when) for (xp = BEG_PROC_ADDR; xp < END_PROC_ADDR; ++xp) { xp->p_found = 0; - if(l++ > PROCLIMIT) { panic("check error", NO_NUM); } + if (l++ > PROCLIMIT) { panic("check error", NO_NUM); } } for (q=0; q < NR_SCHED_QUEUES; q++) { - if(rdy_head[q] && !rdy_tail[q]) { + if (rdy_head[q] && !rdy_tail[q]) { kprintf("head but no tail: %s", when); panic("scheduling error", NO_NUM); } - if(!rdy_head[q] && rdy_tail[q]) { + if (!rdy_head[q] && rdy_tail[q]) { kprintf("tail but no head: %s", when); panic("scheduling error", NO_NUM); } - if(rdy_tail[q] && rdy_tail[q]->p_nextready != NIL_PROC) { + if (rdy_tail[q] && rdy_tail[q]->p_nextready != NIL_PROC) { kprintf("tail and tail->next not null; %s", when); panic("scheduling error", NO_NUM); } @@ -136,29 +136,29 @@ check_runqueues(char *when) panic("found unready process on run queue", NO_NUM); } - if(xp->p_priority != q) { + if (xp->p_priority != q) { kprintf("scheduling error: wrong priority: %s\n", when); panic("wrong priority", NO_NUM); } - if(xp->p_found) { + if (xp->p_found) { kprintf("scheduling error: double scheduling: %s\n", when); panic("proc more than once on scheduling queue", NO_NUM); } xp->p_found = 1; - if(xp->p_nextready == NIL_PROC && rdy_tail[q] != xp) { + if (xp->p_nextready == NIL_PROC && rdy_tail[q] != xp) { kprintf("scheduling error: last element not tail: %s\n", when); panic("scheduling error", NO_NUM); } - if(l++ > PROCLIMIT) panic("loop in schedule queue?", NO_NUM); + if (l++ > PROCLIMIT) panic("loop in schedule queue?", NO_NUM); } } for (xp = BEG_PROC_ADDR; xp < END_PROC_ADDR; ++xp) { - if(! isemptyp(xp) && xp->p_ready && ! xp->p_found) { + if (! isemptyp(xp) && xp->p_ready && ! xp->p_found) { kprintf("scheduling error: ready not on queue: %s\n", when); panic("ready proc not on scheduling queue", NO_NUM); - if(l++ > PROCLIMIT) { panic("loop in proc.t?", NO_NUM); } + if (l++ > PROCLIMIT) { panic("loop in proc.t?", NO_NUM); } } } } diff --git a/kernel/exception.c b/kernel/exception.c index 4ca1f06b8..def5a7e07 100755 --- a/kernel/exception.c +++ b/kernel/exception.c @@ -7,9 +7,9 @@ #include #include "proc.h" -/*==========================================================================* - * exception * - *==========================================================================*/ +/*===========================================================================* + * exception * + *===========================================================================*/ PUBLIC void exception(vec_nr) unsigned vec_nr; { diff --git a/kernel/i8259.c b/kernel/i8259.c index 5854c6b0d..c832bd9cb 100755 --- a/kernel/i8259.c +++ b/kernel/i8259.c @@ -34,9 +34,9 @@ PRIVATE vecaddr_t irq_vec[] = { #define set_vec(nr, addr) ((void)0) #endif -/*==========================================================================* - * intr_init * - *==========================================================================*/ +/*===========================================================================* + * intr_init * + *===========================================================================*/ PUBLIC void intr_init(mine) int mine; { @@ -86,9 +86,9 @@ int mine; } } -/*=========================================================================* - * put_irq_handler * - *=========================================================================*/ +/*===========================================================================* + * put_irq_handler * + *===========================================================================*/ PUBLIC void put_irq_handler(hook, irq, handler) irq_hook_t *hook; int irq; @@ -119,9 +119,9 @@ irq_handler_t handler; irq_use |= 1 << irq; } -/*=========================================================================* - * rm_irq_handler * - *=========================================================================*/ +/*===========================================================================* + * rm_irq_handler * + *===========================================================================*/ PUBLIC void rm_irq_handler(hook) irq_hook_t *hook; { @@ -135,9 +135,9 @@ irq_hook_t *hook; line = &irq_handlers[irq]; while (*line != NULL) { - if((*line)->id == id) { + if ((*line)->id == id) { (*line) = (*line)->next; - if(! irq_handlers[irq]) irq_use &= ~(1 << irq); + if (! irq_handlers[irq]) irq_use &= ~(1 << irq); return; } line = &(*line)->next; @@ -145,9 +145,9 @@ irq_hook_t *hook; /* When the handler is not found, normally return here. */ } -/*==========================================================================* - * intr_handle * - *==========================================================================*/ +/*===========================================================================* + * intr_handle * + *===========================================================================*/ PUBLIC void intr_handle(hook) irq_hook_t *hook; { @@ -173,7 +173,7 @@ irq_hook_t *hook; #if _WORD_SIZE == 2 /*===========================================================================* - * set_vec * + * set_vec * *===========================================================================*/ PRIVATE void set_vec(vec_nr, addr) int vec_nr; /* which vector */ diff --git a/kernel/ipc.h b/kernel/ipc.h index 8a22f073c..c8442f54d 100644 --- a/kernel/ipc.h +++ b/kernel/ipc.h @@ -15,15 +15,15 @@ * numbers are carefully defined so that it can easily be seen (based on * the bits that are on) which checks should be done in sys_call(). */ -#define SEND 1 /* 0 0 0 1 : blocking send */ -#define RECEIVE 2 /* 0 0 1 0 : blocking receive */ -#define SENDREC 3 /* 0 0 1 1 : SEND + RECEIVE */ -#define NOTIFY 4 /* 0 1 0 0 : nonblocking notify */ -#define ECHO 8 /* 1 0 0 0 : echo a message */ +#define SEND 1 /* 0 0 0 1 : blocking send */ +#define RECEIVE 2 /* 0 0 1 0 : blocking receive */ +#define SENDREC 3 /* 0 0 1 1 : SEND + RECEIVE */ +#define NOTIFY 4 /* 0 1 0 0 : nonblocking notify */ +#define ECHO 8 /* 1 0 0 0 : echo a message */ /* The following bit masks determine what checks that should be done. */ -#define CHECK_PTR 0x0B /* 1 0 1 1 : validate message buffer */ -#define CHECK_DST 0x05 /* 0 1 0 1 : validate message destination */ -#define CHECK_SRC 0x02 /* 0 0 1 0 : validate message source */ +#define CHECK_PTR 0x0B /* 1 0 1 1 : validate message buffer */ +#define CHECK_DST 0x05 /* 0 1 0 1 : validate message destination */ +#define CHECK_SRC 0x02 /* 0 0 1 0 : validate message source */ #endif /* IPC_H */ diff --git a/kernel/main.c b/kernel/main.c index 5dbc25467..76707d2ab 100755 --- a/kernel/main.c +++ b/kernel/main.c @@ -26,7 +26,7 @@ FORWARD _PROTOTYPE( void announce, (void)); FORWARD _PROTOTYPE( void shutdown, (timer_t *tp)); /*===========================================================================* - * main * + * main * *===========================================================================*/ PUBLIC void main() { @@ -166,9 +166,9 @@ PUBLIC void main() restart(); } -/*==========================================================================* - * announce * - *==========================================================================*/ +/*===========================================================================* + * announce * + *===========================================================================*/ PRIVATE void announce(void) { /* Display the MINIX startup banner. */ @@ -182,9 +182,9 @@ PRIVATE void announce(void) #endif } -/*==========================================================================* - * prepare_shutdown * - *==========================================================================*/ +/*===========================================================================* + * prepare_shutdown * + *===========================================================================*/ PUBLIC void prepare_shutdown(how) int how; { @@ -232,9 +232,9 @@ int how; set_timer(&shutdown_timer, get_uptime() + HZ, shutdown); } -/*==========================================================================* - * shutdown * - *==========================================================================*/ +/*===========================================================================* + * shutdown * + *===========================================================================*/ PRIVATE void shutdown(tp) timer_t *tp; { diff --git a/kernel/mpx386.s b/kernel/mpx386.s index 4e96a4dde..3eb8ec315 100755 --- a/kernel/mpx386.s +++ b/kernel/mpx386.s @@ -267,7 +267,7 @@ _hwint07: ! Interrupt routine for irq 7 (printer) #define hwint_slave(irq) \ call save /* save interrupted process state */;\ push (_irq_handlers+4*irq) /* irq_handlers[irq] */;\ - call _intr_handle /* intr_handle(irq_handlers[irq]) */;\ + call _intr_handle /* intr_handle(irq_handlers[irq]) */;\ pop ecx ;\ cmp (_irq_actids+4*irq), 0 /* interrupt still active? */;\ jz 0f ;\ diff --git a/kernel/proc.c b/kernel/proc.c index 8165dc33d..f91e80b17 100755 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -361,9 +361,9 @@ int dst; /* which process to notify */ return(OK); } -/*==========================================================================* - * lock_notify * - *==========================================================================*/ +/*===========================================================================* + * lock_notify * + *===========================================================================*/ PUBLIC int lock_notify(src, dst) int src; /* sender of the notification */ int dst; /* who is to be notified */ @@ -406,7 +406,7 @@ register struct proc *rp; /* this process is now runnable */ #if DEBUG_SCHED_CHECK check_runqueues("enqueue"); - if(rp->p_ready) kprintf("enqueue() already ready process\n"); + if (rp->p_ready) kprintf("enqueue() already ready process\n"); #endif /* Determine where to insert to process. */ @@ -559,9 +559,9 @@ PRIVATE void pick_proc() } } -/*==========================================================================* - * lock_send * - *==========================================================================*/ +/*===========================================================================* + * lock_send * + *===========================================================================*/ PUBLIC int lock_send(dst, m_ptr) int dst; /* to whom is message being sent? */ message *m_ptr; /* pointer to message buffer */ @@ -574,9 +574,9 @@ message *m_ptr; /* pointer to message buffer */ return(result); } -/*==========================================================================* - * lock_enqueue * - *==========================================================================*/ +/*===========================================================================* + * lock_enqueue * + *===========================================================================*/ PUBLIC void lock_enqueue(rp) struct proc *rp; /* this process is now runnable */ { @@ -586,9 +586,9 @@ struct proc *rp; /* this process is now runnable */ unlock(3); } -/*==========================================================================* - * lock_dequeue * - *==========================================================================*/ +/*===========================================================================* + * lock_dequeue * + *===========================================================================*/ PUBLIC void lock_dequeue(rp) struct proc *rp; /* this process is no longer runnable */ { diff --git a/kernel/protect.c b/kernel/protect.c index bdc5d7836..5f5324d61 100755 --- a/kernel/protect.c +++ b/kernel/protect.c @@ -74,9 +74,9 @@ FORWARD _PROTOTYPE( void int_gate, (unsigned vec_nr, vir_bytes offset, FORWARD _PROTOTYPE( void sdesc, (struct segdesc_s *segdp, phys_bytes base, vir_bytes size) ); -/*=========================================================================* - * prot_init * - *=========================================================================*/ +/*===========================================================================* + * prot_init * + *===========================================================================*/ PUBLIC void prot_init() { /* Set up tables for protected mode. @@ -191,9 +191,9 @@ PUBLIC void prot_init() #endif } -/*=========================================================================* - * init_codeseg * - *=========================================================================*/ +/*===========================================================================* + * init_codeseg * + *===========================================================================*/ PUBLIC void init_codeseg(segdp, base, size, privilege) register struct segdesc_s *segdp; phys_bytes base; @@ -207,9 +207,9 @@ int privilege; /* CONFORMING = 0, ACCESSED = 0 */ } -/*=========================================================================* - * init_dataseg * - *=========================================================================*/ +/*===========================================================================* + * init_dataseg * + *===========================================================================*/ PUBLIC void init_dataseg(segdp, base, size, privilege) register struct segdesc_s *segdp; phys_bytes base; @@ -222,9 +222,9 @@ int privilege; /* EXECUTABLE = 0, EXPAND_DOWN = 0, ACCESSED = 0 */ } -/*=========================================================================* - * sdesc * - *=========================================================================*/ +/*===========================================================================* + * sdesc * + *===========================================================================*/ PRIVATE void sdesc(segdp, base, size) register struct segdesc_s *segdp; phys_bytes base; @@ -251,9 +251,9 @@ vir_bytes size; #endif } -/*=========================================================================* - * seg2phys * - *=========================================================================*/ +/*===========================================================================* + * seg2phys * + *===========================================================================*/ PUBLIC phys_bytes seg2phys(seg) U16_t seg; { @@ -274,9 +274,9 @@ U16_t seg; return base; } -/*=========================================================================* - * phys2seg * - *=========================================================================*/ +/*===========================================================================* + * phys2seg * + *===========================================================================*/ PUBLIC void phys2seg(seg, off, phys) u16_t *seg; vir_bytes *off; @@ -302,9 +302,9 @@ phys_bytes phys; #endif } -/*=========================================================================* - * int_gate * - *=========================================================================*/ +/*===========================================================================* + * int_gate * + *===========================================================================*/ PRIVATE void int_gate(vec_nr, offset, dpl_type) unsigned vec_nr; vir_bytes offset; @@ -322,9 +322,9 @@ unsigned dpl_type; #endif } -/*=========================================================================* - * enable_iop * - *=========================================================================*/ +/*===========================================================================* + * enable_iop * + *===========================================================================*/ PUBLIC void enable_iop(pp) struct proc *pp; { @@ -336,9 +336,9 @@ struct proc *pp; pp->p_reg.psw |= 0x3000; } -/*==========================================================================* - * alloc_segments * - *==========================================================================*/ +/*===========================================================================* + * alloc_segments * + *===========================================================================*/ PUBLIC void alloc_segments(rp) register struct proc *rp; { diff --git a/kernel/protect.h b/kernel/protect.h index 47009a089..8374d1f73 100755 --- a/kernel/protect.h +++ b/kernel/protect.h @@ -7,21 +7,21 @@ #define LDT_SIZE (2 + NR_REMOTE_SEGS) /* CS, DS and remote segments */ /* Fixed global descriptors. 1 to 7 are prescribed by the BIOS. */ -#define GDT_INDEX 1 /* GDT descriptor */ -#define IDT_INDEX 2 /* IDT descriptor */ -#define DS_INDEX 3 /* kernel DS */ -#define ES_INDEX 4 /* kernel ES (386: flag 4 Gb at startup) */ -#define SS_INDEX 5 /* kernel SS (386: monitor SS at startup) */ -#define CS_INDEX 6 /* kernel CS */ -#define MON_CS_INDEX 7 /* temp for BIOS (386: monitor CS at startup) */ -#define TSS_INDEX 8 /* kernel TSS */ -#define DS_286_INDEX 9 /* scratch 16-bit source segment */ -#define ES_286_INDEX 10 /* scratch 16-bit destination segment */ -#define A_INDEX 11 /* 64K memory segment at A0000 */ -#define B_INDEX 12 /* 64K memory segment at B0000 */ -#define C_INDEX 13 /* 64K memory segment at C0000 */ -#define D_INDEX 14 /* 64K memory segment at D0000 */ -#define FIRST_LDT_INDEX 15 /* rest of descriptors are LDT's */ +#define GDT_INDEX 1 /* GDT descriptor */ +#define IDT_INDEX 2 /* IDT descriptor */ +#define DS_INDEX 3 /* kernel DS */ +#define ES_INDEX 4 /* kernel ES (386: flag 4 Gb at startup) */ +#define SS_INDEX 5 /* kernel SS (386: monitor SS at startup) */ +#define CS_INDEX 6 /* kernel CS */ +#define MON_CS_INDEX 7 /* temp for BIOS (386: monitor CS at startup) */ +#define TSS_INDEX 8 /* kernel TSS */ +#define DS_286_INDEX 9 /* scratch 16-bit source segment */ +#define ES_286_INDEX 10 /* scratch 16-bit destination segment */ +#define A_INDEX 11 /* 64K memory segment at A0000 */ +#define B_INDEX 12 /* 64K memory segment at B0000 */ +#define C_INDEX 13 /* 64K memory segment at C0000 */ +#define D_INDEX 14 /* 64K memory segment at D0000 */ +#define FIRST_LDT_INDEX 15 /* rest of descriptors are LDT's */ #define GDT_SELECTOR 0x08 /* (GDT_INDEX * DESC_SIZE) bad for asld */ #define IDT_SELECTOR 0x10 /* (IDT_INDEX * DESC_SIZE) */ @@ -36,64 +36,64 @@ #define ES_286_SELECTOR 0x51 /* (ES_286_INDEX*DESC_SIZE+TASK_PRIVILEGE) */ /* Fixed local descriptors. */ -#define CS_LDT_INDEX 0 /* process CS */ -#define DS_LDT_INDEX 1 /* process DS=ES=FS=GS=SS */ -#define EXTRA_LDT_INDEX 2 /* first of the extra LDT entries */ +#define CS_LDT_INDEX 0 /* process CS */ +#define DS_LDT_INDEX 1 /* process DS=ES=FS=GS=SS */ +#define EXTRA_LDT_INDEX 2 /* first of the extra LDT entries */ /* Privileges. */ -#define INTR_PRIVILEGE 0 /* kernel and interrupt handlers */ -#define TASK_PRIVILEGE 1 /* kernel tasks */ -#define USER_PRIVILEGE 3 /* servers and user processes */ +#define INTR_PRIVILEGE 0 /* kernel and interrupt handlers */ +#define TASK_PRIVILEGE 1 /* kernel tasks */ +#define USER_PRIVILEGE 3 /* servers and user processes */ /* 286 hardware constants. */ /* Exception vector numbers. */ -#define BOUNDS_VECTOR 5 /* bounds check failed */ -#define INVAL_OP_VECTOR 6 /* invalid opcode */ -#define COPROC_NOT_VECTOR 7 /* coprocessor not available */ -#define DOUBLE_FAULT_VECTOR 8 -#define COPROC_SEG_VECTOR 9 /* coprocessor segment overrun */ -#define INVAL_TSS_VECTOR 10 /* invalid TSS */ -#define SEG_NOT_VECTOR 11 /* segment not present */ -#define STACK_FAULT_VECTOR 12 /* stack exception */ -#define PROTECTION_VECTOR 13 /* general protection */ +#define BOUNDS_VECTOR 5 /* bounds check failed */ +#define INVAL_OP_VECTOR 6 /* invalid opcode */ +#define COPROC_NOT_VECTOR 7 /* coprocessor not available */ +#define DOUBLE_FAULT_VECTOR 8 +#define COPROC_SEG_VECTOR 9 /* coprocessor segment overrun */ +#define INVAL_TSS_VECTOR 10 /* invalid TSS */ +#define SEG_NOT_VECTOR 11 /* segment not present */ +#define STACK_FAULT_VECTOR 12 /* stack exception */ +#define PROTECTION_VECTOR 13 /* general protection */ /* Selector bits. */ -#define TI 0x04 /* table indicator */ -#define RPL 0x03 /* requester privilege level */ +#define TI 0x04 /* table indicator */ +#define RPL 0x03 /* requester privilege level */ /* Descriptor structure offsets. */ -#define DESC_BASE 2 /* to base_low */ -#define DESC_BASE_MIDDLE 4 /* to base_middle */ -#define DESC_ACCESS 5 /* to access byte */ -#define DESC_SIZE 8 /* sizeof (struct segdesc_s) */ +#define DESC_BASE 2 /* to base_low */ +#define DESC_BASE_MIDDLE 4 /* to base_middle */ +#define DESC_ACCESS 5 /* to access byte */ +#define DESC_SIZE 8 /* sizeof (struct segdesc_s) */ /* Base and limit sizes and shifts. */ #define BASE_MIDDLE_SHIFT 16 /* shift for base --> base_middle */ /* Access-byte and type-byte bits. */ -#define PRESENT 0x80 /* set for descriptor present */ -#define DPL 0x60 /* descriptor privilege level mask */ -#define DPL_SHIFT 5 -#define SEGMENT 0x10 /* set for segment-type descriptors */ +#define PRESENT 0x80 /* set for descriptor present */ +#define DPL 0x60 /* descriptor privilege level mask */ +#define DPL_SHIFT 5 +#define SEGMENT 0x10 /* set for segment-type descriptors */ /* Access-byte bits. */ -#define EXECUTABLE 0x08 /* set for executable segment */ -#define CONFORMING 0x04 /* set for conforming segment if executable */ -#define EXPAND_DOWN 0x04 /* set for expand-down segment if !executable*/ -#define READABLE 0x02 /* set for readable segment if executable */ -#define WRITEABLE 0x02 /* set for writeable segment if !executable */ -#define TSS_BUSY 0x02 /* set if TSS descriptor is busy */ -#define ACCESSED 0x01 /* set if segment accessed */ +#define EXECUTABLE 0x08 /* set for executable segment */ +#define CONFORMING 0x04 /* set for conforming segment if executable */ +#define EXPAND_DOWN 0x04 /* set for expand-down segment if !executable*/ +#define READABLE 0x02 /* set for readable segment if executable */ +#define WRITEABLE 0x02 /* set for writeable segment if !executable */ +#define TSS_BUSY 0x02 /* set if TSS descriptor is busy */ +#define ACCESSED 0x01 /* set if segment accessed */ /* Special descriptor types. */ -#define AVL_286_TSS 1 /* available 286 TSS */ -#define LDT 2 /* local descriptor table */ -#define BUSY_286_TSS 3 /* set transparently to the software */ -#define CALL_286_GATE 4 /* not used */ -#define TASK_GATE 5 /* only used by debugger */ -#define INT_286_GATE 6 /* interrupt gate, used for all vectors */ -#define TRAP_286_GATE 7 /* not used */ +#define AVL_286_TSS 1 /* available 286 TSS */ +#define LDT 2 /* local descriptor table */ +#define BUSY_286_TSS 3 /* set transparently to the software */ +#define CALL_286_GATE 4 /* not used */ +#define TASK_GATE 5 /* only used by debugger */ +#define INT_286_GATE 6 /* interrupt gate, used for all vectors */ +#define TRAP_286_GATE 7 /* not used */ /* Extra 386 hardware constants. */ @@ -117,8 +117,8 @@ /* LDT's and TASK_GATE's don't need it */ /* Granularity byte. */ -#define GRANULAR 0x80 /* set for 4K granularilty */ -#define DEFAULT 0x40 /* set for 32-bit defaults (executable seg) */ -#define BIG 0x40 /* set for "BIG" (expand-down seg) */ -#define AVL 0x10 /* 0 for available */ -#define LIMIT_HIGH 0x0F /* mask for high bits of limit */ +#define GRANULAR 0x80 /* set for 4K granularilty */ +#define DEFAULT 0x40 /* set for 32-bit defaults (executable seg) */ +#define BIG 0x40 /* set for "BIG" (expand-down seg) */ +#define AVL 0x10 /* 0 for available */ +#define LIMIT_HIGH 0x0F /* mask for high bits of limit */ diff --git a/kernel/proto.h b/kernel/proto.h index 34f005ff0..f2530549d 100755 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -25,9 +25,9 @@ _PROTOTYPE( void panic, (_CONST char *s, int n) ); /* proc.c */ _PROTOTYPE( int sys_call, (int function, int src_dest, message *m_ptr) ); -_PROTOTYPE( int lock_notify, (int src, int dst) ); +_PROTOTYPE( int lock_notify, (int src, int dst) ); _PROTOTYPE( int lock_send, (int dst, message *m_ptr) ); -_PROTOTYPE( void lock_enqueue, (struct proc *rp) ); +_PROTOTYPE( void lock_enqueue, (struct proc *rp) ); _PROTOTYPE( void lock_dequeue, (struct proc *rp) ); /* start.c */ @@ -39,7 +39,7 @@ _PROTOTYPE( int get_priv, (register struct proc *rc, int proc_type) ); _PROTOTYPE( void send_sig, (int proc_nr, int sig_nr) ); _PROTOTYPE( void cause_sig, (int proc_nr, int sig_nr) ); _PROTOTYPE( void sys_task, (void) ); -_PROTOTYPE( void get_randomness, (int source) ); +_PROTOTYPE( void get_randomness, (int source) ); _PROTOTYPE( int virtual_copy, (struct vir_addr *src, struct vir_addr *dst, vir_bytes bytes) ); #define numap_local(proc_nr, vir_addr, bytes) \ diff --git a/kernel/start.c b/kernel/start.c index fb6f6ff99..dd860f705 100755 --- a/kernel/start.c +++ b/kernel/start.c @@ -15,10 +15,9 @@ #include FORWARD _PROTOTYPE( char *get_value, (_CONST char *params, _CONST char *key)); - -/*==========================================================================* - * cstart * - *==========================================================================*/ +/*===========================================================================* + * cstart * + *===========================================================================*/ PUBLIC void cstart(cs, ds, mds, parmoff, parmsize) U16_t cs, ds; /* kernel code and data segment */ U16_t mds; /* monitor data segment */ @@ -92,9 +91,10 @@ U16_t parmoff, parmsize; /* boot parameters offset and length */ */ } -/*==========================================================================* - * get_value * - *==========================================================================*/ +/*===========================================================================* + * get_value * + *===========================================================================*/ + PRIVATE char *get_value(params, name) _CONST char *params; /* boot monitor parameters */ _CONST char *name; /* key to look up */ diff --git a/kernel/system.c b/kernel/system.c index bf9ffd374..132cd157b 100755 --- a/kernel/system.c +++ b/kernel/system.c @@ -101,7 +101,7 @@ PUBLIC void sys_task() } /*===========================================================================* - * initialize * + * initialize * *===========================================================================*/ PRIVATE void initialize(void) { @@ -171,7 +171,7 @@ PRIVATE void initialize(void) } /*===========================================================================* - * get_priv * + * get_priv * *===========================================================================*/ PUBLIC int get_priv(rc, proc_type) register struct proc *rc; /* new (child) process pointer */ @@ -198,7 +198,7 @@ int proc_type; /* system or user process flag */ } /*===========================================================================* - * get_randomness * + * get_randomness * *===========================================================================*/ PUBLIC void get_randomness(source) int source; @@ -217,7 +217,7 @@ int source; source %= RANDOM_SOURCES; r_next= krandom.bin[source].r_next; - if(machine.processor > 486) { + if (machine.processor > 486) { read_tsc(&tsc_high, &tsc_low); krandom.bin[source].r_buf[r_next] = tsc_low; } else { @@ -347,10 +347,10 @@ vir_bytes bytes; /* # of bytes to be copied */ seg = (vc < rp->p_memmap[S].mem_vir ? D : S); #endif - if((vir_addr>>CLICK_SHIFT) >= rp->p_memmap[seg].mem_vir + + if ((vir_addr>>CLICK_SHIFT) >= rp->p_memmap[seg].mem_vir + rp->p_memmap[seg].mem_len) return( (phys_bytes) 0 ); - if(vc >= rp->p_memmap[seg].mem_vir + + if (vc >= rp->p_memmap[seg].mem_vir + rp->p_memmap[seg].mem_len) return( (phys_bytes) 0 ); #if (CHIP == INTEL) @@ -391,9 +391,9 @@ vir_bytes bytes; /* # of bytes to be copied */ return(fm->mem_phys + (phys_bytes) vir_addr); } -/*==========================================================================* - * virtual_copy * - *==========================================================================*/ +/*===========================================================================* + * virtual_copy * + *===========================================================================*/ PUBLIC int virtual_copy(src_addr, dst_addr, bytes) struct vir_addr *src_addr; /* source virtual address */ struct vir_addr *dst_addr; /* destination virtual address */ diff --git a/kernel/utility.c b/kernel/utility.c index a592c07ee..fe7ee3607 100755 --- a/kernel/utility.c +++ b/kernel/utility.c @@ -25,7 +25,7 @@ FORWARD _PROTOTYPE(void kputc, (int c)); /*===========================================================================* - * panic * + * panic * *===========================================================================*/ PUBLIC void panic(mess,nr) _CONST char *mess; @@ -121,7 +121,7 @@ PUBLIC void kprintf(const char *fmt, ...) /* format to be printed */ } /*===========================================================================* - * kputc * + * kputc * *===========================================================================*/ PRIVATE void kputc(c) int c; /* character to append */ -- 2.44.0