Skip to content

Commit

Permalink
Fixed linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
ergo720 committed Jan 14, 2025
1 parent 366de6d commit 4decbc2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib86cpu/core/memory_management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ addr_t get_code_addr(cpu_t *cpu, addr_t addr, exp_data_t *exp_data)
uint64_t
as_ram_dispatch_read(cpu_t *cpu, addr_t addr, uint64_t size, const memory_region_t<addr_t> *region, uint8_t *buffer)
{
uint64_t bytes_to_read = std::min(region->end - addr + 1ull, size);
uint64_t bytes_to_read = std::min(region->end - addr + (uint64_t)1, size);

switch (region->type)
{
Expand Down
10 changes: 5 additions & 5 deletions lib86cpu/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ mem_init_region_ram(cpu_t *cpu, addr_t start, uint64_t size, bool should_int)

std::unique_ptr<memory_region_t<addr_t>> ram(new memory_region_t<addr_t>);
ram->start = ram->buff_off_start = start;
ram->end = (addr_t)std::min(start + size - 1, 0xFFFFFFFFull);
ram->end = (addr_t)std::min(start + size - 1, (uint64_t)std::numeric_limits<uint32_t>::max());
ram->type = mem_type::ram;

if (should_int) {
Expand Down Expand Up @@ -716,7 +716,7 @@ mem_init_region_io(cpu_t *cpu, addr_t start, uint64_t size, bool io_space, io_ha

std::unique_ptr<memory_region_t<port_t>> io(new memory_region_t<port_t>);
io->start = static_cast<port_t>(start);
io->end = (addr_t)std::min(io->start + size - 1, 0xFFFFull);
io->end = (addr_t)std::min(io->start + size - 1, (uint64_t)std::numeric_limits<uint16_t>::max());
io->type = mem_type::pmio;
io->handlers.fnr8 = handlers.fnr8 ? handlers.fnr8 : default_pmio_read_handler8;
io->handlers.fnr16 = handlers.fnr16 ? handlers.fnr16 : default_pmio_read_handler16;
Expand All @@ -731,7 +731,7 @@ mem_init_region_io(cpu_t *cpu, addr_t start, uint64_t size, bool io_space, io_ha
else {
std::unique_ptr<memory_region_t<addr_t>> mmio(new memory_region_t<addr_t>);
mmio->start = start;
mmio->end = (addr_t)std::min(start + size - 1, 0xFFFFFFFFull);
mmio->end = (addr_t)std::min(start + size - 1, (uint64_t)std::numeric_limits<uint32_t>::max());
mmio->type = mem_type::mmio;
mmio->handlers.fnr8 = handlers.fnr8 ? handlers.fnr8 : default_mmio_read_handler8;
mmio->handlers.fnr16 = handlers.fnr16 ? handlers.fnr16 : default_mmio_read_handler16;
Expand Down Expand Up @@ -777,7 +777,7 @@ mem_init_region_alias(cpu_t *cpu, addr_t alias_start, addr_t ori_start, uint64_t
if ((aliased_region->start <= ori_start) && (aliased_region->end >= (ori_start + ori_size - 1)) && (aliased_region->type != mem_type::unmapped)) {
std::unique_ptr<memory_region_t<addr_t>> alias(new memory_region_t<addr_t>);
alias->start = alias_start;
alias->end = (addr_t)std::min(alias_start + ori_size - 1, 0xFFFFFFFFull);
alias->end = (addr_t)std::min(alias_start + ori_size - 1, (uint64_t)std::numeric_limits<uint32_t>::max());
alias->alias_offset = ori_start - aliased_region->start;
alias->type = mem_type::alias;
alias->aliased_region = aliased_region;
Expand Down Expand Up @@ -816,7 +816,7 @@ mem_init_region_rom(cpu_t *cpu, addr_t start, uint64_t size, uint8_t *buffer, bo

std::unique_ptr<memory_region_t<addr_t>> rom(new memory_region_t<addr_t>);
rom->start = rom->buff_off_start = start;
rom->end = (addr_t)std::min(start + size - 1, 0xFFFFFFFFull);
rom->end = (addr_t)std::min(start + size - 1, (uint64_t)std::numeric_limits<uint32_t>::max());
rom->type = mem_type::rom;
rom->rom_ptr = buffer;

Expand Down

0 comments on commit 4decbc2

Please sign in to comment.