kern

annotate src/vm-asm.S @ 38:e6f75f91e606

- added makefile pattern to produce assembly output from c source files. - removed a commented out previous version of the gmtime_r function in klibc/time.c
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 10 Jun 2011 23:19:25 +0300
parents 5454cee245a3
children 88a6c4e192f9
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@23 37 /* flush_tlb(void)
nuclear@23 38 * invalidates the whole TLB. entries for pages marked as global
nuclear@23 39 * are unaffected */
nuclear@23 40 .globl flush_tlb
nuclear@23 41 flush_tlb:
nuclear@23 42 movl %cr3, %eax
nuclear@23 43 movl %eax, %cr3
nuclear@23 44 ret
nuclear@23 45
nuclear@23 46 /* flush_tlb_addr(uint32_t addr)
nuclear@23 47 * flushes the TLB entry for the page containing a particular
nuclear@23 48 * virtual address */
nuclear@23 49 .globl flush_tlb_addr
nuclear@23 50 flush_tlb_addr:
nuclear@23 51 movl 4(%esp), %eax
nuclear@23 52 invlpg (%eax)
nuclear@23 53 ret
nuclear@23 54
nuclear@17 55 /* get_fault_addr(void)
nuclear@17 56 * returns the contents of control register 2, which provides
nuclear@17 57 * the faulting address during a page fault exception
nuclear@17 58 */
nuclear@17 59 .globl get_fault_addr
nuclear@17 60 get_fault_addr:
nuclear@17 61 movl %cr2, %eax
nuclear@17 62 ret