Changeset 368 for trunk/hal


Ignore:
Timestamp:
Aug 14, 2017, 12:32:08 PM (4 years ago)
Author:
max@…
Message:

Switch the VM space, and explicitly disable the FPU.

Location:
trunk/hal/x86_64/core
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/core/hal_boot.S

    r312 r368  
    416416        orl     $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax
    417417        andl    $~(CR0_CD|CR0_NW),%eax
     418        orl     $(CR0_EM),%eax  /* FPU not implemented yet */
    418419        movl    %eax,%cr0
    419420        jmp     compat
  • trunk/hal/x86_64/core/hal_context.c

    r361 r368  
    109109        /* Switch the VM space */
    110110        if (newproc != oldproc) {
    111                 // TODO userland
    112                 x86_panic((char *)__func__);
     111                lcr3((uint64_t)newproc->vmm.gpt.ppn << CONFIG_PPM_PAGE_SHIFT);
    113112        }
    114113
     
    124123error_t hal_fpu_context_create( thread_t * thread )
    125124{
    126         x86_panic((char *)__func__);
     125        /* FPU not implemented yet */
    127126        return 0;
    128127}
  • trunk/hal/x86_64/core/hal_cpu.S

    r365 r368  
    119119ASM_ENTRY(rcr3)
    120120        movq    %cr3,%rax
     121        ret
     122
     123ASM_ENTRY(lcr3)
     124        movq    %rdi,%cr3
    121125        ret
    122126
  • trunk/hal/x86_64/core/hal_gpt.c

    r319 r368  
    290290        L4dst = (pt_entry_t *)ppm_page2base(page_xp);
    291291        memcpy(&L4dst[256], &L4src[256], 256 * sizeof(pt_entry_t));
    292         L4dst[L4_SLOT_PTE] = (ppm_page2ppn(page_xp) >> CONFIG_PPM_PAGE_SHIFT) |
     292        L4dst[L4_SLOT_PTE] = (ppm_page2ppn(page_xp) << CONFIG_PPM_PAGE_SHIFT) |
    293293            PG_V | PG_KW | PG_NX;
    294294
  • trunk/hal/x86_64/core/hal_internal.h

    r339 r368  
    5151vaddr_t rcr2(void);
    5252uint64_t rcr3(void);
     53void lcr3(uint64_t);
    5354uint64_t rcr4(void);
    5455void lcr4(uint64_t);
  • trunk/hal/x86_64/core/hal_smpboot.S

    r329 r368  
    152152        orl     $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax
    153153        andl    $~(CR0_CD|CR0_NW),%eax
     154        orl     $(CR0_EM),%eax  /* FPU not implemented yet */
    154155        movl    %eax,%cr0
    155156
  • trunk/hal/x86_64/core/hal_special.c

    r336 r368  
    8787void hal_fpu_enable()
    8888{
    89         x86_panic((char *)__func__);
     89        /* FPU not implemented yet */
     90        return;
    9091        clts();
    9192}
     
    9394void hal_fpu_disable()
    9495{
    95         x86_panic((char *)__func__);
     96        /* FPU not implemented yet */
     97        return;
    9698        stts();
    9799}
Note: See TracChangeset for help on using the changeset viewer.