kern

view src/segm-asm.S @ 73:b4b7198986a6

fixed a potential null dereference when deleting a bug in the redblack tree
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 15 Oct 2011 08:06:10 +0300
parents 4eaecb14fe31
children
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
41 /* set_task_reg(uint16_t tss_selector)
42 * loads the TSS selector in the task register */
43 .globl set_task_reg
44 set_task_reg:
45 mov 4(%esp), %eax
46 ltr 4(%esp)
47 ret