The invention discloses a user interrupt event
callback mechanism implementation method, which adopts an implementation method of combining user interrupt event
callback caused by hardware interrupt and conventional task scheduling, after
system hardware interrupt occurs, kernel interrupt
processing codes construct a user mode code running environment, and a user mode is switched to run a user event
callback function, so that the user interrupt event callback is realized. After the execution of the user event callback function is finished, the
system environment before the execution of the user event callback function is recovered through an undefined instruction falling into a kernel; and when all the user callback event functions are executed, falling into the kernel through the undefined instruction again, and recovering an instruction execution
stream before the interruption event occurs by utilizing the stack frame information reserved when the interruption is entered. According to the method, an emergency
processing mechanism with determined
delay is realized, the constructed interrupt event callback function runs in a
user space, and the method has the functions of shielding low-priority interrupt and protecting a memory, is low in overhead, simple to implement and easy to adapt to various processors, and has a good application prospect.