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.
#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");
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);
}
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
}
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";