2006-06-13 17:50:06 +02:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
2006-07-16 17:38:56 +02:00
|
|
|
# Generate vectors.S, the trap/interrupt entry points.
|
|
|
|
# There has to be one entry point per interrupt number
|
2006-08-30 20:55:06 +02:00
|
|
|
# since otherwise there's no way for trap() to discover
|
|
|
|
# the interrupt number.
|
2006-06-13 17:50:06 +02:00
|
|
|
|
2006-09-06 19:50:20 +02:00
|
|
|
print "# generated by vectors.pl - do not edit\n";
|
|
|
|
print "# handlers\n";
|
2006-06-13 17:50:06 +02:00
|
|
|
print ".text\n";
|
|
|
|
print ".globl alltraps\n";
|
|
|
|
for(my $i = 0; $i < 256; $i++){
|
|
|
|
print ".globl vector$i\n";
|
|
|
|
print "vector$i:\n";
|
|
|
|
if(($i < 8 || $i > 14) && $i != 17){
|
2006-09-06 19:04:06 +02:00
|
|
|
print " pushl \$0\n";
|
2006-06-13 17:50:06 +02:00
|
|
|
}
|
2006-09-06 19:04:06 +02:00
|
|
|
print " pushl \$$i\n";
|
|
|
|
print " jmp alltraps\n";
|
2006-06-13 17:50:06 +02:00
|
|
|
}
|
2006-07-16 17:38:56 +02:00
|
|
|
|
2006-09-06 19:50:20 +02:00
|
|
|
print "\n# vector table\n";
|
2006-06-13 17:50:06 +02:00
|
|
|
print ".data\n";
|
|
|
|
print ".globl vectors\n";
|
|
|
|
print "vectors:\n";
|
|
|
|
for(my $i = 0; $i < 256; $i++){
|
2006-09-06 19:04:06 +02:00
|
|
|
print " .long vector$i\n";
|
2006-06-13 17:50:06 +02:00
|
|
|
}
|
2007-08-22 08:01:32 +02:00
|
|
|
|
|
|
|
# sample output:
|
|
|
|
# # handlers
|
|
|
|
# .text
|
|
|
|
# .globl alltraps
|
|
|
|
# .globl vector0
|
|
|
|
# vector0:
|
|
|
|
# pushl $0
|
|
|
|
# pushl $0
|
|
|
|
# jmp alltraps
|
|
|
|
# ...
|
|
|
|
#
|
|
|
|
# # vector table
|
|
|
|
# .data
|
|
|
|
# .globl vectors
|
|
|
|
# vectors:
|
|
|
|
# .long vector0
|
|
|
|
# .long vector1
|
|
|
|
# .long vector2
|
|
|
|
# ...
|
|
|
|
|