Record networking and DMA development progress
Add the current OS source tree, build scripts, system image layout, and development notes covering DMA page allocation, e1000 bring-up, net API dispatch, and DHCP work in progress.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
CC := clang
|
||||
LD := ld.lld
|
||||
|
||||
ROOT := ../..
|
||||
OUT := $(ROOT)/SYSTEM/system/deshab64/mouse/mouseInit.elf
|
||||
|
||||
CFLAGS := -target x86_64-unknown-none -std=c11 -ffreestanding -fno-builtin -fno-stack-protector -fpie -mno-red-zone -mno-sse -mno-sse2 -mno-mmx -msoft-float -m64 -Wall -Wextra -I../UTSM/include -O2
|
||||
LDFLAGS := -nostdlib -static -pie -z max-page-size=0x1000 -T linker.ld
|
||||
|
||||
C_SOURCES := main.c
|
||||
OBJECTS := $(C_SOURCES:.c=.o)
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(OUT)
|
||||
|
||||
$(OUT): $(OBJECTS) linker.ld
|
||||
@if not exist "$(ROOT)\SYSTEM\system\deshab64\mouse" mkdir "$(ROOT)\SYSTEM\system\deshab64\mouse"
|
||||
$(LD) $(LDFLAGS) -o $@ $(OBJECTS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
powershell -NoProfile -Command "Get-ChildItem -Path . -Recurse -Filter *.o | Remove-Item -Force; if (Test-Path '$(OUT)') { Remove-Item '$(OUT)' -Force }"
|
||||
@@ -0,0 +1,16 @@
|
||||
ENTRY(dsk_entry)
|
||||
|
||||
PHDRS
|
||||
{
|
||||
text PT_LOAD FLAGS(5);
|
||||
rodata PT_LOAD FLAGS(4);
|
||||
data PT_LOAD FLAGS(6);
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x1000;
|
||||
.text : ALIGN(4K) { *(.text*) } :text
|
||||
.rodata : ALIGN(4K) { *(.rodata*) } :rodata
|
||||
.data : ALIGN(4K) { *(.data*) *(COMMON) *(.bss*) } :data
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/* mouseInit — safe mouse initializer stub
|
||||
* DSK-owned system component initializer.
|
||||
* Current version must never block or crash first boot.
|
||||
*/
|
||||
|
||||
#include "../UTSM/include/utsm/dsk.h"
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
|
||||
#define COM1 0x3F8
|
||||
#define PS2_STATUS 0x64
|
||||
|
||||
static inline void outb(u16 port, u8 value) { __asm__ volatile("outb %0,%1"::"a"(value),"Nd"(port)); }
|
||||
static inline u8 inb(u16 port) { u8 v; __asm__ volatile("inb %1,%0":"=a"(v):"Nd"(port)); return v; }
|
||||
|
||||
static void sputc(char c) {
|
||||
for (u32 i=0;i<10000;i++) if (inb(COM1+5)&0x20) break;
|
||||
outb(COM1,(u8)c);
|
||||
}
|
||||
static void swrite(const char *s) { while(*s){ if(*s=='\n') sputc('\r'); sputc(*s++);} }
|
||||
static void logl(const char *s) { swrite(s); swrite("\n"); }
|
||||
|
||||
__attribute__((visibility("default")))
|
||||
void dsk_entry(const dsk_boot_context *ctx) {
|
||||
(void)ctx;
|
||||
logl("[mouseInit] boot");
|
||||
|
||||
/* Safe first version: do not touch PS/2 controller command path yet.
|
||||
The previous implementation could block/reboot on some firmware states.
|
||||
Full IRQ12 + packet decoding will be implemented as a later input driver. */
|
||||
u8 status = inb(PS2_STATUS);
|
||||
(void)status;
|
||||
|
||||
logl("[mouseInit] safe init complete");
|
||||
return;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,41 @@
|
||||
# mouseInit 鼠标初始化器
|
||||
|
||||
`CODE/mouse` 生成早期鼠标初始化 ELF:
|
||||
|
||||
```text
|
||||
CODE/mouse -> SYSTEM/system/deshab64/mouse/mouseInit.elf
|
||||
```
|
||||
|
||||
## 目标
|
||||
|
||||
`mouseInit.elf` 是 DSK 直接调度的系统输入初始化器,不属于 FirstInit 用户向导。DSK 在检测到首次启动后先加载并调用它,初始化完成后返回 DSK,再由 DSK 启动 FirstInit 用户设置向导。
|
||||
|
||||
第一版职责:
|
||||
|
||||
1. 初始化 PS/2 Controller 的辅助设备通道(mouse / AUX)。
|
||||
2. 开启 IRQ12 配置位。
|
||||
3. 向鼠标发送默认配置 `0xF6`。
|
||||
4. 启用数据报告 `0xF4`。
|
||||
5. 输出串口日志并返回 DSK。
|
||||
|
||||
## 当前限制
|
||||
|
||||
- 当前只做 PS/2 鼠标初始化,不消费鼠标包。
|
||||
- 鼠标 IRQ12 的实际数据读取应由后续 DKM 输入驱动或 DSK 输入子系统接管。
|
||||
- USB 鼠标需要 xHCI/HID 支持,暂不在第一版范围。
|
||||
|
||||
## 构建
|
||||
|
||||
```powershell
|
||||
cd CODE\mouse
|
||||
make -f MAKEFILE CC=clang LD=ld.lld
|
||||
```
|
||||
|
||||
## 启动链路
|
||||
|
||||
```text
|
||||
DSK 检测 firstInit=0
|
||||
-> 加载并调用 mouseInit.elf
|
||||
-> mouseInit 初始化 PS/2 鼠标后返回
|
||||
-> DSK 继续加载 FirstInit.elf
|
||||
```
|
||||
Reference in New Issue
Block a user