BarinkOS/source/kernel/Memory/paging.s
Nigel 0f0fc9f252 Adding a skeleton for the memory management code
Moved the PMM away from being object orientated as it is just plain annoying
renamed src folder to source
Set timeout to 5 seconds in the grub config
2022-08-21 21:18:53 +02:00

45 lines
988 B
ArmAsm

# NOTE: I wish this wasn't AT&T Syntax its horrible
# REMINDER: INSTRUCTION FROM_REGISTER, TO_REGISTER
.globl enablePaging
enablePaging:
# Create a new call frame
push %ebp
mov %esp, %ebp
# Set the PG bit of CR0
mov %cr0, %eax
or $0x80000000, %eax
mov %eax, %cr0
# Restore to the previous call frame
mov %ebp, %esp
pop %ebp
ret
.globl loadPageDirectory
loadPageDirectory:
push %ebp
mov %esp, %ebp
/* NOTE: We should probably check if paging is already enabled.
Changing the CR3 register whilst paging is enabled might
result in unwanted behaviour (in the worst case) or cause a
fault (in the best case).
*/
mov 8(%esp), %eax # Move the first argument in the eax register
mov %eax, %cr3 # Move the value of eax into the CR3 register
/*
Moving the value of the argument passed to this function
into the CR3 register will allow the MMU to access the paging
structure we setup in memory once we enable paging
*/
mov %ebp, %esp
pop %ebp
ret