blob: ace4c95fe7d1bea9d224885cf3fa0aafd6f06e30 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include "types.h"
#include "param.h"
#include "mmu.h"
#include "proc.h"
#include "defs.h"
#include "x86.h"
struct Gatedesc idt[256];
struct Pseudodesc idt_pd = { 0, sizeof(idt) - 1, (unsigned) &idt };
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);
}
asm volatile("lidt %0" : : "g" (idt_pd.pd_lim));
}
void
trap(struct Trapframe *tf)
{
/* which process are we running? */
if(xx < 10)
cprintf("%d\n", tf->tf_trapno);
xx++;
//while(1)
//;
// XXX probably ought to lgdt on trap return
}
|