feat: FS-E strict filesystem mode - ext4 rw driver, FAT32 big-disk fix, forced re-login

- CODE/dsk/ext4.c: minimal full ext4 read/write (GPT probe, feature gate,
  extent depth 0/1 rw, block/inode alloc-free, dir insert, write-verify);
  boot selftest PASS on p2. Unsupported features panic (FS-E2x), zero fallback.
- DSK fat32 write: on-demand FAT entry RMW + chunked free-cluster scan
  (fixes "no free clusters" on 5.3G ESP); rec_len shrink offset (+4) and
  chunk alignment fixes. USER.CONF write-verify ok, firstInit flip ok.
- First-boot: wizard -> persist -> forced login (FS-E06 if skipped/failed)
  -> desktop. login.elf loaded via system/user/use fallback.
- FirstInit network page: Connect now panics NET-E01 (no wlan stack);
  Save (config only) is the only path forward.
- FirstInit/DSK fatal: ohMyLogo lotus fatal screen (NET-E01 / FS-E series).
- Boot screen: Logo.png image removed, "DESHAB P01" text centered only;
  dcp/xj logos regenerated from TEXTURES/.
- run_qemu.bat: main GPT image on SATA ide.0 (AHCI provider must see ext4).
This commit is contained in:
Linehu
2026-10-02 23:49:05 +08:00
parent c4a5295a81
commit 38ff3cf93c
28 changed files with 2816 additions and 1458 deletions
+50 -1
View File
@@ -3,6 +3,9 @@
#include <utsm/idt.h>
#include <utsm/net.h>
#include <utsm/mm.h>
#include <utsm/dma.h>
#include <utsm/drr.h>
#include <utsm/utrw.h>
#include <utsm/panic.h>
static void dkm_api_info(const char *msg) {
@@ -81,13 +84,57 @@ static dkm_kernel_api g_kernel_api = {
.mm_map_mmio = 0,
.mm_unmap_mmio = 0,
.register_apic_eoi = 0,
.sched = 0
.sched = 0,
.kapi = 0
};
const dkm_kernel_api *dkm_get_kernel_api(void) {
return &g_kernel_api;
}
/* ===================================================================
* D3: 按名导出表(kapi)——自由也要有地图
* =================================================================== */
static const dkm_kapi_entry g_kapi_entries[] = {
{ "log.info", (void *)dkm_api_info },
{ "log.warn", (void *)dkm_api_warn },
{ "log.error", (void *)dkm_api_error },
{ "log.panic", (void *)dkm_api_panic },
{ "dma.alloc_pages", (void *)dma_alloc_pages },
{ "irq.register", (void *)irq_register },
{ "irq.vector_alloc", (void *)irq_vector_alloc },
{ "irq.vector_free", (void *)irq_vector_free },
{ "mm.map_mmio", (void *)mm_map_mmio },
{ "mm.unmap_mmio", (void *)mm_unmap_mmio },
{ "apic.register_eoi", (void *)idt_register_apic_eoi },
{ "drr.snapshot_dirty", (void *)drr_ckpt_snapshot_dirty },
{ "drr.rollback_pages", (void *)drr_rollback_pages },
{ "utrw.debug_dump", (void *)utrw_debug_dump_page },
};
static int kapi_lookup(const char *name, void **out_fn) {
if (!name) return -1;
for (u32 i = 0; i < sizeof(g_kapi_entries) / sizeof(g_kapi_entries[0]); i++) {
const dkm_kapi_entry *e = &g_kapi_entries[i];
const char *a = e->name, *b = name;
while (*a && *a == *b) { a++; b++; }
if (*a == 0 && *b == 0) {
if (out_fn) *out_fn = e->fn;
return 0;
}
}
return -1;
}
static const dkm_kapi_table g_kapi_table = {
.magic = DKM_KAPI_MAGIC,
.version = DKM_KAPI_VERSION,
.count = sizeof(g_kapi_entries) / sizeof(g_kapi_entries[0]),
.entries = g_kapi_entries,
.lookup = kapi_lookup,
};
#include "../arch/x86_64/limine.h"
extern volatile struct limine_rsdp_request g_rsdp_request;
extern volatile struct limine_framebuffer_request g_fb_request;
@@ -127,4 +174,6 @@ void dkm_fill_platform_info(void) {
/* B7 阶段3: 暴露动态向量分配器(MSI/MSI-X 设备驱动使用) */
g_kernel_api.irq_vector_alloc = irq_vector_alloc;
g_kernel_api.irq_vector_free = irq_vector_free;
/* D3: 按名导出表挂入 kernel_api(尾部追加,ABI 兼容) */
g_kernel_api.kapi = &g_kapi_table;
}
+8 -1
View File
@@ -1,7 +1,9 @@
dkm/kernel_api.o: dkm\kernel_api.c include\utsm\dkm.h \
include\utsm\types.h include\utsm\dma.h include\utsm\block.h \
include\utsm\net.h include\utsm\paging.h include\utsm\log.h \
include\utsm\idt.h include\utsm\mm.h include\utsm\panic.h \
include\utsm\idt.h include\utsm\mm.h include\utsm\drr.h \
include\utsm\config.h include\utsm\utrw.h include\utsm\status.h \
include\utsm\capability.h include\utsm\panic.h \
dkm\..\arch\x86_64\limine.h
include\utsm\dkm.h:
include\utsm\types.h:
@@ -12,5 +14,10 @@ include\utsm\paging.h:
include\utsm\log.h:
include\utsm\idt.h:
include\utsm\mm.h:
include\utsm\drr.h:
include\utsm\config.h:
include\utsm\utrw.h:
include\utsm\status.h:
include\utsm\capability.h:
include\utsm\panic.h:
dkm\..\arch\x86_64\limine.h:
Binary file not shown.
+28
View File
@@ -33,6 +33,30 @@
struct dkm_kernel_api;
struct dkm_driver_handle;
/* ===================================================================
* D3: 内核 API 按名导出表(kapi)
*
* "自由也要有地图。" 固定偏移 struct ABI 之外的按名查找层:
* 驱动/用户态可枚举内核服务并按名取函数指针。
* 通过 kernel_api 尾部追加的 ->kapi 指针访问(ABI 兼容)。
* =================================================================== */
typedef struct {
const char *name; /* 如 "log.info"、"dma.alloc_pages" */
void *fn; /* 服务函数指针(签名见对应服务头) */
} dkm_kapi_entry;
typedef struct {
u32 magic; /* DKM_KAPI_MAGIC */
u32 version; /* DKM_KAPI_VERSION */
u32 count; /* entries 数量 */
const dkm_kapi_entry *entries;
/* 按名查找:命中返回 0 并写 out_fn;未命中 -1 */
int (*lookup)(const char *name, void **out_fn);
} dkm_kapi_table;
#define DKM_KAPI_MAGIC 0x4b415049u /* "KAPI" */
#define DKM_KAPI_VERSION 1u
typedef struct dkm_driver_desc {
u32 magic;
u16 abi_version;
@@ -133,6 +157,9 @@ typedef struct dkm_kernel_api {
* 驱动可用:task_create/uptime/sleep/current_task_slot。
* DSK 以 api+0xA8 硬偏移读 block 的约定不受影响(仅尾部追加)。 */
const utsm_sched_api *sched;
/* D3: 按名导出表(尾部追加,ABI 兼容)。驱动/用户态枚举内核服务并
* 按名取函数指针;固定偏移 struct 字段不受影响。 */
const dkm_kapi_table *kapi;
} dkm_kernel_api;
typedef enum dkm_driver_state {
@@ -160,6 +187,7 @@ typedef struct dkm_builtin_driver {
void dkm_init(void);
/* D4: 设置当前驱动日志颜色上下文(driver_init 前设置,返回后清 0) */
void dkm_log_set_driver(const char *name);
int dkm_load_builtin(const dkm_builtin_driver *driver);
void dkm_scan_boot_modules(void);
void dsm_load_by_manifest(void);
+8 -7
View File
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
"""Generate panic_logo_data.inc from ohMyLogo.png (root).
#!/usr/bin/env python3
"""Generate RGBA8888 C array from a PNG (panic screen / login intro logo).
- Downscale logo to 384px wide (keep aspect), RGBA8888
- Sample the 4 corners (averaged) as the panic-screen background color
Usage: python gen_panic_logo.py <ohMyLogo.png> <panic_logo_data.inc>
- Downscale logo to target width (keep aspect), RGBA8888
- Sample the 4 corners (averaged) as background color
Usage: python gen_panic_logo.py <src.png> <out.c> [target_width]
"""
import sys
from PIL import Image
@@ -16,10 +16,11 @@ TARGET_W = 384
def main() -> None:
src = sys.argv[1] if len(sys.argv) > 1 else SRC
dst = sys.argv[2] if len(sys.argv) > 2 else DST
target_w = int(sys.argv[3]) if len(sys.argv) > 3 else TARGET_W
im = Image.open(src).convert("RGBA")
w0, h0 = im.size
scale = TARGET_W / w0
w, h = TARGET_W, max(1, round(h0 * scale))
scale = target_w / w0
w, h = target_w, max(1, round(h0 * scale))
im = im.resize((w, h), Image.LANCZOS)
px = im.load()
+34
View File
@@ -1,6 +1,8 @@
#include <utsm/utsm.h>
#include <utsm/pckc.h>
#include <utsm/crypto.h>
#include <utsm/dma.h>
#include <utsm/dkm.h>
#include <utsm/log.h>
#include <utsm/segment.h>
#include <utsm/arena.h>
@@ -190,6 +192,38 @@ int utsm_selftest_run(void) {
log_info("[UTSM] selftest unsealed segment ok (plain storage)");
}
/* ==== D3: 按名导出表(kapi)——按名取服务并调用 ==== */
{
const dkm_kernel_api *api = dkm_get_kernel_api();
if (!api->kapi || api->kapi->magic != DKM_KAPI_MAGIC) {
log_error("[UTSM] selftest kapi table missing");
return UTSM_ERR_INVALID;
}
void *fn = 0;
if (api->kapi->lookup("log.info", &fn) != 0) {
log_error("[UTSM] selftest kapi lookup log.info failed");
return UTSM_ERR_INVALID;
}
void (*klog)(const char *) = (void (*)(const char *))fn;
klog("[UTSM] selftest kapi: log.info via export table");
if (api->kapi->lookup("dma.alloc_pages", &fn) != 0) {
log_error("[UTSM] selftest kapi lookup dma failed");
return UTSM_ERR_INVALID;
}
int (*kalloc)(u64, u64, u64, dkm_dma_buffer *) = (int (*)(u64, u64, u64, dkm_dma_buffer *))fn;
dkm_dma_buffer kbuf;
if (kalloc(1, 4096, 0xFFFFFFFFULL, &kbuf) != 0 || !kbuf.virt) {
log_error("[UTSM] selftest kapi dma alloc failed");
return UTSM_ERR_INVALID;
}
if (api->kapi->lookup("no.such.service", &fn) == 0) {
log_error("[UTSM] selftest kapi negative lookup failed");
return UTSM_ERR_INVALID;
}
log_hex64("[UTSM] selftest kapi entries=", api->kapi->count);
log_info("[UTSM] selftest kapi ok");
}
/* ==== SCHED-1: O(1) runqueue 语义(合成 TCB,协作式,无 tick) ==== */
/* ==== SCHED-1 + SCHED-2: runqueue / block-wake(tick 竞态保护) ==== */
{
+9 -3
View File
@@ -4,9 +4,10 @@ test/utsm_selftest.o: test\utsm_selftest.c include\utsm\utsm.h \
include\utsm\segment.h include\utsm\dirty.h include\utsm\utrw.h \
include\utsm\vmm.h include\utsm\linux_loader.h include\utsm\ipc_shm.h \
..\utsm-ipc\ipc_proto.h include\utsm\hypercall.h include\utsm\pckc.h \
include\utsm\crypto.h include\utsm\log.h include\utsm\arena.h \
include\utsm\drr.h include\utsm\sched_ext.h include\utsm\sched.h \
test\chacha_kat.inc
include\utsm\crypto.h include\utsm\dma.h include\utsm\dkm.h \
include\utsm\block.h include\utsm\net.h include\utsm\paging.h \
include\utsm\log.h include\utsm\arena.h include\utsm\drr.h \
include\utsm\sched_ext.h include\utsm\sched.h test\chacha_kat.inc
include\utsm\utsm.h:
include\utsm\types.h:
include\utsm\status.h:
@@ -24,6 +25,11 @@ include\utsm\ipc_shm.h:
include\utsm\hypercall.h:
include\utsm\pckc.h:
include\utsm\crypto.h:
include\utsm\dma.h:
include\utsm\dkm.h:
include\utsm\block.h:
include\utsm\net.h:
include\utsm\paging.h:
include\utsm\log.h:
include\utsm\arena.h:
include\utsm\drr.h:
Binary file not shown.