2 Commits

Author SHA1 Message Date
xamidev e5c296238c Stack trace all black & void arg fix 2026-03-14 09:31:57 +01:00
xamidev 5c0d02579b void parameter on functions of arity 0 2026-03-13 17:21:52 +01:00
17 changed files with 28 additions and 29 deletions
+1 -3
View File
@@ -19,11 +19,10 @@ The basics that I'm targeting are:
### Basic utility of what we call a "kernel"
- Fix terminal driver (backspace issues, scrolling) OR add Flanterm or equivalent
- Implement tasks, and task switching + context switching and spinlock acquire/release
- Load an executable
- Filesystem (TAR for read-only initfs, then maybe read-write using FAT12/16/32 or easier fs) w/ VFS layer
- Getting to userspace (syscalls)
- Getting to userspace (ring 3 switching, syscall interface)
- Porting musl libc or equivalent
### Scalability/maintenance/expansion features
@@ -32,7 +31,6 @@ The basics that I'm targeting are:
- SOME error handling in functions
- Unit tests
- Good error codes (like Linux kernel: ENOMEM, ENOENT, ...)
- Make the panic function work within itself without dependencies + error message (and still get cpu context?)
### Optional features
+1 -1
View File
@@ -8,7 +8,7 @@ Indentations should be 4 characters long.
## Line length
Lines should not be more than 100 characters long.
Lines should not be more than 100 characters long. Exceptions is made for printing strings.
## Variables
+2 -2
View File
@@ -20,7 +20,7 @@ void debug_stack_trace(unsigned int max_frames)
{
DEBUG("*** begin stack trace ***");
if (init.terminal) {
printf("\r\n*** begin stack trace ***\r\n");
printf("\r\n\x1b[48;5;232m\x1b[38;5;231m*** begin stack trace ***\r\n");
}
// Thanks GCC :)
uintptr_t* rbp = (uintptr_t*)__builtin_frame_address(0);
@@ -46,7 +46,7 @@ void debug_stack_trace(unsigned int max_frames)
rbp = next_rbp;
}
if (init.terminal) {
printf("*** end stack trace ***");
printf("*** end stack trace ***\x1b[0m");
}
DEBUG("*** end stack trace ***");
}
+1 -1
View File
@@ -9,7 +9,7 @@
#include <stdint.h>
void idt_init();
void idt_init(void);
struct interrupt_descriptor {
uint16_t address_low;
+1 -1
View File
@@ -7,7 +7,7 @@
#ifndef PS2_H
#define PS2_H
void keyboard_handler();
void keyboard_handler(void);
#define SHIFT_PRESSED_BIT 0b00000001
#define ALT_PRESSED_BIT 0b00000010
+1 -1
View File
@@ -13,7 +13,7 @@
void outb(int port, unsigned char data);
unsigned char inb(int port);
int serial_init();
int serial_init(void);
void skputs(const char* str);
void skputc(char c);
+1 -1
View File
@@ -9,6 +9,6 @@
void kputs(const char* str);
void _putchar(char character);
void term_init();
void term_init(void);
#endif
+3 -3
View File
@@ -36,13 +36,13 @@ extern volatile uint64_t ticks;
// printf("debug: [%s]: " log "\n", __FILE__, ##__VA_ARGS__);
void panic(struct cpu_status_t* ctx, const char* str);
void hcf();
void idle();
void hcf(void);
void idle(void);
/* debug */
void debug_stack_trace(unsigned int max_frames);
const char* debug_find_symbol(uintptr_t rip, uintptr_t* offset);
void boot_mem_display();
void boot_mem_display(void);
#define assert(check) do { if(!(check)) hcf(); } while(0)
+2 -6
View File
@@ -64,15 +64,10 @@ extern struct process_t* processes_list;
extern struct process_t* current_process;
struct process_t* idle_proc;
bool iran = false;
// Never gets executed although pedicel is scheduled?
void pedicel_main(void* arg)
{
//panic(NULL, "test");
bool iran = true;
// FROM THE NEXT LINE ONWARDS, CANNOT WRITE TO FRAMEBUFFER WITHOUT PAGE FAULT!
//printf("\n\nWelcome to PepperOS! Pedicel speaking.\nNothing left to do, halting the system!");
printf("\n\nWelcome to PepperOS! Pedicel speaking.\r\nNothing left to do, let's go idle!");
}
void idle_main(void* arg)
@@ -129,5 +124,6 @@ void kmain()
scheduler_init();
kputs(PEPPEROS_SPLASH);
idle();
}
+1 -1
View File
@@ -26,6 +26,6 @@ struct GDTR {
uint64_t address;
} __attribute__((packed));
void gdt_init();
void gdt_init(void);
#endif
+3 -3
View File
@@ -23,10 +23,10 @@ struct heap_block_t {
struct heap_block_t* next;
} __attribute__((aligned(16)));
void kheap_init();
void kheap_init(void);
void* kmalloc(size_t size);
void kfree(void* ptr);
void* kalloc_stack();
void kheap_map_page();
void* kalloc_stack(void);
void kheap_map_page(void);
#endif
+1 -1
View File
@@ -12,6 +12,6 @@
void pmm_init(struct boot_context boot_ctx);
void pmm_free(uintptr_t addr);
uintptr_t pmm_alloc();
uintptr_t pmm_alloc(void);
#endif
+1 -1
View File
@@ -29,6 +29,6 @@ struct vm_object {
#define VM_FLAG_EXEC (1 << 1)
#define VM_FLAG_USER (1 << 2)
void vmm_init();
void vmm_init(void);
#endif
+2 -2
View File
@@ -27,12 +27,12 @@ struct process_t {
struct process_t* next;
};
void process_init();
void process_init(void);
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_delete(struct process_t** processes_list, struct process_t* process);
struct process_t* process_get_next(struct process_t* process);
void process_exit();
void process_exit(void);
void process_display_list(struct process_t* processes_list);
+5
View File
@@ -43,6 +43,11 @@ struct cpu_status_t* scheduler_schedule(struct cpu_status_t* context)
current_process = idle_proc;
}
if (current_process == idle_proc && current_process->next == NULL)
{
return idle_proc->context;
}
current_process->context = context;
//current_process->status = READY;
+1 -1
View File
@@ -8,6 +8,6 @@
#define SCHEDULER_H
struct cpu_status_t* scheduler_schedule(struct cpu_status_t* context);
void scheduler_init();
void scheduler_init(void);
#endif
+1 -1
View File
@@ -7,7 +7,7 @@
#ifndef TIMER_H
#define TIMER_H
void timer_init();
void timer_init(void);
void timer_wait(unsigned int wait_ticks);
#endif