Made to compile on MacOS9

This commit is contained in:
Daniel Gimpelevich 2004-02-06 22:28:00 +00:00
parent c84deba786
commit 126971af49
13 changed files with 1125 additions and 1094 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.135 2004-02-01 23:48:56 cbothamy Exp $ // $Id: bochs.h,v 1.136 2004-02-06 22:27:59 danielg4 Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -58,7 +58,11 @@ extern "C" {
#endif #endif
#include <time.h> #include <time.h>
#if BX_WITH_MACOS #if BX_WITH_MACOS
#define Float32 KLUDGE_Float32
#define Float64 KLUDGE_Float64
# include <types.h> # include <types.h>
#undef Float32
#undef Float64
# include <stat.h> # include <stat.h>
# include <cstdio> # include <cstdio>
# include <unistd.h> # include <unistd.h>

View File

@ -2,4 +2,11 @@
#define USE_WITH_CPU_SIM #define USE_WITH_CPU_SIM
#define PARANOID #define PARANOID
#define fileno(A) 0 #define fileno(A) 0
#ifdef __cplusplus
#include <cstddef>
inline long read(int fd, void *buf, std::size_t nbytes);
long read(int fd, void *buf, std::size_t nbytes) {return read(fd, (char*)buf, nbytes);}
inline long write(int fd, const void *buf, std::size_t nbytes);
long write(int fd, const void *buf, std::size_t nbytes) {return write(fd, (const char*)buf, nbytes);}
#endif

View File

@ -55,7 +55,7 @@ typedef enum {
float_negative_inf, float_negative_inf,
float_positive_inf, float_positive_inf,
float_denormal, float_denormal,
float_normalized, float_normalized
} float_class_t; } float_class_t;
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
@ -93,7 +93,7 @@ enum float_exception_flag_t {
float_flag_divbyzero = 0x04, float_flag_divbyzero = 0x04,
float_flag_overflow = 0x08, float_flag_overflow = 0x08,
float_flag_underflow = 0x10, float_flag_underflow = 0x10,
float_flag_inexact = 0x20, float_flag_inexact = 0x20
}; };
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
@ -103,7 +103,7 @@ enum {
float_relation_less = -1, float_relation_less = -1,
float_relation_equal = 0, float_relation_equal = 0,
float_relation_greater = 1, float_relation_greater = 1,
float_relation_unordered = 2, float_relation_unordered = 2
}; };
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------+ /*---------------------------------------------------------------------------+
| errors.c | | errors.c |
| $Id: errors.c,v 1.15 2003-11-01 18:36:19 sshwarts Exp $ | $Id: errors.c,v 1.16 2004-02-06 22:27:59 danielg4 Exp $
| | | |
| The error handling functions for wm-FPU-emu | | The error handling functions for wm-FPU-emu |
| | | |
@ -28,7 +28,9 @@
#include "control_w.h" #include "control_w.h"
#include "reg_constant.h" #include "reg_constant.h"
#include "version.h" #include "version.h"
#ifdef __cplusplus
extern "C"
#endif
int printk(const char * fmt, ...); int printk(const char * fmt, ...);
/* /*

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.117 2004-02-04 19:54:56 vruppert Exp $ // $Id: siminterface.h,v 1.118 2004-02-06 22:28:00 danielg4 Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Before I can describe what this file is for, I have to make the // Before I can describe what this file is for, I have to make the
@ -907,7 +907,7 @@ public:
enum { enum {
// When a bx_param_num_c is displayed in dialog, USE_SPIN_CONTROL controls // When a bx_param_num_c is displayed in dialog, USE_SPIN_CONTROL controls
// whether a spin control should be used instead of a simple text control. // whether a spin control should be used instead of a simple text control.
USE_SPIN_CONTROL = (1<<0), USE_SPIN_CONTROL = (1<<0)
} bx_numopt_bits; } bx_numopt_bits;
bx_param_num_c (bx_id id, bx_param_num_c (bx_id id,
char *name, char *name,

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: harddrv.cc,v 1.116 2004-01-26 00:55:23 cbothamy Exp $ // $Id: harddrv.cc,v 1.117 2004-02-06 22:28:00 danielg4 Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -159,7 +159,7 @@ bx_hard_drive_c::init(void)
Bit8u channel; Bit8u channel;
char string[5]; char string[5];
BX_DEBUG(("Init $Id: harddrv.cc,v 1.116 2004-01-26 00:55:23 cbothamy Exp $")); BX_DEBUG(("Init $Id: harddrv.cc,v 1.117 2004-02-06 22:28:00 danielg4 Exp $"));
for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) { for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
if (bx_options.ata[channel].Opresent->get() == 1) { if (bx_options.ata[channel].Opresent->get() == 1) {
@ -220,35 +220,35 @@ bx_hard_drive_c::init(void)
channel = 0; channel = 0;
for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) { for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
for (Bit8u device=0; device<2; device ++) { for (Bit8u device=0; device<2; device ++) {
// Initialize controller state, even if device is not present // Initialize controller state, even if device is not present
BX_CONTROLLER(channel,device).status.busy = 0; BX_CONTROLLER(channel,device).status.busy = 0;
BX_CONTROLLER(channel,device).status.drive_ready = 1; BX_CONTROLLER(channel,device).status.drive_ready = 1;
BX_CONTROLLER(channel,device).status.write_fault = 0; BX_CONTROLLER(channel,device).status.write_fault = 0;
BX_CONTROLLER(channel,device).status.seek_complete = 1; BX_CONTROLLER(channel,device).status.seek_complete = 1;
BX_CONTROLLER(channel,device).status.drq = 0; BX_CONTROLLER(channel,device).status.drq = 0;
BX_CONTROLLER(channel,device).status.corrected_data = 0; BX_CONTROLLER(channel,device).status.corrected_data = 0;
BX_CONTROLLER(channel,device).status.index_pulse = 0; BX_CONTROLLER(channel,device).status.index_pulse = 0;
BX_CONTROLLER(channel,device).status.index_pulse_count = 0; BX_CONTROLLER(channel,device).status.index_pulse_count = 0;
BX_CONTROLLER(channel,device).status.err = 0; BX_CONTROLLER(channel,device).status.err = 0;
BX_CONTROLLER(channel,device).error_register = 0x01; // diagnostic code: no error BX_CONTROLLER(channel,device).error_register = 0x01; // diagnostic code: no error
BX_CONTROLLER(channel,device).head_no = 0; BX_CONTROLLER(channel,device).head_no = 0;
BX_CONTROLLER(channel,device).sector_count = 1; BX_CONTROLLER(channel,device).sector_count = 1;
BX_CONTROLLER(channel,device).sector_no = 1; BX_CONTROLLER(channel,device).sector_no = 1;
BX_CONTROLLER(channel,device).cylinder_no = 0; BX_CONTROLLER(channel,device).cylinder_no = 0;
BX_CONTROLLER(channel,device).current_command = 0x00; BX_CONTROLLER(channel,device).current_command = 0x00;
BX_CONTROLLER(channel,device).buffer_index = 0; BX_CONTROLLER(channel,device).buffer_index = 0;
BX_CONTROLLER(channel,device).control.reset = 0; BX_CONTROLLER(channel,device).control.reset = 0;
BX_CONTROLLER(channel,device).control.disable_irq = 0; BX_CONTROLLER(channel,device).control.disable_irq = 0;
BX_CONTROLLER(channel,device).reset_in_progress = 0; BX_CONTROLLER(channel,device).reset_in_progress = 0;
BX_CONTROLLER(channel,device).sectors_per_block = 0x80; BX_CONTROLLER(channel,device).sectors_per_block = 0x80;
BX_CONTROLLER(channel,device).lba_mode = 0; BX_CONTROLLER(channel,device).lba_mode = 0;
BX_CONTROLLER(channel,device).features = 0; BX_CONTROLLER(channel,device).features = 0;
// If not present // If not present
BX_HD_THIS channels[channel].drives[device].device_type = IDE_NONE; BX_HD_THIS channels[channel].drives[device].device_type = IDE_NONE;
if (!bx_options.atadevice[channel][device].Opresent->get()) { if (!bx_options.atadevice[channel][device].Opresent->get()) {

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: harddrv.h,v 1.22 2003-09-22 23:32:24 cbothamy Exp $ // $Id: harddrv.h,v 1.23 2004-02-06 22:28:00 danielg4 Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -285,8 +285,16 @@ class sparse_image_t : public device_image_t
off_t total_size; off_t total_size;
void panic(const char * message); void panic(const char * message);
off_t sparse_image_t::get_physical_offset(); off_t
void sparse_image_t::set_virtual_page(uint32 new_virtual_page); #ifndef PARANOID
sparse_image_t::
#endif
get_physical_offset();
void
#ifndef PARANOID
sparse_image_t::
#endif
set_virtual_page(uint32 new_virtual_page);
void read_header(); void read_header();
ssize_t read_page_fragment(uint32 read_virtual_page, uint32 read_page_offset, size_t read_size, void * buf); ssize_t read_page_fragment(uint32 read_virtual_page, uint32 read_page_offset, size_t read_size, void * buf);

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: slowdown_timer.cc,v 1.17 2003-10-01 02:06:14 bdenney Exp $ // $Id: slowdown_timer.cc,v 1.18 2004-02-06 22:28:00 danielg4 Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -143,14 +143,14 @@ bx_slowdown_timer_c::handle_timer() {
* ^>Bochs runs at normal * ^>Bochs runs at normal
*/ */
if(wanttime > (totaltime+REALTIME_Q)) { if(wanttime > (totaltime+REALTIME_Q)) {
#if BX_HAVE_USLEEP #if BX_HAVE_USLEEP
usleep(s.Q); usleep(s.Q);
#elif BX_HAVE_MSLEEP #elif BX_HAVE_MSLEEP
msleep(usectomsec(s.Q)); msleep(usectomsec(s.Q));
#elif BX_HAVE_SLEEP #elif BX_HAVE_SLEEP
sleep(usectosec(s.Q)); sleep(usectosec(s.Q));
#else #else
#error do not know have to sleep #error do not know have to sleep
#endif //delay(wanttime-totaltime); #endif //delay(wanttime-totaltime);
/*alternatively: delay(Q); /*alternatively: delay(Q);
* This works okay because we share the delay between * This works okay because we share the delay between

View File

@ -1,5 +1,5 @@
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// $Id: virt_timer.cc,v 1.19 2003-08-26 20:24:36 cbothamy Exp $ // $Id: virt_timer.cc,v 1.20 2004-02-06 22:28:00 danielg4 Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -412,7 +412,9 @@ bx_virt_timer_c::init(void) {
system_timer_id = bx_pc_system.register_timer(this, pc_system_timer_handler,virtual_next_event_time , 0, 1, "Virtual Timer"); system_timer_id = bx_pc_system.register_timer(this, pc_system_timer_handler,virtual_next_event_time , 0, 1, "Virtual Timer");
//Real time variables: //Real time variables:
#if BX_HAVE_REALTIME_USEC
last_real_time=GET_VIRT_REALTIME64_USEC()+(Bit64u)TIME_HEADSTART*(Bit64u)USEC_PER_SECOND; last_real_time=GET_VIRT_REALTIME64_USEC()+(Bit64u)TIME_HEADSTART*(Bit64u)USEC_PER_SECOND;
#endif
total_real_usec=0; total_real_usec=0;
last_realtime_delta=0; last_realtime_delta=0;
//System time variables: //System time variables:
@ -529,8 +531,9 @@ bx_virt_timer_c::timer_handler(void) {
#else #else
BX_ASSERT(0); BX_ASSERT(0);
#endif #endif
#if BX_HAVE_REALTIME_USEC
advance_virtual_time(ticks_delta); advance_virtual_time(ticks_delta);
#endif
} }
last_usec=last_usec + usec_delta; last_usec=last_usec + usec_delta;

View File

@ -41,6 +41,8 @@ class vmware3_image_t : public device_image_t
#if defined(_MSC_VER) && (_MSC_VER<1300) #if defined(_MSC_VER) && (_MSC_VER<1300)
#pragma pack(push, 1) #pragma pack(push, 1)
#elif defined(__MWERKS__) && defined(macintosh)
#pragma options align=packed
#endif #endif
typedef typedef
#if defined(_MSC_VER) && (_MSC_VER>=1300) #if defined(_MSC_VER) && (_MSC_VER>=1300)
@ -74,11 +76,13 @@ class vmware3_image_t : public device_image_t
Bit8u PAD3[364]; Bit8u PAD3[364];
} COW_Header } COW_Header
#if !defined(_MSC_VER) #if !defined(_MSC_VER)
__attribute__((packed)) GCC_ATTRIBUTE((packed))
#endif #endif
; ;
#if defined(_MSC_VER) && (_MSC_VER<1300) #if defined(_MSC_VER) && (_MSC_VER<1300)
#pragma pack(pop) #pragma pack(pop)
#elif defined(__MWERKS__) && defined(macintosh)
#pragma options align=reset
#endif #endif
struct COW_Image { struct COW_Image {

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.264 2004-02-04 19:54:52 vruppert Exp $ // $Id: main.cc,v 1.265 2004-02-06 22:27:59 danielg4 Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -24,7 +24,6 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "bochs.h" #include "bochs.h"
#include <assert.h> #include <assert.h>
#include "state_file.h" #include "state_file.h"

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: osdep.cc,v 1.14 2003-05-06 20:28:12 cbothamy Exp $ // $Id: osdep.cc,v 1.15 2004-02-06 22:27:59 danielg4 Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -235,6 +235,9 @@ char *bx_strrev(char *str)
} }
#endif /* !BX_HAVE_STRREV */ #endif /* !BX_HAVE_STRREV */
#if BX_WITH_MACOS
namespace std{extern "C" {char *mktemp(char *tpl);}}
#endif
#if !BX_HAVE_MKSTEMP #if !BX_HAVE_MKSTEMP
int bx_mkstemp(char *tpl) int bx_mkstemp(char *tpl)
{ {