vga now working with term and shell program
This commit is contained in:
@@ -30,7 +30,7 @@ uint32_t vga_mmap(vfs_node_t* node, uint32_t address) {
|
||||
for (uint32_t i = 0; i < num_pages; i++) {
|
||||
uint32_t phys_addr = framebuffer_address + (i * 4096);
|
||||
uint32_t virt_addr = address + (i * 4096);
|
||||
map_page(virt_addr, phys_addr, PAGE_PRESENT | PAGE_WRITABLE);
|
||||
map_page(virt_addr, phys_addr, PAGE_PRESENT | PAGE_WRITABLE | PAGE_USER | PAGE_MMIO);
|
||||
}
|
||||
return address;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ void vga_init(
|
||||
for (uint32_t i = 0; i < num_pages; i++) {
|
||||
uint32_t phys_addr = fb_paddr + (i * 4096);
|
||||
uint32_t virt_addr = VGA_FRAMEBUFFER + (i * 4096);
|
||||
map_page(virt_addr, phys_addr, PAGE_PRESENT | PAGE_WRITABLE);
|
||||
map_page(virt_addr, phys_addr, PAGE_PRESENT | PAGE_WRITABLE | PAGE_MMIO);
|
||||
}
|
||||
|
||||
vga_clear_scrn(0x00000000);
|
||||
|
||||
@@ -166,14 +166,7 @@ void kmain(multiboot_info* mbi) {
|
||||
dev->mnt = devfs;
|
||||
kprintf("mounted devfs\n");
|
||||
|
||||
int font_loaded = set_console_font("/usr/fonts/kernel_font.psf");
|
||||
if (!font_loaded) {
|
||||
kprintf("failed to load console font\n");
|
||||
}
|
||||
console_init();
|
||||
|
||||
kprintf("kernel console initialized\n");
|
||||
kprintf("basic initializations complete. check serial for details\n");
|
||||
kprintf("basic initializations complete\n");
|
||||
kprintf("starting rockos\n");
|
||||
|
||||
load_root_program("/usr/bin/rockterm");
|
||||
|
||||
@@ -16,7 +16,6 @@ static char* hex_chars = "0123456789abcdef";
|
||||
|
||||
static void kwrite(char c) {
|
||||
write_serial(c);
|
||||
console_putchar(c);
|
||||
}
|
||||
|
||||
static void kprint(const char *str) {
|
||||
|
||||
@@ -247,7 +247,7 @@ void* clone_current_pd() {
|
||||
uint32_t pte_src = pt_src[j];
|
||||
if (!(pte_src & PAGE_PRESENT)) continue;
|
||||
|
||||
if (!(pte_src & PAGE_WRITABLE)) {
|
||||
if (!(pte_src & PAGE_WRITABLE) || (pte_src & PAGE_MMIO)) {
|
||||
pt_dst[j] = pt_src[j];
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#define PAGE_WRITABLE (1 << 1)
|
||||
#define PAGE_USER (1 << 2)
|
||||
#define PAGE_COW (1 << 9)
|
||||
#define PAGE_MMIO (1 << 10)
|
||||
|
||||
#define TEMP_KERNPD_VADDR 0xDFF90000
|
||||
#define TEMP_TASKPD_VADDR 0xDFFA0000
|
||||
|
||||
@@ -25,7 +25,14 @@ void unlock_scheduler() {
|
||||
enable_interrupts();
|
||||
}
|
||||
|
||||
typedef struct registers {
|
||||
uint32_t ds; // push %ds
|
||||
uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax; // pushal
|
||||
uint32_t eip, cs, eflags, useresp, ss; // pushed by cpu
|
||||
} __attribute__((packed)) registers_t;
|
||||
|
||||
uint32_t switch_context(uint32_t current_esp) {
|
||||
registers_t* regs = (registers_t*)current_esp;
|
||||
current_process->esp = current_esp;
|
||||
|
||||
process_t* next_process = current_process->sched_next;
|
||||
@@ -62,8 +69,6 @@ uint32_t switch_context(uint32_t current_esp) {
|
||||
if (current_process->flags & PROCESS_FLAG_USER) {
|
||||
tss.esp0 = current_process->kstack_top;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return current_process->esp;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "drivers/serial/serial.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/ringbuf.h"
|
||||
|
||||
@@ -25,11 +26,12 @@ typedef struct registers {
|
||||
|
||||
static int32_t sys_exit(int status) {
|
||||
process_t* task = current_task();
|
||||
task->state = STATE_ZOMBIE;
|
||||
task->exit_status = status;
|
||||
if (task->waiting) {
|
||||
wake(task->waiting);
|
||||
}
|
||||
task->state = STATE_DEAD;
|
||||
// task->exit_status = status;
|
||||
// if (task->waiting) {
|
||||
// wake(task->waiting);
|
||||
// }
|
||||
kprintf("task %d exited with status %d\n", task->pid, status);
|
||||
exit();
|
||||
return 0;
|
||||
}
|
||||
@@ -212,6 +214,7 @@ static int32_t sys_exec(registers_t* regs, const char* prgm) {
|
||||
regs->eip = eip;
|
||||
regs->useresp = (uint32_t)u_esp;
|
||||
|
||||
print_serial("returning from exec\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -253,7 +256,7 @@ static int32_t sys_mmap(int fd) {
|
||||
|
||||
if (!(file->node->flags & VFS_CHARDEVICE)) return 0;
|
||||
|
||||
uint32_t map_vaddr = 0x3FF00000;
|
||||
uint32_t map_vaddr = 0x20000000;
|
||||
return file->node->mmap(file->node, map_vaddr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user