kern

annotate src/segm-asm.S @ 37:2c401f69128e

finished with the klibc/time.c stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 10 Jun 2011 19:54:47 +0300
parents 611b2d66420b
children 4eaecb14fe31
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