ppc: Add more support for CR and FPSCR instructions

This commit is contained in:
Tristan Ravitch 2017-11-29 16:30:24 -08:00
parent 45a898cf5d
commit 52dc736c08
2 changed files with 6 additions and 2 deletions

View File

@ -44,6 +44,7 @@ data PPCReg arch tp where
PPC_CTR :: (w ~ MC.RegAddrWidth (PPCReg arch), 1 <= w) => PPCReg arch (BVType w)
PPC_CR :: PPCReg arch (BVType 32)
PPC_XER :: (w ~ MC.RegAddrWidth (PPCReg arch), 1 <= w) => PPCReg arch (BVType w)
PPC_FPSCR :: PPCReg arch (BVType 32)
deriving instance Eq (PPCReg arch tp)
deriving instance Ord (PPCReg arch tp)
@ -58,6 +59,7 @@ instance Show (PPCReg arch tp) where
PPC_CTR -> "ctr"
PPC_CR -> "cr"
PPC_XER -> "xer"
PPC_FPSCR -> "fpscr"
instance ShowF (PPCReg arch) where
showF = show
@ -116,6 +118,7 @@ instance (ArchWidth ppc) => HasRepr (PPCReg ppc) TypeRepr where
PPC_CTR -> BVTypeRepr (pointerNatRepr (Proxy @ppc))
PPC_CR -> BVTypeRepr n32
PPC_XER -> BVTypeRepr (pointerNatRepr (Proxy @ppc))
PPC_FPSCR -> BVTypeRepr n32
instance ( ArchWidth ppc
@ -138,7 +141,7 @@ ppcRegs = concat [ gprs
, fprs
]
where
sprs = [ Some PPC_IP, Some PPC_LNK, Some PPC_CTR, Some PPC_CR, Some PPC_XER ]
sprs = [ Some PPC_IP, Some PPC_LNK, Some PPC_CTR, Some PPC_CR, Some PPC_XER, Some PPC_FPSCR ]
gprs = [ Some (PPC_GP (D.GPR rnum))
| rnum <- [0..31]
]
@ -158,4 +161,5 @@ locToRegTH _ APPC.LocLNK = [| PPC_LNK |]
locToRegTH _ APPC.LocCTR = [| PPC_CTR |]
locToRegTH _ APPC.LocCR = [| PPC_CR |]
locToRegTH _ APPC.LocXER = [| PPC_XER |]
locToRegTH _ APPC.LocFPSCR = [| PPC_FPSCR |]
locToRegTH _ _ = [| undefined |]

@ -1 +1 @@
Subproject commit 50ae052fddeb6fbd75b013d54f56edfcfc989913
Subproject commit 2def79474e70c15b57ebf370ecd0bc7735259e37