Some fixes for compiling for WIN64 with MSVC.
- Added check in config.h whether or not Bochs is configured and compiled for the same target platform (WIN32 / WIN64). - Fixed some warnings that occur in the MSVC WIN64 case.
This commit is contained in:
parent
61f24a0727
commit
e34d017f60
@ -128,7 +128,7 @@ static Bit64s bx_param_handler(bx_param_c *param, bool set, Bit64s val)
|
|||||||
val = get_floppy_type_from_image(SIM->get_param_string("path", base)->getptr());
|
val = get_floppy_type_from_image(SIM->get_param_string("path", base)->getptr());
|
||||||
SIM->get_param_enum("type", base)->set(val);
|
SIM->get_param_enum("type", base)->set(val);
|
||||||
} else if (!SIM->get_init_done() && (val != BX_FLOPPY_NONE)) {
|
} else if (!SIM->get_init_done() && (val != BX_FLOPPY_NONE)) {
|
||||||
device = get_floppy_devtype_from_type(val);
|
device = get_floppy_devtype_from_type((int)val);
|
||||||
SIM->get_param_enum("devtype", base)->set(device);
|
SIM->get_param_enum("devtype", base)->set(device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2361,7 +2361,7 @@ int bx_split_option_list(const char *msg, const char *rawopt, char **argv, int m
|
|||||||
strcpy(tmpstr, ptr);
|
strcpy(tmpstr, ptr);
|
||||||
ptr2 = tmpstr;
|
ptr2 = tmpstr;
|
||||||
while (isspace(*ptr2)) ptr2++;
|
while (isspace(*ptr2)) ptr2++;
|
||||||
i = strlen(ptr2) - 1;
|
i = (int)strlen(ptr2) - 1;
|
||||||
while ((i >= 0) && isspace(ptr2[i])) {
|
while ((i >= 0) && isspace(ptr2[i])) {
|
||||||
ptr2[i] = 0;
|
ptr2[i] = 0;
|
||||||
i--;
|
i--;
|
||||||
@ -3029,7 +3029,7 @@ static int parse_line_formatted(const char *context, int num_params, char *param
|
|||||||
&tm_time.tm_hour, &tm_time.tm_min, &tm_time.tm_sec, &year);
|
&tm_time.tm_hour, &tm_time.tm_min, &tm_time.tm_sec, &year);
|
||||||
if ((n == 7) && (year >= 1980) && (strstr(months, mon) != NULL)) {
|
if ((n == 7) && (year >= 1980) && (strstr(months, mon) != NULL)) {
|
||||||
tm_time.tm_year = year - 1900;
|
tm_time.tm_year = year - 1900;
|
||||||
tm_time.tm_mon = 12 - (strlen(strstr(months, mon)) / 4);
|
tm_time.tm_mon = 12 - ((int)strlen(strstr(months, mon)) / 4);
|
||||||
SIM->get_param_num(BXPN_CLOCK_TIME0)->set(mktime(&tm_time));
|
SIM->get_param_num(BXPN_CLOCK_TIME0)->set(mktime(&tm_time));
|
||||||
} else {
|
} else {
|
||||||
PARSE_ERR(("%s: time0 string format malformed.", context));
|
PARSE_ERR(("%s: time0 string format malformed.", context));
|
||||||
|
@ -85,6 +85,15 @@
|
|||||||
#define BX_SHOW_IPS 0
|
#define BX_SHOW_IPS 0
|
||||||
|
|
||||||
|
|
||||||
|
#define MSVC_TARGET 0
|
||||||
|
#if defined(_MSC_VER) && defined(MSVC_TARGET)
|
||||||
|
#if defined(_M_X64) && (MSVC_TARGET != 64)
|
||||||
|
#error Bochs not configured for MSVC WIN64
|
||||||
|
#elif !defined(_M_X64) && (MSVC_TARGET != 32)
|
||||||
|
#error Bochs not configured for MSVC WIN32
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (BX_SHOW_IPS) && (defined(__MINGW32__) || defined(_MSC_VER))
|
#if (BX_SHOW_IPS) && (defined(__MINGW32__) || defined(_MSC_VER))
|
||||||
#define SIGALRM 14
|
#define SIGALRM 14
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,9 +48,11 @@ case "$target" in
|
|||||||
case "$target" in
|
case "$target" in
|
||||||
x86_64*)
|
x86_64*)
|
||||||
MSVC_TARGET=64
|
MSVC_TARGET=64
|
||||||
|
AC_DEFINE(MSVC_TARGET, 64)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
MSVC_TARGET=32
|
MSVC_TARGET=32
|
||||||
|
AC_DEFINE(MSVC_TARGET, 32)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
@ -1503,7 +1503,7 @@ void bx_e1000_c::rx_frame(const void *buf, unsigned buf_size)
|
|||||||
if (copy_size > BX_E1000_THIS s.rxbuf_size) {
|
if (copy_size > BX_E1000_THIS s.rxbuf_size) {
|
||||||
copy_size = BX_E1000_THIS s.rxbuf_size;
|
copy_size = BX_E1000_THIS s.rxbuf_size;
|
||||||
}
|
}
|
||||||
DEV_MEM_WRITE_PHYSICAL_DMA(le64_to_cpu(desc.buffer_addr), copy_size,
|
DEV_MEM_WRITE_PHYSICAL_DMA(le64_to_cpu(desc.buffer_addr), (unsigned)copy_size,
|
||||||
(Bit8u *)buf + desc_offset + vlan_offset);
|
(Bit8u *)buf + desc_offset + vlan_offset);
|
||||||
}
|
}
|
||||||
desc_offset += desc_size;
|
desc_offset += desc_size;
|
||||||
|
@ -267,7 +267,7 @@ void bx_pci_ide_c::timer()
|
|||||||
}
|
}
|
||||||
if (BX_PIDE_THIS s.bmdma[channel].cmd_rwcon) {
|
if (BX_PIDE_THIS s.bmdma[channel].cmd_rwcon) {
|
||||||
BX_DEBUG(("READ DMA to addr=0x%08x, size=0x%08x", prd.addr, size));
|
BX_DEBUG(("READ DMA to addr=0x%08x, size=0x%08x", prd.addr, size));
|
||||||
count = size - (BX_PIDE_THIS s.bmdma[channel].buffer_top - BX_PIDE_THIS s.bmdma[channel].buffer_idx);
|
count = (int)(size - (BX_PIDE_THIS s.bmdma[channel].buffer_top - BX_PIDE_THIS s.bmdma[channel].buffer_idx));
|
||||||
while (count > 0) {
|
while (count > 0) {
|
||||||
sector_size = count;
|
sector_size = count;
|
||||||
if (DEV_hd_bmdma_read_sector(channel, BX_PIDE_THIS s.bmdma[channel].buffer_top, §or_size)) {
|
if (DEV_hd_bmdma_read_sector(channel, BX_PIDE_THIS s.bmdma[channel].buffer_top, §or_size)) {
|
||||||
@ -288,7 +288,7 @@ void bx_pci_ide_c::timer()
|
|||||||
BX_DEBUG(("WRITE DMA from addr=0x%08x, size=0x%08x", prd.addr, size));
|
BX_DEBUG(("WRITE DMA from addr=0x%08x, size=0x%08x", prd.addr, size));
|
||||||
DEV_MEM_READ_PHYSICAL_DMA(prd.addr, size, BX_PIDE_THIS s.bmdma[channel].buffer_top);
|
DEV_MEM_READ_PHYSICAL_DMA(prd.addr, size, BX_PIDE_THIS s.bmdma[channel].buffer_top);
|
||||||
BX_PIDE_THIS s.bmdma[channel].buffer_top += size;
|
BX_PIDE_THIS s.bmdma[channel].buffer_top += size;
|
||||||
count = BX_PIDE_THIS s.bmdma[channel].buffer_top - BX_PIDE_THIS s.bmdma[channel].buffer_idx;
|
count = (int)(BX_PIDE_THIS s.bmdma[channel].buffer_top - BX_PIDE_THIS s.bmdma[channel].buffer_idx);
|
||||||
while (count > 511) {
|
while (count > 511) {
|
||||||
if (DEV_hd_bmdma_write_sector(channel, BX_PIDE_THIS s.bmdma[channel].buffer_idx)) {
|
if (DEV_hd_bmdma_write_sector(channel, BX_PIDE_THIS s.bmdma[channel].buffer_idx)) {
|
||||||
BX_PIDE_THIS s.bmdma[channel].buffer_idx += 512;
|
BX_PIDE_THIS s.bmdma[channel].buffer_idx += 512;
|
||||||
@ -309,7 +309,7 @@ void bx_pci_ide_c::timer()
|
|||||||
DEV_hd_bmdma_complete(channel);
|
DEV_hd_bmdma_complete(channel);
|
||||||
} else {
|
} else {
|
||||||
// To avoid buffer overflow reset buffer pointers and copy data if necessary
|
// To avoid buffer overflow reset buffer pointers and copy data if necessary
|
||||||
count = BX_PIDE_THIS s.bmdma[channel].buffer_top - BX_PIDE_THIS s.bmdma[channel].buffer_idx;
|
count = (int)(BX_PIDE_THIS s.bmdma[channel].buffer_top - BX_PIDE_THIS s.bmdma[channel].buffer_idx);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
memmove(BX_PIDE_THIS s.bmdma[channel].buffer, BX_PIDE_THIS s.bmdma[channel].buffer_idx, count);
|
memmove(BX_PIDE_THIS s.bmdma[channel].buffer, BX_PIDE_THIS s.bmdma[channel].buffer_idx, count);
|
||||||
}
|
}
|
||||||
|
@ -1551,7 +1551,7 @@ void bx_serial_c::rx_timer(void)
|
|||||||
SOCKET socketid = BX_SER_THIS s[port].socket_id;
|
SOCKET socketid = BX_SER_THIS s[port].socket_id;
|
||||||
if (socketid >= 0) {
|
if (socketid >= 0) {
|
||||||
FD_SET(socketid, &fds);
|
FD_SET(socketid, &fds);
|
||||||
if (select(socketid+1, &fds, NULL, NULL, &tval) == 1) {
|
if (select((int)(socketid+1), &fds, NULL, NULL, &tval) == 1) {
|
||||||
ssize_t bytes = (ssize_t)
|
ssize_t bytes = (ssize_t)
|
||||||
::recv(socketid, (char*) &chbuf, 1, 0);
|
::recv(socketid, (char*) &chbuf, 1, 0);
|
||||||
if (bytes > 0) {
|
if (bytes > 0) {
|
||||||
|
@ -282,7 +282,7 @@ void scsi_device_t::restore_requests(const char *path)
|
|||||||
do {
|
do {
|
||||||
ret = fgets(line, sizeof(line)-1, fp);
|
ret = fgets(line, sizeof(line)-1, fp);
|
||||||
line[sizeof(line) - 1] = '\0';
|
line[sizeof(line) - 1] = '\0';
|
||||||
int len = strlen(line);
|
size_t len = strlen(line);
|
||||||
if ((len > 0) && (line[len-1] < ' '))
|
if ((len > 0) && (line[len-1] < ' '))
|
||||||
line[len-1] = '\0';
|
line[len-1] = '\0';
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -628,8 +628,8 @@ Bit32s scsi_device_t::scsi_send_command(Bit32u tag, Bit8u *buf, int lun, bool as
|
|||||||
case 0x83:
|
case 0x83:
|
||||||
{
|
{
|
||||||
// Device identification page, mandatory
|
// Device identification page, mandatory
|
||||||
int max_len = 255 - 8;
|
size_t max_len = 255 - 8;
|
||||||
int id_len = strlen(DEVICE_NAME);
|
size_t id_len = strlen(DEVICE_NAME);
|
||||||
if (id_len > max_len)
|
if (id_len > max_len)
|
||||||
id_len = max_len;
|
id_len = max_len;
|
||||||
|
|
||||||
@ -643,15 +643,15 @@ Bit32s scsi_device_t::scsi_send_command(Bit32u tag, Bit8u *buf, int lun, bool as
|
|||||||
|
|
||||||
outbuf[r->buf_len++] = 0x83; // this page
|
outbuf[r->buf_len++] = 0x83; // this page
|
||||||
outbuf[r->buf_len++] = 0x00;
|
outbuf[r->buf_len++] = 0x00;
|
||||||
outbuf[r->buf_len++] = 3 + id_len;
|
outbuf[r->buf_len++] = 3 + (Bit8u)id_len;
|
||||||
|
|
||||||
outbuf[r->buf_len++] = 0x2; // ASCII
|
outbuf[r->buf_len++] = 0x2; // ASCII
|
||||||
outbuf[r->buf_len++] = 0; // not officially assigned
|
outbuf[r->buf_len++] = 0; // not officially assigned
|
||||||
outbuf[r->buf_len++] = 0; // reserved
|
outbuf[r->buf_len++] = 0; // reserved
|
||||||
outbuf[r->buf_len++] = id_len; // length of data following
|
outbuf[r->buf_len++] = (Bit8u)id_len; // length of data following
|
||||||
|
|
||||||
memcpy(&outbuf[r->buf_len], DEVICE_NAME, id_len);
|
memcpy(&outbuf[r->buf_len], DEVICE_NAME, id_len);
|
||||||
r->buf_len += id_len;
|
r->buf_len += (int)id_len;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -769,7 +769,7 @@ Bit32s scsi_device_t::scsi_send_command(Bit32u tag, Bit8u *buf, int lun, bool as
|
|||||||
p[21] = (16 * 176) & 0xff;
|
p[21] = (16 * 176) & 0xff;
|
||||||
p += 22;
|
p += 22;
|
||||||
}
|
}
|
||||||
r->buf_len = p - outbuf;
|
r->buf_len = (int)(p - outbuf);
|
||||||
outbuf[0] = r->buf_len - 4;
|
outbuf[0] = r->buf_len - 4;
|
||||||
if (r->buf_len > (int)len)
|
if (r->buf_len > (int)len)
|
||||||
r->buf_len = len;
|
r->buf_len = len;
|
||||||
|
@ -611,7 +611,7 @@ int usb_device_c::set_usb_string(Bit8u *buf, const char *str)
|
|||||||
*q++ = str[i];
|
*q++ = str[i];
|
||||||
*q++ = 0;
|
*q++ = 0;
|
||||||
}
|
}
|
||||||
return q - buf;
|
return (int)(q - buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BX_SUPPORT_PCI && BX_SUPPORT_PCIUSB
|
#endif // BX_SUPPORT_PCI && BX_SUPPORT_PCIUSB
|
||||||
|
Loading…
Reference in New Issue
Block a user