From 49bf6be16a0a3d577ce9ff07319995a1b233ed3d Mon Sep 17 00:00:00 2001 From: Rafal Kolanski Date: Mon, 30 May 2016 17:15:04 +1000 Subject: [PATCH] Haskell: build setup for arm-hyp (arm-tk1 = ARM_HYP + TK1) --- spec/haskell/Makefile | 17 +++++++++++++-- spec/haskell/SEL4.cabal | 46 ++++++++++++++++++++++------------------- spec/haskell/Setup.hs | 1 + 3 files changed, 41 insertions(+), 23 deletions(-) diff --git a/spec/haskell/Makefile b/spec/haskell/Makefile index d8335629d..c52bce900 100644 --- a/spec/haskell/Makefile +++ b/spec/haskell/Makefile @@ -12,6 +12,7 @@ BOOT_MODULES = Kernel/CSpace Kernel/Thread Kernel/FaultHandler \ Kernel/VSpace Kernel/Init Model/PSpace Object/TCB Object/CNode \ Object/ObjectType Object/Endpoint Object/Interrupt +# FIXME ^ VCPUs go above? BOOT_FILES=$(BOOT_MODULES:%=src/SEL4/%.lhs-boot) @@ -22,12 +23,24 @@ BOOT_FILES=$(BOOT_MODULES:%=src/SEL4/%.lhs-boot) # GHC_PACKAGE_PATH first. CABAL=stack exec -- ./stack-path cabal -all: build pdf +#all: build pdf FIXME original +all: build-arm-hyp build: .stack-work $(BOOT_FILES) $(CABAL) sandbox init $(CABAL) install --dependencies-only - $(CABAL) configure --configure-option="arm-kzm" + $(CABAL) configure --configure-option="arm-kzm" \ + --flags="ArchArm" + $(CABAL) build + +# FIXME XXX these warnings are useless during large Haskell updates +GHC_FIXME_OPTS=--ghc-options="-fno-warn-unused-matches -fno-warn-unused-imports" + +build-arm-hyp: .stack_work $(BOOT_FILES) + $(CABAL) sandbox init + $(CABAL) install --dependencies-only + $(CABAL) configure --configure-option="arm-tk1" \ + --flags="ArchArmHyp -FFI" $(GHC_FIXME_OPTS) $(CABAL) build pdf: diff --git a/spec/haskell/SEL4.cabal b/spec/haskell/SEL4.cabal index 130f4174d..d168c5494 100644 --- a/spec/haskell/SEL4.cabal +++ b/spec/haskell/SEL4.cabal @@ -22,8 +22,12 @@ Flag FFI default: True Flag ArchArm - description: Include ARM modules and platforms (else x64) - default: True + description: Include ARM modules and platforms + default: False + +Flag ArchArmHyp + description: Include ARM (with Hypervisor Extensions) modules and platforms + default: False Library exposed-modules: SEL4 @@ -110,27 +114,27 @@ Library SEL4.Machine.RegisterSet.ARM SEL4.Machine.Hardware.ARM - else - -- FIXME: should be a flag also, or some other way to conditionally compile - -- Setup.hs hooks can handle this, but do we want to do that? + -- FIXME ideally ARMHYP will share code with the main ARM development, + -- but when doing an architecture port we want to make sure we are doing a + -- full pass over the Haskell kernel, touching all files + -- TODO consolidate later + if flag(ArchArmHyp) other-modules: + SEL4.Machine.Hardware.ARM.TK1 - SEL4.API.Types.X64 - SEL4.API.InvocationLabels.X64 - SEL4.API.Invocation.X64 - SEL4.Kernel.VSpace.X64 - SEL4.Kernel.Thread.X64 - SEL4.Object.ObjectType.X64 - SEL4.Object.Structures.X64 - SEL4.Object.Interrupt.X64 - SEL4.Object.Instances.X64 - SEL4.Object.IOPort.X64 - SEL4.Object.TCB.X64 - SEL4.Model.StateData.X64 - SEL4.Machine.RegisterSet.X64 - SEL4.Machine.Hardware.X64 - - SEL4.Machine.Hardware.X64.PC99 + SEL4.API.Types.ARM_HYP + SEL4.API.InvocationLabels.ARM_HYP + SEL4.API.Invocation.ARM_HYP + SEL4.Kernel.VSpace.ARM_HYP + SEL4.Kernel.Thread.ARM_HYP + SEL4.Object.ObjectType.ARM_HYP + SEL4.Object.Structures.ARM_HYP + SEL4.Object.Interrupt.ARM_HYP + SEL4.Object.Instances.ARM_HYP + SEL4.Object.TCB.ARM_HYP + SEL4.Model.StateData.ARM_HYP + SEL4.Machine.RegisterSet.ARM_HYP + SEL4.Machine.Hardware.ARM_HYP hs-source-dirs: src ghc-prof-options: -auto-all -prof -fprof-auto diff --git a/spec/haskell/Setup.hs b/spec/haskell/Setup.hs index f6c05ace4..1bf6213f4 100644 --- a/spec/haskell/Setup.hs +++ b/spec/haskell/Setup.hs @@ -39,6 +39,7 @@ targets = , ("arm-kzm", ("ARM", "KZM")) , ("arm-sabre", ("ARM", "Sabre")) , ("x64-pc99", ("X64", "PC99")) + , ("arm-tk1", ("ARM_HYP", "TK1")) ] getPlatform targetName = do