github.com/jspc/eggos@v0.5.1-0.20221028160421-556c75c878a5/kernel/trap/registry.go (about)

     1  package trap
     2  
     3  var trapHandlers = [256]TrapHandler{}
     4  
     5  type TrapHandler func()
     6  
     7  //go:nosplit
     8  func Handler(no int) TrapHandler {
     9  	return trapHandlers[no]
    10  }
    11  
    12  //go:nosplit
    13  func Register(idx int, handler func()) {
    14  	trapHandlers[idx] = handler
    15  }