Commit f9adcd73 by triazo

Add assembly library to enable paging

parent e64790c4
Showing with 27 additions and 0 deletions
......@@ -2,6 +2,7 @@ C=/home/adam/college/kernel/cross/bin/i686-elf-gcc
all:
/usr/bin/nasm -felf32 head.asm -o boot.o
/usr/bin/nasm -felf32 paging.asm
$C *.c -std=gnu99 -ffreestanding -O2 -Wall -Wextra -c
$C -T linker.ld -o myos.bin -ffreestanding -O2 -nostdlib *.o -lgcc
......
......@@ -5,6 +5,10 @@
#pragma once
#include <stdint.h>
// These two are defined in the assembly file paging.asm
extern void loadPageDirectory(uint32_t*);
extern void enablePaging();
// Defined in the file mem.c
uint32_t* initiate_directory();
void initiate_page_table(uint32_t* page_dir);
section .text
global loadPageDirectory
loadPageDirectory:
push ebp
mov ebp, esp
mov eax, [esp+8]
mov cr3, eax
mov esp, ebp
pop ebp
ret
global enablePaging
enablePaging:
push ebp
mov ebp, esp
mov eax, cr0
or eax, 0x80000000
mov cr0, eax
mov esp, ebp
pop ebp
ret
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment