Skip to content

Commit

Permalink
Fix Linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
ergo720 committed Feb 27, 2024
1 parent 5a7839a commit 3eda131
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib86cpu/support.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,15 @@ template<typename T, mem_type type>
void log_unhandled_write(addr_t addr, T value)
{
if constexpr ((sizeof(T) == 10) || (sizeof(T) == 16)) {
constexpr size_t val_high_digits = sizeof(T) == 10 ? 4 : 16;
using type_high_digits = std::conditional_t<sizeof(T) == 10, uint16_t, uint64_t>;
// NOTE: for some reason, gcc doesn't add the "h" modifier when using PRIX8 and PRIX16, which will cause a compilation error. To avoid the issue, we always use
// PRIX64 to print value.high, even when it's uint80_t
if constexpr (type == mem_type::unmapped) {
LOG(log_level::warn, ("Memory write of value high=0x%0" + std::to_string(val_high_digits) + get_prix_prefix<type_high_digits>() + " and low=0x%016" PRIX64 " to \
unmapped memory at address 0x%08" PRIX32 " with size %" PRId32).c_str(),
value.high, value.low, addr, sizeof(T));
LOG(log_level::warn, "Memory write of value high=0x%016" PRIX64 " and low=0x%016" PRIX64 " to unmapped memory at address 0x%08" PRIX32 " with size %" PRId32,
(uint64_t)value.high, value.low, addr, sizeof(T));
}
else {
LOG(log_level::warn, ("Unhandled mmio write of value high=0x%0" + std::to_string(val_high_digits) + get_prix_prefix<type_high_digits>() + " and low=0x%016" PRIX64 " at \
address 0x%08" PRIX32 " with size %" PRId32).c_str(),
value.high, value.low, addr, sizeof(T));
LOG(log_level::warn, "Unhandled mmio write of value high=0x%016" PRIX64 " and low=0x%016" PRIX64 " at address 0x%08" PRIX32 " with size %" PRId32,
(uint64_t)value.high, value.low, addr, sizeof(T));
}
}
else {
Expand Down

0 comments on commit 3eda131

Please sign in to comment.