Use generic spin () instead of amd64_spin ()
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#include <sys/debug.h>
|
#include <sys/debug.h>
|
||||||
#include <sys/mm.h>
|
#include <sys/mm.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <sys/spin.h>
|
||||||
#include <uacpi/acpi.h>
|
#include <uacpi/acpi.h>
|
||||||
#include <uacpi/status.h>
|
#include <uacpi/status.h>
|
||||||
#include <uacpi/tables.h>
|
#include <uacpi/tables.h>
|
||||||
@@ -45,10 +46,6 @@ static size_t intr_src_override_entries = 0;
|
|||||||
/// Local APIC MMIO base address. It comes from MSR_APIC_BASE
|
/// Local APIC MMIO base address. It comes from MSR_APIC_BASE
|
||||||
static uintptr_t lapic_mmio_base = 0;
|
static uintptr_t lapic_mmio_base = 0;
|
||||||
|
|
||||||
/** @cond DOXYGEN_IGNORE */
|
|
||||||
extern void amd64_spin (void);
|
|
||||||
/** @endcond */
|
|
||||||
|
|
||||||
/// Read IOAPIC
|
/// Read IOAPIC
|
||||||
static uint32_t amd64_ioapic_read (uintptr_t vaddr, uint32_t reg) {
|
static uint32_t amd64_ioapic_read (uintptr_t vaddr, uint32_t reg) {
|
||||||
*(volatile uint32_t*)vaddr = reg;
|
*(volatile uint32_t*)vaddr = reg;
|
||||||
@@ -177,7 +174,7 @@ void amd64_ioapic_init (void) {
|
|||||||
uacpi_status status = uacpi_table_find_by_signature (ACPI_MADT_SIGNATURE, &apic_table);
|
uacpi_status status = uacpi_table_find_by_signature (ACPI_MADT_SIGNATURE, &apic_table);
|
||||||
if (status != UACPI_STATUS_OK) {
|
if (status != UACPI_STATUS_OK) {
|
||||||
DEBUG ("Could not find MADT table!\n");
|
DEBUG ("Could not find MADT table!\n");
|
||||||
amd64_spin ();
|
spin ();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct acpi_madt* apic = (struct acpi_madt*)apic_table.virt_addr;
|
struct acpi_madt* apic = (struct acpi_madt*)apic_table.virt_addr;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <sync/spin_lock.h>
|
#include <sync/spin_lock.h>
|
||||||
#include <sys/debug.h>
|
#include <sys/debug.h>
|
||||||
#include <sys/mm.h>
|
#include <sys/mm.h>
|
||||||
|
#include <sys/spin.h>
|
||||||
#include <uacpi/acpi.h>
|
#include <uacpi/acpi.h>
|
||||||
#include <uacpi/status.h>
|
#include <uacpi/status.h>
|
||||||
#include <uacpi/tables.h>
|
#include <uacpi/tables.h>
|
||||||
@@ -32,10 +33,6 @@ static uint64_t hpet_clock_nano;
|
|||||||
/// Lock, which protects concurrent access. See \ref amd64/smp.c
|
/// Lock, which protects concurrent access. See \ref amd64/smp.c
|
||||||
static spin_lock_t hpet_lock = SPIN_LOCK_INIT;
|
static spin_lock_t hpet_lock = SPIN_LOCK_INIT;
|
||||||
|
|
||||||
/** @cond DOXYGEN_IGNORE */
|
|
||||||
extern void amd64_spin (void);
|
|
||||||
/** @endcond */
|
|
||||||
|
|
||||||
/// Read a HPET register. Assumes caller holds \ref hpet_lock
|
/// Read a HPET register. Assumes caller holds \ref hpet_lock
|
||||||
static uint64_t amd64_hpet_read (uint32_t reg) {
|
static uint64_t amd64_hpet_read (uint32_t reg) {
|
||||||
struct limine_hhdm_response* hhdm = limine_hhdm_request.response;
|
struct limine_hhdm_response* hhdm = limine_hhdm_request.response;
|
||||||
@@ -93,7 +90,7 @@ void amd64_hpet_init (void) {
|
|||||||
uacpi_status status = uacpi_table_find_by_signature (ACPI_HPET_SIGNATURE, &hpet_table);
|
uacpi_status status = uacpi_table_find_by_signature (ACPI_HPET_SIGNATURE, &hpet_table);
|
||||||
if (status != UACPI_STATUS_OK) {
|
if (status != UACPI_STATUS_OK) {
|
||||||
DEBUG ("Could not find HPET table!\n");
|
DEBUG ("Could not find HPET table!\n");
|
||||||
amd64_spin ();
|
spin ();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct acpi_hpet* hpet = (struct acpi_hpet*)hpet_table.virt_addr;
|
struct acpi_hpet* hpet = (struct acpi_hpet*)hpet_table.virt_addr;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <sys/debug.h>
|
#include <sys/debug.h>
|
||||||
#include <sys/irq.h>
|
#include <sys/irq.h>
|
||||||
#include <sys/smp.h>
|
#include <sys/smp.h>
|
||||||
|
#include <sys/spin.h>
|
||||||
|
|
||||||
/* 8259 PIC defs. */
|
/* 8259 PIC defs. */
|
||||||
#define PIC1 0x20
|
#define PIC1 0x20
|
||||||
@@ -58,10 +59,6 @@ ALIGNED (16) static volatile struct idt_entry idt_entries[IDT_ENTRIES_MAX];
|
|||||||
/** @endcond */
|
/** @endcond */
|
||||||
static volatile struct idt idt;
|
static volatile struct idt idt;
|
||||||
|
|
||||||
/** @cond DOXYGEN_IGNORE */
|
|
||||||
extern void amd64_spin (void);
|
|
||||||
/** @endcond */
|
|
||||||
|
|
||||||
/// Remaps and disables old 8259 PIC, since we'll be using APIC.
|
/// Remaps and disables old 8259 PIC, since we'll be using APIC.
|
||||||
static void amd64_init_pic (void) {
|
static void amd64_init_pic (void) {
|
||||||
/** @cond DOXYGEN_IGNORE */
|
/** @cond DOXYGEN_IGNORE */
|
||||||
@@ -169,7 +166,7 @@ static void amd64_intr_exception (struct saved_regs* regs) {
|
|||||||
if (regs->cs == (0x18 | 0x03)) {
|
if (regs->cs == (0x18 | 0x03)) {
|
||||||
proc_kill (thiscpu->proc_current);
|
proc_kill (thiscpu->proc_current);
|
||||||
} else {
|
} else {
|
||||||
amd64_spin ();
|
spin ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user