I'm creating my paging system atm. To enable paging, I need to call some of these assembly routines (below) halfway during the code. To be honoust; I'm really bad at assembly. The page that provided these function, didn't include the C declarations for these function.
Like I tried to create some myself... but my OS kept crashing.. so I want to exclude the possibility that my declarations are wrong.
Code: Select all
unsigned long read_cr0();
extern void write_cr3(unsigned long*);
extern void write_cr0(unsigned long);
Code: Select all
global _read_cr0
_read_cr0:
mov eax, cr0
retn
global _write_cr0
_write_cr0:
push ebp
mov ebp, esp
mov eax, [ebp+8]
mov cr0, eax
pop ebp
retn
global _read_cr3
_read_cr3:
mov eax, cr3
retn
global _write_cr3
_write_cr3:
push ebp
mov ebp, esp
mov eax, [ebp+8]
mov cr3, eax
pop ebp
retn