First you must chose a vector for IPI commands, one that is usually available is for example 0xFF.
The IPI commands are calls over an INT vector and are called as an INT operation.
So, you must prepare an area for serving your chosen INT vector, with some code. For example:
My_INT_FF:
_asm Push eax
Do something.....
_asm Pop eax
_asm IRET
To prepare for the IPI call...
You must get the address of the APIC area.
The APIC physical address is obtained using MSR register #0x1B.
For example some code as the following would do the work:
_asm mov ecx,0x1b
_asm rdmsr //the value is returned in eax:edx, bits 12 to 35
_asm and eax,0xFFFFF000
_asm mov[apic],eax
Then map the obtained address using MmMapIoSpace.
pa.LowPart = apic;
pa.HighPart = -1;
APIC_Address = MmMapIoSpace(pa, 4096, MmNonCached);
Now you can send an IPI command with the following code, for example for sending an IPI command to vector 0xFF:
_asm Mov eax, APIC_Address
_asm Add eax,0x300
Wait1://Wait until ready
_asm Test dword ptr[eax],0x1000 //Status (bit 12 of Second dword)
_asm Jnz Wait1
_asm Mov eax, APIC_Address
_asm Add eax,0x310 //;offset of high dword in icr
_asm Mov [eax],0 //;high dword
_asm sub eax,0x10 //;low dword, 16 bytes lower
_asm mov ebx, 0x000c40ff //;= 000000000000,11,0,0,0,1,0,0,0,000,11111111
_asm Mov[eax], ebx
//Now an INT is produced on the requested CPU ...
Wait2: //wait until operation is complete; that is to say, until interrupt is called
_asm Test dword ptr[eax],0x1000 //Status (bit 12 of second dword)
_asm Jnz Wait2
-----Mensaje original-----
De: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]En nombre de Dmitry Bazhenov
Enviado el: mi?rcoles, 23 de noviembre de 2005 16:00
Para: Windows System Software Devs Interest List
Asunto: [ntdev] How I can use IPIs to schedule a work on other CPUs?
Does anybody know how to schedule some function execution on different CPU via
IPIs?
By now I do the same via DPCs. But I want to do it as fast as it is possible.
Dmitry
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@pandasoftware.es
To unsubscribe send a blank email to xxxxx@lists.osr.com