kern
diff src/vm-asm.S @ 17:098b1cb5eeaa
forgot to add a shitload of files
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 26 Mar 2011 21:39:14 +0200 |
parents | |
children | 5454cee245a3 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/vm-asm.S Sat Mar 26 21:39:14 2011 +0200 1.3 @@ -0,0 +1,27 @@ 1.4 + .text 1.5 +/* enable_paging(void) 1.6 + * sets the cr0 bit 31 which enables page translation */ 1.7 + .globl enable_paging 1.8 +enable_paging: 1.9 + movl %cr0, %eax 1.10 + orl $0x80000000, %eax 1.11 + movl %eax, %cr0 1.12 + ret 1.13 + 1.14 +/* set_pgdir_addr(uint32_t addr) 1.15 + * sets the address of the page directory by writing to cr3, which 1.16 + * also results in a TLB flush. */ 1.17 + .globl set_pgdir_addr 1.18 +set_pgdir_addr: 1.19 + movl 4(%esp), %eax 1.20 + movl %eax, %cr3 1.21 + ret 1.22 + 1.23 +/* get_fault_addr(void) 1.24 + * returns the contents of control register 2, which provides 1.25 + * the faulting address during a page fault exception 1.26 + */ 1.27 + .globl get_fault_addr 1.28 +get_fault_addr: 1.29 + movl %cr2, %eax 1.30 + ret