Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/asm.S

    r8d427a3 r0f17bff  
    3131 */
    3232
     33#include <abi/asmtool.h>
    3334#include <arch/pm.h>
    3435#include <arch/cpu.h>
    3536#include <arch/mm/page.h>
    3637#include <arch/istate_struct.h>
     38#include <arch/smp/apic.h>
    3739
    3840.text
    39 .global paging_on
    40 .global enable_l_apic_in_msr
    41 .global memcpy_from_uspace
    42 .global memcpy_from_uspace_failover_address
    43 .global memcpy_to_uspace
    44 .global memcpy_to_uspace_failover_address
    45 .global early_putchar
    4641
    4742#define MEMCPY_DST   4
     
    6459 *
    6560 */
    66 memcpy_from_uspace:
    67 memcpy_to_uspace:
     61FUNCTION_BEGIN(memcpy_from_uspace)
     62FUNCTION_BEGIN(memcpy_to_uspace)
    6863        movl %edi, %edx  /* save %edi */
    6964        movl %esi, %eax  /* save %esi */
     
    9388                movl MEMCPY_DST(%esp), %eax
    9489                ret
     90FUNCTION_END(memcpy_from_uspace)
     91FUNCTION_END(memcpy_to_uspace)
    9592
    9693/*
     
    9895 * above had caused a page fault.
    9996 */
    100 memcpy_from_uspace_failover_address:
    101 memcpy_to_uspace_failover_address:
     97SYMBOL(memcpy_from_uspace_failover_address)
     98SYMBOL(memcpy_to_uspace_failover_address)
    10299        movl %edx, %edi
    103100        movl %eax, %esi
     
    112109 *
    113110 */
    114 paging_on:
     111FUNCTION_BEGIN(paging_on)
    115112        movl %cr0, %edx
    116         orl $(1 << 31), %edx  /* paging on */
     113        orl $CR0_PG, %edx  /* paging on */
    117114       
    118115        /* Clear Cache Disable and not Write Though */
    119         andl $~((1 << 30) | (1 << 29)), %edx
     116        andl $~(CR0_CD | CR0_NW), %edx
    120117        movl %edx, %cr0
    121118        jmp 0f
     
    123120        0:
    124121                ret
     122FUNCTION_END(paging_on)
    125123
    126124/** Enable local APIC
     
    129127 *
    130128 */
    131 enable_l_apic_in_msr:
    132         movl $0x1b, %ecx
     129FUNCTION_BEGIN(enable_l_apic_in_msr)
     130        movl $IA32_MSR_APIC_BASE, %ecx
    133131        rdmsr
    134         orl $(1 << 11), %eax
    135         orl $(0xfee00000), %eax
     132        orl $(L_APIC_BASE | IA32_APIC_BASE_GE), %eax
    136133        wrmsr
    137134        ret
     135FUNCTION_END(enable_l_apic_in_msr)
    138136
    139137/*
     
    152150 * entirely in registers.
    153151 */
    154 .global sysenter_handler
    155 sysenter_handler:
     152SYMBOL(sysenter_handler)
    156153
    157154        /*
     
    186183
    187184        /*
    188          * Save TLS.
    189          */
    190         movl %gs, %edx
    191         movl %edx, ISTATE_OFFSET_GS(%esp)
    192 
    193         /*
    194185         * Switch to kernel selectors.
    195186         */
    196         movw $(GDT_SELECTOR(KDATA_DES)), %ax
    197         movw %ax, %ds
    198         movw %ax, %es
     187        movl $(GDT_SELECTOR(KDATA_DES)), %eax
     188        movl %eax, %ds
     189        movl %eax, %es
     190        movl $(GDT_SELECTOR(VREG_DES)), %eax
     191        movl %eax, %gs
    199192       
    200193        /*
     
    216209       
    217210        /*
    218          * Restore TLS.
    219          */
    220         movl ISTATE_OFFSET_GS(%esp), %edx
    221         movl %edx, %gs
    222        
    223         /*
    224211         * Prepare return address and userspace stack for SYSEXIT.
    225212         */
     
    232219 * This is the legacy syscall handler using the interrupt mechanism.
    233220 */
    234 .global int_syscall
    235 int_syscall:
     221SYMBOL(int_syscall)
    236222        subl $(ISTATE_SOFT_SIZE + 4), %esp
    237223
     
    256242
    257243        /*
    258          * Save the selector registers.
     244         * Save the segment registers.
    259245         */
    260246        movl %gs, %ecx
     
    276262        movl %eax, %ds
    277263        movl %eax, %es
     264        movl $(GDT_SELECTOR(VREG_DES)), %eax
     265        movl %eax, %gs
    278266               
    279267        movl $0, ISTATE_OFFSET_EBP_FRAME(%esp)
     
    288276                       
    289277        /*
    290          * Restore the selector registers.
     278         * Restore the segment registers.
    291279         */
    292280        movl ISTATE_OFFSET_GS(%esp), %ecx
     
    319307
    320308.macro handler i
    321 .global int_\i
    322 int_\i:
     309SYMBOL(int_\i)
    323310        /*
    324311         * This macro distinguishes between two versions of ia32
     
    359346       
    360347        /*
    361          * Save the selector registers.
     348         * Save the segment registers.
    362349         */
    363350        movl %gs, %ecx
     
    379366        movl %eax, %ds
    380367        movl %eax, %es
     368        movl $(GDT_SELECTOR(VREG_DES)), %eax
     369        movl %eax, %gs
    381370       
    382371        /*
     
    462451 *
    463452 */
    464 early_putchar:
     453FUNCTION_BEGIN(early_putchar)
    465454       
    466455#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
     
    594583       
    595584        ret
    596 
     585FUNCTION_END(early_putchar)
     586
Note: See TracChangeset for help on using the changeset viewer.