1# Copyright 2016 The Fuchsia Authors 2# Copyright (c) 2008-2015 Travis Geiselbrecht 3# 4# Use of this source code is governed by a MIT-style 5# license that can be found in the LICENSE file or at 6# https://opensource.org/licenses/MIT 7 8LOCAL_DIR := $(GET_LOCAL_DIR) 9 10MODULE := $(LOCAL_DIR) 11 12MODULE_SRCS += \ 13 $(LOCAL_DIR)/arch.cpp \ 14 $(LOCAL_DIR)/asm.S \ 15 $(LOCAL_DIR)/boot-mmu.cpp \ 16 $(LOCAL_DIR)/cache-ops.S \ 17 $(LOCAL_DIR)/debugger.cpp \ 18 $(LOCAL_DIR)/exceptions.S \ 19 $(LOCAL_DIR)/exceptions_c.cpp \ 20 $(LOCAL_DIR)/feature.cpp \ 21 $(LOCAL_DIR)/fpu.cpp \ 22 $(LOCAL_DIR)/mexec.S \ 23 $(LOCAL_DIR)/mmu.cpp \ 24 $(LOCAL_DIR)/periphmap.cpp \ 25 $(LOCAL_DIR)/smccc.S \ 26 $(LOCAL_DIR)/spinlock.cpp \ 27 $(LOCAL_DIR)/start.S \ 28 $(LOCAL_DIR)/sysreg.cpp \ 29 $(LOCAL_DIR)/thread.cpp \ 30 $(LOCAL_DIR)/user_copy.S \ 31 $(LOCAL_DIR)/user_copy_c.cpp \ 32 $(LOCAL_DIR)/uspace_entry.S 33 34MODULE_DEPS += \ 35 kernel/dev/iommu/dummy \ 36 kernel/lib/bitmap \ 37 kernel/lib/crashlog \ 38 kernel/object \ 39 40KERNEL_DEFINES += \ 41 ARM_ISA_ARMV8=1 \ 42 ARM_ISA_ARMV8A=1 43 44SMP_MAX_CPUS ?= 16 45 46SMP_CPU_MAX_CLUSTERS ?= 2 47SMP_CPU_MAX_CLUSTER_CPUS ?= $(SMP_MAX_CPUS) 48 49MODULE_SRCS += \ 50 $(LOCAL_DIR)/mp.cpp 51 52KERNEL_DEFINES += \ 53 SMP_MAX_CPUS=$(SMP_MAX_CPUS) \ 54 SMP_CPU_MAX_CLUSTERS=$(SMP_CPU_MAX_CLUSTERS) \ 55 SMP_CPU_MAX_CLUSTER_CPUS=$(SMP_CPU_MAX_CLUSTER_CPUS) \ 56 57KERNEL_ASPACE_BASE ?= 0xffff000000000000 58KERNEL_ASPACE_SIZE ?= 0x0001000000000000 59USER_ASPACE_BASE ?= 0x0000000001000000 60USER_ASPACE_SIZE ?= 0x0000fffffe000000 61 62GLOBAL_DEFINES += \ 63 KERNEL_ASPACE_BASE=$(KERNEL_ASPACE_BASE) \ 64 KERNEL_ASPACE_SIZE=$(KERNEL_ASPACE_SIZE) \ 65 USER_ASPACE_BASE=$(USER_ASPACE_BASE) \ 66 USER_ASPACE_SIZE=$(USER_ASPACE_SIZE) 67 68# kernel is linked to run at the arbitrary address of -4GB 69# peripherals will be mapped just below this mark 70KERNEL_BASE := 0xffffffff00000000 71BOOT_HEADER_SIZE ?= 0x50 72 73KERNEL_DEFINES += \ 74 KERNEL_BASE=$(KERNEL_BASE) \ 75 76# try to find the toolchain 77include $(LOCAL_DIR)/toolchain.mk 78TOOLCHAIN_PREFIX := $(ARCH_$(ARCH)_TOOLCHAIN_PREFIX) 79 80ARCH_COMPILEFLAGS += $(ARCH_$(ARCH)_COMPILEFLAGS) 81 82# generate code for the fairly generic cortex-a53 83ARCH_COMPILEFLAGS += -mcpu=cortex-a53 84 85CLANG_ARCH := aarch64 86ifeq ($(call TOBOOL,$(USE_CLANG)),true) 87GLOBAL_LDFLAGS += -m aarch64elf 88GLOBAL_MODULE_LDFLAGS += -m aarch64elf 89endif 90GLOBAL_LDFLAGS += -z max-page-size=4096 91 92# kernel hard disables floating point 93KERNEL_COMPILEFLAGS += -mgeneral-regs-only 94 95# See engine.mk. 96KEEP_FRAME_POINTER_COMPILEFLAGS += -mno-omit-leaf-frame-pointer 97 98KERNEL_COMPILEFLAGS += -fPIE -include kernel/include/hidden.h 99 100# Clang needs -mcmodel=kernel to tell it to use the right safe-stack ABI for 101# the kernel. 102ifeq ($(call TOBOOL,$(USE_CLANG)),true) 103KERNEL_COMPILEFLAGS += -mcmodel=kernel 104endif 105 106# x18 is reserved in the Fuchsia userland ABI so it can be used 107# for things like -fsanitize=shadow-call-stack. In the kernel, 108# it's reserved so we can use it to point at the per-CPU structure. 109ARCH_COMPILEFLAGS += -ffixed-x18 110 111include make/module.mk 112