blob: 19a4ded25083f3173116ea1c1deb2c6fe12937ca [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT
import("//build/zircon/migrated_targets.gni")
import("//zircon/kernel/params.gni")
zx_library("vm") {
sources = [
"anonymous_page_requester.cc",
"bootreserve.cc",
"compression.cc",
"compressor.cc",
"content_size_manager.cc",
"debug_compressor.cc",
"discardable_vmo_tracker.cc",
"evictor.cc",
"kstack.cc",
"loan_sweeper.cc",
"lz4_compressor.cc",
"page.cc",
"page_queues.cc",
"page_source.cc",
"page_state.cc",
"physical_page_borrowing_config.cc",
"physical_page_provider.cc",
"physmap.cc",
"pinned_vm_object.cc",
"pmm.cc",
"pmm_arena.cc",
"pmm_checker.cc",
"pmm_node.cc",
"ppb_command.cc",
"scanner.cc",
"stack_owned_loaned_pages_interval.cc",
"tri_page_storage.cc",
"vm.cc",
"vm_address_region.cc",
"vm_address_region_or_mapping.cc",
"vm_aspace.cc",
"vm_cow_pages.cc",
"vm_mapping.cc",
"vm_object.cc",
"vm_object_paged.cc",
"vm_object_physical.cc",
"vm_page_list.cc",
"vmm.cc",
]
deps = [
"//zircon/kernel/lib/arch",
"//zircon/kernel/lib/boot-options",
"//zircon/kernel/lib/console",
"//zircon/kernel/lib/counters",
"//zircon/kernel/lib/fbl",
"//zircon/kernel/lib/heap/cmpctmalloc:headers",
"//zircon/kernel/lib/init",
"//zircon/kernel/lib/ktl",
"//zircon/kernel/lib/ktrace",
"//zircon/kernel/lib/page_cache",
"//zircon/kernel/lib/user_copy",
"//zircon/kernel/lib/userabi",
"//zircon/system/ulib/affine",
"//zircon/system/ulib/pretty",
"//zircon/third_party/ulib/lz4",
# TODO: testonly
":tests",
]
defines = [
"LZ4_STATIC_LINKING_ONLY",
"LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION",
]
public_deps = [
# <vm/vm_page_list.h> has #include <ktl/unique_ptr.h>.
"//zircon/kernel/lib/ktl:headers",
# <vm/vm_object.h> has #include <fbl/name.h>.
"//zircon/kernel/lib/fbl:headers",
# <vm/vm_object.h> has #include <lib/user_copy/user_ptr.h>.
"//zircon/kernel/lib/user_copy:headers",
# <vm/vm_aspace.h> has #include <lib/crypto/prng.h>
"//zircon/kernel/lib/crypto:headers",
# <vm/vm_cow_pages.h> has #include <lib/page_cache.h>
"//zircon/kernel/lib/page_cache:headers",
# "pmm_arena.h" has #include <lib/zx/result.h>.
"//zircon/system/ulib/zx:headers",
]
public_configs = [
# <vm/physical_page_provider.h> has #include <object/port_dispatcher.h>.
# But this is a circular dependency, so we can't use its :headers in deps.
"//zircon/kernel/object:headers.config",
]
# GCC figures out some cases where we have a global variable that's used as a
# RefPtr and so appears like it might be passed to delete. We always leak
# the reference so it will never actually be called, but the compiler can't
# figure that out statically so we must disable its warning.
configs += [ ":suppress-nonheap-warning" ]
}
config("suppress-nonheap-warning") {
visibility = [ ":*" ]
if (is_gcc) {
cflags = [ "-Wno-free-nonheap-object" ]
}
}
source_set("tests") {
sources = [
"unittests/aspace_unittest.cc",
"unittests/compression_unittest.cc",
"unittests/evictor_unittest.cc",
"unittests/pmm_unittest.cc",
"unittests/test_helper.cc",
"unittests/vmo_unittest.cc",
"unittests/vmpl_unittest.cc",
]
deps = [
"//zircon/kernel/lib/unittest",
"//zircon/third_party/ulib/lz4",
]
}