CMake style all changed files
Signed-off-by: Kent McLeod <kent@kry10.com>
This commit is contained in:
parent
bfb45ec550
commit
4cdc428082
19 changed files with 1076 additions and 1484 deletions
|
|
@ -11,22 +11,17 @@ set(KERNEL_CONFIG_PATH "${CMAKE_CURRENT_LIST_DIR}/configs/seL4Config.cmake" CACH
|
|||
mark_as_advanced(KERNEL_PATH KERNEL_HELPERS_PATH KERNEL_CONFIG_PATH)
|
||||
|
||||
macro(sel4_import_kernel)
|
||||
add_subdirectory(${KERNEL_PATH} ${CMAKE_BINARY_DIR}/kernel)
|
||||
add_subdirectory(${KERNEL_PATH} ${CMAKE_BINARY_DIR}/kernel)
|
||||
endmacro()
|
||||
|
||||
macro(sel4_import_libsel4)
|
||||
add_subdirectory("${KERNEL_PATH}/libsel4" ${CMAKE_BINARY_DIR}/libsel4)
|
||||
add_subdirectory("${KERNEL_PATH}/libsel4" ${CMAKE_BINARY_DIR}/libsel4)
|
||||
endmacro()
|
||||
|
||||
macro(sel4_configure_platform_settings)
|
||||
include(${KERNEL_CONFIG_PATH})
|
||||
include(${KERNEL_CONFIG_PATH})
|
||||
endmacro()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
seL4
|
||||
DEFAULT_MSG
|
||||
KERNEL_PATH
|
||||
KERNEL_HELPERS_PATH
|
||||
KERNEL_CONFIG_PATH
|
||||
)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(seL4 DEFAULT_MSG KERNEL_PATH KERNEL_HELPERS_PATH
|
||||
KERNEL_CONFIG_PATH)
|
||||
|
|
|
|||
721
config.cmake
721
config.cmake
|
|
@ -4,90 +4,68 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
config_option(
|
||||
KernelIsMCS KERNEL_MCS "Use the MCS kernel configuration, which is not verified." DEFAULT OFF
|
||||
)
|
||||
config_option(KernelIsMCS KERNEL_MCS "Use the MCS kernel configuration, which is not verified."
|
||||
DEFAULT OFF)
|
||||
|
||||
# Error for unsupported MCS platforms
|
||||
if(KernelIsMCS AND (NOT KernelPlatformSupportsMCS))
|
||||
message(
|
||||
FATAL_ERROR "KernelIsMCS selected, but platform: ${KernelPlatform} does not support it."
|
||||
)
|
||||
message(FATAL_ERROR "KernelIsMCS selected, but platform: ${KernelPlatform} does not support it.")
|
||||
endif()
|
||||
|
||||
# Proof based configuration variables
|
||||
set(CSPEC_DIR
|
||||
"."
|
||||
CACHE PATH ""
|
||||
)
|
||||
set(SKIP_MODIFIES
|
||||
ON
|
||||
CACHE BOOL ""
|
||||
)
|
||||
set(SORRY_BITFIELD_PROOFS
|
||||
OFF
|
||||
CACHE BOOL ""
|
||||
)
|
||||
set(CSPEC_DIR "." CACHE PATH "")
|
||||
set(SKIP_MODIFIES ON CACHE BOOL "")
|
||||
set(SORRY_BITFIELD_PROOFS OFF CACHE BOOL "")
|
||||
find_file(UMM_TYPES umm_types.txt CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
set(force FORCE)
|
||||
if(KernelVerificationBuild)
|
||||
set(force CLEAR)
|
||||
set(force CLEAR)
|
||||
endif()
|
||||
mark_as_advanced(${force} CSPEC_DIR SKIP_MODIFIES SORRY_BITFIELD_PROOFS UMM_TYPES)
|
||||
# Use a custom target for collecting information during generation that we need during build
|
||||
add_custom_target(kernel_config_target)
|
||||
# Put our common top level types in
|
||||
set_property(
|
||||
TARGET kernel_config_target
|
||||
APPEND
|
||||
PROPERTY TOPLEVELTYPES
|
||||
cte_C
|
||||
tcb_C
|
||||
endpoint_C
|
||||
notification_C
|
||||
asid_pool_C
|
||||
pte_C
|
||||
user_data_C
|
||||
user_data_device_C
|
||||
)
|
||||
TARGET kernel_config_target
|
||||
APPEND
|
||||
PROPERTY TOPLEVELTYPES
|
||||
cte_C
|
||||
tcb_C
|
||||
endpoint_C
|
||||
notification_C
|
||||
asid_pool_C
|
||||
pte_C
|
||||
user_data_C
|
||||
user_data_device_C)
|
||||
|
||||
# These options are now set in seL4Config.cmake
|
||||
if(DEFINED CALLED_declare_default_headers)
|
||||
# calculate the irq cnode size based on MAX_NUM_IRQ
|
||||
if("${KernelArch}" STREQUAL "riscv")
|
||||
math(EXPR MAX_NUM_IRQ "${CONFIGURE_MAX_IRQ} + 2")
|
||||
# calculate the irq cnode size based on MAX_NUM_IRQ
|
||||
if("${KernelArch}" STREQUAL "riscv")
|
||||
math(EXPR MAX_NUM_IRQ "${CONFIGURE_MAX_IRQ} + 2")
|
||||
else()
|
||||
if(DEFINED KernelMaxNumNodes AND CONFIGURE_NUM_PPI GREATER "0" AND "${KernelArch}" STREQUAL
|
||||
"arm")
|
||||
math(EXPR MAX_NUM_IRQ "(${KernelMaxNumNodes}-1)*${CONFIGURE_NUM_PPI} + ${CONFIGURE_MAX_IRQ}")
|
||||
else()
|
||||
if(DEFINED KernelMaxNumNodes
|
||||
AND CONFIGURE_NUM_PPI GREATER "0"
|
||||
AND "${KernelArch}" STREQUAL "arm"
|
||||
)
|
||||
math(EXPR MAX_NUM_IRQ
|
||||
"(${KernelMaxNumNodes}-1)*${CONFIGURE_NUM_PPI} + ${CONFIGURE_MAX_IRQ}"
|
||||
)
|
||||
else()
|
||||
set(MAX_NUM_IRQ "${CONFIGURE_MAX_IRQ}")
|
||||
endif()
|
||||
set(MAX_NUM_IRQ "${CONFIGURE_MAX_IRQ}")
|
||||
endif()
|
||||
set(BITS "0")
|
||||
while(MAX_NUM_IRQ GREATER "0")
|
||||
math(EXPR BITS "${BITS} + 1")
|
||||
math(EXPR MAX_NUM_IRQ "${MAX_NUM_IRQ} >> 1")
|
||||
endwhile()
|
||||
set(CONFIGURE_IRQ_SLOT_BITS
|
||||
"${BITS}"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
if(NOT DEFINED CONFIGURE_TIMER_PRECISION)
|
||||
set(CONFIGURE_TIMER_PRECISION "0")
|
||||
endif()
|
||||
if(NOT DEFINED CONFIGURE_TIMER_OVERHEAD_TICKS)
|
||||
set(CONFIGURE_TIMER_OVERHEAD_TICKS "0")
|
||||
endif()
|
||||
configure_file(
|
||||
src/arch/${KernelArch}/platform_gen.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/platform_gen.h @ONLY
|
||||
)
|
||||
include_directories(include/plat/default)
|
||||
endif()
|
||||
set(BITS "0")
|
||||
while(MAX_NUM_IRQ GREATER "0")
|
||||
math(EXPR BITS "${BITS} + 1")
|
||||
math(EXPR MAX_NUM_IRQ "${MAX_NUM_IRQ} >> 1")
|
||||
endwhile()
|
||||
set(CONFIGURE_IRQ_SLOT_BITS "${BITS}" CACHE INTERNAL "")
|
||||
if(NOT DEFINED CONFIGURE_TIMER_PRECISION)
|
||||
set(CONFIGURE_TIMER_PRECISION "0")
|
||||
endif()
|
||||
if(NOT DEFINED CONFIGURE_TIMER_OVERHEAD_TICKS)
|
||||
set(CONFIGURE_TIMER_OVERHEAD_TICKS "0")
|
||||
endif()
|
||||
configure_file(src/arch/${KernelArch}/platform_gen.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/platform_gen.h @ONLY)
|
||||
include_directories(include/plat/default)
|
||||
endif()
|
||||
|
||||
# Set defaults for common variables
|
||||
|
|
@ -98,19 +76,16 @@ include(src/arch/${KernelArch}/config.cmake)
|
|||
include(include/${KernelWordSize}/mode/config.cmake)
|
||||
include(src/config.cmake)
|
||||
|
||||
set(KernelCustomDTS
|
||||
""
|
||||
CACHE FILEPATH "Provide a device tree file to use instead of the \
|
||||
KernelPlatform's defaults"
|
||||
)
|
||||
set(KernelCustomDTS "" CACHE FILEPATH "Provide a device tree file to use instead of the \
|
||||
KernelPlatform's defaults")
|
||||
|
||||
if(NOT "${KernelCustomDTS}" STREQUAL "")
|
||||
if(NOT EXISTS ${KernelCustomDTS})
|
||||
message(FATAL_ERROR "Can't open external dts file '${KernelCustomDTS}'!")
|
||||
endif()
|
||||
# Override list to hold only custom dts
|
||||
set(KernelDTSList "${KernelCustomDTS}")
|
||||
message(STATUS "Using custom ${KernelCustomDTS} device tree, ignoring default dts and overlays")
|
||||
if(NOT EXISTS ${KernelCustomDTS})
|
||||
message(FATAL_ERROR "Can't open external dts file '${KernelCustomDTS}'!")
|
||||
endif()
|
||||
# Override list to hold only custom dts
|
||||
set(KernelDTSList "${KernelCustomDTS}")
|
||||
message(STATUS "Using custom ${KernelCustomDTS} device tree, ignoring default dts and overlays")
|
||||
endif()
|
||||
|
||||
# Enshrine common variables in the config
|
||||
|
|
@ -119,180 +94,124 @@ config_set(KernelPaddrUserTop PADDR_USER_DEVICE_TOP "${KernelPaddrUserTop}")
|
|||
|
||||
# System parameters
|
||||
config_string(
|
||||
KernelRootCNodeSizeBits
|
||||
ROOT_CNODE_SIZE_BITS
|
||||
"Root CNode Size (2^n slots) \
|
||||
KernelRootCNodeSizeBits
|
||||
ROOT_CNODE_SIZE_BITS
|
||||
"Root CNode Size (2^n slots) \
|
||||
The acceptable range is 8-27 and 7-26, for 32-bit and 64-bit respectively. \
|
||||
The root CNode needs at least enough space to contain seL4_NumInitialCaps \
|
||||
plus enough room for all the Untyped Caps."
|
||||
DEFAULT 12
|
||||
UNQUOTE
|
||||
)
|
||||
DEFAULT 12
|
||||
UNQUOTE)
|
||||
|
||||
config_string(KernelTimerTickMS TIMER_TICK_MS "Timer tick period in milliseconds" DEFAULT 2 UNQUOTE
|
||||
DEPENDS "NOT KernelIsMCS" UNDEF_DISABLED)
|
||||
config_string(KernelTimeSlice TIME_SLICE "Number of timer ticks until a thread is preempted."
|
||||
DEFAULT 5 UNQUOTE DEPENDS "NOT KernelIsMCS" UNDEF_DISABLED)
|
||||
config_string(
|
||||
KernelTimerTickMS TIMER_TICK_MS "Timer tick period in milliseconds"
|
||||
DEFAULT 2
|
||||
UNQUOTE
|
||||
DEPENDS "NOT KernelIsMCS"
|
||||
UNDEF_DISABLED
|
||||
)
|
||||
KernelBootThreadTimeSlice BOOT_THREAD_TIME_SLICE
|
||||
"Number of milliseconds until the boot thread is preempted." DEFAULT 5 UNQUOTE
|
||||
DEPENDS "KernelIsMCS" UNDEF_DISABLED)
|
||||
config_string(
|
||||
KernelTimeSlice TIME_SLICE "Number of timer ticks until a thread is preempted."
|
||||
DEFAULT 5
|
||||
UNQUOTE
|
||||
DEPENDS "NOT KernelIsMCS"
|
||||
UNDEF_DISABLED
|
||||
)
|
||||
KernelRetypeFanOutLimit RETYPE_FAN_OUT_LIMIT
|
||||
"Maximum number of objects that can be created in a single Retype() invocation." DEFAULT 256
|
||||
UNQUOTE)
|
||||
config_string(
|
||||
KernelBootThreadTimeSlice BOOT_THREAD_TIME_SLICE
|
||||
"Number of milliseconds until the boot thread is preempted."
|
||||
DEFAULT 5
|
||||
UNQUOTE
|
||||
DEPENDS "KernelIsMCS"
|
||||
UNDEF_DISABLED
|
||||
)
|
||||
config_string(
|
||||
KernelRetypeFanOutLimit RETYPE_FAN_OUT_LIMIT
|
||||
"Maximum number of objects that can be created in a single Retype() invocation."
|
||||
DEFAULT 256
|
||||
UNQUOTE
|
||||
)
|
||||
config_string(
|
||||
KernelMaxNumWorkUnitsPerPreemption MAX_NUM_WORK_UNITS_PER_PREEMPTION
|
||||
"Maximum number of work units (delete/revoke iterations) until the kernel checks for\
|
||||
KernelMaxNumWorkUnitsPerPreemption MAX_NUM_WORK_UNITS_PER_PREEMPTION
|
||||
"Maximum number of work units (delete/revoke iterations) until the kernel checks for\
|
||||
pending interrupts (and preempts the currently running syscall if interrupts are pending)."
|
||||
DEFAULT 100
|
||||
UNQUOTE
|
||||
)
|
||||
DEFAULT 100
|
||||
UNQUOTE)
|
||||
config_string(
|
||||
KernelResetChunkBits RESET_CHUNK_BITS
|
||||
"Maximum size in bits of chunks of memory to zero before checking a preemption point."
|
||||
DEFAULT 8
|
||||
UNQUOTE
|
||||
)
|
||||
config_string(
|
||||
KernelMaxNumBootinfoUntypedCaps MAX_NUM_BOOTINFO_UNTYPED_CAPS
|
||||
"Max number of bootinfo untyped caps"
|
||||
DEFAULT 230
|
||||
UNQUOTE
|
||||
)
|
||||
KernelResetChunkBits RESET_CHUNK_BITS
|
||||
"Maximum size in bits of chunks of memory to zero before checking a preemption point." DEFAULT 8
|
||||
UNQUOTE)
|
||||
config_string(KernelMaxNumBootinfoUntypedCaps MAX_NUM_BOOTINFO_UNTYPED_CAPS
|
||||
"Max number of bootinfo untyped caps" DEFAULT 230 UNQUOTE)
|
||||
config_option(KernelFastpath FASTPATH "Enable IPC fastpath" DEFAULT ON)
|
||||
|
||||
config_option(
|
||||
KernelExceptionFastpath EXCEPTION_FASTPATH "Enable exception fastpath"
|
||||
DEFAULT OFF
|
||||
DEPENDS "NOT KernelVerificationBuild; KernelSel4ArchAarch64"
|
||||
)
|
||||
config_option(KernelExceptionFastpath EXCEPTION_FASTPATH "Enable exception fastpath" DEFAULT OFF
|
||||
DEPENDS "NOT KernelVerificationBuild; KernelSel4ArchAarch64")
|
||||
|
||||
config_string(
|
||||
KernelNumDomains NUM_DOMAINS "The number of scheduler domains in the system"
|
||||
DEFAULT 1
|
||||
UNQUOTE
|
||||
)
|
||||
config_string(KernelNumDomains NUM_DOMAINS "The number of scheduler domains in the system" DEFAULT 1
|
||||
UNQUOTE)
|
||||
|
||||
config_option(
|
||||
KernelSignalFastpath SIGNAL_FASTPATH "Enable notification signal fastpath"
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelIsMCS; KernelFastpath; KernelSel4ArchAarch64; NOT KernelVerificationBuild"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
KernelSignalFastpath SIGNAL_FASTPATH "Enable notification signal fastpath" DEFAULT OFF
|
||||
DEPENDS "KernelIsMCS; KernelFastpath; KernelSel4ArchAarch64; NOT KernelVerificationBuild"
|
||||
DEFAULT_DISABLED OFF)
|
||||
|
||||
find_file(
|
||||
KernelDomainSchedule default_domain.c
|
||||
PATHS src/config
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
DOC "A C file providing the symbols ksDomSchedule and ksDomScheduleLength \
|
||||
to be linked with the kernel as a scheduling configuration."
|
||||
)
|
||||
find_file(KernelDomainSchedule default_domain.c PATHS src/config CMAKE_FIND_ROOT_PATH_BOTH
|
||||
DOC "A C file providing the symbols ksDomSchedule and ksDomScheduleLength \
|
||||
to be linked with the kernel as a scheduling configuration.")
|
||||
if(SEL4_CONFIG_DEFAULT_ADVANCED)
|
||||
mark_as_advanced(KernelDomainSchedule)
|
||||
mark_as_advanced(KernelDomainSchedule)
|
||||
endif()
|
||||
|
||||
config_string(
|
||||
KernelNumPriorities NUM_PRIORITIES "The number of priority levels per domain. Valid range 1-256"
|
||||
DEFAULT 256
|
||||
UNQUOTE
|
||||
)
|
||||
config_string(KernelNumPriorities NUM_PRIORITIES
|
||||
"The number of priority levels per domain. Valid range 1-256" DEFAULT 256 UNQUOTE)
|
||||
|
||||
config_string(
|
||||
KernelMaxNumNodes MAX_NUM_NODES "Max number of CPU cores to boot"
|
||||
DEFAULT 1
|
||||
DEPENDS "${KernelNumDomains} EQUAL 1"
|
||||
UNQUOTE
|
||||
)
|
||||
config_string(KernelMaxNumNodes MAX_NUM_NODES "Max number of CPU cores to boot" DEFAULT 1
|
||||
DEPENDS "${KernelNumDomains} EQUAL 1" UNQUOTE)
|
||||
|
||||
# Set CONFIG_ENABLE_SMP_SUPPORT as an alias of CONFIG_MAX_NUM_NODES > 1
|
||||
if(KernelMaxNumNodes GREATER 1)
|
||||
config_set(KernelEnableSMPSupport ENABLE_SMP_SUPPORT ON)
|
||||
config_set(KernelEnableSMPSupport ENABLE_SMP_SUPPORT ON)
|
||||
else()
|
||||
config_set(KernelEnableSMPSupport ENABLE_SMP_SUPPORT OFF)
|
||||
config_set(KernelEnableSMPSupport ENABLE_SMP_SUPPORT OFF)
|
||||
endif()
|
||||
|
||||
config_string(
|
||||
KernelStackBits
|
||||
KERNEL_STACK_BITS
|
||||
"This describes the log2 size of the kernel stack. Great care should be taken as\
|
||||
KernelStackBits
|
||||
KERNEL_STACK_BITS
|
||||
"This describes the log2 size of the kernel stack. Great care should be taken as\
|
||||
there is no guard below the stack so setting this too small will cause random\
|
||||
memory corruption"
|
||||
DEFAULT 12
|
||||
UNQUOTE
|
||||
)
|
||||
DEFAULT 12
|
||||
UNQUOTE)
|
||||
|
||||
config_option(
|
||||
KernelVerificationBuild
|
||||
VERIFICATION_BUILD
|
||||
"When enabled this configuration option prevents the usage of any other options that\
|
||||
KernelVerificationBuild
|
||||
VERIFICATION_BUILD
|
||||
"When enabled this configuration option prevents the usage of any other options that\
|
||||
would compromise the verification story of the kernel. Enabling this option does NOT\
|
||||
imply you are using a verified kernel."
|
||||
DEFAULT ON
|
||||
)
|
||||
DEFAULT ON)
|
||||
|
||||
config_option(
|
||||
KernelBinaryVerificationBuild
|
||||
BINARY_VERIFICATION_BUILD
|
||||
"When enabled, this configuration option restricts the use of other options that would \
|
||||
KernelBinaryVerificationBuild
|
||||
BINARY_VERIFICATION_BUILD
|
||||
"When enabled, this configuration option restricts the use of other options that would \
|
||||
interfere with binary verification. For example, it will disable some inter-procedural \
|
||||
optimisations. Enabling this options does NOT imply that you are using a verified kernel."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelVerificationBuild"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelVerificationBuild")
|
||||
|
||||
config_option(
|
||||
KernelDebugBuild DEBUG_BUILD "Enable debug facilities (symbols and assertions) in the kernel"
|
||||
DEFAULT ON
|
||||
DEPENDS "NOT KernelVerificationBuild"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
KernelDebugBuild DEBUG_BUILD "Enable debug facilities (symbols and assertions) in the kernel"
|
||||
DEFAULT ON DEPENDS "NOT KernelVerificationBuild" DEFAULT_DISABLED OFF)
|
||||
|
||||
config_option(
|
||||
HardwareDebugAPI
|
||||
HARDWARE_DEBUG_API
|
||||
"Builds the kernel with support for a userspace debug API, which can \
|
||||
HardwareDebugAPI
|
||||
HARDWARE_DEBUG_API
|
||||
"Builds the kernel with support for a userspace debug API, which can \
|
||||
allows userspace processes to set breakpoints, watchpoints and to \
|
||||
single-step through thread execution."
|
||||
DEFAULT OFF
|
||||
DEPENDS "NOT KernelVerificationBuild;NOT KernelHardwareDebugAPIUnsupported"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "NOT KernelVerificationBuild;NOT KernelHardwareDebugAPIUnsupported")
|
||||
config_option(
|
||||
KernelPrinting PRINTING
|
||||
"Allow the kernel to print out messages to the serial console during bootup and execution."
|
||||
DEFAULT "${KernelDebugBuild}"
|
||||
DEPENDS "NOT KernelVerificationBuild"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
KernelPrinting PRINTING
|
||||
"Allow the kernel to print out messages to the serial console during bootup and execution."
|
||||
DEFAULT "${KernelDebugBuild}" DEPENDS "NOT KernelVerificationBuild" DEFAULT_DISABLED OFF)
|
||||
|
||||
config_option(
|
||||
KernelInvocationReportErrorIPC KERNEL_INVOCATION_REPORT_ERROR_IPC
|
||||
"Allows the kernel to write the userError to the IPC buffer"
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelPrinting"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
KernelInvocationReportErrorIPC KERNEL_INVOCATION_REPORT_ERROR_IPC
|
||||
"Allows the kernel to write the userError to the IPC buffer" DEFAULT OFF DEPENDS "KernelPrinting"
|
||||
DEFAULT_DISABLED OFF)
|
||||
|
||||
config_choice(
|
||||
KernelBenchmarks
|
||||
KERNEL_BENCHMARK
|
||||
"Enable benchmarks including logging and tracing info. \
|
||||
KernelBenchmarks
|
||||
KERNEL_BENCHMARK
|
||||
"Enable benchmarks including logging and tracing info. \
|
||||
Setting this value > 1 enables a 1MB log buffer and functions for extracting data from it \
|
||||
at user level. NOTE this is only tested on the sabre and will not work on platforms with < 512mb memory. \
|
||||
This is not fully implemented for x86. \
|
||||
|
|
@ -302,301 +221,261 @@ config_choice(
|
|||
system calls, interrupts, user faults and VM faults. \
|
||||
tracepoints -> Enable manually inserted tracepoints that the kernel will track time consumed between. \
|
||||
track_utilisation -> Enable the kernel to track each thread's utilisation time."
|
||||
"none;KernelBenchmarksNone;NO_BENCHMARKS"
|
||||
"generic;KernelBenchmarksGeneric;BENCHMARK_GENERIC;NOT KernelVerificationBuild"
|
||||
"track_kernel_entries;KernelBenchmarksTrackKernelEntries;BENCHMARK_TRACK_KERNEL_ENTRIES;NOT KernelVerificationBuild"
|
||||
"tracepoints;KernelBenchmarksTracepoints;BENCHMARK_TRACEPOINTS;NOT KernelVerificationBuild"
|
||||
"track_utilisation;KernelBenchmarksTrackUtilisation;BENCHMARK_TRACK_UTILISATION;NOT KernelVerificationBuild"
|
||||
"none;KernelBenchmarksNone;NO_BENCHMARKS"
|
||||
"generic;KernelBenchmarksGeneric;BENCHMARK_GENERIC;NOT KernelVerificationBuild"
|
||||
"track_kernel_entries;KernelBenchmarksTrackKernelEntries;BENCHMARK_TRACK_KERNEL_ENTRIES;NOT KernelVerificationBuild"
|
||||
"tracepoints;KernelBenchmarksTracepoints;BENCHMARK_TRACEPOINTS;NOT KernelVerificationBuild"
|
||||
"track_utilisation;KernelBenchmarksTrackUtilisation;BENCHMARK_TRACK_UTILISATION;NOT KernelVerificationBuild"
|
||||
)
|
||||
if(NOT (KernelBenchmarks STREQUAL "none"))
|
||||
config_set(KernelEnableBenchmarks ENABLE_BENCHMARKS ON)
|
||||
config_set(KernelEnableBenchmarks ENABLE_BENCHMARKS ON)
|
||||
else()
|
||||
config_set(KernelEnableBenchmarks ENABLE_BENCHMARKS OFF)
|
||||
config_set(KernelEnableBenchmarks ENABLE_BENCHMARKS OFF)
|
||||
endif()
|
||||
|
||||
# Reflect the existence of kernel Log buffer
|
||||
if(KernelBenchmarksTrackKernelEntries OR KernelBenchmarksTracepoints)
|
||||
config_set(KernelLogBuffer KERNEL_LOG_BUFFER ON)
|
||||
config_set(KernelLogBuffer KERNEL_LOG_BUFFER ON)
|
||||
else()
|
||||
config_set(KernelLogBuffer KERNEL_LOG_BUFFER OFF)
|
||||
config_set(KernelLogBuffer KERNEL_LOG_BUFFER OFF)
|
||||
endif()
|
||||
|
||||
config_string(
|
||||
KernelMaxNumTracePoints
|
||||
MAX_NUM_TRACE_POINTS
|
||||
"Use TRACE_POINT_START(k) and TRACE_POINT_STOP(k) macros for recording data, \
|
||||
KernelMaxNumTracePoints
|
||||
MAX_NUM_TRACE_POINTS
|
||||
"Use TRACE_POINT_START(k) and TRACE_POINT_STOP(k) macros for recording data, \
|
||||
where k is an integer between 0 and this value - 1. The maximum number of \
|
||||
different trace point identifiers which can be used."
|
||||
DEFAULT 1
|
||||
DEPENDS "NOT KernelVerificationBuild;KernelBenchmarksTracepoints" DEFAULT_DISABLED 0
|
||||
UNQUOTE
|
||||
)
|
||||
DEFAULT 1
|
||||
DEPENDS "NOT KernelVerificationBuild;KernelBenchmarksTracepoints" DEFAULT_DISABLED 0
|
||||
UNQUOTE)
|
||||
|
||||
config_option(
|
||||
KernelIRQReporting
|
||||
IRQ_REPORTING
|
||||
"seL4 does not properly check for and handle spurious interrupts. This can result \
|
||||
KernelIRQReporting
|
||||
IRQ_REPORTING
|
||||
"seL4 does not properly check for and handle spurious interrupts. This can result \
|
||||
in unnecessary output from the kernel during debug builds. If you are CERTAIN these \
|
||||
messages are benign then use this config to turn them off."
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelPrinting"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelPrinting"
|
||||
DEFAULT_DISABLED OFF)
|
||||
config_option(
|
||||
KernelColourPrinting
|
||||
COLOUR_PRINTING
|
||||
"In debug mode, seL4 prints diagnostic messages to its serial output describing, \
|
||||
KernelColourPrinting
|
||||
COLOUR_PRINTING
|
||||
"In debug mode, seL4 prints diagnostic messages to its serial output describing, \
|
||||
e.g., the cause of system call errors. This setting determines whether ANSI escape \
|
||||
codes are applied to colour code these error messages. You may wish to disable this \
|
||||
setting if your serial output is redirected to a file or pipe."
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelPrinting"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelPrinting"
|
||||
DEFAULT_DISABLED OFF)
|
||||
config_string(
|
||||
KernelUserStackTraceLength USER_STACK_TRACE_LENGTH
|
||||
"On a double fault the kernel can try and print out the users stack to aid \
|
||||
KernelUserStackTraceLength USER_STACK_TRACE_LENGTH
|
||||
"On a double fault the kernel can try and print out the users stack to aid \
|
||||
debugging. This option determines how many words of stack should be printed."
|
||||
DEFAULT 16
|
||||
DEPENDS "KernelPrinting" DEFAULT_DISABLED 0
|
||||
UNQUOTE
|
||||
)
|
||||
DEFAULT 16
|
||||
DEPENDS "KernelPrinting" DEFAULT_DISABLED 0
|
||||
UNQUOTE)
|
||||
|
||||
config_choice(
|
||||
KernelOptimisation
|
||||
KERNEL_OPT_LEVEL
|
||||
"Select the kernel optimisation level"
|
||||
"-O2;KernelOptimisationO2;KERNEL_OPT_LEVEL_O2"
|
||||
"-Os;KernelOptimisationOS;KERNEL_OPT_LEVEL_OS"
|
||||
"-O0;KernelOptimisationO0;KERNEL_OPT_LEVEL_O0"
|
||||
"-O1;KernelOptimisationO1;KERNEL_OPT_LEVEL_O1"
|
||||
"-O3;KernelOptimisationO3;KERNEL_OPT_LEVEL_O3"
|
||||
)
|
||||
KernelOptimisation
|
||||
KERNEL_OPT_LEVEL
|
||||
"Select the kernel optimisation level"
|
||||
"-O2;KernelOptimisationO2;KERNEL_OPT_LEVEL_O2"
|
||||
"-Os;KernelOptimisationOS;KERNEL_OPT_LEVEL_OS"
|
||||
"-O0;KernelOptimisationO0;KERNEL_OPT_LEVEL_O0"
|
||||
"-O1;KernelOptimisationO1;KERNEL_OPT_LEVEL_O1"
|
||||
"-O3;KernelOptimisationO3;KERNEL_OPT_LEVEL_O3")
|
||||
|
||||
config_option(
|
||||
KernelOptimisationCloneFunctions
|
||||
KERNEL_OPTIMISATION_CLONE_FUNCTIONS
|
||||
"If enabled, allow inter-procedural optimisations that can generate cloned or partial \
|
||||
KernelOptimisationCloneFunctions
|
||||
KERNEL_OPTIMISATION_CLONE_FUNCTIONS
|
||||
"If enabled, allow inter-procedural optimisations that can generate cloned or partial \
|
||||
functions, according to the coarse optimisation setting (KernelOptimisation). \
|
||||
By default, these optimisations are present at -O2 and higher. \
|
||||
If disabled, prevent those optimisations, regardless of the coarse optimisation setting. \
|
||||
The main use of this option is to disable cloned and partial functions when performing \
|
||||
binary verification at -O2. \
|
||||
This currently only affects GCC builds."
|
||||
DEFAULT ON
|
||||
DEPENDS "NOT KernelBinaryVerificationBuild"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
DEFAULT ON
|
||||
DEPENDS "NOT KernelBinaryVerificationBuild"
|
||||
DEFAULT_DISABLED OFF)
|
||||
|
||||
config_option(
|
||||
KernelFWholeProgram KERNEL_FWHOLE_PROGRAM
|
||||
"Enable -fwhole-program when linking kernel. This should work modulo gcc bugs, which \
|
||||
KernelFWholeProgram KERNEL_FWHOLE_PROGRAM
|
||||
"Enable -fwhole-program when linking kernel. This should work modulo gcc bugs, which \
|
||||
are not uncommon with -fwhole-program. Consider this feature experimental!"
|
||||
DEFAULT OFF
|
||||
DEPENDS "NOT KernelBinaryVerificationBuild"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "NOT KernelBinaryVerificationBuild")
|
||||
|
||||
config_option(
|
||||
KernelDangerousCodeInjection DANGEROUS_CODE_INJECTION
|
||||
"Adds a system call that allows users to specify code to be run in kernel mode. \
|
||||
KernelDangerousCodeInjection DANGEROUS_CODE_INJECTION
|
||||
"Adds a system call that allows users to specify code to be run in kernel mode. \
|
||||
Useful for profiling."
|
||||
DEFAULT OFF
|
||||
DEPENDS
|
||||
"NOT KernelArmHypervisorSupport;NOT KernelVerificationBuild;NOT KernelPlatformHikey;NOT KernelSkimWindow"
|
||||
DEFAULT OFF
|
||||
DEPENDS
|
||||
"NOT KernelArmHypervisorSupport;NOT KernelVerificationBuild;NOT KernelPlatformHikey;NOT KernelSkimWindow"
|
||||
)
|
||||
|
||||
config_option(
|
||||
KernelDebugDisablePrefetchers
|
||||
DEBUG_DISABLE_PREFETCHERS
|
||||
"On ia32 platforms, this option disables the L2 hardware prefetcher, the L2 adjacent \
|
||||
KernelDebugDisablePrefetchers
|
||||
DEBUG_DISABLE_PREFETCHERS
|
||||
"On ia32 platforms, this option disables the L2 hardware prefetcher, the L2 adjacent \
|
||||
cache line prefetcher, the DCU prefetcher and the DCU IP prefetcher. On the cortex \
|
||||
a53 this disables the L1 Data prefetcher."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchX86 OR KernelPlatformHikey"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchX86 OR KernelPlatformHikey")
|
||||
|
||||
# Builds the kernel with support for an invocation to set the TLS_BASE
|
||||
# of the currently running thread without a capability.
|
||||
config_set(KernelSetTLSBaseSelf SET_TLS_BASE_SELF ${KernelSetTLSBaseSelf})
|
||||
|
||||
config_string(
|
||||
KernelWcetScale
|
||||
KERNEL_WCET_SCALE
|
||||
"Multiplier to scale kernel WCET estimate by: the kernel WCET estimate \
|
||||
KernelWcetScale
|
||||
KERNEL_WCET_SCALE
|
||||
"Multiplier to scale kernel WCET estimate by: the kernel WCET estimate \
|
||||
is used to ensure a thread has enough budget to get in and out of the \
|
||||
kernel. When running in a simulator the WCET estimate, which is tuned \
|
||||
for hardware, may not be sufficient. This option provides a hacky knob \
|
||||
that can be fiddled with when running inside a simulator."
|
||||
DEFAULT 1
|
||||
UNQUOTE
|
||||
DEPENDS "KernelIsMCS"
|
||||
UNDEF_DISABLED
|
||||
)
|
||||
DEFAULT 1
|
||||
UNQUOTE
|
||||
DEPENDS "KernelIsMCS"
|
||||
UNDEF_DISABLED)
|
||||
|
||||
config_string(
|
||||
KernelStaticMaxPeriodUs KERNEL_STATIC_MAX_PERIOD_US
|
||||
"Specifies a static maximum to which scheduling context can have \
|
||||
either its period or budget configured."
|
||||
DEFAULT 0
|
||||
UNQUOTE
|
||||
DEPENDS "KernelIsMCS"
|
||||
UNDEF_DISABLED
|
||||
)
|
||||
KernelStaticMaxPeriodUs KERNEL_STATIC_MAX_PERIOD_US
|
||||
"Specifies a static maximum to which scheduling context can have \
|
||||
either its period or budget configured." DEFAULT 0 UNQUOTE DEPENDS "KernelIsMCS" UNDEF_DISABLED)
|
||||
|
||||
config_option(
|
||||
KernelClz32 CLZ_32 "Define a __clzsi2 function to count leading zeros for uint32_t arguments. \
|
||||
Only needed on platforms which lack a builtin instruction." DEFAULT OFF
|
||||
)
|
||||
KernelClz32 CLZ_32 "Define a __clzsi2 function to count leading zeros for uint32_t arguments. \
|
||||
Only needed on platforms which lack a builtin instruction." DEFAULT OFF)
|
||||
|
||||
config_option(
|
||||
KernelClz64 CLZ_64 "Define a __clzdi2 function to count leading zeros for uint64_t arguments. \
|
||||
Only needed on platforms which lack a builtin instruction." DEFAULT OFF
|
||||
)
|
||||
KernelClz64 CLZ_64 "Define a __clzdi2 function to count leading zeros for uint64_t arguments. \
|
||||
Only needed on platforms which lack a builtin instruction." DEFAULT OFF)
|
||||
|
||||
config_option(
|
||||
KernelCtz32 CTZ_32 "Define a __ctzsi2 function to count trailing zeros for uint32_t arguments. \
|
||||
Only needed on platforms which lack a builtin instruction." DEFAULT OFF
|
||||
)
|
||||
KernelCtz32 CTZ_32 "Define a __ctzsi2 function to count trailing zeros for uint32_t arguments. \
|
||||
Only needed on platforms which lack a builtin instruction." DEFAULT OFF)
|
||||
|
||||
config_option(
|
||||
KernelCtz64 CTZ_64 "Define a __ctzdi2 function to count trailing zeros for uint64_t arguments. \
|
||||
Only needed on platforms which lack a builtin instruction." DEFAULT OFF
|
||||
)
|
||||
KernelCtz64 CTZ_64 "Define a __ctzdi2 function to count trailing zeros for uint64_t arguments. \
|
||||
Only needed on platforms which lack a builtin instruction." DEFAULT OFF)
|
||||
|
||||
config_option(
|
||||
KernelClzNoBuiltin CLZ_NO_BUILTIN
|
||||
"Expose implementations of clzl and clzll to verification by avoiding the use \
|
||||
of __builtin_clzl and __builtin_clzll." DEFAULT OFF
|
||||
)
|
||||
KernelClzNoBuiltin CLZ_NO_BUILTIN
|
||||
"Expose implementations of clzl and clzll to verification by avoiding the use \
|
||||
of __builtin_clzl and __builtin_clzll." DEFAULT OFF)
|
||||
|
||||
config_option(
|
||||
KernelCtzNoBuiltin CTZ_NO_BUILTIN
|
||||
"Expose implementations of ctzl and ctzll to verification by avoiding the use \
|
||||
of __builtin_ctzl and __builtin_ctzll." DEFAULT OFF
|
||||
)
|
||||
KernelCtzNoBuiltin CTZ_NO_BUILTIN
|
||||
"Expose implementations of ctzl and ctzll to verification by avoiding the use \
|
||||
of __builtin_ctzl and __builtin_ctzll." DEFAULT OFF)
|
||||
|
||||
if(DEFINED KernelDTSList AND (NOT "${KernelDTSList}" STREQUAL ""))
|
||||
set(KernelDTSIntermediate "${CMAKE_CURRENT_BINARY_DIR}/kernel.dts")
|
||||
set(KernelDTBPath
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/kernel.dtb"
|
||||
CACHE INTERNAL "Location of kernel DTB file"
|
||||
)
|
||||
set(compatibility_outfile "${CMAKE_CURRENT_BINARY_DIR}/kernel_compat.txt")
|
||||
set(device_dest "${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/machine/devices_gen.h")
|
||||
set(platform_yaml
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/machine/platform_gen.yaml"
|
||||
CACHE INTERNAL "Location of platform YAML description"
|
||||
)
|
||||
set(platform_json
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/machine/platform_gen.json"
|
||||
CACHE INTERNAL "Location of platform JSON description"
|
||||
)
|
||||
set(config_file "${CMAKE_CURRENT_SOURCE_DIR}/tools/hardware.yml")
|
||||
set(config_schema "${CMAKE_CURRENT_SOURCE_DIR}/tools/hardware_schema.yml")
|
||||
set(KernelCustomDTSOverlay
|
||||
""
|
||||
CACHE STRING
|
||||
"Provide an additional list of overlays to append to the selected KernelPlatform's \
|
||||
device tree during build time"
|
||||
)
|
||||
if(NOT "${KernelCustomDTSOverlay}" STREQUAL "")
|
||||
foreach(dts_entry IN ITEMS ${KernelCustomDTSOverlay})
|
||||
if(NOT EXISTS ${dts_entry})
|
||||
message(FATAL_ERROR "Can't open external overlay file '${dts_entry}'!")
|
||||
endif()
|
||||
list(APPEND KernelDTSList "${dts_entry}")
|
||||
message(STATUS "Appending ${dts_entry} overlay")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
find_program(DTC_TOOL dtc)
|
||||
if("${DTC_TOOL}" STREQUAL "DTC_TOOL-NOTFOUND")
|
||||
message(FATAL_ERROR "Cannot find 'dtc' program.")
|
||||
endif()
|
||||
find_program(STAT_TOOL stat)
|
||||
if("${STAT_TOOL}" STREQUAL "STAT_TOOL-NOTFOUND")
|
||||
message(FATAL_ERROR "Cannot find 'stat' program.")
|
||||
endif()
|
||||
mark_as_advanced(DTC_TOOL STAT_TOOL)
|
||||
# Generate final DTS based on Linux DTS + seL4 overlay[s]
|
||||
foreach(entry ${KernelDTSList})
|
||||
get_absolute_source_or_binary(dts_tmp ${entry})
|
||||
list(APPEND dts_list "${dts_tmp}")
|
||||
set(KernelDTSIntermediate "${CMAKE_CURRENT_BINARY_DIR}/kernel.dts")
|
||||
set(KernelDTBPath "${CMAKE_CURRENT_BINARY_DIR}/kernel.dtb" CACHE INTERNAL
|
||||
"Location of kernel DTB file")
|
||||
set(compatibility_outfile "${CMAKE_CURRENT_BINARY_DIR}/kernel_compat.txt")
|
||||
set(device_dest "${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/machine/devices_gen.h")
|
||||
set(platform_yaml "${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/machine/platform_gen.yaml"
|
||||
CACHE INTERNAL "Location of platform YAML description")
|
||||
set(platform_json "${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/machine/platform_gen.json"
|
||||
CACHE INTERNAL "Location of platform JSON description")
|
||||
set(config_file "${CMAKE_CURRENT_SOURCE_DIR}/tools/hardware.yml")
|
||||
set(config_schema "${CMAKE_CURRENT_SOURCE_DIR}/tools/hardware_schema.yml")
|
||||
set(KernelCustomDTSOverlay
|
||||
""
|
||||
CACHE STRING
|
||||
"Provide an additional list of overlays to append to the selected KernelPlatform's \
|
||||
device tree during build time")
|
||||
if(NOT "${KernelCustomDTSOverlay}" STREQUAL "")
|
||||
foreach(dts_entry IN ITEMS ${KernelCustomDTSOverlay})
|
||||
if(NOT EXISTS ${dts_entry})
|
||||
message(FATAL_ERROR "Can't open external overlay file '${dts_entry}'!")
|
||||
endif()
|
||||
list(APPEND KernelDTSList "${dts_entry}")
|
||||
message(STATUS "Appending ${dts_entry} overlay")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
check_outfile_stale(regen ${KernelDTBPath} dts_list ${CMAKE_CURRENT_BINARY_DIR}/dts.cmd)
|
||||
if(regen)
|
||||
file(REMOVE "${KernelDTSIntermediate}")
|
||||
foreach(entry ${dts_list})
|
||||
file(READ ${entry} CONTENTS)
|
||||
file(APPEND "${KernelDTSIntermediate}" "${CONTENTS}")
|
||||
endforeach()
|
||||
# Compile DTS to DTB
|
||||
execute_process(
|
||||
COMMAND ${DTC_TOOL} -q -I dts -O dtb -o ${KernelDTBPath} ${KernelDTSIntermediate}
|
||||
RESULT_VARIABLE error
|
||||
)
|
||||
if(error)
|
||||
message(FATAL_ERROR "Failed to compile DTS to DTB: ${KernelDTSIntermediate}")
|
||||
endif()
|
||||
# The macOS and GNU coreutils `stat` utilities have different interfaces.
|
||||
# Check if we're using the macOS version, otherwise assume GNU coreutils.
|
||||
# CMAKE_HOST_APPLE is a built-in CMake variable.
|
||||
if(CMAKE_HOST_APPLE AND "${STAT_TOOL}" STREQUAL "/usr/bin/stat")
|
||||
set(STAT_ARGS "-f%z")
|
||||
else()
|
||||
set(STAT_ARGS "-c '%s'")
|
||||
endif()
|
||||
# Track the size of the DTB for downstream tools
|
||||
execute_process(
|
||||
COMMAND ${STAT_TOOL} ${STAT_ARGS} ${KernelDTBPath}
|
||||
OUTPUT_VARIABLE KernelDTBSize
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE error
|
||||
)
|
||||
if(error)
|
||||
message(FATAL_ERROR "Failed to determine KernelDTBSize: ${KernelDTBPath}")
|
||||
endif()
|
||||
string(REPLACE "\'" "" KernelDTBSize ${KernelDTBSize})
|
||||
set(KernelDTBSize
|
||||
"${KernelDTBSize}"
|
||||
CACHE INTERNAL "Size of DTB blob, in bytes"
|
||||
)
|
||||
find_program(DTC_TOOL dtc)
|
||||
if("${DTC_TOOL}" STREQUAL "DTC_TOOL-NOTFOUND")
|
||||
message(FATAL_ERROR "Cannot find 'dtc' program.")
|
||||
endif()
|
||||
find_program(STAT_TOOL stat)
|
||||
if("${STAT_TOOL}" STREQUAL "STAT_TOOL-NOTFOUND")
|
||||
message(FATAL_ERROR "Cannot find 'stat' program.")
|
||||
endif()
|
||||
mark_as_advanced(DTC_TOOL STAT_TOOL)
|
||||
# Generate final DTS based on Linux DTS + seL4 overlay[s]
|
||||
foreach(entry ${KernelDTSList})
|
||||
get_absolute_source_or_binary(dts_tmp ${entry})
|
||||
list(APPEND dts_list "${dts_tmp}")
|
||||
endforeach()
|
||||
|
||||
check_outfile_stale(regen ${KernelDTBPath} dts_list ${CMAKE_CURRENT_BINARY_DIR}/dts.cmd)
|
||||
if(regen)
|
||||
file(REMOVE "${KernelDTSIntermediate}")
|
||||
foreach(entry ${dts_list})
|
||||
file(READ ${entry} CONTENTS)
|
||||
file(APPEND "${KernelDTSIntermediate}" "${CONTENTS}")
|
||||
endforeach()
|
||||
# Compile DTS to DTB
|
||||
execute_process(COMMAND ${DTC_TOOL} -q -I dts -O dtb -o ${KernelDTBPath}
|
||||
${KernelDTSIntermediate} RESULT_VARIABLE error)
|
||||
if(error)
|
||||
message(FATAL_ERROR "Failed to compile DTS to DTB: ${KernelDTSIntermediate}")
|
||||
endif()
|
||||
|
||||
set(deps ${KernelDTBPath} ${config_file} ${config_schema} ${HARDWARE_GEN_PATH})
|
||||
check_outfile_stale(regen ${device_dest} deps ${CMAKE_CURRENT_BINARY_DIR}/gen_header.cmd)
|
||||
if(regen)
|
||||
# Generate devices_gen header based on DTB
|
||||
message(STATUS "${device_dest} is out of date. Regenerating from DTB...")
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/machine/")
|
||||
execute_process(
|
||||
COMMAND
|
||||
${PYTHON3} "${HARDWARE_GEN_PATH}" --dtb "${KernelDTBPath}" --compat-strings
|
||||
--compat-strings-out "${compatibility_outfile}" --c-header --header-out
|
||||
"${device_dest}" --hardware-config "${config_file}" --hardware-schema
|
||||
"${config_schema}" --yaml --yaml-out "${platform_yaml}" --sel4arch
|
||||
"${KernelSel4Arch}" --addrspace-max "${KernelPaddrUserTop}" --json --json-out
|
||||
"${platform_json}" --kernel-config-flags "CONFIG_PRINTING=${KernelPrinting}"
|
||||
"CONFIG_ARM_HYPERVISOR_SUPPORT=${KernelArmHypervisorSupport}"
|
||||
"CONFIG_ARM_SMMU=${KernelArmSMMU}" "CONFIG_TK1_SMMU=${KernelTk1SMMU}"
|
||||
RESULT_VARIABLE error
|
||||
)
|
||||
if(error)
|
||||
message(FATAL_ERROR "Failed to generate from DTB: ${device_dest}")
|
||||
endif()
|
||||
# The macOS and GNU coreutils `stat` utilities have different interfaces.
|
||||
# Check if we're using the macOS version, otherwise assume GNU coreutils.
|
||||
# CMAKE_HOST_APPLE is a built-in CMake variable.
|
||||
if(CMAKE_HOST_APPLE AND "${STAT_TOOL}" STREQUAL "/usr/bin/stat")
|
||||
set(STAT_ARGS "-f%z")
|
||||
else()
|
||||
set(STAT_ARGS "-c '%s'")
|
||||
endif()
|
||||
file(READ "${compatibility_outfile}" compatibility_strings)
|
||||
# Track the size of the DTB for downstream tools
|
||||
execute_process(COMMAND ${STAT_TOOL} ${STAT_ARGS} ${KernelDTBPath} OUTPUT_VARIABLE KernelDTBSize
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE error)
|
||||
if(error)
|
||||
message(FATAL_ERROR "Failed to determine KernelDTBSize: ${KernelDTBPath}")
|
||||
endif()
|
||||
string(REPLACE "\'" "" KernelDTBSize ${KernelDTBSize})
|
||||
set(KernelDTBSize "${KernelDTBSize}" CACHE INTERNAL "Size of DTB blob, in bytes")
|
||||
endif()
|
||||
|
||||
# Mark all file dependencies as CMake rerun dependencies.
|
||||
set(cmake_deps ${deps} ${KernelDTSIntermediate} ${KernelDTSList} ${compatibility_outfile})
|
||||
set_property(
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
APPEND
|
||||
PROPERTY CMAKE_CONFIGURE_DEPENDS ${cmake_deps}
|
||||
)
|
||||
set(deps ${KernelDTBPath} ${config_file} ${config_schema} ${HARDWARE_GEN_PATH})
|
||||
check_outfile_stale(regen ${device_dest} deps ${CMAKE_CURRENT_BINARY_DIR}/gen_header.cmd)
|
||||
if(regen)
|
||||
# Generate devices_gen header based on DTB
|
||||
message(STATUS "${device_dest} is out of date. Regenerating from DTB...")
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/machine/")
|
||||
execute_process(
|
||||
COMMAND
|
||||
${PYTHON3} "${HARDWARE_GEN_PATH}" --dtb "${KernelDTBPath}" --compat-strings
|
||||
--compat-strings-out "${compatibility_outfile}" --c-header --header-out "${device_dest}"
|
||||
--hardware-config "${config_file}" --hardware-schema "${config_schema}" --yaml --yaml-out
|
||||
"${platform_yaml}" --sel4arch "${KernelSel4Arch}" --addrspace-max "${KernelPaddrUserTop}"
|
||||
--json --json-out "${platform_json}" --kernel-config-flags
|
||||
"CONFIG_PRINTING=${KernelPrinting}"
|
||||
"CONFIG_ARM_HYPERVISOR_SUPPORT=${KernelArmHypervisorSupport}"
|
||||
"CONFIG_ARM_SMMU=${KernelArmSMMU}" "CONFIG_TK1_SMMU=${KernelTk1SMMU}"
|
||||
RESULT_VARIABLE error)
|
||||
if(error)
|
||||
message(FATAL_ERROR "Failed to generate from DTB: ${device_dest}")
|
||||
endif()
|
||||
endif()
|
||||
file(READ "${compatibility_outfile}" compatibility_strings)
|
||||
|
||||
include(src/drivers/config.cmake)
|
||||
# Mark all file dependencies as CMake rerun dependencies.
|
||||
set(cmake_deps ${deps} ${KernelDTSIntermediate} ${KernelDTSList} ${compatibility_outfile})
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
|
||||
${cmake_deps})
|
||||
|
||||
include(src/drivers/config.cmake)
|
||||
endif()
|
||||
|
||||
add_config_library(kernel "${configure_string}")
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ include(${KERNEL_ROOT_DIR}/tools/helpers.cmake)
|
|||
# helper macro to unify messages printed output
|
||||
# Usage example: print_message_multiple_options_helper("architectures" aarch32)
|
||||
macro(print_message_multiple_options_helper str_type default_str)
|
||||
message(STATUS "platform ${KernelPlatform} supports multiple ${str_type}, none was given")
|
||||
message(STATUS " defaulting to: ${default_str}")
|
||||
message(STATUS "platform ${KernelPlatform} supports multiple ${str_type}, none was given")
|
||||
message(STATUS " defaulting to: ${default_str}")
|
||||
endmacro()
|
||||
|
||||
# This macro is used by platforms to declare which seL4 architecture(s) they
|
||||
|
|
@ -32,81 +32,57 @@ endmacro()
|
|||
# element is used.
|
||||
# Usage example: declare_seL4_arch("aarch64" "aarch32")
|
||||
macro(declare_seL4_arch)
|
||||
# Since this is a macro and not a function, ARGV is not a real variable. One
|
||||
# must be created to be able iterate over it.
|
||||
set(_arch_list "${ARGV}")
|
||||
if(NOT KernelSel4Arch)
|
||||
# Use first architecture from list as default.
|
||||
list(GET _arch_list 0 _default_KernelSel4Arch)
|
||||
print_message_multiple_options_helper("architectures" "${_default_KernelSel4Arch}")
|
||||
set(KernelSel4Arch
|
||||
"${_default_KernelSel4Arch}"
|
||||
CACHE STRING "" FORCE
|
||||
)
|
||||
elseif(NOT "${KernelSel4Arch}" IN_LIST _arch_list)
|
||||
message(FATAL_ERROR "KernelSel4Arch '${KernelSel4Arch}' not in '${_arch_list}'")
|
||||
endif()
|
||||
# Since this is a macro and not a function, ARGV is not a real variable. One
|
||||
# must be created to be able iterate over it.
|
||||
set(_arch_list "${ARGV}")
|
||||
if(NOT KernelSel4Arch)
|
||||
# Use first architecture from list as default.
|
||||
list(GET _arch_list 0 _default_KernelSel4Arch)
|
||||
print_message_multiple_options_helper("architectures" "${_default_KernelSel4Arch}")
|
||||
set(KernelSel4Arch "${_default_KernelSel4Arch}" CACHE STRING "" FORCE)
|
||||
elseif(NOT "${KernelSel4Arch}" IN_LIST _arch_list)
|
||||
message(FATAL_ERROR "KernelSel4Arch '${KernelSel4Arch}' not in '${_arch_list}'")
|
||||
endif()
|
||||
|
||||
config_choice(
|
||||
KernelSel4Arch
|
||||
SEL4_ARCH
|
||||
"Architecture mode for building the kernel"
|
||||
"aarch32;KernelSel4ArchAarch32;ARCH_AARCH32"
|
||||
"aarch64;KernelSel4ArchAarch64;ARCH_AARCH64"
|
||||
"arm_hyp;KernelSel4ArchArmHyp;ARCH_ARM_HYP"
|
||||
"riscv32;KernelSel4ArchRiscV32;ARCH_RISCV32"
|
||||
"riscv64;KernelSel4ArchRiscV64;ARCH_RISCV64"
|
||||
"x86_64;KernelSel4ArchX86_64;ARCH_X86_64"
|
||||
"ia32;KernelSel4ArchIA32;ARCH_IA32"
|
||||
)
|
||||
config_choice(
|
||||
KernelSel4Arch
|
||||
SEL4_ARCH
|
||||
"Architecture mode for building the kernel"
|
||||
"aarch32;KernelSel4ArchAarch32;ARCH_AARCH32"
|
||||
"aarch64;KernelSel4ArchAarch64;ARCH_AARCH64"
|
||||
"arm_hyp;KernelSel4ArchArmHyp;ARCH_ARM_HYP"
|
||||
"riscv32;KernelSel4ArchRiscV32;ARCH_RISCV32"
|
||||
"riscv64;KernelSel4ArchRiscV64;ARCH_RISCV64"
|
||||
"x86_64;KernelSel4ArchX86_64;ARCH_X86_64"
|
||||
"ia32;KernelSel4ArchIA32;ARCH_IA32")
|
||||
|
||||
if(KernelSel4ArchArmHyp)
|
||||
# arm-hyp is basically aarch32. This should be cleaned up and aligned
|
||||
# with other architectures, where hypervisor support is an additional
|
||||
# flag. The main blocker here is updating the verification flow.
|
||||
config_set(KernelSel4ArchAarch32 ARCH_AARCH32 ON)
|
||||
endif()
|
||||
if(KernelSel4ArchArmHyp)
|
||||
# arm-hyp is basically aarch32. This should be cleaned up and aligned
|
||||
# with other architectures, where hypervisor support is an additional
|
||||
# flag. The main blocker here is updating the verification flow.
|
||||
config_set(KernelSel4ArchAarch32 ARCH_AARCH32 ON)
|
||||
endif()
|
||||
|
||||
config_choice(
|
||||
KernelArch
|
||||
ARCH
|
||||
"Architecture to use when building the kernel"
|
||||
"arm;KernelArchARM;ARCH_ARM;KernelSel4ArchAarch32 OR KernelSel4ArchAarch64"
|
||||
"riscv;KernelArchRiscV;ARCH_RISCV;KernelSel4ArchRiscV32 OR KernelSel4ArchRiscV64"
|
||||
"x86;KernelArchX86;ARCH_X86;KernelSel4ArchX86_64 OR KernelSel4ArchIA32"
|
||||
)
|
||||
config_choice(
|
||||
KernelArch
|
||||
ARCH
|
||||
"Architecture to use when building the kernel"
|
||||
"arm;KernelArchARM;ARCH_ARM;KernelSel4ArchAarch32 OR KernelSel4ArchAarch64"
|
||||
"riscv;KernelArchRiscV;ARCH_RISCV;KernelSel4ArchRiscV32 OR KernelSel4ArchRiscV64"
|
||||
"x86;KernelArchX86;ARCH_X86;KernelSel4ArchX86_64 OR KernelSel4ArchIA32")
|
||||
|
||||
# Set kernel mode options
|
||||
if(KernelSel4ArchAarch32
|
||||
OR KernelSel4ArchRiscV32
|
||||
OR KernelSel4ArchIA32
|
||||
)
|
||||
config_set(KernelWordSize WORD_SIZE 32)
|
||||
set(Kernel64
|
||||
OFF
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(Kernel32
|
||||
ON
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
elseif(
|
||||
KernelSel4ArchAarch64
|
||||
OR KernelSel4ArchRiscV64
|
||||
OR KernelSel4ArchX86_64
|
||||
)
|
||||
config_set(KernelWordSize WORD_SIZE 64)
|
||||
set(Kernel64
|
||||
ON
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(Kernel32
|
||||
OFF
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "unsupported seL4 architecture: '${KernelSel4Arch}'")
|
||||
endif()
|
||||
# Set kernel mode options
|
||||
if(KernelSel4ArchAarch32 OR KernelSel4ArchRiscV32 OR KernelSel4ArchIA32)
|
||||
config_set(KernelWordSize WORD_SIZE 32)
|
||||
set(Kernel64 OFF CACHE INTERNAL "")
|
||||
set(Kernel32 ON CACHE INTERNAL "")
|
||||
elseif(KernelSel4ArchAarch64 OR KernelSel4ArchRiscV64 OR KernelSel4ArchX86_64)
|
||||
config_set(KernelWordSize WORD_SIZE 64)
|
||||
set(Kernel64 ON CACHE INTERNAL "")
|
||||
set(Kernel32 OFF CACHE INTERNAL "")
|
||||
else()
|
||||
message(FATAL_ERROR "unsupported seL4 architecture: '${KernelSel4Arch}'")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Register a platform's config options to be set if it is selected.
|
||||
|
|
@ -119,33 +95,24 @@ endmacro()
|
|||
# enable_test: A CMake boolean formula that allows the option to be selected.
|
||||
# e.g. "KernelSel4ArchAarch32", or "KernelSel4ArchX86_64 OR KernelSel4ArchIA32"
|
||||
macro(declare_platform name config1 config2 enable_test)
|
||||
list(APPEND kernel_platforms "${name}\;${config1}\;${config2}\;${enable_test}")
|
||||
if("${KernelPlatform}" STREQUAL ${name})
|
||||
set(${config1}
|
||||
ON
|
||||
CACHE INTERNAL "" FORCE
|
||||
)
|
||||
# Write KernelPlatform into the cache in case it is only a local variable
|
||||
set(KernelPlatform
|
||||
${KernelPlatform}
|
||||
CACHE STRING ""
|
||||
)
|
||||
else()
|
||||
set(${config1}
|
||||
OFF
|
||||
CACHE INTERNAL "" FORCE
|
||||
)
|
||||
endif()
|
||||
list(APPEND kernel_platforms "${name}\;${config1}\;${config2}\;${enable_test}")
|
||||
if("${KernelPlatform}" STREQUAL ${name})
|
||||
set(${config1} ON CACHE INTERNAL "" FORCE)
|
||||
# Write KernelPlatform into the cache in case it is only a local variable
|
||||
set(KernelPlatform ${KernelPlatform} CACHE STRING "")
|
||||
else()
|
||||
set(${config1} OFF CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# helper macro that prints a message that no sub platform is specified and
|
||||
# the default sub platform will be used
|
||||
# Usage example: check_platform_and_fallback_to_default(KernelARMPlatform "sabre")
|
||||
macro(check_platform_and_fallback_to_default var_cmake_kernel_plat default_sub_plat)
|
||||
if("${${var_cmake_kernel_plat}}" STREQUAL "")
|
||||
print_message_multiple_options_helper("sub platforms" ${default_sub_plat})
|
||||
set(${var_cmake_kernel_plat} ${default_sub_plat})
|
||||
endif()
|
||||
if("${${var_cmake_kernel_plat}}" STREQUAL "")
|
||||
print_message_multiple_options_helper("sub platforms" ${default_sub_plat})
|
||||
set(${var_cmake_kernel_plat} ${default_sub_plat})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# CLK_SHIFT and CLK_MAGIC are generated from tools/reciprocal.py
|
||||
|
|
@ -154,36 +121,34 @@ endmacro()
|
|||
# in future to build the values on the first build. Note the calculation
|
||||
# can take a long time though.
|
||||
macro(declare_default_headers)
|
||||
cmake_parse_arguments(
|
||||
CONFIGURE
|
||||
""
|
||||
"TIMER_FREQUENCY;MAX_IRQ;NUM_PPI;INTERRUPT_CONTROLLER;TIMER;SMMU;CLK_SHIFT;CLK_MAGIC;KERNEL_WCET;TIMER_PRECISION;TIMER_OVERHEAD_TICKS;MAX_SID;MAX_CB"
|
||||
""
|
||||
${ARGN}
|
||||
)
|
||||
set(CALLED_declare_default_headers 1)
|
||||
cmake_parse_arguments(
|
||||
CONFIGURE
|
||||
""
|
||||
"TIMER_FREQUENCY;MAX_IRQ;NUM_PPI;INTERRUPT_CONTROLLER;TIMER;SMMU;CLK_SHIFT;CLK_MAGIC;KERNEL_WCET;TIMER_PRECISION;TIMER_OVERHEAD_TICKS;MAX_SID;MAX_CB"
|
||||
""
|
||||
${ARGN})
|
||||
set(CALLED_declare_default_headers 1)
|
||||
endmacro()
|
||||
|
||||
# For all of the common variables we set a default value here if they haven't
|
||||
# been set by a platform.
|
||||
foreach(
|
||||
var IN
|
||||
ITEMS KernelArmCortexA7
|
||||
KernelArmCortexA8
|
||||
KernelArmCortexA9
|
||||
KernelArmCortexA15
|
||||
KernelArmCortexA35
|
||||
KernelArmCortexA53
|
||||
KernelArmCortexA55
|
||||
KernelArmCortexA57
|
||||
KernelArmCortexA72
|
||||
KernelArchArmV7a
|
||||
KernelArchArmV7ve
|
||||
KernelArchArmV8a
|
||||
KernelAArch64SErrorIgnore
|
||||
)
|
||||
unset(${var} CACHE)
|
||||
set(${var} OFF)
|
||||
var IN
|
||||
ITEMS KernelArmCortexA7
|
||||
KernelArmCortexA8
|
||||
KernelArmCortexA9
|
||||
KernelArmCortexA15
|
||||
KernelArmCortexA35
|
||||
KernelArmCortexA53
|
||||
KernelArmCortexA55
|
||||
KernelArmCortexA57
|
||||
KernelArmCortexA72
|
||||
KernelArchArmV7a
|
||||
KernelArchArmV7ve
|
||||
KernelArchArmV8a
|
||||
KernelAArch64SErrorIgnore)
|
||||
unset(${var} CACHE)
|
||||
set(${var} OFF)
|
||||
endforeach()
|
||||
unset(KernelArmMach CACHE)
|
||||
unset(KernelArmMachFeatureModifiers CACHE)
|
||||
|
|
@ -197,7 +162,7 @@ file(GLOB result ${KERNEL_ROOT_DIR}/src/plat/*/config.cmake)
|
|||
list(SORT result)
|
||||
|
||||
foreach(file ${result})
|
||||
include("${file}")
|
||||
include("${file}")
|
||||
endforeach()
|
||||
|
||||
config_choice(KernelPlatform PLAT "Select the platform" ${kernel_platforms})
|
||||
|
|
@ -207,17 +172,16 @@ config_choice(KernelPlatform PLAT "Select the platform" ${kernel_platforms})
|
|||
# point. This means at least: KernelPlatform KernelArch KernelWordSize
|
||||
|
||||
if("${KernelPlatform}" STREQUAL "")
|
||||
message(FATAL_ERROR "Variable 'KernelPlatform' is not set - is PLATFORM '${PLATFORM}' correct? \
|
||||
Valid platforms are '${KernelPlatform_all_strings}'"
|
||||
)
|
||||
message(FATAL_ERROR "Variable 'KernelPlatform' is not set - is PLATFORM '${PLATFORM}' correct? \
|
||||
Valid platforms are '${KernelPlatform_all_strings}'")
|
||||
endif()
|
||||
|
||||
if("${KernelArch}" STREQUAL "")
|
||||
message(FATAL_ERROR "Variable 'KernelArch' is not set.")
|
||||
message(FATAL_ERROR "Variable 'KernelArch' is not set.")
|
||||
endif()
|
||||
|
||||
if("${KernelWordSize}" STREQUAL "")
|
||||
message(FATAL_ERROR "Variable 'KernelWordSize' is not set.")
|
||||
message(FATAL_ERROR "Variable 'KernelWordSize' is not set.")
|
||||
endif()
|
||||
|
||||
# Now enshrine all the common variables in the config
|
||||
|
|
@ -239,98 +203,57 @@ config_set(KernelAArch64SErrorIgnore AARCH64_SERROR_IGNORE "${KernelAArch64SErro
|
|||
# actual armv to that, but leave armv7a config enabled for anything that
|
||||
# checks directly against it
|
||||
if(KernelArchArmV7ve)
|
||||
set(KernelArmArmV
|
||||
"armv7ve"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelArmArmV "armv7ve" CACHE INTERNAL "")
|
||||
elseif(KernelArchArmV7a)
|
||||
set(KernelArmArmV
|
||||
"armv7-a"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelArmArmV "armv7-a" CACHE INTERNAL "")
|
||||
elseif(KernelArchArmV8a)
|
||||
set(KernelArmArmV
|
||||
"armv8-a"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelArmArmV "armv8-a" CACHE INTERNAL "")
|
||||
endif()
|
||||
if(KernelArmCortexA7)
|
||||
set(KernelArmCPU
|
||||
"cortex-a7"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelArmCPU "cortex-a7" CACHE INTERNAL "")
|
||||
elseif(KernelArmCortexA8)
|
||||
set(KernelArmCPU
|
||||
"cortex-a8"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelArmCPU "cortex-a8" CACHE INTERNAL "")
|
||||
elseif(KernelArmCortexA9)
|
||||
set(KernelArmCPU
|
||||
"cortex-a9"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelArmCPU "cortex-a9" CACHE INTERNAL "")
|
||||
elseif(KernelArmCortexA15)
|
||||
set(KernelArmCPU
|
||||
"cortex-a15"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelArmCPU "cortex-a15" CACHE INTERNAL "")
|
||||
elseif(KernelArmCortexA35)
|
||||
set(KernelArmCPU
|
||||
"cortex-a35"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelArmCPU "cortex-a35" CACHE INTERNAL "")
|
||||
elseif(KernelArmCortexA53)
|
||||
set(KernelArmCPU
|
||||
"cortex-a53"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelArmCPU "cortex-a53" CACHE INTERNAL "")
|
||||
elseif(KernelArmCortexA55)
|
||||
set(KernelArmCPU
|
||||
"cortex-a55"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelArmCPU "cortex-a55" CACHE INTERNAL "")
|
||||
elseif(KernelArmCortexA57)
|
||||
set(KernelArmCPU
|
||||
"cortex-a57"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelArmCPU "cortex-a57" CACHE INTERNAL "")
|
||||
elseif(KernelArmCortexA72)
|
||||
set(KernelArmCPU
|
||||
"cortex-a72"
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelArmCPU "cortex-a72" CACHE INTERNAL "")
|
||||
endif()
|
||||
if(KernelArchARM)
|
||||
config_set(KernelArmMach ARM_MACH "${KernelArmMach}")
|
||||
config_set(KernelArmMach ARM_MACH "${KernelArmMach}")
|
||||
endif()
|
||||
|
||||
if("${TRIPLE}" STREQUAL "")
|
||||
set(toolchain_file gcc.cmake)
|
||||
set(toolchain_file gcc.cmake)
|
||||
else()
|
||||
set(toolchain_file llvm.cmake)
|
||||
set(toolchain_file llvm.cmake)
|
||||
endif()
|
||||
set(toolchain_outputfile "${CMAKE_BINARY_DIR}/${toolchain_file}")
|
||||
if(("${CMAKE_TOOLCHAIN_FILE}" STREQUAL "") OR ("${CMAKE_TOOLCHAIN_FILE}" STREQUAL
|
||||
"${toolchain_outputfile}")
|
||||
)
|
||||
if(DEFINED CACHE{CROSS_COMPILER_PREFIX})
|
||||
set(cross_prefix $CACHE{CROSS_COMPILER_PREFIX})
|
||||
endif()
|
||||
"${toolchain_outputfile}"))
|
||||
if(DEFINED CACHE{CROSS_COMPILER_PREFIX})
|
||||
set(cross_prefix $CACHE{CROSS_COMPILER_PREFIX})
|
||||
endif()
|
||||
|
||||
configure_file("${KERNEL_ROOT_DIR}/${toolchain_file}" "${toolchain_outputfile}.temp" @ONLY)
|
||||
if(EXISTS "${toolchain_outputfile}")
|
||||
file(READ "${toolchain_outputfile}.temp" filea)
|
||||
file(READ "${toolchain_outputfile}" fileb)
|
||||
if(NOT "${filea}" STREQUAL "${fileb}")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Config changes have resulted in a different toolchain file. This is not supported"
|
||||
)
|
||||
endif()
|
||||
configure_file("${KERNEL_ROOT_DIR}/${toolchain_file}" "${toolchain_outputfile}.temp" @ONLY)
|
||||
if(EXISTS "${toolchain_outputfile}")
|
||||
file(READ "${toolchain_outputfile}.temp" filea)
|
||||
file(READ "${toolchain_outputfile}" fileb)
|
||||
if(NOT "${filea}" STREQUAL "${fileb}")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Config changes have resulted in a different toolchain file. This is not supported")
|
||||
endif()
|
||||
file(RENAME "${toolchain_outputfile}.temp" "${toolchain_outputfile}")
|
||||
set(CMAKE_TOOLCHAIN_FILE
|
||||
"${toolchain_outputfile}"
|
||||
CACHE PATH ""
|
||||
)
|
||||
endif()
|
||||
file(RENAME "${toolchain_outputfile}.temp" "${toolchain_outputfile}")
|
||||
set(CMAKE_TOOLCHAIN_FILE "${toolchain_outputfile}" CACHE PATH "")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -5,17 +5,16 @@
|
|||
#
|
||||
|
||||
add_sources(
|
||||
DEP "KernelSel4ArchAarch32"
|
||||
PREFIX src/arch/arm/32
|
||||
CFILES object/objecttype.c
|
||||
machine/capdl.c
|
||||
machine/registerset.c
|
||||
machine/fpu.c
|
||||
machine/debug.c
|
||||
model/statedata.c
|
||||
c_traps.c
|
||||
idle.c
|
||||
kernel/thread.c
|
||||
kernel/vspace.c
|
||||
ASMFILES head.S traps.S hyp_traps.S idle.S
|
||||
)
|
||||
DEP "KernelSel4ArchAarch32"
|
||||
PREFIX src/arch/arm/32
|
||||
CFILES object/objecttype.c
|
||||
machine/capdl.c
|
||||
machine/registerset.c
|
||||
machine/fpu.c
|
||||
machine/debug.c
|
||||
model/statedata.c
|
||||
c_traps.c
|
||||
idle.c
|
||||
kernel/thread.c
|
||||
kernel/vspace.c
|
||||
ASMFILES head.S traps.S hyp_traps.S idle.S)
|
||||
|
|
|
|||
|
|
@ -5,17 +5,16 @@
|
|||
#
|
||||
|
||||
add_sources(
|
||||
DEP "KernelSel4ArchAarch64"
|
||||
PREFIX src/arch/arm/64
|
||||
CFILES object/objecttype.c
|
||||
machine/capdl.c
|
||||
machine/registerset.c
|
||||
machine/fpu.c
|
||||
machine/debug.c
|
||||
model/statedata.c
|
||||
c_traps.c
|
||||
idle.c
|
||||
kernel/thread.c
|
||||
kernel/vspace.c
|
||||
ASMFILES head.S traps.S idle.S
|
||||
)
|
||||
DEP "KernelSel4ArchAarch64"
|
||||
PREFIX src/arch/arm/64
|
||||
CFILES object/objecttype.c
|
||||
machine/capdl.c
|
||||
machine/registerset.c
|
||||
machine/fpu.c
|
||||
machine/debug.c
|
||||
model/statedata.c
|
||||
c_traps.c
|
||||
idle.c
|
||||
kernel/thread.c
|
||||
kernel/vspace.c
|
||||
ASMFILES head.S traps.S idle.S)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,5 @@
|
|||
#
|
||||
|
||||
add_sources(
|
||||
DEP "KernelArchArmV7a"
|
||||
PREFIX src/arch/arm/armv/armv7-a
|
||||
CFILES cache.c user_access.c tlb.c
|
||||
ASMFILES machine_asm.S
|
||||
)
|
||||
DEP "KernelArchArmV7a" PREFIX src/arch/arm/armv/armv7-a CFILES cache.c user_access.c tlb.c
|
||||
ASMFILES machine_asm.S)
|
||||
|
|
|
|||
|
|
@ -4,9 +4,5 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
add_sources(
|
||||
DEP "KernelArchArmV8a"
|
||||
PREFIX src/arch/arm/armv/armv8-a/${KernelWordSize}
|
||||
CFILES cache.c user_access.c
|
||||
ASMFILES machine_asm.S
|
||||
)
|
||||
add_sources(DEP "KernelArchArmV8a" PREFIX src/arch/arm/armv/armv8-a/${KernelWordSize}
|
||||
CFILES cache.c user_access.c ASMFILES machine_asm.S)
|
||||
|
|
|
|||
|
|
@ -5,154 +5,133 @@
|
|||
#
|
||||
|
||||
if(KernelSel4ArchAarch32)
|
||||
set_property(
|
||||
TARGET kernel_config_target
|
||||
APPEND
|
||||
PROPERTY TOPLEVELTYPES pde_C
|
||||
)
|
||||
set_property(TARGET kernel_config_target APPEND PROPERTY TOPLEVELTYPES pde_C)
|
||||
endif()
|
||||
|
||||
set(KernelArmPASizeBits40 OFF)
|
||||
set(KernelArmPASizeBits44 OFF)
|
||||
if(KernelArmCortexA35)
|
||||
set(KernelArmICacheVIPT ON)
|
||||
set(KernelArmPASizeBits40 ON)
|
||||
math(EXPR KernelPaddrUserTop "(1 << 40)")
|
||||
set(KernelArmICacheVIPT ON)
|
||||
set(KernelArmPASizeBits40 ON)
|
||||
math(EXPR KernelPaddrUserTop "(1 << 40)")
|
||||
elseif(KernelArmCortexA53)
|
||||
set(KernelArmICacheVIPT ON)
|
||||
set(KernelArmPASizeBits40 ON)
|
||||
math(EXPR KernelPaddrUserTop "(1 << 40)")
|
||||
set(KernelArmICacheVIPT ON)
|
||||
set(KernelArmPASizeBits40 ON)
|
||||
math(EXPR KernelPaddrUserTop "(1 << 40)")
|
||||
elseif(KernelArmCortexA55)
|
||||
set(KernelArmICacheVIPT ON)
|
||||
set(KernelArmPASizeBits40 ON)
|
||||
math(EXPR KernelPaddrUserTop "(1 << 40)")
|
||||
set(KernelArmICacheVIPT ON)
|
||||
set(KernelArmPASizeBits40 ON)
|
||||
math(EXPR KernelPaddrUserTop "(1 << 40)")
|
||||
elseif(KernelArmCortexA57)
|
||||
set(KernelArmPASizeBits44 ON)
|
||||
math(EXPR KernelPaddrUserTop "(1 << 44)")
|
||||
set(KernelArmPASizeBits44 ON)
|
||||
math(EXPR KernelPaddrUserTop "(1 << 44)")
|
||||
elseif(KernelArmCortexA72)
|
||||
# For Cortex-A72 in AArch64 state, the physical address range is 44 bits
|
||||
# (https://developer.arm.com/documentation/100095/0001/memory-management-unit/about-the-mmu)
|
||||
set(KernelArmPASizeBits44 ON)
|
||||
math(EXPR KernelPaddrUserTop "(1 << 44)")
|
||||
# For Cortex-A72 in AArch64 state, the physical address range is 44 bits
|
||||
# (https://developer.arm.com/documentation/100095/0001/memory-management-unit/about-the-mmu)
|
||||
set(KernelArmPASizeBits44 ON)
|
||||
math(EXPR KernelPaddrUserTop "(1 << 44)")
|
||||
endif()
|
||||
config_set(KernelArmPASizeBits40 ARM_PA_SIZE_BITS_40 "${KernelArmPASizeBits40}")
|
||||
config_set(KernelArmPASizeBits44 ARM_PA_SIZE_BITS_44 "${KernelArmPASizeBits44}")
|
||||
config_set(KernelArmICacheVIPT ARM_ICACHE_VIPT "${KernelArmICacheVIPT}")
|
||||
|
||||
if(KernelSel4ArchAarch32)
|
||||
# 64-bit targets may be building in 32-bit mode,
|
||||
# so make sure maximum paddr is 32-bit.
|
||||
math(EXPR KernelPaddrUserTop "(1 << 32) - 1")
|
||||
# 64-bit targets may be building in 32-bit mode,
|
||||
# so make sure maximum paddr is 32-bit.
|
||||
math(EXPR KernelPaddrUserTop "(1 << 32) - 1")
|
||||
endif()
|
||||
|
||||
include(src/arch/arm/armv/armv7-a/config.cmake)
|
||||
include(src/arch/arm/armv/armv8-a/config.cmake)
|
||||
|
||||
config_option(
|
||||
KernelDebugDisableL2Cache DEBUG_DISABLE_L2_CACHE
|
||||
"Do not enable the L2 cache on startup for debugging purposes."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchARM"
|
||||
)
|
||||
KernelDebugDisableL2Cache DEBUG_DISABLE_L2_CACHE
|
||||
"Do not enable the L2 cache on startup for debugging purposes." DEFAULT OFF
|
||||
DEPENDS "KernelArchARM")
|
||||
config_option(
|
||||
KernelDebugDisableL1ICache DEBUG_DISABLE_L1_ICACHE
|
||||
"Do not enable the L1 instruction cache on startup for debugging purposes."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchARM;KernelDebugDisableL2Cache"
|
||||
)
|
||||
KernelDebugDisableL1ICache DEBUG_DISABLE_L1_ICACHE
|
||||
"Do not enable the L1 instruction cache on startup for debugging purposes." DEFAULT OFF
|
||||
DEPENDS "KernelArchARM;KernelDebugDisableL2Cache")
|
||||
config_option(
|
||||
KernelDebugDisableL1DCache DEBUG_DISABLE_L1_DCACHE
|
||||
"Do not enable the L1 data cache on startup for debugging purposes."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchARM;KernelDebugDisableL2Cache"
|
||||
)
|
||||
KernelDebugDisableL1DCache DEBUG_DISABLE_L1_DCACHE
|
||||
"Do not enable the L1 data cache on startup for debugging purposes." DEFAULT OFF
|
||||
DEPENDS "KernelArchARM;KernelDebugDisableL2Cache")
|
||||
config_option(
|
||||
KernelDebugDisableBranchPrediction
|
||||
DEBUG_DISABLE_BRANCH_PREDICTION
|
||||
"Do not enable branch prediction (also called program flow control) on startup. \
|
||||
KernelDebugDisableBranchPrediction
|
||||
DEBUG_DISABLE_BRANCH_PREDICTION
|
||||
"Do not enable branch prediction (also called program flow control) on startup. \
|
||||
This makes execution time more deterministic at the expense of dramatically decreasing \
|
||||
performance. Primary use is for debugging."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchARM"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchARM")
|
||||
|
||||
if(NOT DEFINED KernelSel4ArchArmHyp)
|
||||
# the current CMake scripts ensure that KernelSel4ArchArmHyp is always set
|
||||
# to either ON or OFF. If it is not set, something is either broken or the
|
||||
# CMake files are used wrongly. Or support for KernelSel4ArchArmHyp has
|
||||
# finally been removed - and then this check here should be removed and the
|
||||
# KernelArmHypervisorSupport below can be OFF by default.
|
||||
message(FATAL_ERROR "KernelSel4ArchArmHyp must be ON or OFF")
|
||||
# the current CMake scripts ensure that KernelSel4ArchArmHyp is always set
|
||||
# to either ON or OFF. If it is not set, something is either broken or the
|
||||
# CMake files are used wrongly. Or support for KernelSel4ArchArmHyp has
|
||||
# finally been removed - and then this check here should be removed and the
|
||||
# KernelArmHypervisorSupport below can be OFF by default.
|
||||
message(FATAL_ERROR "KernelSel4ArchArmHyp must be ON or OFF")
|
||||
endif()
|
||||
config_option(
|
||||
KernelArmHypervisorSupport ARM_HYPERVISOR_SUPPORT
|
||||
"Build as Hypervisor. Utilise ARM virtualisation extensions to build the kernel as a hypervisor"
|
||||
DEFAULT ${KernelSel4ArchArmHyp}
|
||||
DEPENDS
|
||||
"KernelArmCortexA15 OR KernelArmCortexA35 OR KernelArmCortexA57 OR KernelArmCortexA53 OR KernelArmCortexA55 OR KernelArmCortexA72"
|
||||
KernelArmHypervisorSupport ARM_HYPERVISOR_SUPPORT
|
||||
"Build as Hypervisor. Utilise ARM virtualisation extensions to build the kernel as a hypervisor"
|
||||
DEFAULT ${KernelSel4ArchArmHyp}
|
||||
DEPENDS
|
||||
"KernelArmCortexA15 OR KernelArmCortexA35 OR KernelArmCortexA57 OR KernelArmCortexA53 OR KernelArmCortexA55 OR KernelArmCortexA72"
|
||||
)
|
||||
|
||||
config_option(KernelArmGicV3 ARM_GIC_V3_SUPPORT "Build support for GICv3" DEFAULT OFF)
|
||||
|
||||
if(KernelArmPASizeBits40 AND ARM_HYPERVISOR_SUPPORT)
|
||||
config_set(KernelAarch64VspaceS2StartL1 AARCH64_VSPACE_S2_START_L1 "ON")
|
||||
config_set(KernelAarch64VspaceS2StartL1 AARCH64_VSPACE_S2_START_L1 "ON")
|
||||
else()
|
||||
config_set(KernelAarch64VspaceS2StartL1 AARCH64_VSPACE_S2_START_L1 "OFF")
|
||||
config_set(KernelAarch64VspaceS2StartL1 AARCH64_VSPACE_S2_START_L1 "OFF")
|
||||
endif()
|
||||
|
||||
config_option(
|
||||
KernelArmHypEnableVCPUCP14SaveAndRestore
|
||||
ARM_HYP_ENABLE_VCPU_CP14_SAVE_AND_RESTORE
|
||||
"Trap, but don't save/restore VCPUs' CP14 accesses \
|
||||
KernelArmHypEnableVCPUCP14SaveAndRestore
|
||||
ARM_HYP_ENABLE_VCPU_CP14_SAVE_AND_RESTORE
|
||||
"Trap, but don't save/restore VCPUs' CP14 accesses \
|
||||
This allows us to turn off the save and restore of VCPU threads' CP14 \
|
||||
context for performance (or other) reasons, we can just turn them off \
|
||||
and trap them instead, and have the VCPUs' accesses to CP14 \
|
||||
intercepted and delivered to the VM Monitor as fault messages"
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelSel4ArchArmHyp;NOT KernelVerificationBuild"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelSel4ArchArmHyp;NOT KernelVerificationBuild"
|
||||
DEFAULT_DISABLED OFF)
|
||||
|
||||
config_option(
|
||||
KernelArmErrata430973
|
||||
ARM_ERRATA_430973
|
||||
"Enable workaround for 430973 Cortex-A8 (r1p0..r1p2) erratum \
|
||||
KernelArmErrata430973
|
||||
ARM_ERRATA_430973
|
||||
"Enable workaround for 430973 Cortex-A8 (r1p0..r1p2) erratum \
|
||||
Enables a workaround for the 430973 Cortex-A8 (r1p0..r1p2) erratum. Error occurs \
|
||||
if code containing ARM/Thumb interworking branch is replaced by different code \
|
||||
at the same virtual address."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchARM;KernelArmCortexA8"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchARM;KernelArmCortexA8")
|
||||
|
||||
config_option(
|
||||
KernelArmErrata773022
|
||||
ARM_ERRATA_773022
|
||||
"Enable workaround for 773022 Cortex-A15 (r0p0..r0p4) erratum \
|
||||
KernelArmErrata773022
|
||||
ARM_ERRATA_773022
|
||||
"Enable workaround for 773022 Cortex-A15 (r0p0..r0p4) erratum \
|
||||
Enables a workaround for the 773022 Cortex-A15 (r0p0..r0p4) erratum. Error occurs \
|
||||
on rare sequences of instructions and results in the loop buffer delivering \
|
||||
incorrect instructions. The work around is to disable the loop buffer"
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelArchARM;KernelArmCortexA15"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelArchARM;KernelArmCortexA15"
|
||||
DEFAULT_DISABLED OFF)
|
||||
|
||||
config_option(KernelArmSMMU ARM_SMMU "Enable SystemMMU" DEFAULT ON DEPENDS "KernelPlatformTx2"
|
||||
DEFAULT_DISABLED OFF)
|
||||
|
||||
config_option(KernelTk1SMMU TK1_SMMU "Enable SystemMMU for the Tegra TK1 SoC" DEFAULT OFF
|
||||
DEPENDS "KernelPlatformTK1")
|
||||
|
||||
config_option(
|
||||
KernelArmSMMU ARM_SMMU "Enable SystemMMU"
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelPlatformTx2"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
|
||||
config_option(
|
||||
KernelTk1SMMU TK1_SMMU "Enable SystemMMU for the Tegra TK1 SoC"
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelPlatformTK1"
|
||||
)
|
||||
|
||||
config_option(
|
||||
KernelArmEnableA9Prefetcher
|
||||
ENABLE_A9_PREFETCHER
|
||||
"Enable Cortex-A9 prefetcher \
|
||||
KernelArmEnableA9Prefetcher
|
||||
ENABLE_A9_PREFETCHER
|
||||
"Enable Cortex-A9 prefetcher \
|
||||
Cortex-A9 has an L1 and L2 prefetcher. By default \
|
||||
they are disabled. This config options allows \
|
||||
them to be turned on. Enabling the prefetchers \
|
||||
|
|
@ -161,152 +140,135 @@ config_option(
|
|||
Cortex-A9 the bits used to enable the prefetchers \
|
||||
no longer exist, it is not clear if this is just \
|
||||
a document error or not."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArmCortexA9"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArmCortexA9")
|
||||
|
||||
config_option(
|
||||
KernelArmExportPMUUser
|
||||
EXPORT_PMU_USER
|
||||
"PL0 access to PMU. \
|
||||
KernelArmExportPMUUser
|
||||
EXPORT_PMU_USER
|
||||
"PL0 access to PMU. \
|
||||
Grant user access to Performance Monitoring Unit. \
|
||||
WARNING: While useful for evaluating performance, \
|
||||
this option opens timing and covert channels."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchArmV7a OR KernelArchArmV8a;NOT KernelArmCortexA8"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchArmV7a OR KernelArchArmV8a;NOT KernelArmCortexA8")
|
||||
|
||||
config_option(
|
||||
KernelArmDisableWFIWFETraps DISABLE_WFI_WFE_TRAPS "Disable the trapping of WFI \
|
||||
KernelArmDisableWFIWFETraps DISABLE_WFI_WFE_TRAPS "Disable the trapping of WFI \
|
||||
and WFE instructions when configuring the \
|
||||
Hyp Configuration Registor (HCR) of a VCPU"
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchArmV7a OR KernelArchArmV8a;KernelArmHypervisorSupport"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchArmV7a OR KernelArchArmV8a;KernelArmHypervisorSupport")
|
||||
config_option(
|
||||
KernelTk1SMMUInterruptEnable
|
||||
SMMU_INTERRUPT_ENABLE
|
||||
"Enable SMMU interrupts. \
|
||||
KernelTk1SMMUInterruptEnable
|
||||
SMMU_INTERRUPT_ENABLE
|
||||
"Enable SMMU interrupts. \
|
||||
SMMU interrupts currently only serve a debug purpose as \
|
||||
they are not forwarded to user level. Enabling this will \
|
||||
cause some fault types to print out a message in the kernel. \
|
||||
WARNING: Printing fault information is slow and rapid faults \
|
||||
can result in all time spent in the kernel printing fault \
|
||||
messages"
|
||||
DEFAULT "${KernelDebugBuild}"
|
||||
DEPENDS "KernelTk1SMMU"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
DEFAULT "${KernelDebugBuild}"
|
||||
DEPENDS "KernelTk1SMMU"
|
||||
DEFAULT_DISABLED OFF)
|
||||
|
||||
config_option(
|
||||
KernelAArch32FPUEnableContextSwitch
|
||||
AARCH32_FPU_ENABLE_CONTEXT_SWITCH
|
||||
"Enable hardware VFP and SIMD context switch \
|
||||
KernelAArch32FPUEnableContextSwitch
|
||||
AARCH32_FPU_ENABLE_CONTEXT_SWITCH
|
||||
"Enable hardware VFP and SIMD context switch \
|
||||
This enables the VFP and SIMD context switch on platforms with \
|
||||
hardware support, allowing the user to execute hardware VFP and SIMD \
|
||||
operations in a multithreading environment, instead of relying on \
|
||||
software emulation of FPU/VFP from the C library (e.g. mfloat-abi=soft)."
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelSel4ArchAarch32"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelSel4ArchAarch32"
|
||||
DEFAULT_DISABLED OFF)
|
||||
|
||||
config_option(
|
||||
KernelAArch64UserCacheEnable
|
||||
AARCH64_USER_CACHE_ENABLE
|
||||
"Enable any attempt to execute a DC CVAU, DC CIVAC, DC CVAC, or IC IVAU \
|
||||
KernelAArch64UserCacheEnable
|
||||
AARCH64_USER_CACHE_ENABLE
|
||||
"Enable any attempt to execute a DC CVAU, DC CIVAC, DC CVAC, or IC IVAU \
|
||||
instruction or access to CTR_EL0 at EL0 using AArch64. \
|
||||
When disabled, these operations will be trapped."
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelSel4ArchAarch64"
|
||||
)
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelSel4ArchAarch64")
|
||||
|
||||
config_option(
|
||||
KernelAArch64SErrorIgnore
|
||||
AARCH64_SERROR_IGNORE
|
||||
"By default any SError interrupt will halt the kernel. SErrors may \
|
||||
KernelAArch64SErrorIgnore
|
||||
AARCH64_SERROR_IGNORE
|
||||
"By default any SError interrupt will halt the kernel. SErrors may \
|
||||
be caused by e.g. writes to read-only device registers or ECC errors. \
|
||||
When this option is enabled SErrors will be ignored."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelSel4ArchAarch64;NOT KernelVerificationBuild"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelSel4ArchAarch64;NOT KernelVerificationBuild")
|
||||
mark_as_advanced(KernelAArch64SErrorIgnore)
|
||||
|
||||
config_option(
|
||||
KernelAllowSMCCalls
|
||||
ALLOW_SMC_CALLS
|
||||
"Allow components to make SMC calls. \
|
||||
KernelAllowSMCCalls
|
||||
ALLOW_SMC_CALLS
|
||||
"Allow components to make SMC calls. \
|
||||
WARNING: Allowing SMC calls causes a couple of issues. Since seL4 cannot \
|
||||
pre-empt the secure monitor, the WCET is no longer guaranteed. Also, since the \
|
||||
secure monitor is a higher privilege level and can make any change in the \
|
||||
system, the proofs can no longer be guaranteed."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelSel4ArchAarch64"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelSel4ArchAarch64")
|
||||
|
||||
config_choice(
|
||||
KernelArmTLSReg
|
||||
ARM_TLS_REG
|
||||
"Which TLS register is used for Kernel TLS syscalls and invocations. \
|
||||
KernelArmTLSReg
|
||||
ARM_TLS_REG
|
||||
"Which TLS register is used for Kernel TLS syscalls and invocations. \
|
||||
The usual registers used by gnu-elf ABIs are: \
|
||||
- on aarch32: tpidruro \
|
||||
- on aarch64: tpidru."
|
||||
"tpidru;KernelArmTLSRegTPIDRU;ARM_TLS_REG_TPIDRU;KernelArchARM"
|
||||
"tpidruro;KernelArmTLSRegTPIDRURO;ARM_TLS_REG_TPIDRURO;KernelArchARM"
|
||||
)
|
||||
"tpidru;KernelArmTLSRegTPIDRU;ARM_TLS_REG_TPIDRU;KernelArchARM"
|
||||
"tpidruro;KernelArmTLSRegTPIDRURO;ARM_TLS_REG_TPIDRURO;KernelArchARM")
|
||||
|
||||
if(KernelArmTLSRegTPIDRURO)
|
||||
set(KernelSetTLSBaseSelf ON)
|
||||
set(KernelSetTLSBaseSelf ON)
|
||||
endif()
|
||||
|
||||
if(KernelAArch32FPUEnableContextSwitch OR KernelSel4ArchAarch64)
|
||||
set(KernelHaveFPU ON)
|
||||
set(KernelHaveFPU ON)
|
||||
endif()
|
||||
|
||||
if(KernelArmCortexA7
|
||||
OR KernelArmCortexA8
|
||||
OR KernelArmCortexA15
|
||||
OR KernelArmCortexA35
|
||||
OR KernelArmCortexA53
|
||||
OR KernelArmCortexA55
|
||||
OR KernelArmCortexA57
|
||||
OR KernelArmCortexA72
|
||||
)
|
||||
# According to https://developer.arm.com/documentation/100095/0001/functional-description/about-the-cortex-a72-processor-functions/components-of-the-processor
|
||||
# the L1 instruction on the Cortex-A72 cache has a 64-byte cache line.
|
||||
# Thus, 6 bits are needed.
|
||||
config_set(KernelArmCacheLineSizeBits L1_CACHE_LINE_SIZE_BITS "6")
|
||||
if(KernelArmCortexA7 OR KernelArmCortexA8 OR KernelArmCortexA15 OR KernelArmCortexA35
|
||||
OR KernelArmCortexA53 OR KernelArmCortexA55 OR KernelArmCortexA57 OR KernelArmCortexA72)
|
||||
# According to https://developer.arm.com/documentation/100095/0001/functional-description/about-the-cortex-a72-processor-functions/components-of-the-processor
|
||||
# the L1 instruction on the Cortex-A72 cache has a 64-byte cache line.
|
||||
# Thus, 6 bits are needed.
|
||||
config_set(KernelArmCacheLineSizeBits L1_CACHE_LINE_SIZE_BITS "6")
|
||||
elseif(KernelArmCortexA9)
|
||||
config_set(KernelArmCacheLineSizeBits L1_CACHE_LINE_SIZE_BITS "5")
|
||||
config_set(KernelArmCacheLineSizeBits L1_CACHE_LINE_SIZE_BITS "5")
|
||||
endif()
|
||||
|
||||
if(KernelArmCortexA8)
|
||||
config_set(KernelArmHasTlbLock ARM_HAS_TLB_LOCK ON)
|
||||
config_set(KernelArmHasTlbLock ARM_HAS_TLB_LOCK ON)
|
||||
else()
|
||||
config_set(KernelArmHasTlbLock ARM_HAS_TLB_LOCK OFF)
|
||||
config_set(KernelArmHasTlbLock ARM_HAS_TLB_LOCK OFF)
|
||||
endif()
|
||||
|
||||
add_sources(
|
||||
DEP "KernelArchARM"
|
||||
PREFIX src/arch/arm
|
||||
CFILES c_traps.c
|
||||
api/faults.c
|
||||
benchmark/benchmark.c
|
||||
kernel/boot.c
|
||||
kernel/thread.c
|
||||
machine/cache.c
|
||||
machine/errata.c
|
||||
machine/debug.c
|
||||
machine/hardware.c
|
||||
machine/io.c
|
||||
object/interrupt.c
|
||||
object/tcb.c
|
||||
object/iospace.c
|
||||
object/vcpu.c
|
||||
object/smmu.c
|
||||
object/smc.c
|
||||
smp/ipi.c
|
||||
)
|
||||
DEP "KernelArchARM"
|
||||
PREFIX src/arch/arm
|
||||
CFILES c_traps.c
|
||||
api/faults.c
|
||||
benchmark/benchmark.c
|
||||
kernel/boot.c
|
||||
kernel/thread.c
|
||||
machine/cache.c
|
||||
machine/errata.c
|
||||
machine/debug.c
|
||||
machine/hardware.c
|
||||
machine/io.c
|
||||
object/interrupt.c
|
||||
object/tcb.c
|
||||
object/iospace.c
|
||||
object/vcpu.c
|
||||
object/smmu.c
|
||||
object/smc.c
|
||||
smp/ipi.c)
|
||||
|
||||
add_bf_source_old("KernelArchARM" "structures.bf" "include/arch/arm" "arch/object")
|
||||
|
||||
|
|
|
|||
|
|
@ -5,48 +5,40 @@
|
|||
#
|
||||
|
||||
config_string(
|
||||
KernelPTLevels PT_LEVELS "Number of page \
|
||||
KernelPTLevels PT_LEVELS "Number of page \
|
||||
table levels for RISC-V depends on the mode. For example there are: \
|
||||
2, 3 and 4 levels on Sv32, Sv39, Sv48 RISC-V paging modes respectively."
|
||||
DEFAULT 3
|
||||
UNDEF_DISABLED UNQUOTE
|
||||
DEPENDS "KernelArchRiscV"
|
||||
)
|
||||
DEFAULT 3
|
||||
UNDEF_DISABLED UNQUOTE
|
||||
DEPENDS "KernelArchRiscV")
|
||||
|
||||
set(_KernelRiscvExtD ON)
|
||||
set(_KernelRiscvExtF ON)
|
||||
if(LLVM_TOOLCHAIN AND KernelSel4ArchRiscV32)
|
||||
# Versions of clang we support can't compile for D double width floating
|
||||
# point. But we've found that having F but not D still leads to errors with
|
||||
# code that assumes if any floating point is enabled, both F and D are enabled.
|
||||
set(_KernelRiscvExtD OFF)
|
||||
set(_KernelRiscvExtF OFF)
|
||||
# Versions of clang we support can't compile for D double width floating
|
||||
# point. But we've found that having F but not D still leads to errors with
|
||||
# code that assumes if any floating point is enabled, both F and D are enabled.
|
||||
set(_KernelRiscvExtD OFF)
|
||||
set(_KernelRiscvExtF OFF)
|
||||
endif()
|
||||
|
||||
config_option(
|
||||
KernelRiscvExtF RISCV_EXT_F "RISC-V extension for single-precision floating-point"
|
||||
DEFAULT ${_KernelRiscvExtF}
|
||||
DEPENDS "KernelArchRiscV"
|
||||
)
|
||||
config_option(KernelRiscvExtF RISCV_EXT_F "RISC-V extension for single-precision floating-point"
|
||||
DEFAULT ${_KernelRiscvExtF} DEPENDS "KernelArchRiscV")
|
||||
|
||||
config_option(KernelRiscvExtD RISCV_EXT_D "RISC-V extension for double-precision floating-point"
|
||||
DEFAULT ${_KernelRiscvExtD} DEPENDS "KernelArchRiscV")
|
||||
|
||||
config_option(
|
||||
KernelRiscvExtD RISCV_EXT_D "RISC-V extension for double-precision floating-point"
|
||||
DEFAULT ${_KernelRiscvExtD}
|
||||
DEPENDS "KernelArchRiscV"
|
||||
)
|
||||
|
||||
config_option(
|
||||
KernelRiscvUseClintMtime
|
||||
RISCV_USE_CLINT_MTIME
|
||||
"When reading the timestamp \
|
||||
KernelRiscvUseClintMtime
|
||||
RISCV_USE_CLINT_MTIME
|
||||
"When reading the timestamp \
|
||||
from the hardware, directly access the CLINT timer register (mtime) instead \
|
||||
of using the rdtime instruction. This is a performance optimization, but \
|
||||
only for platforms where executing the rdtime instruction results in a \
|
||||
trap into M-mode software which then accesses the CLINT timer register. \
|
||||
Note that this option requires S-mode access to the CLINT."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchRiscV"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchRiscV")
|
||||
|
||||
# Until RISC-V has instructions to count leading/trailing zeros, we provide
|
||||
# library implementations. Platforms that implement the bit manipulation
|
||||
|
|
@ -58,91 +50,69 @@ config_option(
|
|||
# even when the platform has sutiable inline assembly, we do not make these the
|
||||
# default.
|
||||
if(KernelWordSize EQUAL 32)
|
||||
set(KernelClz32
|
||||
ON
|
||||
CACHE BOOL ""
|
||||
)
|
||||
set(KernelCtz32
|
||||
ON
|
||||
CACHE BOOL ""
|
||||
)
|
||||
if(KernelIsMCS)
|
||||
# Used for long division in timer calculations.
|
||||
set(KernelClz64
|
||||
ON
|
||||
CACHE BOOL ""
|
||||
)
|
||||
endif()
|
||||
set(KernelClz32 ON CACHE BOOL "")
|
||||
set(KernelCtz32 ON CACHE BOOL "")
|
||||
if(KernelIsMCS)
|
||||
# Used for long division in timer calculations.
|
||||
set(KernelClz64 ON CACHE BOOL "")
|
||||
endif()
|
||||
elseif(KernelWordSize EQUAL 64)
|
||||
set(KernelClz64
|
||||
ON
|
||||
CACHE BOOL ""
|
||||
)
|
||||
set(KernelCtz64
|
||||
ON
|
||||
CACHE BOOL ""
|
||||
)
|
||||
set(KernelClz64 ON CACHE BOOL "")
|
||||
set(KernelCtz64 ON CACHE BOOL "")
|
||||
endif()
|
||||
|
||||
if(KernelSel4ArchRiscV32)
|
||||
set(KernelPTLevels
|
||||
2
|
||||
CACHE STRING "" FORCE
|
||||
)
|
||||
set(KernelPTLevels 2 CACHE STRING "" FORCE)
|
||||
endif()
|
||||
if(KernelPTLevels EQUAL 2)
|
||||
if(KernelSel4ArchRiscV32)
|
||||
# seL4 on RISCV32 uses 32-bit ints for addresses,
|
||||
# so limit the maximum paddr to 32-bits.
|
||||
math(EXPR KernelPaddrUserTop "(1 << 32) - 1")
|
||||
else()
|
||||
math(EXPR KernelPaddrUserTop "1 << 34")
|
||||
endif()
|
||||
if(KernelSel4ArchRiscV32)
|
||||
# seL4 on RISCV32 uses 32-bit ints for addresses,
|
||||
# so limit the maximum paddr to 32-bits.
|
||||
math(EXPR KernelPaddrUserTop "(1 << 32) - 1")
|
||||
else()
|
||||
math(EXPR KernelPaddrUserTop "1 << 34")
|
||||
endif()
|
||||
elseif(KernelPTLevels EQUAL 3)
|
||||
# RISC-V technically supports 56-bit paddrs,
|
||||
# but structures.bf limits us to using 39 of those bits.
|
||||
math(EXPR KernelPaddrUserTop "1 << 39")
|
||||
# RISC-V technically supports 56-bit paddrs,
|
||||
# but structures.bf limits us to using 39 of those bits.
|
||||
math(EXPR KernelPaddrUserTop "1 << 39")
|
||||
elseif(KernelPTLevels EQUAL 4)
|
||||
math(EXPR KernelPaddrUserTop "1 << 56")
|
||||
math(EXPR KernelPaddrUserTop "1 << 56")
|
||||
endif()
|
||||
|
||||
if(KernelRiscvExtD)
|
||||
# The D extension depends on the base single-precision
|
||||
# instruction subset F.
|
||||
set(KernelRiscvExtF ON)
|
||||
# The D extension depends on the base single-precision
|
||||
# instruction subset F.
|
||||
set(KernelRiscvExtF ON)
|
||||
endif()
|
||||
|
||||
if(KernelRiscvExtF)
|
||||
set(KernelHaveFPU ON)
|
||||
set(KernelHaveFPU ON)
|
||||
endif()
|
||||
|
||||
# This is not supported on RISC-V
|
||||
set(KernelHardwareDebugAPIUnsupported
|
||||
ON
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
set(KernelHardwareDebugAPIUnsupported ON CACHE INTERNAL "")
|
||||
|
||||
add_sources(
|
||||
DEP "KernelArchRiscV"
|
||||
PREFIX src/arch/riscv
|
||||
CFILES c_traps.c
|
||||
idle.c
|
||||
api/faults.c
|
||||
api/benchmark.c
|
||||
kernel/boot.c
|
||||
kernel/thread.c
|
||||
kernel/vspace.c
|
||||
machine/capdl.c
|
||||
machine/hardware.c
|
||||
machine/registerset.c
|
||||
machine/io.c
|
||||
machine/fpu.c
|
||||
model/statedata.c
|
||||
object/interrupt.c
|
||||
object/objecttype.c
|
||||
object/tcb.c
|
||||
smp/ipi.c
|
||||
ASMFILES head.S traps.S idle.S
|
||||
)
|
||||
DEP "KernelArchRiscV"
|
||||
PREFIX src/arch/riscv
|
||||
CFILES c_traps.c
|
||||
idle.c
|
||||
api/faults.c
|
||||
api/benchmark.c
|
||||
kernel/boot.c
|
||||
kernel/thread.c
|
||||
kernel/vspace.c
|
||||
machine/capdl.c
|
||||
machine/hardware.c
|
||||
machine/registerset.c
|
||||
machine/io.c
|
||||
machine/fpu.c
|
||||
model/statedata.c
|
||||
object/interrupt.c
|
||||
object/objecttype.c
|
||||
object/tcb.c
|
||||
smp/ipi.c
|
||||
ASMFILES head.S traps.S idle.S)
|
||||
|
||||
add_bf_source_old("KernelArchRiscV" "structures.bf" "include/arch/riscv" "arch/object")
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@
|
|||
#
|
||||
|
||||
add_sources(
|
||||
DEP "KernelSel4ArchIA32"
|
||||
PREFIX src/arch/x86/32
|
||||
CFILES
|
||||
c_traps.c
|
||||
object/objecttype.c
|
||||
kernel/thread.c
|
||||
kernel/vspace.c
|
||||
kernel/vspace_32paging.c
|
||||
kernel/elf.c
|
||||
model/statedata.c
|
||||
machine/registerset.c
|
||||
machine/capdl.c
|
||||
smp/ipi.c
|
||||
ASMFILES machine_asm.S traps.S head.S
|
||||
)
|
||||
DEP "KernelSel4ArchIA32"
|
||||
PREFIX src/arch/x86/32
|
||||
CFILES c_traps.c
|
||||
object/objecttype.c
|
||||
kernel/thread.c
|
||||
kernel/vspace.c
|
||||
kernel/vspace_32paging.c
|
||||
kernel/elf.c
|
||||
model/statedata.c
|
||||
machine/registerset.c
|
||||
machine/capdl.c
|
||||
smp/ipi.c
|
||||
ASMFILES machine_asm.S traps.S head.S)
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@
|
|||
#
|
||||
|
||||
add_sources(
|
||||
DEP "KernelSel4ArchX86_64"
|
||||
PREFIX src/arch/x86/64
|
||||
CFILES
|
||||
c_traps.c
|
||||
object/objecttype.c
|
||||
kernel/thread.c
|
||||
kernel/vspace.c
|
||||
kernel/elf.c
|
||||
model/statedata.c
|
||||
model/smp.c
|
||||
machine/capdl.c
|
||||
machine/registerset.c
|
||||
smp/ipi.c
|
||||
ASMFILES machine_asm.S traps.S head.S
|
||||
)
|
||||
DEP "KernelSel4ArchX86_64"
|
||||
PREFIX src/arch/x86/64
|
||||
CFILES c_traps.c
|
||||
object/objecttype.c
|
||||
kernel/thread.c
|
||||
kernel/vspace.c
|
||||
kernel/elf.c
|
||||
model/statedata.c
|
||||
model/smp.c
|
||||
machine/capdl.c
|
||||
machine/registerset.c
|
||||
smp/ipi.c
|
||||
ASMFILES machine_asm.S traps.S head.S)
|
||||
|
|
|
|||
|
|
@ -5,165 +5,125 @@
|
|||
#
|
||||
|
||||
if(KernelArchX86)
|
||||
set_property(
|
||||
TARGET kernel_config_target
|
||||
APPEND
|
||||
PROPERTY TOPLEVELTYPES pde_C
|
||||
)
|
||||
# x86 always has an FPU
|
||||
set(KernelHaveFPU ON)
|
||||
set_property(TARGET kernel_config_target APPEND PROPERTY TOPLEVELTYPES pde_C)
|
||||
# x86 always has an FPU
|
||||
set(KernelHaveFPU ON)
|
||||
|
||||
endif()
|
||||
|
||||
# Add any top level types
|
||||
if(KernelSel4ArchX86_64)
|
||||
set_property(
|
||||
TARGET kernel_config_target
|
||||
APPEND
|
||||
PROPERTY TOPLEVELTYPES pdpte_C pml4e_C
|
||||
)
|
||||
set_property(TARGET kernel_config_target APPEND PROPERTY TOPLEVELTYPES pdpte_C pml4e_C)
|
||||
endif()
|
||||
|
||||
config_choice(
|
||||
KernelX86MicroArch
|
||||
KERNEL_X86_MICRO_ARCH
|
||||
"Select the x86 micro architecture"
|
||||
"nehalem;KernelX86MicroArchNehalem;ARCH_X86_NEHALEM;KernelArchX86"
|
||||
"generic;KernelX86MicroArchGeneric;ARCH_X86_GENERIC;KernelArchX86"
|
||||
"westmere;KernelX86MicroArchWestmere;ARCH_X86_WESTMERE;KernelArchX86"
|
||||
"sandy;KernelX86MicroArchSandy;ARCH_X86_SANDY;KernelArchX86"
|
||||
"ivy;KernelX86MicroArchIvy;ARCH_X86_IVY;KernelArchX86"
|
||||
"haswell;KernelX86MicroArchHaswell;ARCH_X86_HASWELL;KernelArchX86"
|
||||
"broadwell;KernelX86MicroArchBroadwell;ARCH_X86_BROADWELL;KernelArchX86"
|
||||
"skylake;KernelX86MicroArchSkylake;ARCH_X86_SKYLAKE;KernelArchX86"
|
||||
)
|
||||
KernelX86MicroArch
|
||||
KERNEL_X86_MICRO_ARCH
|
||||
"Select the x86 micro architecture"
|
||||
"nehalem;KernelX86MicroArchNehalem;ARCH_X86_NEHALEM;KernelArchX86"
|
||||
"generic;KernelX86MicroArchGeneric;ARCH_X86_GENERIC;KernelArchX86"
|
||||
"westmere;KernelX86MicroArchWestmere;ARCH_X86_WESTMERE;KernelArchX86"
|
||||
"sandy;KernelX86MicroArchSandy;ARCH_X86_SANDY;KernelArchX86"
|
||||
"ivy;KernelX86MicroArchIvy;ARCH_X86_IVY;KernelArchX86"
|
||||
"haswell;KernelX86MicroArchHaswell;ARCH_X86_HASWELL;KernelArchX86"
|
||||
"broadwell;KernelX86MicroArchBroadwell;ARCH_X86_BROADWELL;KernelArchX86"
|
||||
"skylake;KernelX86MicroArchSkylake;ARCH_X86_SKYLAKE;KernelArchX86")
|
||||
|
||||
config_choice(
|
||||
KernelIRQController
|
||||
KERNEL_IRQ_CONTROLLER
|
||||
"Select the IRQ controller seL4 will use. Code for others may still be included if \
|
||||
KernelIRQController
|
||||
KERNEL_IRQ_CONTROLLER
|
||||
"Select the IRQ controller seL4 will use. Code for others may still be included if \
|
||||
needed to disable at run time. \
|
||||
PIC -> Use the legacy PIC controller. \
|
||||
IOAPIC -> Use one or more IOAPIC controllers"
|
||||
"IOAPIC;KernelIRQControllerIOAPIC;IRQ_IOAPIC;KernelArchX86"
|
||||
"PIC;KernelIRQControllerPIC;IRQ_PIC;KernelArchX86"
|
||||
)
|
||||
"IOAPIC;KernelIRQControllerIOAPIC;IRQ_IOAPIC;KernelArchX86"
|
||||
"PIC;KernelIRQControllerPIC;IRQ_PIC;KernelArchX86")
|
||||
|
||||
config_string(
|
||||
KernelMaxNumIOAPIC
|
||||
MAX_NUM_IOAPIC
|
||||
"Configure the maximum number of IOAPIC controllers that can be supported. SeL4 \
|
||||
KernelMaxNumIOAPIC
|
||||
MAX_NUM_IOAPIC
|
||||
"Configure the maximum number of IOAPIC controllers that can be supported. SeL4 \
|
||||
will detect IOAPICs regardless of whether the IOAPIC will actually be used as \
|
||||
the final IRQ controller."
|
||||
DEFAULT 1
|
||||
DEPENDS "KernelIRQControllerIOAPIC" DEFAULT_DISABLED 0
|
||||
UNQUOTE
|
||||
)
|
||||
DEFAULT 1
|
||||
DEPENDS "KernelIRQControllerIOAPIC" DEFAULT_DISABLED 0
|
||||
UNQUOTE)
|
||||
|
||||
config_choice(
|
||||
KernelLAPICMode
|
||||
KERNEL_LAPIC_MODE
|
||||
"Select the mode local APIC will use. Not all machines support X2APIC mode."
|
||||
"XAPIC;KernelLAPICModeXPAIC;XAPIC;KernelArchX86"
|
||||
"X2APIC;KernelLAPICModeX2APIC;X2APIC;KernelArchX86"
|
||||
)
|
||||
KernelLAPICMode
|
||||
KERNEL_LAPIC_MODE
|
||||
"Select the mode local APIC will use. Not all machines support X2APIC mode."
|
||||
"XAPIC;KernelLAPICModeXPAIC;XAPIC;KernelArchX86"
|
||||
"X2APIC;KernelLAPICModeX2APIC;X2APIC;KernelArchX86")
|
||||
|
||||
config_option(
|
||||
KernelUseLogicalIDs USE_LOGICAL_IDS
|
||||
"Use logical IDs to broadcast IPI between cores. Not all machines support logical \
|
||||
KernelUseLogicalIDs USE_LOGICAL_IDS
|
||||
"Use logical IDs to broadcast IPI between cores. Not all machines support logical \
|
||||
IDs. In xAPIC mode only 8 cores can be addressed using logical IDs."
|
||||
DEFAULT OFF
|
||||
DEPENDS "NOT ${KernelMaxNumNodes} EQUAL 1;KernelArchX86"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "NOT ${KernelMaxNumNodes} EQUAL 1;KernelArchX86")
|
||||
|
||||
config_string(KernelCacheLnSz CACHE_LN_SZ "Define cache line size for the current architecture"
|
||||
DEFAULT 64 DEPENDS "KernelArchX86" UNDEF_DISABLED UNQUOTE)
|
||||
|
||||
config_option(KernelVTX VTX "VTX support" DEFAULT OFF
|
||||
DEPENDS "KernelArchX86;NOT KernelVerificationBuild")
|
||||
|
||||
config_option(KernelX86_64VTX64BitGuests X86_64_VTX_64BIT_GUESTS "Support 64-bit guests" DEFAULT OFF
|
||||
DEPENDS "KernelArchX86;KernelVTX;NOT KernelVerificationBuild")
|
||||
|
||||
config_option(KernelIOMMU IOMMU "IOMMU support for VT-d enabled chipset" DEFAULT ON
|
||||
DEPENDS "KernelPlatPC99; NOT KernelVerificationBuild" DEFAULT_DISABLED OFF)
|
||||
|
||||
config_string(
|
||||
KernelCacheLnSz CACHE_LN_SZ "Define cache line size for the current architecture"
|
||||
DEFAULT 64
|
||||
DEPENDS "KernelArchX86"
|
||||
UNDEF_DISABLED UNQUOTE
|
||||
)
|
||||
|
||||
config_option(
|
||||
KernelVTX VTX "VTX support"
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchX86;NOT KernelVerificationBuild"
|
||||
)
|
||||
|
||||
config_option(
|
||||
KernelX86_64VTX64BitGuests X86_64_VTX_64BIT_GUESTS "Support 64-bit guests"
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchX86;KernelVTX;NOT KernelVerificationBuild"
|
||||
)
|
||||
|
||||
config_option(
|
||||
KernelIOMMU IOMMU "IOMMU support for VT-d enabled chipset"
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelPlatPC99; NOT KernelVerificationBuild"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
KernelMaxRMRREntries MAX_RMRR_ENTRIES
|
||||
"Setsthe maximum number of Reserved Memory Region Reporting structures we support \
|
||||
recording from the ACPI tables" DEFAULT 32 DEPENDS "KernelIOMMU" DEFAULT_DISABLED 1 UNQUOTE)
|
||||
|
||||
config_string(
|
||||
KernelMaxRMRREntries MAX_RMRR_ENTRIES
|
||||
"Setsthe maximum number of Reserved Memory Region Reporting structures we support \
|
||||
recording from the ACPI tables"
|
||||
DEFAULT 32
|
||||
DEPENDS "KernelIOMMU" DEFAULT_DISABLED 1
|
||||
UNQUOTE
|
||||
)
|
||||
|
||||
config_string(
|
||||
KernelMaxVPIDs
|
||||
MAX_VPIDS
|
||||
"The kernel maintains a mapping of 16-bit VPIDs to VCPUs. This option should be \
|
||||
KernelMaxVPIDs
|
||||
MAX_VPIDS
|
||||
"The kernel maintains a mapping of 16-bit VPIDs to VCPUs. This option should be \
|
||||
sized as small as possible to save memory, but be at least the number of VCPUs that \
|
||||
will be run for optimum performance."
|
||||
DEFAULT 1024
|
||||
DEPENDS "KernelVTX" DEFAULT_DISABLED 0
|
||||
UNQUOTE
|
||||
)
|
||||
DEFAULT 1024
|
||||
DEPENDS "KernelVTX" DEFAULT_DISABLED 0
|
||||
UNQUOTE)
|
||||
|
||||
config_option(
|
||||
KernelHugePage HUGE_PAGE
|
||||
"Add support for 1GB huge page. Not all recent processor models support this feature."
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelSel4ArchX86_64"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
KernelHugePage HUGE_PAGE
|
||||
"Add support for 1GB huge page. Not all recent processor models support this feature." DEFAULT ON
|
||||
DEPENDS "KernelSel4ArchX86_64" DEFAULT_DISABLED OFF)
|
||||
config_option(
|
||||
KernelSupportPCID SUPPORT_PCID
|
||||
"Add support for PCIDs (aka hardware ASIDs). Not all processor models support this feature."
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelSel4ArchX86_64"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
KernelSupportPCID SUPPORT_PCID
|
||||
"Add support for PCIDs (aka hardware ASIDs). Not all processor models support this feature."
|
||||
DEFAULT ON DEPENDS "KernelSel4ArchX86_64" DEFAULT_DISABLED OFF)
|
||||
|
||||
config_choice(
|
||||
KernelSyscall
|
||||
KERNEL_X86_SYSCALL
|
||||
"The kernel only ever supports one method of performing syscalls at a time. This \
|
||||
KernelSyscall
|
||||
KERNEL_X86_SYSCALL
|
||||
"The kernel only ever supports one method of performing syscalls at a time. This \
|
||||
config should be set to the most efficient one that is support by the hardware the \
|
||||
system will run on"
|
||||
"syscall;KernelX86SyscallSyscall;SYSCALL;KernelSel4ArchX86_64"
|
||||
"sysenter;KernelX86SyscallSysenter;SYSENTER;KernelArchX86"
|
||||
)
|
||||
"syscall;KernelX86SyscallSyscall;SYSCALL;KernelSel4ArchX86_64"
|
||||
"sysenter;KernelX86SyscallSysenter;SYSENTER;KernelArchX86")
|
||||
|
||||
config_choice(
|
||||
KernelFPU
|
||||
KERNEL_X86_FPU
|
||||
"Choose the method that FPU state is stored in. This \
|
||||
KernelFPU
|
||||
KERNEL_X86_FPU
|
||||
"Choose the method that FPU state is stored in. This \
|
||||
directly affects the method used to save and restore it. \
|
||||
FXSAVE -> This chooses the legacy 512-byte region used by the fxsave and fxrstor functions \
|
||||
XSAVE -> This chooses the variable xsave region, and enables the ability to use any \
|
||||
of the xsave variants to save and restore. The actual size of the region is dependent on \
|
||||
the features enabled."
|
||||
"XSAVE;KernelFPUXSave;XSAVE;KernelArchX86"
|
||||
"FXSAVE;KernelFPUFXSave;FXSAVE;KernelArchX86"
|
||||
)
|
||||
"XSAVE;KernelFPUXSave;XSAVE;KernelArchX86"
|
||||
"FXSAVE;KernelFPUFXSave;FXSAVE;KernelArchX86")
|
||||
|
||||
config_choice(
|
||||
KernelXSave
|
||||
KERNEL_XSAVE
|
||||
"The XSAVE area supports multiple instructions to save
|
||||
KernelXSave
|
||||
KERNEL_XSAVE
|
||||
"The XSAVE area supports multiple instructions to save
|
||||
and restore to it. These instructions are dependent upon specific CPU support. See Chapter 13 of Volume \
|
||||
1 of the Intel Architectures SOftware Developers Manual for discussion on the init and modified \
|
||||
optimizations. \
|
||||
|
|
@ -175,162 +135,144 @@ config_choice(
|
|||
XSAVEOPT -> Save state taking advantage of both the init optimization and modified optimization \
|
||||
XSAVES -> Save state taking advantage of all optimizations. This instruction is only \
|
||||
available in OS code, and is the preferred save method if it exists."
|
||||
"XSAVE;KernelXSaveXSave;XSAVE_XSAVE;KernelFPUXSave"
|
||||
"XSAVES;KernelXSaveXSaveS;XSAVE_XSAVES;KernelFPUXSave"
|
||||
"XSAVEOPT;KernelXSaveXSaveOpt;XSAVE_XSAVEOPT;KernelFPUXSave"
|
||||
"XSAVEC;KernelXSaveXSaveC;XSAVE_XSAVEC;KernelFPUXSave"
|
||||
)
|
||||
"XSAVE;KernelXSaveXSave;XSAVE_XSAVE;KernelFPUXSave"
|
||||
"XSAVES;KernelXSaveXSaveS;XSAVE_XSAVES;KernelFPUXSave"
|
||||
"XSAVEOPT;KernelXSaveXSaveOpt;XSAVE_XSAVEOPT;KernelFPUXSave"
|
||||
"XSAVEC;KernelXSaveXSaveC;XSAVE_XSAVEC;KernelFPUXSave")
|
||||
|
||||
config_string(
|
||||
KernelXSaveFeatureSet
|
||||
XSAVE_FEATURE_SET
|
||||
"XSAVE can save and restore the state for various features \
|
||||
KernelXSaveFeatureSet
|
||||
XSAVE_FEATURE_SET
|
||||
"XSAVE can save and restore the state for various features \
|
||||
through the use of the feature mask. This config option represents the feature mask that we want to \
|
||||
support. The CPU must support all bits in this feature mask. Current known bits are \
|
||||
0 - FPU \
|
||||
1 - SSE \
|
||||
2 - AVX \
|
||||
FPU and SSE is guaranteed to exist if XSAVE exists."
|
||||
DEFAULT 3
|
||||
DEPENDS "KernelFPUXSave" DEFAULT_DISABLED 0
|
||||
UNQUOTE
|
||||
)
|
||||
DEFAULT 3
|
||||
DEPENDS "KernelFPUXSave" DEFAULT_DISABLED 0
|
||||
UNQUOTE)
|
||||
|
||||
if(KernelFPUXSave)
|
||||
if("${KernelXSaveFeatureSet}" EQUAL 7)
|
||||
set(default_xsave_size 832)
|
||||
else()
|
||||
set(default_xsave_size 576)
|
||||
endif()
|
||||
if("${KernelXSaveFeatureSet}" EQUAL 7)
|
||||
set(default_xsave_size 832)
|
||||
else()
|
||||
set(default_xsave_size 576)
|
||||
endif()
|
||||
else()
|
||||
set(default_xsave_size 512)
|
||||
set(default_xsave_size 512)
|
||||
endif()
|
||||
|
||||
config_string(
|
||||
KernelXSaveSize
|
||||
XSAVE_SIZE
|
||||
"The size of the XSAVE region. This is dependent upon the features in \
|
||||
KernelXSaveSize XSAVE_SIZE "The size of the XSAVE region. This is dependent upon the features in \
|
||||
XSAVE_FEATURE_SET that have been requested. Default is 576 for the FPU and SSE
|
||||
state, unless XSAVE is not in use then it should be 512 for the legacy FXSAVE region."
|
||||
DEFAULT ${default_xsave_size}
|
||||
DEPENDS "KernelArchX86" DEFAULT_DISABLED 0
|
||||
UNQUOTE
|
||||
)
|
||||
DEFAULT ${default_xsave_size}
|
||||
DEPENDS "KernelArchX86" DEFAULT_DISABLED 0
|
||||
UNQUOTE)
|
||||
|
||||
config_choice(
|
||||
KernelFSGSBase
|
||||
KERNEL_FSGS_BASE
|
||||
"There are three ways to to set FS/GS base addresses: \
|
||||
KernelFSGSBase
|
||||
KERNEL_FSGS_BASE
|
||||
"There are three ways to to set FS/GS base addresses: \
|
||||
IA32_FS/GS_GDT, IA32_FS/GS_BASE_MSR, and fsgsbase instructions. \
|
||||
IA32_FS/GS_GDT and IA32_FS/GS_BASE_MSR are available for 32-bit. \
|
||||
IA32_FS/GS_BASE_MSR and fsgsbase instructions are available for 64-bit."
|
||||
"inst;KernelFSGSBaseInst;FSGSBASE_INST;KernelSel4ArchX86_64"
|
||||
"gdt;KernelFSGSBaseGDT;FSGSBASE_GDT;KernelSel4ArchIA32"
|
||||
"msr;KernelFSGSBaseMSR;FSGSBASE_MSR;KernelArchX86"
|
||||
)
|
||||
"inst;KernelFSGSBaseInst;FSGSBASE_INST;KernelSel4ArchX86_64"
|
||||
"gdt;KernelFSGSBaseGDT;FSGSBASE_GDT;KernelSel4ArchIA32"
|
||||
"msr;KernelFSGSBaseMSR;FSGSBASE_MSR;KernelArchX86")
|
||||
|
||||
config_choice(
|
||||
KernelMultibootGFXMode
|
||||
KERNEL_MUTLTIBOOT_GFX_MODE
|
||||
"The type of graphics mode to request from the boot loader. This is encoded into the \
|
||||
KernelMultibootGFXMode
|
||||
KERNEL_MUTLTIBOOT_GFX_MODE
|
||||
"The type of graphics mode to request from the boot loader. This is encoded into the \
|
||||
multiboot header and is merely a hint, the boot loader is free to ignore or set some \
|
||||
other mode"
|
||||
"none;KernelMultibootGFXModeNone;MULTIBOOT_GRAPHICS_MODE_NONE;KernelArchX86"
|
||||
"text;KernelMultibootGFXModeText;MULTIBOOT_GRAPHICS_MODE_TEXT;KernelArchX86"
|
||||
"linear;KernelMultibootGFXModeLinear;MULTIBOOT_GRAPHICS_MODE_LINEAR;KernelArchX86"
|
||||
)
|
||||
"none;KernelMultibootGFXModeNone;MULTIBOOT_GRAPHICS_MODE_NONE;KernelArchX86"
|
||||
"text;KernelMultibootGFXModeText;MULTIBOOT_GRAPHICS_MODE_TEXT;KernelArchX86"
|
||||
"linear;KernelMultibootGFXModeLinear;MULTIBOOT_GRAPHICS_MODE_LINEAR;KernelArchX86")
|
||||
|
||||
config_string(
|
||||
KernelMultibootGFXDepth MULTIBOOT_GRAPHICS_MODE_DEPTH
|
||||
"The bits per pixel of the linear graphics mode to request. Value of zero indicates \
|
||||
no preference."
|
||||
DEFAULT 32
|
||||
DEPENDS "KernelMultibootGFXModeLinear"
|
||||
UNDEF_DISABLED UNQUOTE
|
||||
)
|
||||
KernelMultibootGFXDepth MULTIBOOT_GRAPHICS_MODE_DEPTH
|
||||
"The bits per pixel of the linear graphics mode to request. Value of zero indicates \
|
||||
no preference." DEFAULT 32 DEPENDS "KernelMultibootGFXModeLinear" UNDEF_DISABLED UNQUOTE)
|
||||
|
||||
config_string(
|
||||
KernelMultibootGFXWidth
|
||||
MULTIBOOT_GRAPHICS_MODE_WIDTH
|
||||
"The width of the graphics mode to request. For a linear graphics mode this is the \
|
||||
KernelMultibootGFXWidth
|
||||
MULTIBOOT_GRAPHICS_MODE_WIDTH
|
||||
"The width of the graphics mode to request. For a linear graphics mode this is the \
|
||||
number of pixels. For a text mode this is the number of characters, value of zero \
|
||||
indicates no preference."
|
||||
DEFAULT 0
|
||||
DEPENDS "KernelMultibootGFXModeText OR KernelMultibootGFXModeLinear"
|
||||
UNDEF_DISABLED UNQUOTE
|
||||
)
|
||||
DEFAULT 0
|
||||
DEPENDS "KernelMultibootGFXModeText OR KernelMultibootGFXModeLinear"
|
||||
UNDEF_DISABLED UNQUOTE)
|
||||
config_string(
|
||||
KernelMultibootGFXHeight
|
||||
MULTIBOOT_GRAPHICS_MODE_HEIGHT
|
||||
"The height of the graphics mode to request. For a linear graphics mode this is the \
|
||||
KernelMultibootGFXHeight
|
||||
MULTIBOOT_GRAPHICS_MODE_HEIGHT
|
||||
"The height of the graphics mode to request. For a linear graphics mode this is the \
|
||||
number of pixels. For a text mode this is the number of characters, value of zero \
|
||||
indicates no preference."
|
||||
DEFAULT 0
|
||||
DEPENDS "KernelMultibootGFXModeText OR KernelMultibootGFXModeLinear"
|
||||
UNDEF_DISABLED UNQUOTE
|
||||
)
|
||||
DEFAULT 0
|
||||
DEPENDS "KernelMultibootGFXModeText OR KernelMultibootGFXModeLinear"
|
||||
UNDEF_DISABLED UNQUOTE)
|
||||
|
||||
config_option(
|
||||
KernelMultiboot1Header
|
||||
MULTIBOOT1_HEADER
|
||||
"Inserts a header that indicates to the bootloader that the kernel supports a multiboot 1 boot header"
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelArchX86"
|
||||
)
|
||||
KernelMultiboot1Header
|
||||
MULTIBOOT1_HEADER
|
||||
"Inserts a header that indicates to the bootloader that the kernel supports a multiboot 1 boot header"
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelArchX86")
|
||||
|
||||
config_option(
|
||||
KernelMultiboot2Header
|
||||
MULTIBOOT2_HEADER
|
||||
"Inserts a header that indicates to the bootloader that the kernel supports a multiboot 2 boot header. \
|
||||
KernelMultiboot2Header
|
||||
MULTIBOOT2_HEADER
|
||||
"Inserts a header that indicates to the bootloader that the kernel supports a multiboot 2 boot header. \
|
||||
This is can be enabled together with a multiboot 1 header and the boot loader may use either one"
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelArchX86"
|
||||
)
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelArchX86")
|
||||
|
||||
config_option(
|
||||
KernelSkimWindow
|
||||
KERNEL_SKIM_WINDOW
|
||||
"Prevent against the Meltdown vulnerability by using a reduced Static Kernel
|
||||
KernelSkimWindow
|
||||
KERNEL_SKIM_WINDOW
|
||||
"Prevent against the Meltdown vulnerability by using a reduced Static Kernel
|
||||
Image and Micro-state window instead of having all kernel state in the kernel window.
|
||||
This only needs to be enabled if deploying to a vulnerable processor"
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelSel4ArchX86_64"
|
||||
DEFAULT_DISABLED OFF
|
||||
)
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelSel4ArchX86_64"
|
||||
DEFAULT_DISABLED OFF)
|
||||
|
||||
config_option(
|
||||
KernelExportPMCUser
|
||||
EXPORT_PMC_USER
|
||||
"Grant user access to the Performance Monitoring Counters.
|
||||
KernelExportPMCUser
|
||||
EXPORT_PMC_USER
|
||||
"Grant user access to the Performance Monitoring Counters.
|
||||
This allows the user to read performance counters, although
|
||||
not control what the counters are and whether or not they
|
||||
are counting. Nevertheless whilst this is useful for
|
||||
evalulating performance this option opens timing and covert
|
||||
channels."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchX86;NOT KernelVerificationBuild"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchX86;NOT KernelVerificationBuild")
|
||||
|
||||
config_option(
|
||||
KernelX86DangerousMSR
|
||||
KERNEL_X86_DANGEROUS_MSR
|
||||
"rdmsr/wrmsr kernel interface. Provides a syscall interface for reading and writing arbitrary MSRs.
|
||||
KernelX86DangerousMSR
|
||||
KERNEL_X86_DANGEROUS_MSR
|
||||
"rdmsr/wrmsr kernel interface. Provides a syscall interface for reading and writing arbitrary MSRs.
|
||||
This is extremely dangerous as no checks are performed and exists
|
||||
to aid debugging and benchmarking."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchX86;NOT KernelVerificationBuild"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchX86;NOT KernelVerificationBuild")
|
||||
|
||||
if(KernelArchX86 AND (NOT "${KernelMaxNumNodes}" EQUAL 1))
|
||||
set(STIBDEP TRUE)
|
||||
set(STIBDEP TRUE)
|
||||
else()
|
||||
set(STIBDEP FALSE)
|
||||
set(STIBDEP FALSE)
|
||||
endif()
|
||||
|
||||
config_choice(
|
||||
KernelX86IBRSMode
|
||||
KERNEL_X86_IBRS
|
||||
"Indirect Branch Restricted Speculation mode
|
||||
KernelX86IBRSMode
|
||||
KERNEL_X86_IBRS
|
||||
"Indirect Branch Restricted Speculation mode
|
||||
Used to prevent a user from manipulating the branch predictor to manipulate speculative
|
||||
execution of other processes. On current processors IBRS has a prohibitive performance
|
||||
penalty and it is recommended that it be disabled such that software mitigations are
|
||||
|
|
@ -340,85 +282,81 @@ config_choice(
|
|||
vulnerable to RSB underflow. The STIBP is essentially software mitigation but enables
|
||||
the single thread isolation for branch predictions. This is only needed if attempting
|
||||
to protect user level process from each other in a multicore environment."
|
||||
"ibrs_none;KernelX86IBRSnone;KERNEL_X86_IBRS_NONE;KernelArchX86"
|
||||
"ibrs_stibp;KernelX86IBRSSTIBP;KERNEL_X86_IBRS_STIBP;STIBPDEP"
|
||||
"ibrs_basic;KernelX86IBRSBasic;KERNEL_X86_IBRS_BASIC;KernelArchX86"
|
||||
"ibrs_all;KernelX86IBRSAll;KERNEL_X86_IBRS_ALL;KernelArchX86"
|
||||
)
|
||||
"ibrs_none;KernelX86IBRSnone;KERNEL_X86_IBRS_NONE;KernelArchX86"
|
||||
"ibrs_stibp;KernelX86IBRSSTIBP;KERNEL_X86_IBRS_STIBP;STIBPDEP"
|
||||
"ibrs_basic;KernelX86IBRSBasic;KERNEL_X86_IBRS_BASIC;KernelArchX86"
|
||||
"ibrs_all;KernelX86IBRSAll;KERNEL_X86_IBRS_ALL;KernelArchX86")
|
||||
|
||||
if(KernelX86IBRSBasic OR KernelX86IBRSSTIBP)
|
||||
# As the kernel has no function pointers or other indirect jumps except those
|
||||
# as generated by the compiler through switch statements we can disable jump
|
||||
# tables in order to prevent Spectre Variant 2 style attacks.
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-jump-tables")
|
||||
# As the kernel has no function pointers or other indirect jumps except those
|
||||
# as generated by the compiler through switch statements we can disable jump
|
||||
# tables in order to prevent Spectre Variant 2 style attacks.
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-jump-tables")
|
||||
endif()
|
||||
|
||||
config_option(
|
||||
KernelX86IBPBOnContextSwitch
|
||||
KERNEL_X86_IBPB_ON_CONTEXT_SWITCH
|
||||
"Performs a IBPB on every context switch to prevent Spectre attacks between user
|
||||
KernelX86IBPBOnContextSwitch
|
||||
KERNEL_X86_IBPB_ON_CONTEXT_SWITCH
|
||||
"Performs a IBPB on every context switch to prevent Spectre attacks between user
|
||||
processes. This is extremely expensive and is recommended you only turn this on
|
||||
if absolutely necessary.
|
||||
Note that in a multicore environment you should also enable STIBP to prevent
|
||||
other cores retraining the branch predictor even after context switch."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchX86"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchX86")
|
||||
|
||||
config_option(
|
||||
KernelX86RSBOnContextSwitch
|
||||
KERNEL_X86_RSB_ON_CONTEXT_SWITCH
|
||||
"Flushes the RSB on context switch to prevent Spectre attacks between user processes.
|
||||
KernelX86RSBOnContextSwitch
|
||||
KERNEL_X86_RSB_ON_CONTEXT_SWITCH
|
||||
"Flushes the RSB on context switch to prevent Spectre attacks between user processes.
|
||||
Whilst not nearly as expensive as an IBPB it is not enabled by default as it is
|
||||
largely pointless to flush the RSB without also doing an IBPB as the RSB is already
|
||||
a harder attack vector."
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchX86"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArchX86")
|
||||
|
||||
if(KernelSel4ArchIA32)
|
||||
set(KernelSetTLSBaseSelf ON)
|
||||
math(EXPR KernelPaddrUserTop "0xffff0000")
|
||||
set(KernelSetTLSBaseSelf ON)
|
||||
math(EXPR KernelPaddrUserTop "0xffff0000")
|
||||
else()
|
||||
math(EXPR KernelPaddrUserTop "1 << 47")
|
||||
math(EXPR KernelPaddrUserTop "1 << 47")
|
||||
endif()
|
||||
if(KernelSel4ArchX86_64 AND NOT KernelFSGSBaseInst)
|
||||
set(KernelSetTLSBaseSelf ON)
|
||||
set(KernelSetTLSBaseSelf ON)
|
||||
endif()
|
||||
|
||||
add_sources(
|
||||
DEP "KernelArchX86"
|
||||
PREFIX src/arch/x86
|
||||
CFILES c_traps.c
|
||||
idle.c
|
||||
api/faults.c
|
||||
object/interrupt.c
|
||||
object/ioport.c
|
||||
object/objecttype.c
|
||||
object/tcb.c
|
||||
object/iospace.c
|
||||
object/vcpu.c
|
||||
kernel/vspace.c
|
||||
kernel/apic.c
|
||||
kernel/xapic.c
|
||||
kernel/x2apic.c
|
||||
kernel/boot_sys.c
|
||||
kernel/smp_sys.c
|
||||
kernel/boot.c
|
||||
kernel/cmdline.c
|
||||
kernel/ept.c
|
||||
kernel/thread.c
|
||||
model/statedata.c
|
||||
machine/capdl.c
|
||||
machine/hardware.c
|
||||
machine/fpu.c
|
||||
machine/cpu_identification.c
|
||||
machine/breakpoint.c
|
||||
machine/registerset.c
|
||||
benchmark/benchmark.c
|
||||
smp/ipi.c
|
||||
ASMFILES multiboot.S idle.S
|
||||
)
|
||||
DEP "KernelArchX86"
|
||||
PREFIX src/arch/x86
|
||||
CFILES c_traps.c
|
||||
idle.c
|
||||
api/faults.c
|
||||
object/interrupt.c
|
||||
object/ioport.c
|
||||
object/objecttype.c
|
||||
object/tcb.c
|
||||
object/iospace.c
|
||||
object/vcpu.c
|
||||
kernel/vspace.c
|
||||
kernel/apic.c
|
||||
kernel/xapic.c
|
||||
kernel/x2apic.c
|
||||
kernel/boot_sys.c
|
||||
kernel/smp_sys.c
|
||||
kernel/boot.c
|
||||
kernel/cmdline.c
|
||||
kernel/ept.c
|
||||
kernel/thread.c
|
||||
model/statedata.c
|
||||
machine/capdl.c
|
||||
machine/hardware.c
|
||||
machine/fpu.c
|
||||
machine/cpu_identification.c
|
||||
machine/breakpoint.c
|
||||
machine/registerset.c
|
||||
benchmark/benchmark.c
|
||||
smp/ipi.c
|
||||
ASMFILES multiboot.S idle.S)
|
||||
|
||||
add_bf_source_old("KernelArchX86" "structures.bf" "include/arch/x86" "arch/object")
|
||||
|
||||
|
|
|
|||
|
|
@ -5,44 +5,36 @@
|
|||
#
|
||||
|
||||
add_sources(
|
||||
CFILES
|
||||
src/inlines.c
|
||||
src/assert.c
|
||||
src/util.c
|
||||
src/string.c
|
||||
src/fastpath/fastpath.c
|
||||
src/api/syscall.c
|
||||
src/api/faults.c
|
||||
src/kernel/cspace.c
|
||||
src/kernel/faulthandler.c
|
||||
src/kernel/thread.c
|
||||
src/kernel/boot.c
|
||||
src/kernel/stack.c
|
||||
src/object/notification.c
|
||||
src/object/cnode.c
|
||||
src/object/endpoint.c
|
||||
src/object/interrupt.c
|
||||
src/object/objecttype.c
|
||||
src/object/tcb.c
|
||||
src/object/untyped.c
|
||||
src/model/preemption.c
|
||||
src/model/statedata.c
|
||||
src/model/smp.c
|
||||
src/machine/io.c
|
||||
src/machine/capdl.c
|
||||
src/machine/registerset.c
|
||||
src/machine/fpu.c
|
||||
src/benchmark/benchmark.c
|
||||
src/benchmark/benchmark_track.c
|
||||
src/benchmark/benchmark_utilisation.c
|
||||
src/smp/lock.c
|
||||
src/smp/ipi.c
|
||||
)
|
||||
add_sources(
|
||||
DEP KernelIsMCS
|
||||
CFILES
|
||||
src/object/reply.c
|
||||
src/object/schedcontext.c
|
||||
src/object/schedcontrol.c
|
||||
src/kernel/sporadic.c
|
||||
)
|
||||
CFILES src/inlines.c
|
||||
src/assert.c
|
||||
src/util.c
|
||||
src/string.c
|
||||
src/fastpath/fastpath.c
|
||||
src/api/syscall.c
|
||||
src/api/faults.c
|
||||
src/kernel/cspace.c
|
||||
src/kernel/faulthandler.c
|
||||
src/kernel/thread.c
|
||||
src/kernel/boot.c
|
||||
src/kernel/stack.c
|
||||
src/object/notification.c
|
||||
src/object/cnode.c
|
||||
src/object/endpoint.c
|
||||
src/object/interrupt.c
|
||||
src/object/objecttype.c
|
||||
src/object/tcb.c
|
||||
src/object/untyped.c
|
||||
src/model/preemption.c
|
||||
src/model/statedata.c
|
||||
src/model/smp.c
|
||||
src/machine/io.c
|
||||
src/machine/capdl.c
|
||||
src/machine/registerset.c
|
||||
src/machine/fpu.c
|
||||
src/benchmark/benchmark.c
|
||||
src/benchmark/benchmark_track.c
|
||||
src/benchmark/benchmark_utilisation.c
|
||||
src/smp/lock.c
|
||||
src/smp/ipi.c)
|
||||
add_sources(DEP KernelIsMCS CFILES src/object/reply.c src/object/schedcontext.c
|
||||
src/object/schedcontrol.c src/kernel/sporadic.c)
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
#
|
||||
|
||||
macro(register_driver compatibility_strings match_strings)
|
||||
foreach(match_string IN ITEMS ${match_strings})
|
||||
list(FIND ${compatibility_strings} ${match_string} res)
|
||||
if(NOT (res EQUAL -1))
|
||||
add_sources(${ARGN})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(match_string IN ITEMS ${match_strings})
|
||||
list(FIND ${compatibility_strings} ${match_string} res)
|
||||
if(NOT (res EQUAL -1))
|
||||
add_sources(${ARGN})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
include(src/drivers/serial/config.cmake)
|
||||
|
|
|
|||
|
|
@ -5,40 +5,19 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
register_driver(
|
||||
compatibility_strings "brcm,bcm2835-aux-uart"
|
||||
PREFIX src/drivers/serial
|
||||
CFILES "bcm2835-aux-uart.c"
|
||||
)
|
||||
register_driver(compatibility_strings "brcm,bcm2835-aux-uart" PREFIX src/drivers/serial
|
||||
CFILES "bcm2835-aux-uart.c")
|
||||
register_driver(compatibility_strings "arm,pl011" PREFIX src/drivers/serial CFILES "pl011.c")
|
||||
register_driver(
|
||||
compatibility_strings "nvidia,tegra20-uart;ti,omap3-uart;snps,dw-apb-uart"
|
||||
PREFIX src/drivers/serial
|
||||
CFILES "tegra_omap3_dwapb.c"
|
||||
)
|
||||
register_driver(
|
||||
compatibility_strings "fsl,imx6q-uart;fsl,imx6sx-uart"
|
||||
PREFIX src/drivers/serial
|
||||
CFILES "imx.c"
|
||||
)
|
||||
register_driver(
|
||||
compatibility_strings "fsl,imx8qxp-lpuart;fsl,imx7ulp-lpuart"
|
||||
PREFIX src/drivers/serial
|
||||
CFILES "imx-lpuart.c"
|
||||
)
|
||||
register_driver(
|
||||
compatibility_strings "samsung,exynos4210-uart"
|
||||
PREFIX src/drivers/serial
|
||||
CFILES "exynos4210-uart.c"
|
||||
)
|
||||
register_driver(
|
||||
compatibility_strings "qcom,msm-uartdm"
|
||||
PREFIX src/drivers/serial
|
||||
CFILES "msm-uartdm.c"
|
||||
)
|
||||
register_driver(compatibility_strings "nvidia,tegra20-uart;ti,omap3-uart;snps,dw-apb-uart"
|
||||
PREFIX src/drivers/serial CFILES "tegra_omap3_dwapb.c")
|
||||
register_driver(compatibility_strings "fsl,imx6q-uart;fsl,imx6sx-uart" PREFIX src/drivers/serial
|
||||
CFILES "imx.c")
|
||||
register_driver(compatibility_strings "fsl,imx8qxp-lpuart;fsl,imx7ulp-lpuart"
|
||||
PREFIX src/drivers/serial CFILES "imx-lpuart.c")
|
||||
register_driver(compatibility_strings "samsung,exynos4210-uart" PREFIX src/drivers/serial
|
||||
CFILES "exynos4210-uart.c")
|
||||
register_driver(compatibility_strings "qcom,msm-uartdm" PREFIX src/drivers/serial
|
||||
CFILES "msm-uartdm.c")
|
||||
register_driver(compatibility_strings "xlnx,xuartps" PREFIX src/drivers/serial CFILES "xuartps.c")
|
||||
register_driver(
|
||||
compatibility_strings "amlogic,meson-gx-uart"
|
||||
PREFIX src/drivers/serial
|
||||
CFILES "meson-gx-uart.c"
|
||||
)
|
||||
register_driver(compatibility_strings "amlogic,meson-gx-uart" PREFIX src/drivers/serial
|
||||
CFILES "meson-gx-uart.c")
|
||||
|
|
|
|||
|
|
@ -4,106 +4,83 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
register_driver(
|
||||
compatibility_strings "ti,am335x-timer"
|
||||
PREFIX src/drivers/timer
|
||||
CFILES "am335x-timer.c"
|
||||
)
|
||||
register_driver(
|
||||
compatibility_strings "qcom,kpss-timer"
|
||||
PREFIX src/drivers/timer
|
||||
CFILES "kpss-timer.c"
|
||||
)
|
||||
register_driver(
|
||||
compatibility_strings "samsung,exynos4210-mct"
|
||||
PREFIX src/drivers/timer
|
||||
CFILES "exynos4210-mct.c"
|
||||
)
|
||||
register_driver(
|
||||
compatibility_strings "samsung,exynos4412-mct"
|
||||
PREFIX src/drivers/timer
|
||||
CFILES "exynos4412-mct.c"
|
||||
)
|
||||
register_driver(
|
||||
compatibility_strings "ti,omap3430-timer"
|
||||
PREFIX src/drivers/timer
|
||||
CFILES "omap3430-timer.c"
|
||||
)
|
||||
register_driver(
|
||||
compatibility_strings "arm,cortex-a9-twd-timer"
|
||||
PREFIX src/drivers/timer
|
||||
CFILES "priv_timer.c"
|
||||
)
|
||||
register_driver(
|
||||
compatibility_strings "arm,cortex-a9-global-timer"
|
||||
PREFIX src/drivers/timer
|
||||
CFILES "global_timer.c"
|
||||
)
|
||||
register_driver(
|
||||
compatibility_strings "arm,armv7-timer"
|
||||
PREFIX src/drivers/timer
|
||||
CFILES "generic_timer.c"
|
||||
)
|
||||
register_driver(
|
||||
compatibility_strings "arm,armv8-timer"
|
||||
PREFIX src/drivers/timer
|
||||
CFILES "generic_timer.c"
|
||||
)
|
||||
register_driver(compatibility_strings "ti,am335x-timer" PREFIX src/drivers/timer
|
||||
CFILES "am335x-timer.c")
|
||||
register_driver(compatibility_strings "qcom,kpss-timer" PREFIX src/drivers/timer
|
||||
CFILES "kpss-timer.c")
|
||||
register_driver(compatibility_strings "samsung,exynos4210-mct" PREFIX src/drivers/timer
|
||||
CFILES "exynos4210-mct.c")
|
||||
register_driver(compatibility_strings "samsung,exynos4412-mct" PREFIX src/drivers/timer
|
||||
CFILES "exynos4412-mct.c")
|
||||
register_driver(compatibility_strings "ti,omap3430-timer" PREFIX src/drivers/timer
|
||||
CFILES "omap3430-timer.c")
|
||||
register_driver(compatibility_strings "arm,cortex-a9-twd-timer" PREFIX src/drivers/timer
|
||||
CFILES "priv_timer.c")
|
||||
register_driver(compatibility_strings "arm,cortex-a9-global-timer" PREFIX src/drivers/timer
|
||||
CFILES "global_timer.c")
|
||||
register_driver(compatibility_strings "arm,armv7-timer" PREFIX src/drivers/timer
|
||||
CFILES "generic_timer.c")
|
||||
register_driver(compatibility_strings "arm,armv8-timer" PREFIX src/drivers/timer
|
||||
CFILES "generic_timer.c")
|
||||
|
||||
set(KernelArmHaveGenericTimer OFF)
|
||||
|
||||
foreach(match_string IN ITEMS "arm,armv7-timer" "arm,armv8-timer")
|
||||
if(${match_string} IN_LIST compatibility_strings)
|
||||
set(KernelArmHaveGenericTimer ON)
|
||||
break()
|
||||
endif()
|
||||
if(${match_string} IN_LIST compatibility_strings)
|
||||
set(KernelArmHaveGenericTimer ON)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
config_option(
|
||||
KernelArmExportPCNTUser EXPORT_PCNT_USER "PL0 access to generic timer CNTPCT and CNTFRQ. \
|
||||
KernelArmExportPCNTUser
|
||||
EXPORT_PCNT_USER
|
||||
"PL0 access to generic timer CNTPCT and CNTFRQ. \
|
||||
Grant user access to physical counter and counter \
|
||||
frequency registers of the generic timer. \
|
||||
WARNING: selecting this option opens a timing \
|
||||
channel"
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArmHaveGenericTimer"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArmHaveGenericTimer")
|
||||
|
||||
config_option(
|
||||
KernelArmExportVCNTUser EXPORT_VCNT_USER "PL0 access to generic timer CNTVCT and CNTFRQ. \
|
||||
KernelArmExportVCNTUser
|
||||
EXPORT_VCNT_USER
|
||||
"PL0 access to generic timer CNTVCT and CNTFRQ. \
|
||||
Grant user access to virtual counter and counter \
|
||||
frequency registers of the generic timer. \
|
||||
WARNING: selecting this option opens a timing \
|
||||
channel"
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArmHaveGenericTimer"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArmHaveGenericTimer")
|
||||
|
||||
config_option(
|
||||
KernelArmExportPTMRUser EXPORT_PTMR_USER "PL0 access to generic timer CNTP_CTL and CNTP_CVAL. \
|
||||
KernelArmExportPTMRUser
|
||||
EXPORT_PTMR_USER
|
||||
"PL0 access to generic timer CNTP_CTL and CNTP_CVAL. \
|
||||
Grant user access to physical timer registers of the generic timer. \
|
||||
WARNING: selecting this option opens a storage channel and allows threads to easily \
|
||||
corrupt these registers for each other, this should only be used for \
|
||||
debugging / development purposes"
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArmHaveGenericTimer"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArmHaveGenericTimer")
|
||||
|
||||
config_option(
|
||||
KernelArmExportVTMRUser EXPORT_VTMR_USER "PL0 access to generic timer CNTV_CTL and CNTV_CVAL. \
|
||||
KernelArmExportVTMRUser
|
||||
EXPORT_VTMR_USER
|
||||
"PL0 access to generic timer CNTV_CTL and CNTV_CVAL. \
|
||||
Grant user access to virtual timer registers of the generic timer. \
|
||||
WARNING: selecting this option opens a storage channel and allows threads to easily \
|
||||
corrupt these registers for each other, this should only be used for \
|
||||
debugging / development purposes"
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArmHaveGenericTimer"
|
||||
)
|
||||
DEFAULT OFF
|
||||
DEPENDS "KernelArmHaveGenericTimer")
|
||||
|
||||
config_option(
|
||||
KernelArmVtimerUpdateVOffset VTIMER_UPDATE_VOFFSET
|
||||
"When set the kernel will update the VOFFSET \
|
||||
KernelArmVtimerUpdateVOffset
|
||||
VTIMER_UPDATE_VOFFSET
|
||||
"When set the kernel will update the VOFFSET \
|
||||
register of a VCPU when restoring it so that its view of Virtual time hasn't increased while it \
|
||||
was suspended. When unset the VOFFSET won't be updated other than by the read and write register api."
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelArmHypervisorSupport"
|
||||
)
|
||||
DEFAULT ON
|
||||
DEPENDS "KernelArmHypervisorSupport")
|
||||
|
|
|
|||
|
|
@ -7,22 +7,19 @@
|
|||
declare_platform(hifive-p550 KernelPlatformHifiveP550 PLAT_HIFIVE_P550 KernelArchRiscV)
|
||||
|
||||
if(KernelPlatformHifiveP550)
|
||||
declare_seL4_arch(riscv64)
|
||||
config_set(KernelRiscVPlatform RISCV_PLAT ${KernelPlatform})
|
||||
config_set(KernelPlatformFirstHartID FIRST_HART_ID 0)
|
||||
config_set(KernelOpenSBIPlatform OPENSBI_PLATFORM "generic")
|
||||
# Note that by default the kernel is configured for the 16GB model.
|
||||
list(APPEND KernelDTSList "tools/dts/${KernelPlatform}.dts")
|
||||
list(APPEND KernelDTSList "${CMAKE_CURRENT_LIST_DIR}/overlay-${KernelPlatform}.dts")
|
||||
# The value for TIMER_FREQUENCY is from the "timebase-frequency" field on
|
||||
# the "cpus" node in the HiFive P550 device tree.
|
||||
# The value for MAX_IRQ comes from the DTS "interrupt-controller" node which says
|
||||
# "riscv,ndev = <0x208>".
|
||||
declare_default_headers(
|
||||
TIMER_FREQUENCY 1000000
|
||||
MAX_IRQ 520
|
||||
INTERRUPT_CONTROLLER drivers/irq/riscv_plic0.h
|
||||
)
|
||||
declare_seL4_arch(riscv64)
|
||||
config_set(KernelRiscVPlatform RISCV_PLAT ${KernelPlatform})
|
||||
config_set(KernelPlatformFirstHartID FIRST_HART_ID 0)
|
||||
config_set(KernelOpenSBIPlatform OPENSBI_PLATFORM "generic")
|
||||
# Note that by default the kernel is configured for the 16GB model.
|
||||
list(APPEND KernelDTSList "tools/dts/${KernelPlatform}.dts")
|
||||
list(APPEND KernelDTSList "${CMAKE_CURRENT_LIST_DIR}/overlay-${KernelPlatform}.dts")
|
||||
# The value for TIMER_FREQUENCY is from the "timebase-frequency" field on
|
||||
# the "cpus" node in the HiFive P550 device tree.
|
||||
# The value for MAX_IRQ comes from the DTS "interrupt-controller" node which says
|
||||
# "riscv,ndev = <0x208>".
|
||||
declare_default_headers(TIMER_FREQUENCY 1000000 MAX_IRQ 520
|
||||
INTERRUPT_CONTROLLER drivers/irq/riscv_plic0.h)
|
||||
else()
|
||||
unset(KernelPlatformFirstHartID CACHE)
|
||||
unset(KernelPlatformFirstHartID CACHE)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -7,21 +7,18 @@
|
|||
declare_platform(bananapi-f3 KernelPlatformBananapiF3 PLAT_BANANAPIF3 KernelArchRiscV)
|
||||
|
||||
if(KernelPlatformBananapiF3)
|
||||
declare_seL4_arch(riscv64)
|
||||
config_set(KernelRiscVPlatform RISCV_PLAT ${KernelPlatform})
|
||||
config_set(KernelPlatformFirstHartID FIRST_HART_ID 0)
|
||||
config_set(KernelOpenSBIPlatform OPENSBI_PLATFORM "generic")
|
||||
list(APPEND KernelDTSList "tools/dts/${KernelPlatform}.dts")
|
||||
list(APPEND KernelDTSList "${CMAKE_CURRENT_LIST_DIR}/overlay-${KernelPlatform}.dts")
|
||||
# The value for TIMER_FREQUENCY is from the "timebase-frequency" field on
|
||||
# the "cpus" node in the Banana Pi F3 device tree.
|
||||
# The value for MAX_IRQ comes from the DTS "interrupt-controller" node which says
|
||||
# "riscv,ndev = <0x9f>".
|
||||
declare_default_headers(
|
||||
TIMER_FREQUENCY 24000000
|
||||
MAX_IRQ 159
|
||||
INTERRUPT_CONTROLLER drivers/irq/riscv_plic0.h
|
||||
)
|
||||
declare_seL4_arch(riscv64)
|
||||
config_set(KernelRiscVPlatform RISCV_PLAT ${KernelPlatform})
|
||||
config_set(KernelPlatformFirstHartID FIRST_HART_ID 0)
|
||||
config_set(KernelOpenSBIPlatform OPENSBI_PLATFORM "generic")
|
||||
list(APPEND KernelDTSList "tools/dts/${KernelPlatform}.dts")
|
||||
list(APPEND KernelDTSList "${CMAKE_CURRENT_LIST_DIR}/overlay-${KernelPlatform}.dts")
|
||||
# The value for TIMER_FREQUENCY is from the "timebase-frequency" field on
|
||||
# the "cpus" node in the Banana Pi F3 device tree.
|
||||
# The value for MAX_IRQ comes from the DTS "interrupt-controller" node which says
|
||||
# "riscv,ndev = <0x9f>".
|
||||
declare_default_headers(TIMER_FREQUENCY 24000000 MAX_IRQ 159
|
||||
INTERRUPT_CONTROLLER drivers/irq/riscv_plic0.h)
|
||||
else()
|
||||
unset(KernelPlatformFirstHartID CACHE)
|
||||
unset(KernelPlatformFirstHartID CACHE)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -7,41 +7,38 @@
|
|||
# File for helpers that are very specific to the kernel
|
||||
|
||||
function(gen_invocation_header)
|
||||
cmake_parse_arguments(PARSE_ARGV 0 "GEN" "LIBSEL4;ARCH;SEL4ARCH" "OUTPUT;XML" "")
|
||||
if(NOT "${GEN_UNPARSED_ARGUMENTS}" STREQUAL "")
|
||||
message(FATAL_ERROR "Unknown arguments to gen_invocation_header: ${GEN_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
# Ensure only one of arch or sel4arch
|
||||
if(GEN_ARCH AND GEN_SEL4ARCH)
|
||||
message(FATAL_ERROR "Can only specify one of ARCH or SEL4ARCH")
|
||||
endif()
|
||||
# OUTPUT and XML are required
|
||||
if(("${GEN_OUTPUT}" STREQUAL "") OR ("${GEN_XML}" STREQUAL ""))
|
||||
message(FATAL_ERROR "OUTPUT and XML must both be specified")
|
||||
endif()
|
||||
set(arch_setting "")
|
||||
if(GEN_ARCH)
|
||||
set(arch_setting "--arch")
|
||||
elseif(GEN_SEL4ARCH)
|
||||
set(arch_setting "--sel4_arch")
|
||||
endif()
|
||||
set(libsel4_setting "")
|
||||
if(GEN_LIBSEL4)
|
||||
set(libsel4_setting "--libsel4")
|
||||
endif()
|
||||
# Turn the input xml into an absolute path as we build commands that may be
|
||||
# be run with a working directory that is not the current source directory
|
||||
get_absolute_source_or_binary(xml_absolute "${GEN_XML}")
|
||||
add_custom_command(
|
||||
OUTPUT "${GEN_OUTPUT}"
|
||||
COMMAND rm -f "${GEN_OUTPUT}"
|
||||
COMMAND
|
||||
"${PYTHON3}" "${INVOCATION_ID_GEN_PATH}"
|
||||
--xml "${xml_absolute}" ${libsel4_setting} ${arch_setting}
|
||||
--dest "${GEN_OUTPUT}"
|
||||
DEPENDS "${xml_absolute}" "${INVOCATION_ID_GEN_PATH}"
|
||||
COMMENT "Generate invocation header ${GEN_OUTPUT}"
|
||||
)
|
||||
cmake_parse_arguments(PARSE_ARGV 0 "GEN" "LIBSEL4;ARCH;SEL4ARCH" "OUTPUT;XML" "")
|
||||
if(NOT "${GEN_UNPARSED_ARGUMENTS}" STREQUAL "")
|
||||
message(FATAL_ERROR "Unknown arguments to gen_invocation_header: ${GEN_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
# Ensure only one of arch or sel4arch
|
||||
if(GEN_ARCH AND GEN_SEL4ARCH)
|
||||
message(FATAL_ERROR "Can only specify one of ARCH or SEL4ARCH")
|
||||
endif()
|
||||
# OUTPUT and XML are required
|
||||
if(("${GEN_OUTPUT}" STREQUAL "") OR ("${GEN_XML}" STREQUAL ""))
|
||||
message(FATAL_ERROR "OUTPUT and XML must both be specified")
|
||||
endif()
|
||||
set(arch_setting "")
|
||||
if(GEN_ARCH)
|
||||
set(arch_setting "--arch")
|
||||
elseif(GEN_SEL4ARCH)
|
||||
set(arch_setting "--sel4_arch")
|
||||
endif()
|
||||
set(libsel4_setting "")
|
||||
if(GEN_LIBSEL4)
|
||||
set(libsel4_setting "--libsel4")
|
||||
endif()
|
||||
# Turn the input xml into an absolute path as we build commands that may be
|
||||
# be run with a working directory that is not the current source directory
|
||||
get_absolute_source_or_binary(xml_absolute "${GEN_XML}")
|
||||
add_custom_command(
|
||||
OUTPUT "${GEN_OUTPUT}"
|
||||
COMMAND rm -f "${GEN_OUTPUT}"
|
||||
COMMAND "${PYTHON3}" "${INVOCATION_ID_GEN_PATH}" --xml "${xml_absolute}" ${libsel4_setting}
|
||||
${arch_setting} --dest "${GEN_OUTPUT}"
|
||||
DEPENDS "${xml_absolute}" "${INVOCATION_ID_GEN_PATH}"
|
||||
COMMENT "Generate invocation header ${GEN_OUTPUT}")
|
||||
endfunction(gen_invocation_header)
|
||||
|
||||
# Adds files to the global sources list, but only if the supplied dependencies are met.
|
||||
|
|
@ -49,26 +46,26 @@ endfunction(gen_invocation_header)
|
|||
# ASMFILES are added to asm_sources. An PREFIX can be given as path to prefix to each
|
||||
# C and ASM file given
|
||||
function(add_sources)
|
||||
cmake_parse_arguments(PARSE_ARGV 0 "ADD" "" "DEP;PREFIX" "CFILES;ASMFILES")
|
||||
if(NOT "${ADD_UNPARSED_ARGUMENTS}" STREQUAL "")
|
||||
message(FATAL_ERROR "Unknown arguments to add_c_sources: ${ADD_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
# Need to prefix files with the CMAKE_CURRENT_SOURCE_DIR as we use these
|
||||
# in custom commands whose working directory is not the source directory
|
||||
# Also need to ensure that if an additional prefix wasn't specified by the
|
||||
# caller, that we don't add an additional /, as this will screw up file sorting
|
||||
if(NOT "${ADD_PREFIX}" STREQUAL "")
|
||||
set(ADD_PREFIX "${ADD_PREFIX}/")
|
||||
endif()
|
||||
set(ADD_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/${ADD_PREFIX}")
|
||||
foreach(file IN LISTS ADD_CFILES)
|
||||
list(APPEND new_c_sources "${ADD_PREFIX}${file}")
|
||||
endforeach()
|
||||
foreach(file IN LISTS ADD_ASMFILES)
|
||||
list(APPEND new_asm_sources "${ADD_PREFIX}${file}")
|
||||
endforeach()
|
||||
list_append_if(c_sources "${ADD_DEP}" ${new_c_sources})
|
||||
list_append_if(asm_sources "${ADD_DEP}" ${new_asm_sources})
|
||||
cmake_parse_arguments(PARSE_ARGV 0 "ADD" "" "DEP;PREFIX" "CFILES;ASMFILES")
|
||||
if(NOT "${ADD_UNPARSED_ARGUMENTS}" STREQUAL "")
|
||||
message(FATAL_ERROR "Unknown arguments to add_c_sources: ${ADD_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
# Need to prefix files with the CMAKE_CURRENT_SOURCE_DIR as we use these
|
||||
# in custom commands whose working directory is not the source directory
|
||||
# Also need to ensure that if an additional prefix wasn't specified by the
|
||||
# caller, that we don't add an additional /, as this will screw up file sorting
|
||||
if(NOT "${ADD_PREFIX}" STREQUAL "")
|
||||
set(ADD_PREFIX "${ADD_PREFIX}/")
|
||||
endif()
|
||||
set(ADD_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/${ADD_PREFIX}")
|
||||
foreach(file IN LISTS ADD_CFILES)
|
||||
list(APPEND new_c_sources "${ADD_PREFIX}${file}")
|
||||
endforeach()
|
||||
foreach(file IN LISTS ADD_ASMFILES)
|
||||
list(APPEND new_asm_sources "${ADD_PREFIX}${file}")
|
||||
endforeach()
|
||||
list_append_if(c_sources "${ADD_DEP}" ${new_c_sources})
|
||||
list_append_if(asm_sources "${ADD_DEP}" ${new_asm_sources})
|
||||
endfunction(add_sources)
|
||||
|
||||
# If the dependencies list in the 'dep' argument is true then a bf file is added
|
||||
|
|
@ -76,7 +73,6 @@ endfunction(add_sources)
|
|||
# separate where the bf file is located in the source, versus where it will get
|
||||
# generated.
|
||||
function(add_bf_source_old dep file prefix path)
|
||||
list_append_if(
|
||||
bf_declarations "${dep}" "${CMAKE_CURRENT_SOURCE_DIR}/${prefix}/${path}/${file}:${path}"
|
||||
)
|
||||
list_append_if(bf_declarations "${dep}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${prefix}/${path}/${file}:${path}")
|
||||
endfunction(add_bf_source_old)
|
||||
|
|
|
|||
Loading…
Reference in a new issue