10a70d042Srtm#!/usr/bin/perl -w 20a70d042Srtm 34763a042Srsc# Generate vectors.S, the trap/interrupt entry points. 44763a042Srsc# There has to be one entry point per interrupt number 52aa4c3bcSrtm# since otherwise there's no way for trap() to discover 62aa4c3bcSrtm# the interrupt number. 70a70d042Srtm 8f5527388Srscprint "# generated by vectors.pl - do not edit\n"; 9f5527388Srscprint "# handlers\n"; 100a70d042Srtmprint ".globl alltraps\n"; 110a70d042Srtmfor(my $i = 0; $i < 256; $i++){ 120a70d042Srtm print ".globl vector$i\n"; 130a70d042Srtm print "vector$i:\n"; 14*0159c8bbSkolya if(!($i == 8 || ($i >= 10 && $i <= 14) || $i == 17)){ 15a650c606Srsc print " pushl \$0\n"; 160a70d042Srtm } 17a650c606Srsc print " pushl \$$i\n"; 18a650c606Srsc print " jmp alltraps\n"; 190a70d042Srtm} 204763a042Srsc 21f5527388Srscprint "\n# vector table\n"; 220a70d042Srtmprint ".data\n"; 230a70d042Srtmprint ".globl vectors\n"; 240a70d042Srtmprint "vectors:\n"; 250a70d042Srtmfor(my $i = 0; $i < 256; $i++){ 26a650c606Srsc print " .long vector$i\n"; 270a70d042Srtm} 28eaea18cbSrsc 29eaea18cbSrsc# sample output: 30eaea18cbSrsc# # handlers 31eaea18cbSrsc# .globl alltraps 32eaea18cbSrsc# .globl vector0 33eaea18cbSrsc# vector0: 34eaea18cbSrsc# pushl $0 35eaea18cbSrsc# pushl $0 36eaea18cbSrsc# jmp alltraps 37eaea18cbSrsc# ... 38eaea18cbSrsc# 39eaea18cbSrsc# # vector table 40eaea18cbSrsc# .data 41eaea18cbSrsc# .globl vectors 42eaea18cbSrsc# vectors: 43eaea18cbSrsc# .long vector0 44eaea18cbSrsc# .long vector1 45eaea18cbSrsc# .long vector2 46eaea18cbSrsc# ... 47eaea18cbSrsc 48