diff --git a/xtoskrnl/hl/x86/pic.c b/xtoskrnl/hl/x86/pic.c index 4123d7d..018a347 100644 --- a/xtoskrnl/hl/x86/pic.c +++ b/xtoskrnl/hl/x86/pic.c @@ -371,3 +371,35 @@ HlpInitializePic(VOID) /* Initialize legacy PIC */ HlpInitializeLegacyPic(); } + +/** + * Sends an IPI (Inter-Processor Interrupt) to the specified CPU. + * + * @param ApicId + * Supplies a CPU APIC ID to send an IPI to. + * + * @param Vector + * Supplies the IPI vector to send. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTAPI +VOID +HlpSendIpi(ULONG ApicId, + ULONG Vector) +{ + /* Check current APIC mode */ + if(HlpApicMode == APIC_MODE_X2APIC) + { + /* Send IPI using x2APIC mode */ + HlWriteApicRegister(APIC_ICR0, ((ULONGLONG)ApicId << 32) | Vector); + } + else + { + /* Send IPI using xAPIC compatibility mode */ + HlWriteApicRegister(APIC_ICR1, ApicId << 24); + HlWriteApicRegister(APIC_ICR0, Vector); + } +} diff --git a/xtoskrnl/includes/amd64/hli.h b/xtoskrnl/includes/amd64/hli.h index 6c61d5b..a90eaa7 100644 --- a/xtoskrnl/includes/amd64/hli.h +++ b/xtoskrnl/includes/amd64/hli.h @@ -54,6 +54,11 @@ XTAPI VOID HlpInitializePic(); +XTAPI +VOID +HlpSendIpi(ULONG ApicId, + ULONG Vector); + XTFASTCALL KRUNLEVEL HlpTransformApicTprToRunLevel(IN UCHAR Tpr); diff --git a/xtoskrnl/includes/i686/hli.h b/xtoskrnl/includes/i686/hli.h index 5b8024f..cd41c00 100644 --- a/xtoskrnl/includes/i686/hli.h +++ b/xtoskrnl/includes/i686/hli.h @@ -54,6 +54,11 @@ XTAPI VOID HlpInitializePic(VOID); +XTAPI +VOID +HlpSendIpi(ULONG ApicId, + ULONG Vector); + XTFASTCALL KRUNLEVEL HlpTransformApicTprToRunLevel(IN UCHAR Tpr);