Exemplo n.º 1
0
        public BootableAppVerb(SourcePath dfyroot, DafnyCCVerb.FramePointerMode useFramePointer, VerificationRequest verificationRequest)
        {
            this.dfyroot             = dfyroot;
            this.verificationRequest = verificationRequest;
            string concreteId = verificationRequest.ToString() + "," + useFramePointer.ToString();

            this.abstractId = new AbstractId(this.GetType().Name, version, dfyroot.ToString(), concrete: concreteId);

            string targetDirectory = Path.Combine(
                BuildEngine.theEngine.getObjRoot(),
                dfyroot.getDirPath(),
                "bootable-" + verificationRequest.ToString());

            this.bootIniFile = new BuildObject(Path.Combine(targetDirectory, "safeos\\boot.ini"));

            // TODO: Create the bootloader verb.

            this.loaderVerb = new IroncladAppVerb(new SourcePath(LOADER_DFY), IroncladAppVerb.TARGET.BARE_METAL, useFramePointer, verificationRequest);
            this.appVerb    = new IroncladAppVerb(dfyroot, IroncladAppVerb.TARGET.BARE_METAL, useFramePointer, verificationRequest);

            this.batchVerb = new BatchVerifyVerb(dfyroot, new HashSet <IObligationsProducer>()
            {
                this.appVerb, this.loaderVerb
            }, BatchVerifyVerb.BatchMode.APP);
            this.batchSummaryVerb = new VerificationResultSummaryVerb(this.batchVerb);

            this.loaderCopy        = new BuildObject(Path.Combine(targetDirectory, this.targetExecutableName(this.loaderVerb)));
            this.bootloaderCopy    = new BuildObject(Path.Combine(targetDirectory, this.bootloader.getFileName()));
            this.appExecutableCopy = new BuildObject(Path.Combine(targetDirectory, this.targetExecutableName(this.appVerb)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the IronfleetAppVerb class.
        /// </summary>
        /// <param name="input">Main dafny file for the application.</param>
        public IronfleetAppVerb(SourcePath input, VerificationRequest verificationRequest, bool releaseBuild = false)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            this.abstractId = new AbstractId(GetType().Name, Version, input.ToString() + verificationRequest.ToString());
            this.input      = input;
            // this.buildVerb = new VSSolutionVerb(new SourcePath(@"src\IronfleetTestDriver\IronfleetTestDriver.sln"), input, releaseBuild);
            this.buildVerb = new VSSolutionVerb(new SourcePath(@"src/IronfleetTestDriver/IronfleetTestDriver.sln"), input, releaseBuild);

            if (verificationRequest.verifyMode == VerificationRequest.VerifyMode.NoVerify)
            {
                this.exeOutput  = this.input.makeOutputObject(UnverifiedExeExt);
                this.verifyVerb = null;
                this.verbs      = new IVerb[] { this.buildVerb };
            }
            else
            {
                this.exeOutput  = this.input.makeOutputObject(VerifiedExeExt);
                this.verifyVerb = new VerificationResultSummaryVerb(new DafnyVerifyTreeVerb(input));
                this.verbs      = new IVerb[] { this.verifyVerb, this.buildVerb };
            }

            this.otherOutputs = new List <BuildObject>();
            var ohs = this.buildVerb.getOutputs().ToList();

            ohs.RemoveAll(o => o.getExtension() == ".exe");
            foreach (var o in ohs)
            {
                this.otherOutputs.Add(RelocateBuildObjectToExeDirectory(o));
            }
        }
Exemplo n.º 3
0
        public BootableAppVerb(SourcePath dfyroot, DafnyCCVerb.FramePointerMode useFramePointer, VerificationRequest verificationRequest)
        {
            this.dfyroot = dfyroot;
            this.verificationRequest = verificationRequest;
            string concreteId = verificationRequest.ToString() + "," + useFramePointer.ToString();
            this.abstractId = new AbstractId(this.GetType().Name, version, dfyroot.ToString(), concrete: concreteId);

            string targetDirectory = Path.Combine(
                BuildEngine.theEngine.getObjRoot(),
                dfyroot.getDirPath(),
                "bootable-" + verificationRequest.ToString());
            this.bootIniFile = new BuildObject(Path.Combine(targetDirectory, "safeos\\boot.ini"));

            // TODO: Create the bootloader verb.

            this.loaderVerb = new IroncladAppVerb(new SourcePath(LOADER_DFY), IroncladAppVerb.TARGET.BARE_METAL, useFramePointer, verificationRequest);
            this.appVerb = new IroncladAppVerb(dfyroot, IroncladAppVerb.TARGET.BARE_METAL, useFramePointer, verificationRequest);

            this.batchVerb = new BatchVerifyVerb(dfyroot, new HashSet<IObligationsProducer>() { this.appVerb, this.loaderVerb }, BatchVerifyVerb.BatchMode.APP);
            this.batchSummaryVerb = new VerificationResultSummaryVerb(this.batchVerb);

            this.loaderCopy = new BuildObject(Path.Combine(targetDirectory, this.targetExecutableName(this.loaderVerb)));
            this.bootloaderCopy = new BuildObject(Path.Combine(targetDirectory, this.bootloader.getFileName()));
            this.appExecutableCopy = new BuildObject(Path.Combine(targetDirectory, this.targetExecutableName(this.appVerb)));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the IronfleetAppVerb class.
        /// </summary>
        /// <param name="input">Main dafny file for the application.</param>
        public IronfleetAppVerb(SourcePath input, VerificationRequest verificationRequest, bool releaseBuild = false)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            this.abstractId = new AbstractId(GetType().Name, Version, input.ToString() + verificationRequest.ToString());
            this.input = input;
            this.buildVerb = new VSSolutionVerb(new SourcePath(@"src\IronfleetTestDriver\IronfleetTestDriver.sln"), input, releaseBuild);

            if (verificationRequest.verifyMode == VerificationRequest.VerifyMode.NoVerify)
            {
                this.exeOutput = this.input.makeOutputObject(UnverifiedExeExt);
                this.verifyVerb = null;
                this.verbs = new IVerb[] { this.buildVerb };
            }
            else
            {
                this.exeOutput = this.input.makeOutputObject(VerifiedExeExt);
                this.verifyVerb = new VerificationResultSummaryVerb(new DafnyVerifyTreeVerb(input));
                this.verbs = new IVerb[] { this.verifyVerb, this.buildVerb };
            }

            this.otherOutputs = new List<BuildObject>();
            var ohs = this.buildVerb.getOutputs().ToList();
            ohs.RemoveAll(o => o.getExtension() == ".exe");
            foreach (var o in ohs)
            {
                this.otherOutputs.Add(RelocateBuildObjectToExeDirectory(o));
            }
        }
Exemplo n.º 5
0
        public IroncladAppVerb(SourcePath dfyroot, TARGET target, DafnyCCVerb.FramePointerMode framePointerMode, VerificationRequest verificationRequest)
        {
            this.dfyroot = dfyroot;

            // TODO this is the only #define we support just yet, so I'm stuffing it in here.
            // We'll need to plumb more carefully when we want to add x64.
            if (dfyroot.getDirPath().Split(Path.DirectorySeparatorChar).Last().Equals("AppLoader"))
            {
                this.poundDefines = new PoundDefines(new string[] { "AppLoader" });
            }
            else
            {
                this.poundDefines = PoundDefines.empty();
            }

            this.verificationRequest = verificationRequest;
            this.abstractId = new AbstractId(
                this.GetType().Name,
                version,
                dfyroot.ToString(),
                this.poundDefines,
                concrete: string.Format(
                    "{0},{1},{2}",
                    target,
                    framePointerMode.ToString(),
                    verificationRequest.ToString()));
            this.appLabel = dfyroot.getDirPath().Split(Path.DirectorySeparatorChar).Last();
            this.dafnyspecVerb = new DafnySpecVerb(dfyroot, this.appLabel);
            this.dafnyccVerb = new DafnyCCVerb(dfyroot, this.appLabel, framePointerMode);

            bool isLoader = dfyroot.getRelativePath().Equals(BootableAppVerb.LOADER_DFY);

            // NB we keep dafnyccVerb as the lowest-priority context, so that our hand-written
            // beat impls will override its output.
            IContextGeneratingVerb contextWithDafny = new ConcatContextVerb(
                BuildEngine.theEngine.getVerveContextVerb(this.poundDefines),
                new VerbOutputsContextVerb(this.dafnyspecVerb, false),
                new VerbOutputsContextVerb(this.dafnyccVerb, true),
                this.poundDefines);
            this.stitcherVerb = new EntryStitcherVerb(contextWithDafny, this.appLabel);
            IContextGeneratingVerb contextWithDafnyAndEntry = new ConcatContextVerb(
                new VerbOutputsContextVerb(this.stitcherVerb, false),
                contextWithDafny,
                this.poundDefines);

            BuildObject entryImpObj = this.stitcherVerb.getEntryImpOutput();
            BoogieAsmLinkVerb entryVerb = new BoogieAsmLinkVerb(contextWithDafnyAndEntry, entryImpObj);
            if (target == TARGET.BARE_METAL)
            {
                MasmVerb masmVerb = new MasmVerb(entryVerb);
                this.linkerVerb = new LinkerVerb(masmVerb, isLoader);
            }
            else if (target == TARGET.WINDOWS)
            {     // Rewrite the asm that comes out of entryVerb before linking it
                AsmRewriterVerb rewriter = new AsmRewriterVerb(entryVerb);
                MasmVerb masmVerb = new MasmVerb(rewriter);
                this.linkerVerb = new WinLinkerVerb(masmVerb, isLoader);
            }

            BoogieAsmVerificationObligationListVerb bavolVerb =
                new BoogieAsmVerificationObligationListVerb(contextWithDafnyAndEntry, entryImpObj, verificationRequest);

            this.verifyResultsVerb = new VerificationResultSummaryVerb(bavolVerb);

            this.srcObject = this.linkerVerb.getUntrustedExe();
            if (verificationRequest.isComplete())
            {
                this.exeObject = dfyroot.makeOutputObject(TRUSTED_EXE_EXTN);
                this.outputObject = this.exeObject;
            }
            else
            {
                this.exeObject = this.srcObject;
                this.outputObject = dfyroot.makeVirtualObject(UNVERIFIED_SENTINEL_EXTENSION);
            }
        }
Exemplo n.º 6
0
        public IroncladAppVerb(SourcePath dfyroot, TARGET target, DafnyCCVerb.FramePointerMode framePointerMode, VerificationRequest verificationRequest)
        {
            this.dfyroot = dfyroot;

            // TODO this is the only #define we support just yet, so I'm stuffing it in here.
            // We'll need to plumb more carefully when we want to add x64.
            if (dfyroot.getDirPath().Split(Path.DirectorySeparatorChar).Last().Equals("AppLoader"))
            {
                this.poundDefines = new PoundDefines(new string[] { "AppLoader" });
            }
            else
            {
                this.poundDefines = PoundDefines.empty();
            }

            this.verificationRequest = verificationRequest;
            this.abstractId          = new AbstractId(
                this.GetType().Name,
                version,
                dfyroot.ToString(),
                this.poundDefines,
                concrete: string.Format(
                    "{0},{1},{2}",
                    target,
                    framePointerMode.ToString(),
                    verificationRequest.ToString()));
            this.appLabel      = dfyroot.getDirPath().Split(Path.DirectorySeparatorChar).Last();
            this.dafnyspecVerb = new DafnySpecVerb(dfyroot, this.appLabel);
            this.dafnyccVerb   = new DafnyCCVerb(dfyroot, this.appLabel, framePointerMode);

            bool isLoader = dfyroot.getRelativePath().Equals(BootableAppVerb.LOADER_DFY);

            // NB we keep dafnyccVerb as the lowest-priority context, so that our hand-written
            // beat impls will override its output.
            IContextGeneratingVerb contextWithDafny = new ConcatContextVerb(
                BuildEngine.theEngine.getVerveContextVerb(this.poundDefines),
                new VerbOutputsContextVerb(this.dafnyspecVerb, false),
                new VerbOutputsContextVerb(this.dafnyccVerb, true),
                this.poundDefines);

            this.stitcherVerb = new EntryStitcherVerb(contextWithDafny, this.appLabel);
            IContextGeneratingVerb contextWithDafnyAndEntry = new ConcatContextVerb(
                new VerbOutputsContextVerb(this.stitcherVerb, false),
                contextWithDafny,
                this.poundDefines);

            BuildObject       entryImpObj = this.stitcherVerb.getEntryImpOutput();
            BoogieAsmLinkVerb entryVerb   = new BoogieAsmLinkVerb(contextWithDafnyAndEntry, entryImpObj);

            if (target == TARGET.BARE_METAL)
            {
                MasmVerb masmVerb = new MasmVerb(entryVerb);
                this.linkerVerb = new LinkerVerb(masmVerb, isLoader);
            }
            else if (target == TARGET.WINDOWS)
            {     // Rewrite the asm that comes out of entryVerb before linking it
                AsmRewriterVerb rewriter = new AsmRewriterVerb(entryVerb);
                MasmVerb        masmVerb = new MasmVerb(rewriter);
                this.linkerVerb = new WinLinkerVerb(masmVerb, isLoader);
            }

            BoogieAsmVerificationObligationListVerb bavolVerb =
                new BoogieAsmVerificationObligationListVerb(contextWithDafnyAndEntry, entryImpObj, verificationRequest);

            this.verifyResultsVerb = new VerificationResultSummaryVerb(bavolVerb);

            this.srcObject = this.linkerVerb.getUntrustedExe();
            if (verificationRequest.isComplete())
            {
                this.exeObject    = dfyroot.makeOutputObject(TRUSTED_EXE_EXTN);
                this.outputObject = this.exeObject;
            }
            else
            {
                this.exeObject    = this.srcObject;
                this.outputObject = dfyroot.makeVirtualObject(UNVERIFIED_SENTINEL_EXTENSION);
            }
        }