kern

annotate src/segm-asm.S @ 98:921a264297a4

merged the filesystem stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 17 Apr 2014 17:03:30 +0300
parents 4eaecb14fe31
children
rev   line source
nuclear@7 1 .data
nuclear@8 2 .align 4
nuclear@8 3 /* memory reserved for setup_selectors */
nuclear@7 4 off:.long 0
nuclear@7 5 seg:.short 0
nuclear@8 6 /* memory reserved for set_gdt */
nuclear@8 7 lim:.short 0
nuclear@8 8 addr:.long 0
nuclear@7 9
nuclear@7 10 .text
nuclear@7 11 /* setup_selectors(uint16_t code, uint16_t data)
nuclear@7 12 * loads the requested selectors to all the selector registers */
nuclear@7 13 .globl setup_selectors
nuclear@7 14 setup_selectors:
nuclear@8 15 /* set data selectors directly */
nuclear@7 16 movl 8(%esp), %eax
nuclear@7 17 movw %ax, %ss
nuclear@7 18 movw %ax, %es
nuclear@7 19 movw %ax, %ds
nuclear@7 20 movw %ax, %gs
nuclear@7 21 movw %ax, %fs
nuclear@8 22 /* set cs using a long jump */
nuclear@7 23 movl 4(%esp), %eax
nuclear@7 24 movw %ax, (seg)
nuclear@7 25 movl $ldcs, (off)
nuclear@7 26 ljmp *off
nuclear@7 27 ldcs:
nuclear@7 28 ret
nuclear@7 29
nuclear@7 30 /* set_gdt(uint32_t addr, uint16_t limit)
nuclear@7 31 * loads the GDTR with the new address and limit for the GDT */
nuclear@7 32 .globl set_gdt
nuclear@7 33 set_gdt:
nuclear@7 34 movl 4(%esp), %eax
nuclear@8 35 movl %eax, (addr)
nuclear@7 36 movw 8(%esp), %ax
nuclear@8 37 movw %ax, (lim)
nuclear@8 38 lgdt (lim)
nuclear@7 39 ret
nuclear@54 40
nuclear@54 41 /* set_task_reg(uint16_t tss_selector)
nuclear@54 42 * loads the TSS selector in the task register */
nuclear@54 43 .globl set_task_reg
nuclear@54 44 set_task_reg:
nuclear@55 45 mov 4(%esp), %eax
nuclear@54 46 ltr 4(%esp)
nuclear@54 47 ret