annotate src/vm-asm.S @ 80:4db99a52863e
fixed the "endianess" of the text messages in the ATA identify info block. this
is the first time I've seen wrong byteorder in ascii text, the ATA committee
should be commended.
author |
John Tsiombikas <nuclear@member.fsf.org> |
date |
Tue, 06 Dec 2011 13:35:39 +0200 |
parents |
387078ef5c0d |
children |
|
rev |
line source |
nuclear@17
|
1 .text
|
nuclear@17
|
2 /* enable_paging(void)
|
nuclear@26
|
3 * sets bit 31 of cr0 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@26
|
12 * clears bit 31 of cr0 which disables page translation */
|
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@26
|
20 /* get_paging_status(void)
|
nuclear@26
|
21 * returns 0 if paging is disabled or 1 if it's enabled */
|
nuclear@23
|
22 .globl get_paging_status
|
nuclear@23
|
23 get_paging_status:
|
nuclear@23
|
24 movl %cr0, %eax
|
nuclear@23
|
25 shr $31, %eax
|
nuclear@23
|
26 ret
|
nuclear@23
|
27
|
nuclear@17
|
28 /* set_pgdir_addr(uint32_t addr)
|
nuclear@17
|
29 * sets the address of the page directory by writing to cr3, which
|
nuclear@17
|
30 * also results in a TLB flush. */
|
nuclear@17
|
31 .globl set_pgdir_addr
|
nuclear@17
|
32 set_pgdir_addr:
|
nuclear@17
|
33 movl 4(%esp), %eax
|
nuclear@17
|
34 movl %eax, %cr3
|
nuclear@17
|
35 ret
|
nuclear@17
|
36
|
nuclear@55
|
37 /* get_pgdir_addr(void)
|
nuclear@55
|
38 * returns the physical address of the page table directory (cr3) */
|
nuclear@55
|
39 .globl get_pgdir_addr
|
nuclear@55
|
40 get_pgdir_addr:
|
nuclear@55
|
41 movl %cr3, %eax
|
nuclear@55
|
42 ret
|
nuclear@55
|
43
|
nuclear@23
|
44 /* flush_tlb(void)
|
nuclear@23
|
45 * invalidates the whole TLB. entries for pages marked as global
|
nuclear@23
|
46 * are unaffected */
|
nuclear@23
|
47 .globl flush_tlb
|
nuclear@23
|
48 flush_tlb:
|
nuclear@23
|
49 movl %cr3, %eax
|
nuclear@23
|
50 movl %eax, %cr3
|
nuclear@23
|
51 ret
|
nuclear@23
|
52
|
nuclear@23
|
53 /* flush_tlb_addr(uint32_t addr)
|
nuclear@23
|
54 * flushes the TLB entry for the page containing a particular
|
nuclear@23
|
55 * virtual address */
|
nuclear@23
|
56 .globl flush_tlb_addr
|
nuclear@23
|
57 flush_tlb_addr:
|
nuclear@23
|
58 movl 4(%esp), %eax
|
nuclear@23
|
59 invlpg (%eax)
|
nuclear@23
|
60 ret
|
nuclear@23
|
61
|
nuclear@17
|
62 /* get_fault_addr(void)
|
nuclear@17
|
63 * returns the contents of control register 2, which provides
|
nuclear@17
|
64 * the faulting address during a page fault exception
|
nuclear@17
|
65 */
|
nuclear@17
|
66 .globl get_fault_addr
|
nuclear@17
|
67 get_fault_addr:
|
nuclear@17
|
68 movl %cr2, %eax
|
nuclear@17
|
69 ret
|