Changes in / [d078c9b9:4c3602c4] in mainline


Ignore:
Files:
80 added
8 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    rd078c9b9 r4c3602c4  
    137137! [PLATFORM=mips32&(MACHINE=bmalta|MACHINE=lmalta)] PROCESSOR (choice)
    138138
     139% Kernel memory model
     140@ "kernel" Kernel
     141@ "large" Large
     142! [PLATFORM=amd64] MEMORY_MODEL (choice)
     143
    139144% RAM disk format
    140145@ "tmpfs" TMPFS image
  • defaults/amd64/Makefile.config

    rd078c9b9 r4c3602c4  
    11# Platform
    22PLATFORM = amd64
     3
     4# Kernel memory model
     5MEMORY_MODEL = kernel
    36
    47# Ramdisk format
  • kernel/arch/amd64/Makefile.inc

    rd078c9b9 r4c3602c4  
    3232
    3333FPU_NO_CFLAGS = -mno-sse -mno-sse2
    34 CMN1 = -m64 -mcmodel=kernel -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer
     34CMN1 = -m64 -mcmodel=$(MEMORY_MODEL) -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer
    3535GCC_CFLAGS += $(CMN1)
    3636ICC_CFLAGS += $(CMN1)
  • kernel/arch/amd64/include/arch/mm/km.h

    rd078c9b9 r4c3602c4  
    3838#include <typedefs.h>
    3939
    40 #define KM_AMD64_IDENTITY_START         UINT64_C(0xffffffff80000000)
    41 #define KM_AMD64_IDENTITY_SIZE          UINT64_C(0x0000000080000000)
     40#ifdef MEMORY_MODEL_kernel
    4241
    43 #define KM_AMD64_NON_IDENTITY_START     UINT64_C(0xffff800000000000)
    44 #define KM_AMD64_NON_IDENTITY_SIZE      UINT64_C(0x00007fff80000000)
     42#define KM_AMD64_IDENTITY_START      UINT64_C(0xffffffff80000000)
     43#define KM_AMD64_IDENTITY_SIZE       UINT64_C(0x0000000080000000)
     44
     45#define KM_AMD64_NON_IDENTITY_START  UINT64_C(0xffff800000000000)
     46#define KM_AMD64_NON_IDENTITY_SIZE   UINT64_C(0x00007fff80000000)
     47
     48#endif /* MEMORY_MODEL_kernel */
     49
     50#ifdef MEMORY_MODEL_large
     51
     52#define KM_AMD64_IDENTITY_START      UINT64_C(0xffff800000000000)
     53#define KM_AMD64_IDENTITY_SIZE       UINT64_C(0x0000400000000000)
     54
     55#define KM_AMD64_NON_IDENTITY_START  UINT64_C(0xffffc00000000000)
     56#define KM_AMD64_NON_IDENTITY_SIZE   UINT64_C(0x0000400000000000)
     57
     58#endif /* MEMORY_MODEL_large */
    4559
    4660extern void km_identity_arch_init(void);
  • kernel/arch/amd64/include/arch/mm/page.h

    rd078c9b9 r4c3602c4  
    4242#define PAGE_SIZE   FRAME_SIZE
    4343
     44#ifdef MEMORY_MODEL_kernel
     45
    4446#ifndef __ASM__
    4547
     
    5355
    5456#endif /* __ASM__ */
     57
     58#endif /* MEMORY_MODEL_kernel */
     59
     60#ifdef MEMORY_MODEL_large
     61
     62#ifndef __ASM__
     63
     64#define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffff800000000000))
     65#define PA2KA(x)  (((uintptr_t) (x)) + UINT64_C(0xffff800000000000))
     66
     67#else /* __ASM__ */
     68
     69#define KA2PA(x)  ((x) - 0xffff800000000000)
     70#define PA2KA(x)  ((x) + 0xffff800000000000)
     71
     72#endif /* __ASM__ */
     73
     74#endif /* MEMORY_MODEL_large */
    5575
    5676/* Number of entries in each level. */
  • kernel/arch/amd64/src/boot/multiboot.S

    rd078c9b9 r4c3602c4  
    430430        movl multiboot_eax, %edi
    431431        movl multiboot_ebx, %esi
     432       
     433#ifdef MEMORY_MODEL_large
     434        movabsq $amd64_pre_main, %rax
     435        callq *%rax
     436#else
    432437        callq amd64_pre_main
    433 
     438#endif
     439       
    434440        long_status $status_main
    435441       
    436442        /* Call main_bsp() */
    437         callq main_bsp
     443#ifdef MEMORY_MODEL_large
     444        movabsq $main_bsp, %rax
     445        callq *%rax
     446#else
     447        callq main_bsp
     448#endif
    438449       
    439450        /* Not reached */
     
    622633        ptl2gen 512 7
    623634
     635#ifdef MEMORY_MODEL_kernel
    624636.align 4096
    625637ptl_1:
     
    638650        .quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
    639651
    640 
    641652.align 4096
    642653SYMBOL(ptl_0)
     
    644655        .fill 510, 8, 0
    645656        .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
     657#endif
     658
     659#ifdef MEMORY_MODEL_large
     660.align 4096
     661ptl_1:
     662        /* Identity mapping for [0; 8G) */
     663        .quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
     664        .quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
     665        .quad ptl_2_2g + (PTL_WRITABLE | PTL_PRESENT)
     666        .quad ptl_2_3g + (PTL_WRITABLE | PTL_PRESENT)
     667        .quad ptl_2_4g + (PTL_WRITABLE | PTL_PRESENT)
     668        .quad ptl_2_5g + (PTL_WRITABLE | PTL_PRESENT)
     669        .quad ptl_2_6g + (PTL_WRITABLE | PTL_PRESENT)
     670        .quad ptl_2_7g + (PTL_WRITABLE | PTL_PRESENT)
     671        .fill 504, 8, 0
     672
     673.align 4096
     674SYMBOL(ptl_0)
     675        .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
     676        .fill 255, 8, 0
     677        .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
     678        .fill 255, 8, 0
     679#endif
    646680
    647681.section K_DATA_START, "aw", @progbits
  • kernel/arch/amd64/src/boot/multiboot2.S

    rd078c9b9 r4c3602c4  
    253253        movl multiboot_eax, %edi
    254254        movl multiboot_ebx, %esi
    255         callq amd64_pre_main
     255       
     256#ifdef MEMORY_MODEL_large
     257        movabsq $amd64_pre_main, %rax
     258        callq *%rax
     259#else
     260        callq amd64_pre_main
     261#endif
    256262       
    257263        /* Call main_bsp() */
    258         callq main_bsp
     264#ifdef MEMORY_MODEL_large
     265        movabsq $main_bsp, %rax
     266        callq *%rax
     267#else
     268        callq main_bsp
     269#endif
    259270       
    260271        /* Not reached */
  • kernel/arch/amd64/src/context.S

    rd078c9b9 r4c3602c4  
    5050        movq %r14, CONTEXT_OFFSET_R14(%rdi)
    5151        movq %r15, CONTEXT_OFFSET_R15(%rdi)
    52 
     52       
     53#ifdef MEMORY_MODEL_large
     54        movabsq $vreg_ptr, %rsi
     55        movq (%rsi), %rsi
     56#else
    5357        movq vreg_ptr, %rsi
     58#endif
    5459        movq %fs:VREG_TP(%rsi), %rsi
    5560        movq %rsi, CONTEXT_OFFSET_TP(%rdi)
     
    7984        movq %rdx, (%rsp)
    8085       
    81         movq CONTEXT_OFFSET_TP(%rdi), %rcx
     86        movq CONTEXT_OFFSET_TP(%rdi), %rcx
     87#ifdef MEMORY_MODEL_large
     88        movabsq $vreg_ptr, %rsi
     89        movq (%rsi), %rsi
     90#else
    8291        movq vreg_ptr, %rsi
     92#endif
    8393        movq %rcx, %fs:VREG_TP(%rsi)
    8494       
Note: See TracChangeset for help on using the changeset viewer.