From 50dfe4b8dec1c501a006732bd3ed90b8f0192be5 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Mon, 21 May 2018 16:11:46 +0000 Subject: [PATCH] Some fixes for MSVC. - Fixed compilation failure of MSVC plugin 'speaker'. - Fixed some MSVC warnings. --- bochs/iodev/cmos.cc | 2 +- bochs/iodev/pci.cc | 4 ++-- bochs/memory/memory-bochs.h | 4 ++-- bochs/memory/misc_mem.cc | 6 +++--- bochs/osdep.h | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bochs/iodev/cmos.cc b/bochs/iodev/cmos.cc index b24714ef2..b986b68a4 100644 --- a/bochs/iodev/cmos.cc +++ b/bochs/iodev/cmos.cc @@ -231,7 +231,7 @@ void bx_cmos_c::init(void) (stat_buf.st_size != 256)) { BX_PANIC(("CMOS: image file size must be 64, 128 or 256")); } else { - BX_CMOS_THIS s.max_reg = stat_buf.st_size - 1; + BX_CMOS_THIS s.max_reg = (Bit8u)(stat_buf.st_size - 1); if (BX_CMOS_THIS s.max_reg == 255) { DEV_register_ioread_handler(this, read_handler, 0x0072, "Ext CMOS RAM", 1); DEV_register_ioread_handler(this, read_handler, 0x0073, "Ext CMOS RAM", 1); diff --git a/bochs/iodev/pci.cc b/bochs/iodev/pci.cc index 2d488c67b..be6efa8c1 100644 --- a/bochs/iodev/pci.cc +++ b/bochs/iodev/pci.cc @@ -448,7 +448,7 @@ Bit32u bx_pci_bridge_c::agp_aperture_read(bx_phy_address addr, unsigned len, bx_bool agp) { if (BX_PCI_THIS pci_conf[0x51] & 0x02) { - Bit32u offset = (addr - pci_bar[0].addr); + Bit32u offset = (Bit32u)(addr - pci_bar[0].addr); Bit32u gart_index = (Bit32u)(offset >> 12); Bit32u page_offset = (Bit32u)(offset & 0xfff); Bit32u gart_addr = BX_PCI_THIS gart_base + (gart_index << 2); @@ -474,7 +474,7 @@ void bx_pci_bridge_c::agp_aperture_write(bx_phy_address addr, Bit32u value, unsigned len, bx_bool agp) { if (BX_PCI_THIS pci_conf[0x51] & 0x02) { - Bit32u offset = (addr - pci_bar[0].addr); + Bit32u offset = (Bit32u)(addr - pci_bar[0].addr); Bit32u gart_index = (Bit32u)(offset >> 12); Bit32u page_offset = (Bit32u)(offset & 0xfff); Bit32u gart_addr = BX_PCI_THIS gart_base + (gart_index << 2); diff --git a/bochs/memory/memory-bochs.h b/bochs/memory/memory-bochs.h index 5b139281d..d74199e56 100644 --- a/bochs/memory/memory-bochs.h +++ b/bochs/memory/memory-bochs.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2001-2017 The Bochs Project +// Copyright (C) 2001-2018 The Bochs Project // // I/O memory handlers API Copyright (C) 2003 by Frank Cornelis // @@ -156,7 +156,7 @@ public: BX_MEM_SMF Bit64u get_memory_len(void); BX_MEM_SMF void allocate_block(Bit32u index); - BX_MEM_SMF Bit8u* alloc_vector_aligned(Bit32u bytes, Bit32u alignment); + BX_MEM_SMF Bit8u* alloc_vector_aligned(Bit64u bytes, Bit64u alignment); #if BX_SUPPORT_MONITOR_MWAIT BX_MEM_SMF bx_bool is_monitor(bx_phy_address begin_addr, unsigned len); diff --git a/bochs/memory/misc_mem.cc b/bochs/memory/misc_mem.cc index 5b6657a0a..e87e9bab9 100644 --- a/bochs/memory/misc_mem.cc +++ b/bochs/memory/misc_mem.cc @@ -54,7 +54,7 @@ BX_MEM_C::BX_MEM_C() #endif } -Bit8u* BX_MEM_C::alloc_vector_aligned(Bit32u bytes, Bit32u alignment) +Bit8u* BX_MEM_C::alloc_vector_aligned(Bit64u bytes, Bit64u alignment) { Bit64u test_mask = alignment - 1; BX_MEM_THIS actual_vector = new Bit8u [(Bit32u)(bytes + test_mask)]; @@ -429,7 +429,7 @@ void BX_MEM_C::load_ROM(const char *path, bx_phy_address romaddress, Bit8u type) return; } } else { - romaddress = -size; + romaddress = ~(size - 1); } offset = romaddress & BIOS_MASK; if ((romaddress & 0xf0000) < 0xf0000) { @@ -531,7 +531,7 @@ void BX_MEM_C::load_RAM(const char *path, bx_phy_address ramaddress) size = (unsigned long)stat_buf.st_size; - offset = ramaddress; + offset = (unsigned long)ramaddress; while (size > 0) { ret = read(fd, (bx_ptr_t) BX_MEM_THIS get_vector(offset), size); if (ret <= 0) { diff --git a/bochs/osdep.h b/bochs/osdep.h index 098cd869a..72224c812 100644 --- a/bochs/osdep.h +++ b/bochs/osdep.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2001-2017 The Bochs Project +// Copyright (C) 2001-2018 The Bochs Project // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -345,7 +345,7 @@ BX_CPP_INLINE void bx_ppc_store_le64(Bit64u *p, Bit64u v) #if BX_HAVE_REALTIME_USEC // 64-bit time in useconds. -extern Bit64u bx_get_realtime64_usec (void); +BOCHSAPI_MSVCONLY extern Bit64u bx_get_realtime64_usec (void); #endif #ifdef WIN32