中断路由 (B7): - apic.drv: LAPIC enable + IOAPIC重定向表编程(MADT ISO感知) + apic_route/apic_route_legacy/apic_diag开关 - UTSM: LAPIC EOI钩子(register_apic_eoi, ABI尾部追加) + IDT 0-255全覆盖 + spurious 0xFF特判 - FUCK: apic_route=0默认PIC(零回归) / =1 IOAPIC->LAPIC接管(失败完整降级) / legacy放开IRQ1/12/11 存储: - nvme.drv: 写路径 + PRP list + 读回校验 + MSI/MSI-X中断驱动(nvme_msi开关, 回退纯轮询) - build.ps1: apic.drv纳入构建(原为预置二进制) 网络: - virtio_net: virtqueue RX/TX + netdev注册 + DHCP自测(slirp真实OFFER) PE兼容层: - pe_shim: guest->host指针转换(g_emu_mem_base + gp()) + shim fn32列补齐 - gen_pe.py: PE32+ RVA偏置修复(BUG-004) + cmd.exe生成 - desktop_app.h: da_mouse_poll先判AUX位 + da_mouse_init冲刷残留(BUG-003/008) - shell: Ctrl修饰键跟踪(BUG-001) + g_run_image扩至1MB(BUG-002) QEMU测试套件: - 9用例全自动化(Run-All.ps1): boot-regression/driver-matrix/linux-compat/pe-compat/deaicup-e2e/userapps-matrix/network-e2e/performance-baseline/x86emu32-coverage - QemuTest.ps1公共库: 串口断言/monitor sendkey/screendump/HTTP服务器/并发隔离 文档: - CLAUDE.md: APIC/IOAPIC能力 + kernel_api暴露 + IRQ后端升级状态 - LESSONS_LEARNED.md: B7 LAPIC/IOAPIC经验教训(2条) - Bug记录.txt: BUG-20260801-001~008 + BUG-20260803-009(9条) - test-cases/*.md: 全部补充自动化脚本小节 - 桌面设计.md: .lnk快捷方式 + LINUXAPP.CNF Linux应用图标 - 系统开发策划.md: NVMe/virtio_net标完成 + B2/B7标已解决 + M2进度列
104 lines
2.9 KiB
C
104 lines
2.9 KiB
C
#include <utsm/dkm.h>
|
|
#include <utsm/log.h>
|
|
#include <utsm/idt.h>
|
|
#include <utsm/net.h>
|
|
#include <utsm/mm.h>
|
|
|
|
static void dkm_api_info(const char *msg) {
|
|
log_info(msg);
|
|
}
|
|
|
|
static void dkm_api_warn(const char *msg) {
|
|
log_warn(msg);
|
|
}
|
|
|
|
static void dkm_api_error(const char *msg) {
|
|
log_error(msg);
|
|
}
|
|
|
|
static void dkm_api_panic(const char *msg) {
|
|
log_error(msg);
|
|
for (;;) {
|
|
__asm__ volatile("cli; hlt");
|
|
}
|
|
}
|
|
|
|
static const dkm_log_api g_log_api = {
|
|
.info = dkm_api_info,
|
|
.warn = dkm_api_warn,
|
|
.error = dkm_api_error,
|
|
.panic = dkm_api_panic
|
|
};
|
|
|
|
static dkm_kernel_api g_kernel_api = {
|
|
.version = DKM_KERNEL_API_VERSION,
|
|
.size = sizeof(dkm_kernel_api),
|
|
.feature_bits = 0,
|
|
.log = &g_log_api,
|
|
.mem = 0,
|
|
.utsm = 0,
|
|
.irq = 0,
|
|
.pci = 0,
|
|
.dma = 0,
|
|
.vfs = 0,
|
|
.net = 0,
|
|
.timer = 0,
|
|
.drr = 0,
|
|
.rsdp_address = 0,
|
|
.fb_address = 0,
|
|
.fb_width = 0,
|
|
.fb_height = 0,
|
|
.fb_pitch = 0,
|
|
.fb_bpp = 0,
|
|
.boot_modules_response = 0,
|
|
.irq_register = 0,
|
|
.hhdm_offset = 0,
|
|
.block = 0,
|
|
.mmio = 0,
|
|
.mm_map_mmio = 0,
|
|
.mm_unmap_mmio = 0,
|
|
.register_apic_eoi = 0
|
|
};
|
|
|
|
const dkm_kernel_api *dkm_get_kernel_api(void) {
|
|
return &g_kernel_api;
|
|
}
|
|
|
|
#include "../arch/x86_64/limine.h"
|
|
extern volatile struct limine_rsdp_request g_rsdp_request;
|
|
extern volatile struct limine_framebuffer_request g_fb_request;
|
|
extern volatile struct limine_module_request g_module_request;
|
|
extern volatile struct limine_hhdm_request g_hhdm_request;
|
|
|
|
void dkm_fill_platform_info(void) {
|
|
g_kernel_api.dma = dma_get_api();
|
|
g_kernel_api.net = net_get_api();
|
|
g_kernel_api.block = block_get_api();
|
|
g_kernel_api.mmio = paging_get_api();
|
|
if (g_rsdp_request.response && g_rsdp_request.response->address) {
|
|
g_kernel_api.rsdp_address = g_rsdp_request.response->address;
|
|
}
|
|
if (g_fb_request.response && g_fb_request.response->framebuffer_count > 0) {
|
|
struct limine_framebuffer *fb = g_fb_request.response->framebuffers[0];
|
|
g_kernel_api.fb_address = fb->address;
|
|
g_kernel_api.fb_width = fb->width;
|
|
g_kernel_api.fb_height = fb->height;
|
|
g_kernel_api.fb_pitch = fb->pitch;
|
|
g_kernel_api.fb_bpp = fb->bpp;
|
|
}
|
|
if (g_module_request.response) {
|
|
g_kernel_api.boot_modules_response = g_module_request.response;
|
|
}
|
|
g_kernel_api.irq_register = (int (*)(u8,void*))((u64)irq_register);
|
|
if (g_hhdm_request.response) {
|
|
g_kernel_api.hhdm_offset = g_hhdm_request.response->offset;
|
|
}
|
|
g_kernel_api.mm_map_mmio = mm_map_mmio;
|
|
g_kernel_api.mm_unmap_mmio = mm_unmap_mmio;
|
|
/* B7 阶段2: 暴露 LAPIC EOI 钩子注册入口(apic.drv LAPIC 接管时调用) */
|
|
g_kernel_api.register_apic_eoi = idt_register_apic_eoi;
|
|
/* B7 阶段3: 暴露动态向量分配器(MSI/MSI-X 设备驱动使用) */
|
|
g_kernel_api.irq_vector_alloc = irq_vector_alloc;
|
|
g_kernel_api.irq_vector_free = irq_vector_free;
|
|
}
|