github.com/icexin/eggos@v0.4.2-0.20220216025428-78b167e4f349/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  }