CS350 COS
COS
|
#include <stdbool.h>
#include <stdint.h>
#include <sys/kassert.h>
#include <sys/kdebug.h>
#include <machine/amd64.h>
#include <machine/amd64op.h>
#include <machine/pmap.h>
#include <machine/trap.h>
Go to the source code of this file.
Macros | |
#define | CPUID_FLAG_APIC 0x100 |
#define | IA32_APIC_BASE_MSR 0x1B |
#define | IA32_APIC_BASE_MSR_BSP 0x100 |
#define | IA32_APIC_BASE_MSR_ENABLE 0x800 |
#define | LAPIC_ID 0x0020 /* CPU ID */ |
#define | LAPIC_VERSION 0x0030 /* Version */ |
#define | LAPIC_VERSION_LVTMASK 0x00FF0000 |
#define | LAPIC_VERSION_LVTSHIFT 0x10 |
#define | LAPIC_TPR 0x0080 /* Task Priority Register */ |
#define | LAPIC_EOI 0x00B0 /* End of Interrupt */ |
#define | LAPIC_SIV 0x00F0 /* Spurious Interrupt Vector */ |
#define | LAPIC_SIV_ENABLE 0x100 |
#define | LAPIC_ESR 0x0280 /* Error Status Register */ |
#define | LAPIC_LVT_CMCI 0x02F0 /* LVT CMCI */ |
#define | LAPIC_ICR_LO 0x0300 /* Interrupt Command Register */ |
#define | LAPIC_ICR_HI 0x0310 /* Interrupt Command Register */ |
#define | LAPIC_ICR_FIXED 0x0000 /* Delivery Mode */ |
#define | LAPIC_ICR_NMI 0x0400 |
#define | LAPIC_ICR_INIT 0x0500 |
#define | LAPIC_ICR_STARTUP 0x0600 |
#define | LAPIC_ICR_ASSERT 0x4000 |
#define | LAPIC_ICR_TRIG 0x8000 |
#define | LAPIC_ICR_SELF 0x00080000 /* Destination */ |
#define | LAPIC_ICR_INCSELF 0x00080000 |
#define | LAPIC_ICR_EXCSELF 0x000C0000 |
#define | LAPIC_ICR_DELIVERY_PENDING 0x1000 /* Delivery Pending */ |
#define | LAPIC_LVT_TIMER 0x0320 /* LVT Timer */ |
#define | LAPIC_LVT_TIMER_ONESHOT 0x00000000 |
#define | LAPIC_LVT_TIMER_PERIODIC 0x00020000 |
#define | LAPIC_LVT_TIMER_TSCDEADLINE 0x00040000 |
#define | LAPIC_LVT_THERMAL 0x0330 /* LVT Thermal Sensor */ |
#define | LAPIC_LVT_PMCR 0x0340 /* LVT Performance Monitoring Counter */ |
#define | LAPIC_LVT_LINT0 0x0350 /* LVT LINT0 */ |
#define | LAPIC_LVT_LINT1 0x0360 /* LVT LINT1 */ |
#define | LAPIC_LVT_ERROR 0x0370 /* LVT Error */ |
#define | LAPIC_LVT_FLAG_MASKED 0x00010000 /* Masked */ |
#define | LAPIC_LVT_FLAG_NMI 0x00000400 /* NMI */ |
#define | LAPIC_LVT_FLAG_EXTINT 0x00000700 /* ExtINT */ |
#define | LAPIC_TICR 0x0380 /* Timer Initial Count Register */ |
#define | LAPIC_TCCR 0x0390 /* Timer Currnet Count Register */ |
#define | LAPIC_TDCR 0x03E0 /* Time Divide Configuration Register */ |
#define | LAPIC_TDCR_X1 0x000B /* Divide counts by 1 */ |
Functions | |
static uint32_t * | LAPIC_GetBase () |
uint32_t | LAPIC_Read (uint16_t reg) |
void | LAPIC_Write (uint16_t reg, uint32_t val) |
uint32_t | LAPIC_CPU () |
void | LAPIC_SendEOI () |
void | LAPIC_Periodic (uint64_t rate) |
void | LAPIC_StartAP (uint8_t apicid, uint32_t addr) |
int | LAPIC_Broadcast (int vector) |
int | LAPIC_BroadcastNMI (int vector) |
void | LAPIC_Init () |
static void | Debug_LAPIC (int argc, const char *argv[]) |
REGISTER_DBGCMD (lapic, "LAPIC Status", Debug_LAPIC) | |
Variables | |
bool | lapicInitialized = false |
#define LAPIC_ICR_DELIVERY_PENDING 0x1000 /* Delivery Pending */ |
#define LAPIC_LVT_PMCR 0x0340 /* LVT Performance Monitoring Counter */ |
#define LAPIC_TDCR 0x03E0 /* Time Divide Configuration Register */ |
|
static |
int LAPIC_Broadcast | ( | int | vector | ) |
int LAPIC_BroadcastNMI | ( | int | vector | ) |
uint32_t LAPIC_CPU | ( | ) |
|
static |
void LAPIC_Init | ( | ) |
Definition at line 179 of file lapic.c.
void LAPIC_Periodic | ( | uint64_t | rate | ) |
void LAPIC_SendEOI | ( | ) |
Definition at line 116 of file lapic.c.
REGISTER_DBGCMD | ( | lapic | , |
"LAPIC Status" | , | ||
Debug_LAPIC | |||
) |