Compare commits
6 Commits
fc79a47957
...
main
Author | SHA1 | Date | |
---|---|---|---|
44f5d687b0 | |||
1f5a358b19 | |||
e15f0af292 | |||
8e2017bd29 | |||
11125325ca | |||
81c54647d2 |
4
Makefile
4
Makefile
@ -33,7 +33,9 @@ $(NAME): $(OBJ)
|
||||
run: $(NAME)
|
||||
qemu-system-i386 -kernel build/$(NAME).bin -vga std
|
||||
|
||||
iso: $(NAME) mkdir -p isodir/boot/grub cp build/$(NAME).bin isodir/boot/$(NAME).bin
|
||||
iso: $(NAME)
|
||||
mkdir -p isodir/boot/grub
|
||||
cp build/$(NAME).bin isodir/boot/$(NAME).bin
|
||||
cp config/grub.cfg isodir/boot/grub/grub.cfg
|
||||
grub-mkrescue -o build/$(NAME).iso --compress=xz --locales=en@quot --themes= isodir
|
||||
rm -rf isodir
|
||||
|
41
src/kernel.c
41
src/kernel.c
@ -30,28 +30,6 @@
|
||||
#error "This tutorial needs to be compiled with a ix86-elf compiler"
|
||||
#endif
|
||||
|
||||
static void uwu(void)
|
||||
{
|
||||
kprintf("uwu\n");
|
||||
}
|
||||
|
||||
static void owo(void)
|
||||
{
|
||||
while (true)
|
||||
kprintf("owoooooooooooooooooooooooooooooooooooo\n");
|
||||
}
|
||||
|
||||
static void awa(void)
|
||||
{
|
||||
uint32_t pid = fork();
|
||||
PRINT_INT(pid);
|
||||
if (pid < 0)
|
||||
kprintf("awais");
|
||||
kprintf("awaille\n");
|
||||
if (pid)
|
||||
wait();
|
||||
}
|
||||
|
||||
static void bozo(int int_code)
|
||||
{
|
||||
kprintf("apagnan code\n");
|
||||
@ -64,26 +42,7 @@ void kernel_main(multiboot_info_t *mbd, uint32_t magic)
|
||||
init_idt();
|
||||
init_memory(mbd, magic);
|
||||
load_drivers();
|
||||
// kprintf(KERN_ALERT
|
||||
// "I see no way to confuse an array of 256 seg:off pairs with a
|
||||
// " "complex 8*unknown quantity -byte descriptor table. -- Troy
|
||||
// " "Martin 03:50, 22 March 2009 (UTC)\n");
|
||||
create_kernel_task();
|
||||
vmalloc(1231231);
|
||||
// uint32_t nb_alloc = 0;
|
||||
// while (kmalloc(10))
|
||||
// nb_alloc++;
|
||||
// kprintf("%d\n", nb_alloc);
|
||||
for (uint8_t i = 0; i < 10; i++)
|
||||
vmalloc(32);
|
||||
char *str = kmalloc(20);
|
||||
show_kalloc_mem();
|
||||
strcpy(str, "test\n");
|
||||
kprintf("%s", str);
|
||||
// exec_fn(owo);
|
||||
// exec_fn(owo);
|
||||
// exec_fn(owo);
|
||||
// exec_fn(owo);
|
||||
kill(0, 4);
|
||||
for (size_t i = 0; i < 10000; i++)
|
||||
free_pages(alloc_pages(1, NULL), 1);
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
extern uint32_t page_table1[1024];
|
||||
extern const char *faults[];
|
||||
void clear_registers(void);
|
||||
|
||||
__attribute__((noreturn)) void kpanic(const char *format, ...)
|
||||
{
|
||||
@ -16,6 +17,7 @@ __attribute__((noreturn)) void kpanic(const char *format, ...)
|
||||
|
||||
/* terminal_set_bg_color(VGA_COLOR_BLUE); */
|
||||
/* terminal_clear(); */
|
||||
kprintf("kpanic: ");
|
||||
va_start(va, format);
|
||||
kvprintf(format, &va);
|
||||
va_end(va);
|
||||
@ -30,7 +32,5 @@ __attribute__((noreturn)) void kpanic(const char *format, ...)
|
||||
/* print_stack(); */
|
||||
/* kprintf("\n\n"); */
|
||||
/* kprintf("PRESS SPACE TO REBOOT"); */
|
||||
while (terminal_getkey().scan_code != KEY_SPACE)
|
||||
;
|
||||
reboot();
|
||||
__asm__ __volatile__("jmp panic");
|
||||
}
|
||||
|
19
src/panic.s
Normal file
19
src/panic.s
Normal file
@ -0,0 +1,19 @@
|
||||
.intel_syntax noprefix
|
||||
|
||||
.section .text
|
||||
.global panic
|
||||
|
||||
panic:
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
xor edx, edx
|
||||
xor esp, esp
|
||||
xor ebp, ebp
|
||||
xor esi, esi
|
||||
xor edi, edi
|
||||
|
||||
cli
|
||||
loop:
|
||||
hlt
|
||||
jmp loop
|
Reference in New Issue
Block a user