xv6

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit cb83c71628378bc0e295dd71bf6641379fbcdf37
parent 84eb544b23b17fed07b8c33142d48fdceffce10c
Author: rtm <rtm>
Date:   Tue, 13 Jun 2006 22:08:20 +0000

fix some trap bugs

Diffstat:
MNotes | 6++++++
Mmain.c | 12++++++++++--
Mtrap.c | 12+++++++++---
Mvectors.pl | 2+-
4 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/Notes b/Notes @@ -73,3 +73,9 @@ setupsegs() may modify current segment table, is that legal? trap() ought to lgdt on return, since currently only done in swtch() protect hardware interrupt vectors from user INT instructions? + +i'm getting a curious interrupt when jumping into user space. maybe +it's IRQ 0, but it comes at a weird and changing vector (e.g. 119) if +you don't initialize the PIC. why doesn't jos see this? if i +initialize the PIC with IRQ_OFFSET 32, the interrupt arrives at vector +32. diff --git a/main.c b/main.c @@ -5,12 +5,20 @@ #include "defs.h" #include "x86.h" -char junk1[20000]; -char junk2[20000] = { 1 }; +extern char edata[], end[]; main() { struct proc *p; + + // clear BSS + memset(edata, 0, end - edata); + + // partially initizialize PIC + outb(0x20+1, 0xFF); // IO_PIC1 + outb(0xA0+1, 0xFF); // IO_PIC2 + outb(0x20, 0x11); + outb(0x20+1, 32); cprintf("\nxV6\n\n"); diff --git a/trap.c b/trap.c @@ -12,11 +12,15 @@ extern unsigned vectors[]; /* vectors.S, array of 256 entry point addresses */ extern void trapenter(); extern void trapenter1(); + +int xx; + void tinit() { int i; + xx = 0; for(i = 0; i < 256; i++){ SETGATE(idt[i], 1, SEG_KCODE << 3, vectors[i], 3); } @@ -27,8 +31,10 @@ void trap(struct Trapframe *tf) { /* which process are we running? */ - cprintf("trap %d tf %x\n", tf->tf_trapno, tf); - while(1) - ; + if(xx < 10) + cprintf("%d\n", tf->tf_trapno); + xx++; + //while(1) + //; // XXX probably ought to lgdt on trap return } diff --git a/vectors.pl b/vectors.pl @@ -14,7 +14,7 @@ for(my $i = 0; $i < 256; $i++){ if(($i < 8 || $i > 14) && $i != 17){ print "\tpushl \$0\n"; } - print "\tpushl $i\n"; + print "\tpushl \$$i\n"; print "\tjmp alltraps\n"; } print ".data\n";