kern
diff src/vm-asm.S @ 23:5454cee245a3
- fixed tragic mistake in the initial kernel image mapping
- page table modifications by disabling paging first
- page allocation completed
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 04 Apr 2011 23:34:06 +0300 |
parents | 098b1cb5eeaa |
children | 387078ef5c0d |
line diff
1.1 --- a/src/vm-asm.S Sun Apr 03 18:42:19 2011 +0300 1.2 +++ b/src/vm-asm.S Mon Apr 04 23:34:06 2011 +0300 1.3 @@ -8,6 +8,21 @@ 1.4 movl %eax, %cr0 1.5 ret 1.6 1.7 +/* disable_paging(void) 1.8 + * clears the cr0 bit 31 */ 1.9 + .globl disable_paging 1.10 +disable_paging: 1.11 + movl %cr0, %eax 1.12 + andl $0x7fffffff, %eax 1.13 + movl %eax, %cr0 1.14 + ret 1.15 + 1.16 + .globl get_paging_status 1.17 +get_paging_status: 1.18 + movl %cr0, %eax 1.19 + shr $31, %eax 1.20 + ret 1.21 + 1.22 /* set_pgdir_addr(uint32_t addr) 1.23 * sets the address of the page directory by writing to cr3, which 1.24 * also results in a TLB flush. */ 1.25 @@ -17,6 +32,24 @@ 1.26 movl %eax, %cr3 1.27 ret 1.28 1.29 +/* flush_tlb(void) 1.30 + * invalidates the whole TLB. entries for pages marked as global 1.31 + * are unaffected */ 1.32 + .globl flush_tlb 1.33 +flush_tlb: 1.34 + movl %cr3, %eax 1.35 + movl %eax, %cr3 1.36 + ret 1.37 + 1.38 +/* flush_tlb_addr(uint32_t addr) 1.39 + * flushes the TLB entry for the page containing a particular 1.40 + * virtual address */ 1.41 + .globl flush_tlb_addr 1.42 +flush_tlb_addr: 1.43 + movl 4(%esp), %eax 1.44 + invlpg (%eax) 1.45 + ret 1.46 + 1.47 /* get_fault_addr(void) 1.48 * returns the contents of control register 2, which provides 1.49 * the faulting address during a page fault exception