Safe handling of ICR register in Apic

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
rdos
Member
Member
Posts: 3311
Joined: Wed Oct 01, 2008 1:55 pm

Safe handling of ICR register in Apic

Post by rdos »

The Intel software manual is not specific about how to handle the ICR, when it is busy, and how long it could potentially remain busy. It doesn't say if there is any buffering either (are new writes lost if the busy flag is set?)

Possible multithreading/ISR safe handling of ICR:

Code: Select all

icr_send:
    cli
    test ICR,DeliveryStatusBit
    jz icr_ready
    sti 
    pause
    jmp icr_send

icr_ready:
    mov ICR+4,edx
    mov ICR,eax
    sti
Would this always work even if IPIs are sent in ISRs / directly after each others?
Post Reply