annotate src/vm-asm.S @ 29:8ea6debe4265
starting on the task switching implementation
author |
John Tsiombikas <nuclear@siggraph.org> |
date |
Sat, 23 Apr 2011 00:51:18 +0300 |
parents |
098b1cb5eeaa |
children |
387078ef5c0d |
rev |
line source |
nuclear@17
|
1 .text
|
nuclear@17
|
2 /* enable_paging(void)
|
nuclear@17
|
3 * sets the cr0 bit 31 which enables page translation */
|
nuclear@17
|
4 .globl enable_paging
|
nuclear@17
|
5 enable_paging:
|
nuclear@17
|
6 movl %cr0, %eax
|
nuclear@17
|
7 orl $0x80000000, %eax
|
nuclear@17
|
8 movl %eax, %cr0
|
nuclear@17
|
9 ret
|
nuclear@17
|
10
|
nuclear@23
|
11 /* disable_paging(void)
|
nuclear@23
|
12 * clears the cr0 bit 31 */
|
nuclear@23
|
13 .globl disable_paging
|
nuclear@23
|
14 disable_paging:
|
nuclear@23
|
15 movl %cr0, %eax
|
nuclear@23
|
16 andl $0x7fffffff, %eax
|
nuclear@23
|
17 movl %eax, %cr0
|
nuclear@23
|
18 ret
|
nuclear@23
|
19
|
nuclear@23
|
20 .globl get_paging_status
|
nuclear@23
|
21 get_paging_status:
|
nuclear@23
|
22 movl %cr0, %eax
|
nuclear@23
|
23 shr $31, %eax
|
nuclear@23
|
24 ret
|
nuclear@23
|
25
|
nuclear@17
|
26 /* set_pgdir_addr(uint32_t addr)
|
nuclear@17
|
27 * sets the address of the page directory by writing to cr3, which
|
nuclear@17
|
28 * also results in a TLB flush. */
|
nuclear@17
|
29 .globl set_pgdir_addr
|
nuclear@17
|
30 set_pgdir_addr:
|
nuclear@17
|
31 movl 4(%esp), %eax
|
nuclear@17
|
32 movl %eax, %cr3
|
nuclear@17
|
33 ret
|
nuclear@17
|
34
|
nuclear@23
|
35 /* flush_tlb(void)
|
nuclear@23
|
36 * invalidates the whole TLB. entries for pages marked as global
|
nuclear@23
|
37 * are unaffected */
|
nuclear@23
|
38 .globl flush_tlb
|
nuclear@23
|
39 flush_tlb:
|
nuclear@23
|
40 movl %cr3, %eax
|
nuclear@23
|
41 movl %eax, %cr3
|
nuclear@23
|
42 ret
|
nuclear@23
|
43
|
nuclear@23
|
44 /* flush_tlb_addr(uint32_t addr)
|
nuclear@23
|
45 * flushes the TLB entry for the page containing a particular
|
nuclear@23
|
46 * virtual address */
|
nuclear@23
|
47 .globl flush_tlb_addr
|
nuclear@23
|
48 flush_tlb_addr:
|
nuclear@23
|
49 movl 4(%esp), %eax
|
nuclear@23
|
50 invlpg (%eax)
|
nuclear@23
|
51 ret
|
nuclear@23
|
52
|
nuclear@17
|
53 /* get_fault_addr(void)
|
nuclear@17
|
54 * returns the contents of control register 2, which provides
|
nuclear@17
|
55 * the faulting address during a page fault exception
|
nuclear@17
|
56 */
|
nuclear@17
|
57 .globl get_fault_addr
|
nuclear@17
|
58 get_fault_addr:
|
nuclear@17
|
59 movl %cr2, %eax
|
nuclear@17
|
60 ret
|