kern

view src/segm-asm.S @ 36:e70b1ab9613e

- added cmos rtc code - added time/date functions in klibc - implemented an iowait macro with output to 0x80
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 10 Jun 2011 05:33:38 +0300
parents 611b2d66420b
children 4eaecb14fe31
line source
1 .data
2 .align 4
3 /* memory reserved for setup_selectors */
4 off:.long 0
5 seg:.short 0
6 /* memory reserved for set_gdt */
7 lim:.short 0
8 addr:.long 0
10 .text
11 /* setup_selectors(uint16_t code, uint16_t data)
12 * loads the requested selectors to all the selector registers */
13 .globl setup_selectors
14 setup_selectors:
15 /* set data selectors directly */
16 movl 8(%esp), %eax
17 movw %ax, %ss
18 movw %ax, %es
19 movw %ax, %ds
20 movw %ax, %gs
21 movw %ax, %fs
22 /* set cs using a long jump */
23 movl 4(%esp), %eax
24 movw %ax, (seg)
25 movl $ldcs, (off)
26 ljmp *off
27 ldcs:
28 ret
30 /* set_gdt(uint32_t addr, uint16_t limit)
31 * loads the GDTR with the new address and limit for the GDT */
32 .globl set_gdt
33 set_gdt:
34 movl 4(%esp), %eax
35 movl %eax, (addr)
36 movw 8(%esp), %ax
37 movw %ax, (lim)
38 lgdt (lim)
39 ret