diff options
author | Chuan Zhu <chuan.zhu@arm.com> | 2017-07-26 17:03:18 +0100 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2018-02-16 09:28:24 +0000 |
commit | c105793a2027cd113233e8ce6c5e2d4ea2f9cded (patch) | |
tree | 7e8fd86bc3ea02ea382d451db968ca8f61e9ea9a /src/arch/arm/isa/insts/ldr64.isa | |
parent | fcc98a50e3af273921914f9adf61db7b1944bb05 (diff) | |
download | gem5-c105793a2027cd113233e8ce6c5e2d4ea2f9cded.tar.xz |
arch-arm: Fix big endian support in {Load,Store}Double64
{Load, Store}Double64 didn't consider some of the big-endian
situations. Added big-endian related data conversions to correct them.
Change-Id: I8840613f94446e6042276779d1f02350ab57987f
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/8145
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/arch/arm/isa/insts/ldr64.isa')
-rw-r--r-- | src/arch/arm/isa/insts/ldr64.isa | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/src/arch/arm/isa/insts/ldr64.isa b/src/arch/arm/isa/insts/ldr64.isa index e035e1d7e..8c966e40e 100644 --- a/src/arch/arm/isa/insts/ldr64.isa +++ b/src/arch/arm/isa/insts/ldr64.isa @@ -228,23 +228,31 @@ let {{ if self.size == 4: accCode = ''' uint64_t data = cSwap(Mem_ud, isBigEndian64(xc->tcBase())); - AA64FpDestP0_uw = (uint32_t)data; + AA64FpDestP0_uw = isBigEndian64(xc->tcBase()) + ? (data >> 32) + : (uint32_t)data; AA64FpDestP1_uw = 0; AA64FpDestP2_uw = 0; AA64FpDestP3_uw = 0; - AA64FpDest2P0_uw = (data >> 32); + AA64FpDest2P0_uw = isBigEndian64(xc->tcBase()) + ? (uint32_t)data + : (data >> 32); AA64FpDest2P1_uw = 0; AA64FpDest2P2_uw = 0; AA64FpDest2P3_uw = 0; ''' elif self.size == 8: accCode = ''' - AA64FpDestP0_uw = (uint32_t)Mem_tud[0]; - AA64FpDestP1_uw = (uint32_t)(Mem_tud[0] >> 32); + uint64_t data_a = cSwap(Mem_tud[0], + isBigEndian64(xc->tcBase())); + uint64_t data_b = cSwap(Mem_tud[1], + isBigEndian64(xc->tcBase())); + AA64FpDestP0_uw = (uint32_t)data_a; + AA64FpDestP1_uw = (uint32_t)(data_a >> 32); AA64FpDestP2_uw = 0; AA64FpDestP3_uw = 0; - AA64FpDest2P0_uw = (uint32_t)Mem_tud[1]; - AA64FpDest2P1_uw = (uint32_t)(Mem_tud[1] >> 32); + AA64FpDest2P0_uw = (uint32_t)data_b; + AA64FpDest2P1_uw = (uint32_t)(data_b >> 32); AA64FpDest2P2_uw = 0; AA64FpDest2P3_uw = 0; ''' @@ -254,26 +262,38 @@ let {{ accCode = ''' uint64_t data = cSwap(Mem_ud, isBigEndian64(xc->tcBase())); - XDest = sext<32>((uint32_t)data); - XDest2 = sext<32>(data >> 32); + XDest = isBigEndian64(xc->tcBase()) + ? sext<32>(data >> 32) + : sext<32>((uint32_t)data); + XDest2 = isBigEndian64(xc->tcBase()) + ? sext<32>((uint32_t)data) + : sext<32>(data >> 32); ''' elif self.size == 8: accCode = ''' - XDest = Mem_tud[0]; - XDest2 = Mem_tud[1]; + XDest = cSwap(Mem_tud[0], + isBigEndian64(xc->tcBase())); + XDest2 = cSwap(Mem_tud[1], + isBigEndian64(xc->tcBase())); ''' else: if self.size == 4: accCode = ''' uint64_t data = cSwap(Mem_ud, isBigEndian64(xc->tcBase())); - XDest = (uint32_t)data; - XDest2 = data >> 32; + XDest = isBigEndian64(xc->tcBase()) + ? (data >> 32) + : (uint32_t)data; + XDest2 = isBigEndian64(xc->tcBase()) + ? (uint32_t)data + : (data >> 32); ''' elif self.size == 8: accCode = ''' - XDest = Mem_tud[0]; - XDest2 = Mem_tud[1]; + XDest = cSwap(Mem_tud[0], + isBigEndian64(xc->tcBase())); + XDest2 = cSwap(Mem_tud[1], + isBigEndian64(xc->tcBase())); ''' self.codeBlobs["memacc_code"] = accCode |