Flanterm can write to fb but page fault before process creation. (BEFORE KHEAP UPDATE)
This commit is contained in:
1
Makefile
1
Makefile
@@ -7,7 +7,6 @@ build:
|
|||||||
x86_64-elf-gcc -g -c -Isrc $(SOURCES) $(PROBLEMATIC_FLAGS) -Wall -Wextra -std=gnu99 -nostdlib -ffreestanding -fno-stack-protector -fno-omit-frame-pointer -fno-stack-check -fno-PIC -ffunction-sections -fdata-sections -mcmodel=kernel
|
x86_64-elf-gcc -g -c -Isrc $(SOURCES) $(PROBLEMATIC_FLAGS) -Wall -Wextra -std=gnu99 -nostdlib -ffreestanding -fno-stack-protector -fno-omit-frame-pointer -fno-stack-check -fno-PIC -ffunction-sections -fdata-sections -mcmodel=kernel
|
||||||
objcopy -O elf64-x86-64 -B i386 -I binary zap-light16.psf zap-light16.o
|
objcopy -O elf64-x86-64 -B i386 -I binary zap-light16.psf zap-light16.o
|
||||||
nasm -f elf64 src/idt/idt.S -o idt_stub.o
|
nasm -f elf64 src/idt/idt.S -o idt_stub.o
|
||||||
nasm -f elf64 src/entry.S -o entry.o
|
|
||||||
x86_64-elf-ld -o pepperk -T linker.ld *.o
|
x86_64-elf-ld -o pepperk -T linker.ld *.o
|
||||||
nm -n pepperk | awk '$$2 ~ /[TtDdBbRr]/ {print $$1, $$3}' > symbols.map
|
nm -n pepperk | awk '$$2 ~ /[TtDdBbRr]/ {print $$1, $$3}' > symbols.map
|
||||||
python3 symbols.py
|
python3 symbols.py
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
OUTPUT_FORMAT(elf64-x86-64)
|
OUTPUT_FORMAT(elf64-x86-64)
|
||||||
|
|
||||||
ENTRY(_start)
|
ENTRY(kmain)
|
||||||
|
|
||||||
PHDRS
|
PHDRS
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#define KERNEL_STACK_SIZE 65536
|
#define KERNEL_STACK_SIZE 65536
|
||||||
|
|
||||||
/* heap */
|
/* heap */
|
||||||
#define KHEAP_SIZE (16*1024*1024)
|
#define KHEAP_SIZE (32*1024*1024)
|
||||||
|
|
||||||
/* term */
|
/* term */
|
||||||
#define TERM_HISTORY_MAX_LINES 256
|
#define TERM_HISTORY_MAX_LINES 256
|
||||||
|
|||||||
@@ -203,9 +203,6 @@ struct cpu_status_t* interrupt_dispatch(struct cpu_status_t* context)
|
|||||||
if (ticks % SCHEDULER_QUANTUM == 0)
|
if (ticks % SCHEDULER_QUANTUM == 0)
|
||||||
{
|
{
|
||||||
return scheduler_schedule(context);
|
return scheduler_schedule(context);
|
||||||
//struct cpu_status_t* current_ctx = scheduler_schedule(context);
|
|
||||||
//process_switch(current_ctx->iret_rsp, current_ctx->iret_rip);
|
|
||||||
//SET_INTERRUPTS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ int serial_init()
|
|||||||
// Set normal operation mode
|
// Set normal operation mode
|
||||||
outb(PORT + 4, 0x0F);
|
outb(PORT + 4, 0x0F);
|
||||||
|
|
||||||
DEBUG("serial initialized");
|
DEBUG("*** Welcome to PepperOS! ***");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
44
src/kmain.c
44
src/kmain.c
File diff suppressed because one or more lines are too long
@@ -56,7 +56,7 @@ void kheap_init()
|
|||||||
head->size = PAGE_SIZE - sizeof(struct heap_block_t);
|
head->size = PAGE_SIZE - sizeof(struct heap_block_t);
|
||||||
head->free = true;
|
head->free = true;
|
||||||
head->next = NULL;
|
head->next = NULL;
|
||||||
DEBUG("kheap initialized, head=0x%p, size=%u", head, head->size);
|
DEBUG("kernel heap initialized, head=0x%p, max_size=%u bytes", head, KHEAP_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* kmalloc(size_t size)
|
void* kmalloc(size_t size)
|
||||||
|
|||||||
@@ -68,5 +68,6 @@ void vmm_setup_pt_root()
|
|||||||
|
|
||||||
void vmm_init()
|
void vmm_init()
|
||||||
{
|
{
|
||||||
vmm_setup_pt_root();
|
// NO U
|
||||||
|
//vmm_setup_pt_root();
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "io/serial/serial.h"
|
#include "io/serial/serial.h"
|
||||||
|
|
||||||
|
#include "io/term/flanterm.h"
|
||||||
|
extern struct flanterm_context* ft_ctx;
|
||||||
|
|
||||||
struct process_t* processes_list;
|
struct process_t* processes_list;
|
||||||
struct process_t* current_process;
|
struct process_t* current_process;
|
||||||
|
|
||||||
@@ -139,23 +142,6 @@ struct process_t* process_get_next(struct process_t* process)
|
|||||||
return process->next;
|
return process->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (from gdt) This will switch tasks ONLY in ring 0
|
|
||||||
// KERNEL CS = 0x08
|
|
||||||
// KERNEL SS = 0x10
|
|
||||||
__attribute__((naked, noreturn))
|
|
||||||
void process_switch(uint64_t stack_addr, uint64_t code_addr)
|
|
||||||
{
|
|
||||||
asm volatile(" \
|
|
||||||
push $0x10 \n\
|
|
||||||
push %0 \n\
|
|
||||||
push $0x202 \n\
|
|
||||||
push $0x08 \n\
|
|
||||||
push %1 \n\
|
|
||||||
iretq \n\
|
|
||||||
" :: "r"(stack_addr), "r"(code_addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Will be used to clean up resources (if any, when we implement it)
|
// Will be used to clean up resources (if any, when we implement it)
|
||||||
// Just mark as DEAD then idle. Scheduler will delete process at next timer interrupt % quantum.
|
// Just mark as DEAD then idle. Scheduler will delete process at next timer interrupt % quantum.
|
||||||
void process_exit()
|
void process_exit()
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ struct process_t* process_create(char* name, void(*function)(void*), void* arg);
|
|||||||
void process_add(struct process_t** processes_list, struct process_t* process);
|
void process_add(struct process_t** processes_list, struct process_t* process);
|
||||||
void process_delete(struct process_t** processes_list, struct process_t* process);
|
void process_delete(struct process_t** processes_list, struct process_t* process);
|
||||||
struct process_t* process_get_next(struct process_t* process);
|
struct process_t* process_get_next(struct process_t* process);
|
||||||
void process_switch(uint64_t stack_addr, uint64_t code_addr);
|
|
||||||
void process_exit();
|
void process_exit();
|
||||||
|
|
||||||
void process_display_list(struct process_t* processes_list);
|
void process_display_list(struct process_t* processes_list);
|
||||||
|
|||||||
Reference in New Issue
Block a user