kern
view src/vm-asm.S @ 26:387078ef5c0d
fixes here and there
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 09 Apr 2011 07:14:06 +0300 |
parents | 5454cee245a3 |
children | 88a6c4e192f9 |
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 /* flush_tlb(void)
38 * invalidates the whole TLB. entries for pages marked as global
39 * are unaffected */
40 .globl flush_tlb
41 flush_tlb:
42 movl %cr3, %eax
43 movl %eax, %cr3
44 ret
46 /* flush_tlb_addr(uint32_t addr)
47 * flushes the TLB entry for the page containing a particular
48 * virtual address */
49 .globl flush_tlb_addr
50 flush_tlb_addr:
51 movl 4(%esp), %eax
52 invlpg (%eax)
53 ret
55 /* get_fault_addr(void)
56 * returns the contents of control register 2, which provides
57 * the faulting address during a page fault exception
58 */
59 .globl get_fault_addr
60 get_fault_addr:
61 movl %cr2, %eax
62 ret