Ignore:
File:
1 edited

Legend:

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

    r0f17bff r8d427a3  
    3131 */
    3232
    33 #include <abi/asmtool.h>
    3433#include <arch/pm.h>
    3534#include <arch/cpu.h>
    3635#include <arch/mm/page.h>
    3736#include <arch/istate_struct.h>
    38 #include <arch/smp/apic.h>
    3937
    4038.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
    4146
    4247#define MEMCPY_DST   4
     
    5964 *
    6065 */
    61 FUNCTION_BEGIN(memcpy_from_uspace)
    62 FUNCTION_BEGIN(memcpy_to_uspace)
     66memcpy_from_uspace:
     67memcpy_to_uspace:
    6368        movl %edi, %edx  /* save %edi */
    6469        movl %esi, %eax  /* save %esi */
     
    8893                movl MEMCPY_DST(%esp), %eax
    8994                ret
    90 FUNCTION_END(memcpy_from_uspace)
    91 FUNCTION_END(memcpy_to_uspace)
    9295
    9396/*
     
    9598 * above had caused a page fault.
    9699 */
    97 SYMBOL(memcpy_from_uspace_failover_address)
    98 SYMBOL(memcpy_to_uspace_failover_address)
     100memcpy_from_uspace_failover_address:
     101memcpy_to_uspace_failover_address:
    99102        movl %edx, %edi
    100103        movl %eax, %esi
     
    109112 *
    110113 */
    111 FUNCTION_BEGIN(paging_on)
     114paging_on:
    112115        movl %cr0, %edx
    113         orl $CR0_PG, %edx  /* paging on */
     116        orl $(1 << 31), %edx  /* paging on */
    114117       
    115118        /* Clear Cache Disable and not Write Though */
    116         andl $~(CR0_CD | CR0_NW), %edx
     119        andl $~((1 << 30) | (1 << 29)), %edx
    117120        movl %edx, %cr0
    118121        jmp 0f
     
    120123        0:
    121124                ret
    122 FUNCTION_END(paging_on)
    123125
    124126/** Enable local APIC
     
    127129 *
    128130 */
    129 FUNCTION_BEGIN(enable_l_apic_in_msr)
    130         movl $IA32_MSR_APIC_BASE, %ecx
     131enable_l_apic_in_msr:
     132        movl $0x1b, %ecx
    131133        rdmsr
    132         orl $(L_APIC_BASE | IA32_APIC_BASE_GE), %eax
     134        orl $(1 << 11), %eax
     135        orl $(0xfee00000), %eax
    133136        wrmsr
    134137        ret
    135 FUNCTION_END(enable_l_apic_in_msr)
    136138
    137139/*
     
    150152 * entirely in registers.
    151153 */
    152 SYMBOL(sysenter_handler)
     154.global sysenter_handler
     155sysenter_handler:
    153156
    154157        /*
     
    183186
    184187        /*
     188         * Save TLS.
     189         */
     190        movl %gs, %edx
     191        movl %edx, ISTATE_OFFSET_GS(%esp)
     192
     193        /*
    185194         * Switch to kernel selectors.
    186195         */
    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
     196        movw $(GDT_SELECTOR(KDATA_DES)), %ax
     197        movw %ax, %ds
     198        movw %ax, %es
    192199       
    193200        /*
     
    209216       
    210217        /*
     218         * Restore TLS.
     219         */
     220        movl ISTATE_OFFSET_GS(%esp), %edx
     221        movl %edx, %gs
     222       
     223        /*
    211224         * Prepare return address and userspace stack for SYSEXIT.
    212225         */
     
    219232 * This is the legacy syscall handler using the interrupt mechanism.
    220233 */
    221 SYMBOL(int_syscall)
     234.global int_syscall
     235int_syscall:
    222236        subl $(ISTATE_SOFT_SIZE + 4), %esp
    223237
     
    242256
    243257        /*
    244          * Save the segment registers.
     258         * Save the selector registers.
    245259         */
    246260        movl %gs, %ecx
     
    262276        movl %eax, %ds
    263277        movl %eax, %es
    264         movl $(GDT_SELECTOR(VREG_DES)), %eax
    265         movl %eax, %gs
    266278               
    267279        movl $0, ISTATE_OFFSET_EBP_FRAME(%esp)
     
    276288                       
    277289        /*
    278          * Restore the segment registers.
     290         * Restore the selector registers.
    279291         */
    280292        movl ISTATE_OFFSET_GS(%esp), %ecx
     
    307319
    308320.macro handler i
    309 SYMBOL(int_\i)
     321.global int_\i
     322int_\i:
    310323        /*
    311324         * This macro distinguishes between two versions of ia32
     
    346359       
    347360        /*
    348          * Save the segment registers.
     361         * Save the selector registers.
    349362         */
    350363        movl %gs, %ecx
     
    366379        movl %eax, %ds
    367380        movl %eax, %es
    368         movl $(GDT_SELECTOR(VREG_DES)), %eax
    369         movl %eax, %gs
    370381       
    371382        /*
     
    451462 *
    452463 */
    453 FUNCTION_BEGIN(early_putchar)
     464early_putchar:
    454465       
    455466#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
     
    583594       
    584595        ret
    585 FUNCTION_END(early_putchar)
    586 
     596
Note: See TracChangeset for help on using the changeset viewer.