1#
2# Copyright 2019, Data61, CSIRO (ABN 41 687 119 230)
3#
4# SPDX-License-Identifier: BSD-2-Clause
5#
6
7cmake_minimum_required(VERSION 3.8.2)
8
9project(libsel4vm C)
10
11set(configure_string "")
12
13add_compile_options(-std=gnu99)
14
15config_option(
16    LibSel4VMDeferMemoryMap
17    LIB_SEL4VM_DEFER_MEMORY_MAP
18    "Defer mappings of memory reservations until faulted on"
19    DEFAULT
20    OFF
21)
22config_option(LibSel4VMVMXTimerDebug LIB_VM_VMX_TIMER_DEBUG "Use VMX Pre-Emption timer for debugging
23    Will cause a regular vmexit to happen based on VMX pre-emption
24    timer. At each exit the guest state will be printed out. This
25    can be used to aid debugging when running a guest causes nothing
26    to appear to happen" DEFAULT OFF DEPENDS "KernelArchX86")
27
28config_string(
29    LibSel4VMVMXTimerTimeout
30    LIB_VM_VMX_TIMER_TIMEOUT
31    "Cycles between VMX timer pre-emptions
32    Cycles between timer exits. Time spent loading the VMCS context
33    count, so setting this too low may result in the guest making
34    no progress"
35    DEFAULT
36    4000
37    DEPENDS
38    "LibSel4VMVMXTimerDebug"
39)
40
41mark_as_advanced(LibSel4VMDeferMemoryMap LibSel4VMVMXTimerDebug LibSel4VMVMXTimerTimeout)
42
43add_config_library(sel4vm "${configure_string}")
44
45file(
46    GLOB
47        sources
48        src/*.c
49        src/arch/${KernelArch}/*.c
50        src/arch/${KernelArch}/vgic/*.c
51        src/arch/${KernelArch}/i8259/*.c
52        src/arch/${KernelArch}/processor/*.c
53        src/sel4_arch/${KernelSel4Arch}/*.c
54)
55
56add_library(sel4vm STATIC EXCLUDE_FROM_ALL ${sources})
57target_include_directories(
58    sel4vm
59    PUBLIC include arch_include/${KernelArch} sel4_arch_include/${KernelSel4Arch}
60)
61target_include_directories(
62    sel4vm
63    PRIVATE src src/arch/${KernelArch} src/sel4_arch/${KernelSel4Arch}
64)
65target_link_libraries(
66    sel4vm
67    muslc
68    sel4
69    sel4simple
70    utils
71    sel4utils
72    sel4vka
73    sel4vspace
74    platsupport
75    sel4_autoconf
76    sel4vm_Config
77)
78