From 8bf4da2afaf18e8eb51fc9e7e4274dec43730a3c Mon Sep 17 00:00:00 2001 From: fslongjin Date: Fri, 8 Apr 2022 00:18:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BA=86=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/driver/interrupt/apic/apic.c | 16 ++++++++-------- kernel/main.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/kernel/driver/interrupt/apic/apic.c b/kernel/driver/interrupt/apic/apic.c index 7427d171..a81bef32 100644 --- a/kernel/driver/interrupt/apic/apic.c +++ b/kernel/driver/interrupt/apic/apic.c @@ -27,8 +27,8 @@ void apic_io_apic_init() acpi_iter_SDT(acpi_get_MADT, &madt_addr); madt = (struct acpi_Multiple_APIC_Description_Table_t *)madt_addr; - kdebug("MADT->local intr controller addr=%#018lx", madt->Local_Interrupt_Controller_Address); - kdebug("MADT->length= %d bytes", madt->header.Length); + //kdebug("MADT->local intr controller addr=%#018lx", madt->Local_Interrupt_Controller_Address); + //kdebug("MADT->length= %d bytes", madt->header.Length); // 寻找io apic的ICS void *ent = (void *)(madt_addr) + sizeof(struct acpi_Multiple_APIC_Description_Table_t); struct apic_Interrupt_Controller_Structure_header_t *header = (struct apic_Interrupt_Controller_Structure_header_t *)ent; @@ -38,21 +38,21 @@ void apic_io_apic_init() if (header->type == 1) { struct acpi_IO_APIC_Structure_t *t = (struct acpi_IO_APIC_Structure_t *)ent; - kdebug("IO apic addr = %#018lx", t->IO_APIC_Address); + // kdebug("IO apic addr = %#018lx", t->IO_APIC_Address); io_apic_ICS = t; break; } ent += header->length; } - kdebug("Global_System_Interrupt_Base=%d", io_apic_ICS->Global_System_Interrupt_Base); + // kdebug("Global_System_Interrupt_Base=%d", io_apic_ICS->Global_System_Interrupt_Base); apic_ioapic_map.addr_phys = io_apic_ICS->IO_APIC_Address; apic_ioapic_map.virtual_index_addr = (unsigned char *)APIC_IO_APIC_VIRT_BASE_ADDR; apic_ioapic_map.virtual_data_addr = (uint *)(APIC_IO_APIC_VIRT_BASE_ADDR + 0x10); apic_ioapic_map.virtual_EOI_addr = (uint *)(APIC_IO_APIC_VIRT_BASE_ADDR + 0x40); - kdebug("(ul)apic_ioapic_map.virtual_index_addr=%#018lx", (ul)apic_ioapic_map.virtual_index_addr); + // kdebug("(ul)apic_ioapic_map.virtual_index_addr=%#018lx", (ul)apic_ioapic_map.virtual_index_addr); // 填写页表,完成地址映射 mm_map_phys_addr((ul)apic_ioapic_map.virtual_index_addr, apic_ioapic_map.addr_phys, PAGE_2M_SIZE, PAGE_KERNEL_PAGE | PAGE_PWT | PAGE_PCD); @@ -62,7 +62,7 @@ void apic_io_apic_init() *apic_ioapic_map.virtual_data_addr = 0x0f000000; io_mfence(); - kdebug("I/O APIC ID:%#010x", ((*apic_ioapic_map.virtual_data_addr) >> 24) & 0xff); + // kdebug("I/O APIC ID:%#010x", ((*apic_ioapic_map.virtual_data_addr) >> 24) & 0xff); io_mfence(); // 获取IO APIC Version @@ -180,8 +180,8 @@ void apic_init_ap_core_local_apic() io_mfence(); kdebug("cmci = %#018lx", *(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_CMCI)); */ - *(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_TIMER) = 0x10000; - io_mfence(); + //*(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_TIMER) = 0x10000; + //io_mfence(); /* *(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_THERMAL) = 0x1000000; io_mfence(); diff --git a/kernel/main.c b/kernel/main.c index 8deb094c..4765ca1f 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -22,6 +22,7 @@ #include "driver/disk/ata.h" #include "driver/pci/pci.h" #include "driver/disk/ahci/ahci.h" +#include unsigned int *FR_address = (unsigned int *)0xb8000; //帧缓存区的地址 @@ -165,7 +166,8 @@ void system_initialize() acpi_init(); // 初始化中断模块 irq_init(); - + + smp_init(); // 先初始化系统调用模块 @@ -226,7 +228,11 @@ void Start_Kernel(void) } */ - ipi_send_IPI(DEST_PHYSICAL, IDLE, ICR_LEVEL_DE_ASSERT, EDGE_TRIGGER, 0xc8, ICR_APIC_FIXED, ICR_No_Shorthand, true, 1); // 测试ipi + // ipi_send_IPI(DEST_PHYSICAL, IDLE, ICR_LEVEL_DE_ASSERT, EDGE_TRIGGER, 0xc8, ICR_APIC_FIXED, ICR_No_Shorthand, true, 1); // 测试ipi + struct time tt; + rtc_get_cmos_time(&tt); + kinfo("Current Time: %04d/%02d/%02d %02d:%02d:%02d", tt.year, tt.month, tt.day, tt.hour, tt.minute, tt.second); + while (1) hlt(); }