From c1b100e93044469de30c634107bc645361cc1a73 Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 28 Aug 2007 18:23:48 +0000 Subject: [PATCH] nits --- console.c | 5 +---- fsvar.h | 40 ---------------------------------------- ide.c | 6 +++--- main.c | 2 +- runoff | 22 ++++++++++++++++++---- toc.ftr | 1 - toc.hdr | 1 - trap.c | 4 ---- trapasm.S | 4 +--- 9 files changed, 24 insertions(+), 61 deletions(-) diff --git a/console.c b/console.c index b41262d098..d849860ab4 100644 --- a/console.c +++ b/console.c @@ -105,7 +105,7 @@ printint(int xx, int base, int sgn) cons_putc(buf[i]); } -// Print to the input. only understands %d, %x, %p, %s. +// Print to the console. only understands %d, %x, %p, %s. void cprintf(char *fmt, ...) { @@ -200,7 +200,6 @@ console_intr(int (*getc)(void)) case C('P'): // Process listing. procdump(); break; - case C('U'): // Kill line. while(input.e > input.w && input.buf[(input.e-1) % INPUT_BUF] != '\n'){ @@ -208,14 +207,12 @@ console_intr(int (*getc)(void)) cons_putc(BACKSPACE); } break; - case C('H'): // Backspace if(input.e > input.w){ input.e--; cons_putc(BACKSPACE); } break; - default: if(c != 0 && input.e < input.r+INPUT_BUF){ input.buf[input.e++] = c; diff --git a/fsvar.h b/fsvar.h index 43574b6504..17bcb5b005 100644 --- a/fsvar.h +++ b/fsvar.h @@ -16,43 +16,3 @@ struct inode { #define I_BUSY 0x1 #define I_VALID 0x2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Blank page. diff --git a/ide.c b/ide.c index f7681d2530..53139ece32 100644 --- a/ide.c +++ b/ide.c @@ -52,7 +52,7 @@ ide_init(void) ide_wait_ready(0); // Check if disk 1 is present - outb(0x1f6, 0xE0 | (1<<4)); + outb(0x1f6, 0xe0 | (1<<4)); for(i=0; i<1000; i++){ if(inb(0x1f7) != 0){ disk_1_present = 1; @@ -61,7 +61,7 @@ ide_init(void) } // Switch back to disk 0. - outb(0x1f6, 0xE0 | (0<<4)); + outb(0x1f6, 0xe0 | (0<<4)); } // Start the request for b. Caller must hold ide_lock. @@ -77,7 +77,7 @@ ide_start_request(struct buf *b) outb(0x1f3, b->sector & 0xff); outb(0x1f4, (b->sector >> 8) & 0xff); outb(0x1f5, (b->sector >> 16) & 0xff); - outb(0x1f6, 0xE0 | ((b->dev&1)<<4) | ((b->sector>>24)&0x0f)); + outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((b->sector>>24)&0x0f)); if(b->flags & B_DIRTY){ outb(0x1f7, IDE_CMD_WRITE); outsl(0x1f0, b->data, 512/4); diff --git a/main.c b/main.c index 87e5841499..87dfd3e902 100644 --- a/main.c +++ b/main.c @@ -57,7 +57,7 @@ main(void) } // Additional processors start here. -void +static void mpmain(void) { cprintf("cpu%d: starting\n", cpu()); diff --git a/runoff b/runoff index 386939198b..37ca0142b4 100755 --- a/runoff +++ b/runoff @@ -134,7 +134,19 @@ perl -e ' } ' $files >defs -perl -n -e 'print if s/^([0-9]+ [a-zA-Z0-9_]+)\(.*$/\1/;' $files | +(for i in $files +do + case "$i" in + *.S) + cat $i | sed 's;#.*;;; s;//.*;;;' + ;; + *) + cat $i | sed 's;//.*;;; s;"([^"\\]|\\.)*";;;' + esac +done +) >alltext + +perl -n -e 'print if s/^([0-9]+ [a-zA-Z0-9_]+)\(.*$/\1/;' alltext | egrep -v ' (usage|main|if|for)$' >>defs ( >s.defs @@ -144,9 +156,11 @@ for i in `awk '{print $2}' defs | sort -fu` do defs=`egrep '^[0-9]+ '$i'( |$)' defs | awk '{print $1}'` echo $i $defs >>s.defs - uses=`egrep -h '([^a-zA-Z_0-9])'$i'($|[^a-zA-Z_0-9])' $files | awk '{print $1}'` - echo $i $defs - echo $uses |fmt -24 | sed 's/^/ /' + uses=`egrep -h '([^a-zA-Z_0-9])'$i'($|[^a-zA-Z_0-9])' alltext | awk '{print $1}'` + if [ "x$defs" != "x$uses" ]; then + echo $i $defs + echo $uses |fmt -24 | sed 's/^/ /' + fi done ) >refs diff --git a/toc.ftr b/toc.ftr index 0641a6d975..3b16d8cad3 100644 --- a/toc.ftr +++ b/toc.ftr @@ -1,6 +1,5 @@ - The source listing is preceded by a cross-reference that lists every defined constant, struct, global variable, and function in xv6. Each entry gives, on the same line as the name, the line number (or, in a few cases, numbers) diff --git a/toc.hdr b/toc.hdr index faff6ae07f..3698d81bee 100644 --- a/toc.hdr +++ b/toc.hdr @@ -4,4 +4,3 @@ lines per column, giving one hundred lines per sheet (or page). Thus there is a convenient relationship between line numbers and sheet numbers. - diff --git a/trap.c b/trap.c index d60a38aebd..ab5b7ccc80 100644 --- a/trap.c +++ b/trap.c @@ -48,7 +48,6 @@ trap(struct trapframe *tf) // during interrupt handler. Decrement before returning. cpus[cpu()].nlock++; - // PAGEBREAK: 10 switch(tf->trapno){ case IRQ_OFFSET + IRQ_TIMER: if(cpu() == 0){ @@ -59,17 +58,14 @@ trap(struct trapframe *tf) } lapic_eoi(); break; - case IRQ_OFFSET + IRQ_IDE: ide_intr(); lapic_eoi(); break; - case IRQ_OFFSET + IRQ_KBD: kbd_intr(); lapic_eoi(); break; - case IRQ_OFFSET + IRQ_SPURIOUS: cprintf("spurious interrupt from cpu %d eip %x\n", cpu(), tf->eip); lapic_eoi(); diff --git a/trapasm.S b/trapasm.S index 87a832a7f3..acdca994e5 100644 --- a/trapasm.S +++ b/trapasm.S @@ -1,11 +1,9 @@ .text -.globl trap -.globl trapret1 -.globl alltraps .set SEG_KDATA_SEL, 0x10 # selector for SEG_KDATA # vectors.S sends all traps here. +.globl alltraps alltraps: # Build trap frame. pushl %ds