feat: B7 APIC/IOAPIC接管 + NVMe写路径 + virtio_net virtqueue + PE兼容层修复 + QEMU测试套件全自动化

中断路由 (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进度列
This commit is contained in:
xyou
2026-08-04 18:08:08 +08:00
parent f52157b7af
commit a26866e339
70 changed files with 4652 additions and 504 deletions
+12 -5
View File
@@ -1846,8 +1846,9 @@ typedef struct { u32 type,flags; u64 offset,vaddr,paddr,filesz,memsz,align; } sh
typedef struct { i64 tag; u64 val; } sh_elf64_dyn;
typedef struct { u64 offset; u64 info; i64 addend; } sh_elf64_rela;
/* run 加载镜像缓冲(容纳工具 ELF 展开后的 memsz) */
static u8 g_run_image[262144];
/* run 加载镜像缓冲(容纳工具 ELF 展开后的 memsz;与 desktop 宿主 g_elf_image 对齐。
* editor.elf 文件 43KB 但 BSS NOBITS 内存镜像 ~496KB,256KB 上限曾导致 sh_load_elf -5。) */
static u8 g_run_image[1048576];
static int sh_load_elf(u8 *data, void **entry_out) {
const sh_elf64_ehdr *eh = (const sh_elf64_ehdr *)data;
@@ -3314,6 +3315,7 @@ void dsk_entry(const dsk_boot_context *ctx) {
/* 主循环 */
int shift = 0;
int e0 = 0;
int ctrl = 0; /* Ctrl 修饰键状态:0x1D 按下 / 0x9D 释放(右 Ctrl 为 E0 前缀同名扫描码) */
u64 blink_start = rdtsc_shell();
for (;;) {
draw_prompt();
@@ -3350,7 +3352,11 @@ void dsk_entry(const dsk_boot_context *ctx) {
if (sc == 0xE0) { e0 = 1; continue; }
if (sc == 0x2A || sc == 0x36) { shift = 1; continue; }
if (sc == 0xAA || sc == 0xB6) { shift = 0; continue; }
/* Ctrl 修饰键跟踪:左 Ctrl 按下 0x1D;右 Ctrl 为 E0 1D(e0 已置位,此处一并清除) */
if (sc == 0x1D) { ctrl = 1; e0 = 0; continue; }
if (sc & 0x80) {
/* 左 Ctrl 释放 0x9D;右 Ctrl 释放 E0 9D —— 两者 sc 均为 0x9D */
if (sc == 0x9D) { ctrl = 0; }
if (e0 && sc == 0x9C) { e0 = 0; }
else if (e0 && sc == 0xCB) { e0 = 0; }
else if (e0 && sc == 0xCD) { e0 = 0; }
@@ -3396,9 +3402,10 @@ void dsk_entry(const dsk_boot_context *ctx) {
if (sc == 0x0E) { delete_char_back(); continue; }
if (sc == 0x0F) { handle_tab_complete(); continue; }
if (sc == 0x01) { logl("[shell] esc -> return to DSK"); return; }
if (sc == 0x15 && !shift) { kill_line(); continue; }
if (sc == 0x17 && !shift) { while (input_cursor > 0) delete_char_back(); continue; }
if (sc == 0x0B && !shift) { kill_to_end(); continue; }
/* Ctrl 组合键:仅 Ctrl 按下时生效,普通键入 y/i/0 走下方 ASCII 插入(BUG-20260801-001) */
if (sc == 0x15 && ctrl) { kill_line(); continue; } /* Ctrl+U: 清空整行 */
if (sc == 0x17 && ctrl) { while (input_cursor > 0) delete_char_back(); continue; } /* Ctrl+W: 删至行首 */
if (sc == 0x0B && ctrl) { kill_to_end(); continue; } /* Ctrl+K: 删至行尾 */
char c = scan_to_ascii(sc, shift);
if (c && c >= 32 && c <= 126) {
insert_char(c);
BIN
View File
Binary file not shown.