Callbacks

While processing an I/O request, a driver can perform post-processing on the request by inserting the address of a callback routine in the IOP_callback_table member of the IOP and updating the IOP_callback_ptr member:


; get callback pointer
mov eax, [esi.IOP_callback_ptr]
; save callback address in table
mov [eax.IOP_callback_table], offset32 vol_completion
; move down to next entry
add [esi.IOP_callback_ptr], size IOP_callback_entry

When calling back a request after completion or termination, each driver performs any necessary preprocessing, places the IOP address on the stack, and calls the next higher layer:


sub [ebx].IOP_callback_ptr, size IOP_callback_entry
                                  ; point to next available cb entry
mov eax, [ebx].IOP_callback_ptr   ; get pointer to next entry
push ebx                          ; place *IOP on stack
call [eax].IOP_cb_address         ; call back request
add esp, 4                        ; restore stack

See also IOP