fix some trap bugs

This commit is contained in:
rtm 2006-06-13 22:08:20 +00:00
parent 84eb544b23
commit cb83c71628
4 changed files with 26 additions and 6 deletions

6
Notes
View file

@ -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.

12
main.c
View file

@ -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");

12
trap.c
View file

@ -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
}

View file

@ -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";