trying to get VGA fb mode to work..

This commit is contained in:
2026-07-14 00:07:50 -05:00
parent 5c7febbbf0
commit 454de8feed
17 changed files with 567 additions and 300 deletions

View File

@@ -95,6 +95,25 @@ static int32_t sys_brk(uint32_t new_break) {
return current->heap_end;
}
static int32_t sys_sbrk(int32_t inc) {
process_t* current = current_task();
if (inc <= 0) { // can't shrink yet
return current->heap_end;
}
uint32_t page_start = (current->heap_end + 4095) & ~4095;
current->heap_end += inc;
uint32_t page_end = (current->heap_end + 4095) & ~4095;
for (uint32_t addr = page_start; addr < page_end; addr += 4096) {
void* phys = p_alloc_frame();
map_page(addr, (uint32_t)phys, PAGE_PRESENT | PAGE_WRITABLE | PAGE_USER);
}
return current->heap_end;
}
static int32_t sys_pty(int* slave_fd) {
pty_t* pty = (pty_t*)kalloc(sizeof(pty_t));
ring_buf_init(&pty->master_rb);
@@ -230,6 +249,7 @@ void syscall(registers_t* regs) {
case 5: ret = sys_open((const char*)regs->ebx, regs->ecx); break;
case 6: ret = sys_close(regs->ebx); break;
case 12: ret = sys_brk(regs->ebx); break;
case 13: ret = sys_sbrk(regs->ebx); break;
case 20: ret = sys_pty((int*)regs->ebx); break;
case 21: ret = sys_fork(regs); break;
case 22: ret = sys_exec(regs, (const char*)regs->ebx); break;