kern

view src/vm-asm.S @ 76:0fe6eef16335

holy fuck, copy_on_write didn't actually do the copy!!!!
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 05 Nov 2011 04:53:46 +0200
parents 387078ef5c0d
children
line source
1 .text
2 /* enable_paging(void)
3 * sets bit 31 of cr0 which enables page translation */
4 .globl enable_paging
5 enable_paging:
6 movl %cr0, %eax
7 orl $0x80000000, %eax
8 movl %eax, %cr0
9 ret
11 /* disable_paging(void)
12 * clears bit 31 of cr0 which disables page translation */
13 .globl disable_paging
14 disable_paging:
15 movl %cr0, %eax
16 andl $0x7fffffff, %eax
17 movl %eax, %cr0
18 ret
20 /* get_paging_status(void)
21 * returns 0 if paging is disabled or 1 if it's enabled */
22 .globl get_paging_status
23 get_paging_status:
24 movl %cr0, %eax
25 shr $31, %eax
26 ret
28 /* set_pgdir_addr(uint32_t addr)
29 * sets the address of the page directory by writing to cr3, which
30 * also results in a TLB flush. */
31 .globl set_pgdir_addr
32 set_pgdir_addr:
33 movl 4(%esp), %eax
34 movl %eax, %cr3
35 ret
37 /* get_pgdir_addr(void)
38 * returns the physical address of the page table directory (cr3) */
39 .globl get_pgdir_addr
40 get_pgdir_addr:
41 movl %cr3, %eax
42 ret
44 /* flush_tlb(void)
45 * invalidates the whole TLB. entries for pages marked as global
46 * are unaffected */
47 .globl flush_tlb
48 flush_tlb:
49 movl %cr3, %eax
50 movl %eax, %cr3
51 ret
53 /* flush_tlb_addr(uint32_t addr)
54 * flushes the TLB entry for the page containing a particular
55 * virtual address */
56 .globl flush_tlb_addr
57 flush_tlb_addr:
58 movl 4(%esp), %eax
59 invlpg (%eax)
60 ret
62 /* get_fault_addr(void)
63 * returns the contents of control register 2, which provides
64 * the faulting address during a page fault exception
65 */
66 .globl get_fault_addr
67 get_fault_addr:
68 movl %cr2, %eax
69 ret