M68k next patches
The following changes since commit 64f0ad8ad8e13257e7c912df470d46784b55c3fd:
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2020-07-02' into staging (2020-07-02 15:54:09 +0100)
are available in the Git repository at:
git://github.com/vivier/qemu-m68k.git tags/m68k-next-pull-request
for you to fetch changes up to d159dd058c7dc48a9291fde92eaae52a9f26a4d1:
softfloat,m68k: disable floatx80_invalid_encoding() for m68k (2020-07-06 21:41:52 +0200)
----------------------------------------------------------------
m68k pull-request 20200706
disable floatx80_invalid_encoding() for m68k
fix m68k_cpu_get_phys_page_debug()
----------------------------------------------------------------
Laurent Vivier (1):
softfloat,m68k: disable floatx80_invalid_encoding() for m68k
Mark Cave-Ayland (2):
target/m68k: fix physical address translation in
m68k_cpu_get_phys_page_debug()
target/m68k: consolidate physical translation offset into
get_physical_address()
include/fpu/softfloat.h | 24 ++++++++++++++++++++++++ target/m68k/helper.c | 17 ++++++++--------- 2 files changed, 32 insertions(+), 9 deletions(-)
Signature · 1 line
2.26.2
[PULL 1/3] target/m68k: fix physical address translation in m68k_cpu_get_phys_page_debug()
From: Mark Cave-Ayland <[email protected]>
The result of the get_physical_address() function should be combined with the offset of the original page access before being returned. Otherwise the m68k_cpu_get_phys_page_debug() function can round to the wrong page causing incorrect lookups in gdbstub and various "Disassembler disagrees with translator over instruction decoding" warnings to appear at translation time.
Message-Id: <[email protected]>
--- target/m68k/helper.c | 4 ++++ 1 file changed, 4 insertions(+)
target/m68k/helper.c +4 -0
@@ -820,10 +820,14 @@ hwaddr m68k_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)if (env->sr &SR_S ) { access_type |=ACCESS_SUPER ; } +if (get_physical_address (env, &phys_addr, &prot, addr, access_type, &page_size) !=0 ) {return -1 ; } + + addr &=TARGET_PAGE_MASK ; + phys_addr += addr & (page_size -1 );return phys_addr; }
Signature · 1 line
2.26.2
[PULL 3/3] softfloat, m68k: disable floatx80_invalid_encoding() for m68k
In reply to Laurent VivierAccording to the comment, this definition of invalid encoding is given by intel developer's manual, and doesn't comply with 680x0 FPU.
With m68k, the explicit integer bit can be zero in the case of:
- zeros (exp == 0, mantissa == 0)
- denormalized numbers (exp == 0, mantissa != 0)
- unnormalized numbers (exp != 0, exp < 0x7FFF)
- infinities (exp == 0x7FFF, mantissa == 0)
- not-a-numbers (exp == 0x7FFF, mantissa != 0)
For infinities and NaNs, the explicit integer bit can be either one or zero.
The IEEE 754 standard does not define a zero integer bit. Such a number is an unnormalized number. Hardware does not directly support denormalized and unnormalized numbers, but implicitly supports them by trapping them as unimplemented data types, allowing efficient conversion in software.
See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL",
"1.6 FLOATING-POINT DATA TYPES"
We will implement in the m68k TCG emulator the FP_UNIMP exception to trap into the kernel to normalize the number. In case of linux-user, the number will be normalized by QEMU.
Message-Id: <[email protected]>
--- include/fpu/softfloat.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
include/fpu/softfloat.h +24 -0
@@ -794,7 +794,31 @@ static inline bool floatx80_unordered_quiet(floatx80 a, floatx80 b,*----------------------------------------------------------------------------*/ static inline bool floatx80_invalid_encoding (floatx80 a) { +#if defined(TARGET_M68K ) +/*------------------------------------------------------------------------- +| With m68k, the explicit integer bit can be zero in the case of: +| - zeros (exp == 0, mantissa == 0) +| - denormalized numbers (exp == 0, mantissa != 0) +| - unnormalized numbers (exp != 0, exp < 0x7FFF) +| - infinities (exp == 0x7FFF, mantissa == 0) +| - not-a-numbers (exp == 0x7FFF, mantissa != 0) +| +| For infinities and NaNs, the explicit integer bit can be either one or +| zero. +| +| The IEEE 754 standard does not define a zero integer bit. Such a number +| is an unnormalized number. Hardware does not directly support +| denormalized and unnormalized numbers, but implicitly supports them by +| trapping them as unimplemented data types, allowing efficient conversion +| in software. +| +| See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL", +| "1.6 FLOATING-POINT DATA TYPES" +*------------------------------------------------------------------------*/ +return false; +#else return (a.low & (1ULL <<63 )) ==0 && (a.high &0x7FFF ) !=0 ; +#endif }#define floatx80_zero make_floatx80(0x0000, 0x0000000000000000LL)
Signature · 1 line
2.26.2
[PULL 2/3] target/m68k: consolidate physical translation offset into get_physical_address()
In reply to Laurent VivierFrom: Mark Cave-Ayland <[email protected]>
Since all callers to get_physical_address() now apply the same page offset to the translation result, move the logic into get_physical_address() itself to avoid duplication.
Message-Id: <[email protected]>
--- target/m68k/helper.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
target/m68k/helper.c +6 -11
@@ -643,7 +643,7 @@ static int get_physical_address(CPUM68KState *env, hwaddr *physical,/* Transparent Translation Register bit */ env->mmu.mmusr =M68K_MMU_T_040 |M68K_MMU_R_040 ; } - *physical = address &TARGET_PAGE_MASK ; + *physical = address; *page_size =TARGET_PAGE_SIZE ;return 0 ; }
@@ -771,7 +771,7 @@ static int get_physical_address(CPUM68KState *env, hwaddr *physical, } *page_size =1 << page_bits; page_mask = ~(*page_size -1 ); - *physical = next & page_mask; + *physical = (next & page_mask) + (address & (*page_size -1 ));if (access_type &ACCESS_PTEST ) { env->mmu.mmusr |= next &M68K_MMU_SR_MASK_040 ;
@@ -826,8 +826,6 @@ hwaddr m68k_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)return -1 ; } - addr &=TARGET_PAGE_MASK ; - phys_addr += addr & (page_size -1 );return phys_addr; }
@@ -891,10 +889,8 @@ bool m68k_cpu_tlb_fill(CPUState *cs, vaddr address, int size, ret =get_physical_address (&cpu->env, &physical, &prot, address, access_type, &page_size);if (likely (ret ==0 )) { - address &=TARGET_PAGE_MASK ; - physical += address & (page_size -1 ); -tlb_set_page (cs, address, physical, - prot, mmu_idx,TARGET_PAGE_SIZE ); +tlb_set_page (cs, address &TARGET_PAGE_MASK , + physical &TARGET_PAGE_MASK , prot, mmu_idx, page_size);return true; }
@@ -1383,9 +1379,8 @@ void HELPER(ptest)(CPUM68KState *env, uint32_t addr, uint32_t is_read) ret =get_physical_address (env, &physical, &prot, addr, access_type, &page_size);if (ret ==0 ) { - addr &=TARGET_PAGE_MASK ; - physical += addr & (page_size -1 ); -tlb_set_page (env_cpu (env), addr, physical, +tlb_set_page (env_cpu (env), addr &TARGET_PAGE_MASK , + physical &TARGET_PAGE_MASK , prot, access_type &ACCESS_SUPER ?MMU_KERNEL_IDX :MMU_USER_IDX , page_size); }
Signature · 1 line
2.26.2
Peter Maydell
AppliedQuoted 11 lines · Laurent Vivier
The following changes since commit
64f0ad8ad8e13257e7c912df470d46784b55c3fd:Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2020-07-02' into staging (2020-07-02 15:54:09 +0100)
are available in the Git repository at:
git://github.com/vivier/qemu-m68k.gittags/m68k-next-pull-requestfor you to fetch changes up to
d159dd058c7dc48a9291fde92eaae52a9f26a4d1:
Quoted 8 lines
softfloat,m68k: disable
floatx80_invalid_encoding()for m68k (2020-07-06 21:41:52 +0200)----------------------------------------------------------------
m68k pull-request 20200706disable
floatx80_invalid_encoding()for m68k
fixm68k_cpu_get_phys_page_debug()
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.
-- PMM