Skip to content

Commit

Permalink
Whitespace only
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGlScott committed Nov 14, 2023
1 parent 8f5e945 commit c4ba5c1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions arch/Pate/AArch32.hs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ instance PA.ValidArch SA.AArch32 where
uninterpretedArchStmt _ = True

archClassifier _ =
conditionalCallClassifier
<|> conditionalReturnClassifier
conditionalCallClassifier
<|> conditionalReturnClassifier
<|> MD.branchClassifier
<|> MD.noreturnCallClassifier
<|> MD.callClassifier
Expand All @@ -144,7 +144,7 @@ instance PA.ValidArch SA.AArch32 where
<|> MD.pltStubClassifier
<|> MD.directJumpClassifier
<|> MD.tailCallClassifier

archClassifierWrapper = wrapClassifierForPstateT

archExtractArchTerms = \term st mret -> Just $ case term of
Expand Down Expand Up @@ -300,7 +300,7 @@ stubOverrides = PA.ArchStubOverrides (PA.mkDefaultStubOverride "__pate_stub" r0
])
where
mkDefault nm = (nm, PA.mkDefaultStubOverride nm r0)

r0 = ARMReg.ARMGlobalBV (ASL.knownGlobalRef @"_R0")
r1 = ARMReg.ARMGlobalBV (ASL.knownGlobalRef @"_R1")
r2 = ARMReg.ARMGlobalBV (ASL.knownGlobalRef @"_R2")
Expand Down Expand Up @@ -329,7 +329,7 @@ archLoader :: PA.ArchLoader PEE.LoadError
archLoader = PA.ArchLoader $ \pd em origHdr patchedHdr ->
case (em, EEP.headerClass (EEP.header origHdr)) of
(EEP.EM_ARM, EEP.ELFCLASS32) -> case getArchOpts pd of
Just opts ->
Just opts ->
let vad = PA.ValidArchData { PA.validArchSyscallDomain = handleSystemCall
, PA.validArchFunctionDomain = handleExternalCall
, PA.validArchDedicatedRegisters = hasDedicatedRegister
Expand Down
4 changes: 2 additions & 2 deletions arch/Pate/PPC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ stubOverrides = PA.ArchStubOverrides (PA.mkDefaultStubOverride "__pate_stub" r0
, "read"
, "memcpy" -- FIXME: needs implementation
, "__floatsidf" -- FIXME: lets us ignore float operations
, "__extendsfdf2" -- FIXME: lets us ignore float operations
, "__extendsfdf2" -- FIXME: lets us ignore float operations
, "__gtdf2" -- FIXME: lets us ignore float operations
, "ceil" -- FIXME: more floating point hacks
, "FLEXCAN_DRV_Send" -- FIXME: IO stub
Expand All @@ -305,7 +305,7 @@ stubOverrides = PA.ArchStubOverrides (PA.mkDefaultStubOverride "__pate_stub" r0
where
mkNOPStub nm = (nm, PA.mkNOPStub nm)
mkDefault nm = (nm, PA.mkDefaultStubOverride nm r0)

r0 = gpr 0
r1 = gpr 1
r2 = gpr 2
Expand Down
20 changes: 10 additions & 10 deletions src/Pate/Discovery/PLT.hs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ otherwise ignored.

--FIXME: Move

data ExtraJumpTarget arch =
data ExtraJumpTarget arch =
DirectTargets (Set (MM.ArchSegmentOff arch))
| ReturnTarget
deriving (Eq, Ord)
Expand All @@ -174,7 +174,7 @@ extraReturnClassifier jumps = classifierName "Extra Return" $ do
let ainfo = pctxArchInfo (classifierParseContext bcc)
Info.withArchConstraints ainfo $ do
startAddr <- CMR.asks (Info.pctxAddr . Info.classifierParseContext)
Just (instr_off, instr_txt) <- return $ lastInstructionStart (F.toList (classifierStmts bcc))
Just (instr_off, instr_txt) <- return $ lastInstructionStart (F.toList (classifierStmts bcc))
Just final_addr <- return $ MM.incSegmentOff startAddr (fromIntegral instr_off)
case Map.lookup final_addr jumps of
Just ReturnTarget -> return ()
Expand All @@ -194,9 +194,9 @@ extraJumpClassifier jumps = classifierName "Extra Jump" $ do

Info.withArchConstraints ainfo $ do
startAddr <- CMR.asks (Info.pctxAddr . Info.classifierParseContext)
-- FIXME: This is not exactly right, but I'm not sure if there's a better way to find the
-- FIXME: This is not exactly right, but I'm not sure if there's a better way to find the
-- address corresponding to this instruction. Maybe examine the statements?
Just (instr_off, instr_txt) <- return $ lastInstructionStart (F.toList (classifierStmts bcc))
Just (instr_off, instr_txt) <- return $ lastInstructionStart (F.toList (classifierStmts bcc))

Just final_addr <- return $ MM.incSegmentOff startAddr (fromIntegral instr_off)
targets <- case Map.lookup final_addr jumps of
Expand All @@ -212,12 +212,12 @@ extraJumpClassifier jumps = classifierName "Extra Jump" $ do
-- we don't have a good way to reify the branch condition here, but
-- it's not strictly necessary that the ParsedBranch condition be valid, as
-- long as the two targets are correct
-- ideally we'd just set this to "undefined", but there's no good way to
-- ideally we'd just set this to "undefined", but there's no good way to
-- create new macaw terms here
return $ Parsed.ParsedBranch (classifierFinalRegState bcc) (MM.CValue (MM.BoolCValue True)) target1 target2
-}
_ -> fail $ "Unsupported extra targets: " ++ show targets

jumpTargets <- forM targets $ \tgt -> do
let abst' = abst & setAbsIP tgt
return $ (tgt, abst', tgtBnds)
Expand All @@ -233,7 +233,7 @@ extraJumpClassifier jumps = classifierName "Extra Jump" $ do
-- macaw value represents an address that jumps to a PLT stub
pltStubClassifier ::
forall arch ids.
(Value arch ids (BVType (ArchAddrWidth arch)) -> Maybe (ArchSegmentOff arch, BSC.ByteString)) ->
(Value arch ids (BVType (ArchAddrWidth arch)) -> Maybe (ArchSegmentOff arch, BSC.ByteString)) ->
Info.BlockClassifier arch ids
pltStubClassifier f = classifierName "Extra PLT Stub" $ do
stmts <- CMR.asks Info.classifierStmts
Expand All @@ -249,14 +249,14 @@ pltStubClassifier f = classifierName "Extra PLT Stub" $ do
Just (addr,_) -> do
return Parsed.ParsedContents { Parsed.parsedNonterm = F.toList stmts
, Parsed.parsedTerm = Parsed.ParsedCall finalRegs (Just ret)
, Parsed.intraJumpTargets =
, Parsed.intraJumpTargets =
[( ret
, Info.postCallAbsState ainfo (classifierAbsState bcc) finalRegs ret
, Jmp.postCallBounds (Info.archCallParams ainfo) (classifierJumpBounds bcc) finalRegs
)]
, Parsed.newFunctionAddrs = [addr]
, Parsed.writtenCodeAddrs = Info.classifierWrittenAddrs bcc
}
}
Nothing -> fail "Not a PLT stub"


Expand All @@ -283,4 +283,4 @@ pltStubClassifier f = classifierName "Extra PLT Stub" $ do
Jmp.TrueFeasibleBranch _ -> fail "Infeasible false branch"
Jmp.FalseFeasibleBranch _ -> fail "Infeasible true branch"
Jmp.InfeasibleBranch -> fail "Branch targets are both infeasible"
-}
-}

0 comments on commit c4ba5c1

Please sign in to comment.