added base src
[xv6-db.git] / vectors.pl
blob57b49dddef0c0c06ae000e6601a4bbfede0fadb6
1 #!/usr/bin/perl -w
3 # Generate vectors.S, the trap/interrupt entry points.
4 # There has to be one entry point per interrupt number
5 # since otherwise there's no way for trap() to discover
6 # the interrupt number.
8 print "# generated by vectors.pl - do not edit\n";
9 print "# handlers\n";
10 print ".globl alltraps\n";
11 for(my $i = 0; $i < 256; $i++){
12 print ".globl vector$i\n";
13 print "vector$i:\n";
14 if(!($i == 8 || ($i >= 10 && $i <= 14) || $i == 17)){
15 print " pushl \$0\n";
17 print " pushl \$$i\n";
18 print " jmp alltraps\n";
21 print "\n# vector table\n";
22 print ".data\n";
23 print ".globl vectors\n";
24 print "vectors:\n";
25 for(my $i = 0; $i < 256; $i++){
26 print " .long vector$i\n";
29 # sample output:
30 # # handlers
31 # .globl alltraps
32 # .globl vector0
33 # vector0:
34 # pushl $0
35 # pushl $0
36 # jmp alltraps
37 # ...
39 # # vector table
40 # .data
41 # .globl vectors
42 # vectors:
43 # .long vector0
44 # .long vector1
45 # .long vector2
46 # ...