My Project
Loading...
Searching...
No Matches
apic.c File Reference
#include "../../includes/me.h"
#include "../../includes/mh.h"
#include "../../includes/mm.h"
#include "../../includes/mg.h"
#include "../../assert.h"
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define IA32_APIC_BASE_MSR   0x1BULL
#define APIC_BASE_RESERVED   0xFFF0000000000000ULL
#define LAPIC_PAGE_SIZE   0x1000
#define LAPIC_MAP_FLAGS   (PAGE_PRESENT | PAGE_RW | PAGE_PCD)
#define APIC_LVT_TIMER_PERIODIC   (1U << 17)
#define APIC_TIMER_MASKED   (1U << 16)

Enumerations

enum  {
  LAPIC_VERSION = 0x030 , LAPIC_TPR = 0x080 , LAPIC_EOI = 0x0B0 , LAPIC_SVR = 0x0F0 ,
  LAPIC_ESR = 0x280 , LAPIC_ICR_LOW = 0x300 , LAPIC_ICR_HIGH = 0x310 , LAPIC_LVT_TIMER = 0x320 ,
  LAPIC_LVT_THERMAL = 0x330 , LAPIC_LVT_PCC = 0x340 , LAPIC_LVT_LINT0 = 0x350 , LAPIC_LVT_LINT1 = 0x360 ,
  LAPIC_LVT_ERROR = 0x370 , LAPIC_TIMER_INITCNT = 0x380 , LAPIC_TIMER_CURRCNT = 0x390 , LAPIC_TIMER_DIV = 0x3E0
}

Functions

uint32_t lapic_mmio_read (uint32_t off)
void lapic_mmio_write (uint32_t off, uint32_t val)
void lapic_init_siv (void)
void lapic_enable (void)
void lapic_init_cpu (void)
void lapic_send_ipi (uint8_t apic_id, uint8_t vector, uint32_t flags)
void lapic_eoi (void)
void lapic_timer_calibrate (void)
int init_lapic_timer (uint32_t hz)
void MhRequestSoftwareInterrupt (IN IRQL RequestIrql)

Macro Definition Documentation

◆ APIC_BASE_RESERVED

#define APIC_BASE_RESERVED   0xFFF0000000000000ULL

Definition at line 10 of file apic.c.

◆ APIC_LVT_TIMER_PERIODIC

#define APIC_LVT_TIMER_PERIODIC   (1U << 17)

Definition at line 149 of file apic.c.

◆ APIC_TIMER_MASKED

#define APIC_TIMER_MASKED   (1U << 16)

Definition at line 150 of file apic.c.

◆ IA32_APIC_BASE_MSR

#define IA32_APIC_BASE_MSR   0x1BULL

Definition at line 9 of file apic.c.

◆ LAPIC_MAP_FLAGS

#define LAPIC_MAP_FLAGS   (PAGE_PRESENT | PAGE_RW | PAGE_PCD)

Definition at line 13 of file apic.c.

◆ LAPIC_PAGE_SIZE

#define LAPIC_PAGE_SIZE   0x1000

Definition at line 12 of file apic.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
LAPIC_VERSION 
LAPIC_TPR 
LAPIC_EOI 
LAPIC_SVR 
LAPIC_ESR 
LAPIC_ICR_LOW 
LAPIC_ICR_HIGH 
LAPIC_LVT_TIMER 
LAPIC_LVT_THERMAL 
LAPIC_LVT_PCC 
LAPIC_LVT_LINT0 
LAPIC_LVT_LINT1 
LAPIC_LVT_ERROR 
LAPIC_TIMER_INITCNT 
LAPIC_TIMER_CURRCNT 
LAPIC_TIMER_DIV 

Definition at line 16 of file apic.c.

Function Documentation

◆ init_lapic_timer()

int init_lapic_timer ( uint32_t hz)

Definition at line 179 of file apic.c.

◆ lapic_enable()

void lapic_enable ( void )

Definition at line 98 of file apic.c.

◆ lapic_eoi()

void lapic_eoi ( void )

Definition at line 136 of file apic.c.

◆ lapic_init_cpu()

void lapic_init_cpu ( void )

Definition at line 113 of file apic.c.

◆ lapic_init_siv()

void lapic_init_siv ( void )

Definition at line 60 of file apic.c.

◆ lapic_mmio_read()

uint32_t lapic_mmio_read ( uint32_t off)

Definition at line 36 of file apic.c.

◆ lapic_mmio_write()

void lapic_mmio_write ( uint32_t off,
uint32_t val )

Definition at line 45 of file apic.c.

◆ lapic_send_ipi()

void lapic_send_ipi ( uint8_t apic_id,
uint8_t vector,
uint32_t flags )

Definition at line 129 of file apic.c.

◆ lapic_timer_calibrate()

void lapic_timer_calibrate ( void )

Definition at line 171 of file apic.c.

◆ MhRequestSoftwareInterrupt()

void MhRequestSoftwareInterrupt ( IN IRQL RequestIrql)

Definition at line 199 of file apic.c.