Commit Graph

614 Commits

Author SHA1 Message Date
asvitkine
7bb230abed apparently this makes newest SDL happy 2010-09-24 00:48:58 +00:00
asvitkine
556a42001b Some messy changes got into last commit that weren't supposed to be there. 2010-07-28 01:10:24 +00:00
asvitkine
930374bbc6 Do the right thing if host-triplet is a i386-i686, but gcc compiles by
default as x86_64. Fixes configure on Snow Leopard.
2010-07-28 01:07:45 +00:00
asvitkine
853db27159 Fixing sigsegv on Mach x86_64 - possibly a hack; I'm not sure why the
address returned doesn't have that bit set already.
2010-07-27 22:52:33 +00:00
asvitkine
812db6ed4f [Howard Spoelstra and Joel Mauras]
Patches to update Linux NetDriver to work with newer kernel versions.
2010-04-08 03:58:26 +00:00
asvitkine
8a0002de43 [Joel Mauras]
GCC has become too smart - we need to slice the binary created to be sure the
address of the trap is within the test addresses. This is why each trap occurs
between two case labels and a new section of assembly code is set in between.
2010-04-08 03:53:27 +00:00
asvitkine
ebfe00ba48 [Amadeusz Sławiński]
fix check on gcc 4.4.3
2010-03-10 01:05:49 +00:00
asvitkine
78027e7a46 [Amadeusz Slawinski]
These patches fix the issues with using newer versions of autoconf,
which led to generating broken configure script.
2010-03-07 00:45:10 +00:00
cebix
dca3b18d9d fixed warnings 2010-02-21 12:00:42 +00:00
cebix
1fbacc9c73 fixed missing INT_MAX 2010-02-21 09:58:00 +00:00
cebix
71852dae82 fixed compiler warnings 2010-02-21 09:55:52 +00:00
asvitkine
989f5036fc Fix PrefsInit() calls to take correct number of parameter 2010-01-15 01:53:31 +00:00
asvitkine
6f230efee8 [ Patch from Jean-Pierre <chombier@free.fr> ]
Make lowmem be able to deal with x86_64 binaries.
2009-11-13 01:57:48 +00:00
asvitkine
02313b55c2 [Joel Mauras]
Patch for network suppor on 2.6 Linux Kernel.
2009-10-20 01:55:03 +00:00
asvitkine
cb55b15d39 Change #include <mach/mach_host.h> to #include <mach/mach.h> 2009-08-21 17:39:58 +00:00
asvitkine
5a8dfa1b36 [Charles Srstka]
Attached is a set of patches to port the precise timer that is currently used in the Linux and BeOS builds of SheepShaver to Mac OS X (and any other Mach-based operating systems).

Currently, the Linux build uses the clock_gettime() function to get nanosecond-precision time, and falls back on gettimeofday() if it is not present. Unfortunately, Mac OS X does not currently support clock_gettime(), and gettimeofday() has only microsecond granularity. The Mach kernel, however, has a clock_get_time() function that does very nearly the same thing as clock_gettime(). The patches to BasiliskII cause the timing functions such as timer_current_time() to use clock_get_time() instead of gettimeofday() on Mach-based systems that do not support clock_gettime().

The changes to SheepShaver involve the precise timer. The existing code for Linux uses pthreads and real-time signals to handle the timing. Mac OS X unfortunately does not seem to support real-time signals, so Mach calls are again used to suspend and resume the timer thread in order to attempt to duplicate the Linux and BeOS versions of the timer. The code is somewhat ugly right now, as I decided to leave alone the pre-existing style of the source file, which unfortunately involves #ifdefs scattered throughout the file and some duplication of code. A future patch may want to clean this up to separate out the OS-specific code and put it all together at the top of the file. However, for the time being, this seems to work.

This has not been extensively tested, because I have not been able to get my hands on a good test-case app for the classic Mac OS that would run inside the emulator and try out the timer. However, performance does seem to be better than with the pre-existing code, and nothing seems to have blown up as far as I can tell. I did find a game via a Google search -  Cap'n Magneto - that is known to have problems with Basilisk/SheepShaver's legacy 60 Hz timer, and the opening fade-to-color for this game appears to run much more smoothly with the precise timer code in place.
2009-08-17 20:44:30 +00:00
asvitkine
c6d88f213c [Michael Schmitt]
SheepShaver includes the C errno string in many error messages. One case is when it calls the memory allocation routines in the Basilisk II vm_alloc.cpp program.

This works when the memory allocation routine uses functions that set errno (such as mmap or malloc). For example, running SheepShaver on a Linux hosts produces meaningful error messages.

The problem is that when run on an OS X host, the memory allocation uses Mach routines such as vm_allocate, which do not set errno.

So when SheepShaver reported the error, it used a stale value of errno, which happened to be 17. The result was an extremely misleading error message: "Cannot map RAM: File already exists".

The fix is to change vm_alloc so that it translates Mac return codes into POSIX errno values.

It also initializes errno to 0 at the start of the memory allocation routine, so that no matter what path it takes, it won't return a stale value.
2009-08-11 07:43:46 +00:00
asvitkine
d0c46de7c3 BasiliskII side of changes to support .sheepvm bundles for SheepShaver 2009-07-23 19:19:14 +00:00
asvitkine
8ad0bbcc80 windows fix try#2 2009-04-13 23:13:20 +00:00
asvitkine
abb9d2eb24 make sigsegv work better with cygwin 2009-04-13 19:57:08 +00:00
asvitkine
da540a74f6 [patch by Mike Sliczniak]
Here is a patch to allow compiling of SS and B2 with an SDL Framework. You can
get this by downloading from:

http://www.libsdl.org/release/SDL-1.2.13.dmg

Here is how I tested on an intel 32-bit mac with Mac OS X 10.5.6:

SS ./autogen.sh --disable-standalone-gui --enable-vosf --enable-sdl-framework --enable-sdl-framework-prefix=/Users/mzs/Library/Frameworks --enable-sdl-video --disable-sdl-audio --enable-addressing=real
--without-esd --without-gtk --without-mon --without-x

SS /autogen.sh --disable-standalone-gui --enable-vosf --disable-sdl-framework --disable-sdl-video --disable-sdl-audio --enable-addressing=real --without-esd --without-gtk --without-mon --with-x

B2 ./autogen.sh --disable-standalone-gui --enable-vosf --enable-sdl-framework --enable-sdl-framework-prefix=/Users/mzs/Library/Frameworks --enable-sdl-video --enable-sdl-audio --enable-addressing=real --without-esd --without-gtk --without-mon --without-x --enable-jit-compiler

B2 ./autogen.sh --disable-standalone-gui --enable-vosf --disable-sdl-framework --disable-sdl-video --disable-sdl-audio --enable-addressing=real --with-esd --without-gtk --without-mon --with-x --enable-jit-compiler

(esound does not really work on mac, it needs some better coreaudio patches.)

configure.ac for SS has two little additional fixes so that the Cocoa prefs gui
does not get built if you are building for X11 and so that you can use esd, sdl,
or coreaudio for sound.
2009-03-03 08:07:22 +00:00
asvitkine
3e12a80a3b [Patch by Mike Sliczniak]
I was testing some other SS patches and I noticed that when I ran an X11
build of SS there were not all the video modes I expected in the the
control strip. Mac OS X 10.5 changed the form of the DISPLAY environment
variable. The reason for this is that the DISPLAY variable looks like
this in Leopard:

/tmp/launch-XXXXXX/:0

The Xs are like in mktemp.
2009-02-19 07:09:35 +00:00
asvitkine
65eac29142 [patch from Mike Sliczniak]
Here is a patch that has a shell script cpr.sh to recursively copy directories but
discarding things that cause problems at least on 10.4 when making the .app bundles.
2009-02-19 06:52:03 +00:00
asvitkine
8375c57047 move sigsegv_info_t declaration to header 2009-02-11 20:44:10 +00:00
asvitkine
ca2b9b5832 [Patch from Mike Sliczniak]
This first patch gets B2 and SS to build under Leopard and Tiger.

I tested this on a 32-bit intel 10.5.6 mac like so:

B2
./autogen.sh --disable-standalone-gui --enable-vosf --enable-sdl-video --enable-sdl-audio --enable-addressing=real --without-esd --without-gtk --without-mon --without-x

SS
./autogen.sh --disable-standalone-gui --enable-vosf -enable-sdl-video --disable-sdl-audio --enable-addressing=real --without-esd --without-gtk --without-mon --without-x --enable-jit

There is also a little tweak so that you can use sdl audio in SheepShaver when building for Mac OS X.
2009-02-11 19:23:53 +00:00
asvitkine
a370638388 some changes to make Basillisk build better on Leopard 2008-12-09 18:03:35 +00:00
gbeauche
3f15f4ed26 64-bit Mach exceptions support. Note that mach_exc_server() et al. must be
explicitly generated from mig. The advantage of that is to provide a "fast"
path for x86_64 on Leopard too (fault address in code[1]).

By "fast", this means +33% faster wrt. explicitly thread_get_state() but
still pretty slow (40 usec/fault). This is on par with the i386 code path though.
2008-01-20 22:24:53 +00:00
gbeauche
68668bb4e2 Add support for Windows/ia64. 2008-01-20 17:09:34 +00:00
gbeauche
62697e13c1 Err, restore a reasonnable value for the emulators. ;-) 2008-01-20 11:52:13 +00:00
gbeauche
a4209f5db0 Arrangements for the SIGSEGV perf tester. 2008-01-20 11:51:08 +00:00
gbeauche
2bdb300da1 HPPA support. 2008-01-20 00:39:51 +00:00
gbeauche
acd35671b8 HP-UX does support 32-bit memory mappings. 2008-01-20 00:38:52 +00:00
gbeauche
88ea04a365 Add support for HP-UX/ia64. It would be best to use libunwind so that to
handle stacked registers access with ease...
2008-01-19 22:27:29 +00:00
gbeauche
3615be1d4d Use fixed-size integer types, especially for 64-bit quantities. HP-UX for IPF
is essentially an ILP32 platform but machine registers are 64-bit wide. Make
IA64_SET_GR() set the NaT bit at the same time as the register value.
2008-01-19 22:25:27 +00:00
gbeauche
b5ac45434a Fix build on 64-bit Vista. 2008-01-17 23:19:01 +00:00
gbeauche
69376f61ca Wrap the Windows write-watch API. 2008-01-16 22:36:35 +00:00
gbeauche
ef39e46cb2 Fix build on MacOS X Leopard.
Leopard kernel faster? This is pure marketing hype. For 32-bit applications,
Mach exception recovery is 60% slower. For 64-bit applications, this is up
to 40% faster though. In any case, MacOS X remains pretty slow wrt. Linux...
2008-01-14 19:29:29 +00:00
gbeauche
df3475ed16 64-bit Windows support 2008-01-12 23:01:40 +00:00
gbeauche
f5e5da6916 LLP64 fixes (64-bit Windows) 2008-01-12 21:43:02 +00:00
gbeauche
b1fa25128a Make it possible to override the Mach fault recovery scheme through an
environment variable: SIGSEGV_MACH_FAULT. It can be set to "direct" to
assume the fault address comes from code[1] argument, or "slow" to use
the slow path through thread_get_status(EXCEPTION_STATE)->faultvaddr.
2008-01-07 22:44:39 +00:00
gbeauche
58ff9aba45 The Linux kernel actually allows to restart execution from the specified slot
in the bundle. This is faster and more accurate as this avoids emulation.

Also clean-up code so that to prepare the use of lib uaccess on hpux/ia64.
XXX: this will need explicit use of uint64_t to define registers because
HP/UX is ILP32 capable and all registers are 64-bit capable so "unsigned long"
won't fit.
2008-01-06 17:22:19 +00:00
gbeauche
8aadf8e455 Further comment the ia64 decoder and (minimal) emulator. 2008-01-06 16:36:00 +00:00
gbeauche
57ae6ed470 Add initial support for instruction skipping on Linux/ia64. It was more
complex than expected but it was fun to play with. Who designed this ISA?
I'd love to see how the decoder is implemented in HW, by all means it is
not "simplified" unless I missed some pattern...
2008-01-06 16:25:03 +00:00
gbeauche
a56e4b9be0 Hack around over-optimized labels-as-values extension from GCC. 2008-01-06 16:19:27 +00:00
gbeauche
e08bb16edf ISO C++ conformance fixes: remove superfluous coma at the end of enum definitions. 2008-01-06 16:10:30 +00:00
gbeauche
a93bec88fd Don't clobber "sip" arg from our sigsegv_info wrapper (renamed to SIP). 2008-01-05 08:35:08 +00:00
gbeauche
c8cb4879a4 Happy New Year! 2008-01-01 09:40:36 +00:00
gbeauche
26f9b1d38b Fix instruction skipping on MacOS X in the fast path case. 2007-12-31 18:07:01 +00:00
gbeauche
b5ac365858 Add support for 64-bit MacOS X for PowerPC (untested beyond "it compiles"). 2007-12-31 06:59:39 +00:00
gbeauche
9fa1bbd972 According to kernel sources, that is XNU 344.49 (10.2.8), XNU 517.12.7 (10.3.9),
XNU 792.21.3 (10.4.10) and XNU 1228 (10.5.0), exception handler code[1] always
contains the fault address nowadays. So make it the default fast path but keep
provisions to check that at run-time first.

This yields a nearly 4x improvement in SIGSEGV recovery but MacOS X is still
suboptimal wrt. Linux, so VOSF is still not possible with frameskip == 0.

XXX: the ppc kernel had bugs that caused DAR (put into code[1]) to be incorrectly
decoded. This would need a broader test audience or more careful audit of the
sources changes.
2007-12-30 12:11:17 +00:00
gbeauche
016dfddd79 Sync with the new SIGSEGV API. 2007-12-30 08:47:34 +00:00
gbeauche
902079ec8e Improve API for systems that require explicit calls to functions to retrieve
the memory addresses that triggered a SIGSEGV (e.g. MacOS X).
2007-12-30 08:45:18 +00:00
gbeauche
b899d55068 Don't raise SIGPIPE, let errno be set to EPIPE. i.e. this fixes slirp ethernet
mode with no listening port on the remote host.
2007-11-03 11:31:36 +00:00
gbeauche
9000d4f54c Rewrite ExtFS support for MacOS X. This implementation uses xattrs (metadata)
on Tiger+ to store FInfo and FXInfo. Otherwise, plain old .finfo/ helpers are
used. "Safe" flags and fields are always synchronized to/from MacOS X.

BTW, CFString leak was fixed at the same time.
2007-11-01 15:33:22 +00:00
gbeauche
e3f9d46556 Improve heuristic for VOSF profitability: we should not spend more than
the half of a video interrupt quantum for updating the screen. Also improve
the wording of the result.
2007-06-16 07:24:39 +00:00
gbeauche
320b4ccd61 Add Darwin/x86_64 support. Fix EDX register index for i386 insn decoder. 2007-06-16 06:21:57 +00:00
gbeauche
e9c5625ada Fix REAL_ADDRESSING mode on MacOS X, aka move Mach defines to config_macosx.h
and fix lowmem (BLESS) to handle other-endian binaries.
2007-06-15 22:54:24 +00:00
gbeauche
0a7fe2eaf8 Workaround video mode switch problems. IOW, make sure to always allocate
the frame buffer at the same base address.
2007-06-14 14:45:54 +00:00
gbeauche
03833e4c56 Fix autogen.sh to automatically include the local m4 directory, used as a
fallback if system-wide defs are not found.
2007-06-13 13:27:40 +00:00
gbeauche
4ec66db185 Add MIPS files from cxmon. 2007-06-07 11:52:14 +00:00
gbeauche
974f086a8c Arrangements for Linux/mips. 2007-06-05 13:15:57 +00:00
asvitkine
f12f5173be macroman_to_host_encoding - so it works the other way around too 2007-01-24 02:37:06 +00:00
asvitkine
ab86a395da Since Guest and Host OS may use different text encodings for filenames,
I am adding functionality to support this. For the moment, I've only
added the platform-specific conversion for MacOSX (ie: UTF8 -> MacRoman),
but others can be added later.
2007-01-22 17:14:06 +00:00
asvitkine
e9fbc36368 fix compile warnings on OS X 2007-01-21 17:10:49 +00:00
gbeauche
2e95c43bf2 Remove the 33-bit addressing hack as it's overly complex for not much gain.
Rather, use an address override prefix (0x67) though Intel Core optimization
reference guide says to avoid LCP prefixes. In practise, impact on performance
is measurably marginal on e.g. Speedometer tests.
2007-01-13 18:21:30 +00:00
gbeauche
87e1518e96 A few fixlets to the SIGSEGV library:
- Don't export transfer types definitions (formerly used by older API)
- Handle ADD instructions in ix86_skip_instruction() (generated by icc 9.1)
- Use "%p" format for EIP/RIP addresses
2006-07-19 21:31:10 +00:00
gbeauche
d1d7d5bd4c Fix remove_shm_range() to actually return something 2006-07-19 21:23:41 +00:00
gbeauche
f39c252fbd Fix 33-bit addressing mode check when compiling with icc 9.1 2006-07-19 21:22:41 +00:00
gbeauche
98675da523 Fix NQD bounds checking -- don't overwrite the CLEAR Page Guard. 2006-05-14 08:32:05 +00:00
gbeauche
26a71e5417 Fix page alignment 2006-05-14 07:11:23 +00:00
gbeauche
e4015e069f Use NQD dirty boxes, VOSF backend
+ make video_vosf_profitable() NQD accel aware
+ call vm_protect() only if PFLAG_CLEAR(page)
2006-05-13 16:48:47 +00:00
gbeauche
4c225b2705 MacOS X exception handling updates:
- Call user handler for KERN_INVALID_ADDRESS too (SIGBUS)
- Check for VALID_THREAD_STATE_FLAVOR in forward_exception()
- Return KERN_FAILURE if forward_exception() got an unknown behavior code
2006-05-09 06:24:05 +00:00
gbeauche
24af8d27c3 Fix for LAZY_FLUSH_ICACHE_RANGE. Blocks are indexed by native addresses. 2006-05-08 16:56:07 +00:00
gbeauche
ecdc036c69 Adapt for new functions (DarwinSysInit() & DarwinSysExit()) 2006-05-08 15:22:56 +00:00
gbeauche
61a2e86594 Rewrite MacOS X CD-ROM support.
Other bugs fixed:
- CD-ROM media are polled and now can be changed without rebooting
- Buffer overflow, memory leak and extra wait in CD-ROM ejection code
2006-05-08 12:15:58 +00:00
gbeauche
ff950c35e6 fix underquoted definition warning 2006-05-05 07:37:14 +00:00
gbeauche
5d3f53943d Add another NULL pointer check 2006-05-05 06:00:17 +00:00
gbeauche
1314f09a68 remove 2006-05-05 05:56:52 +00:00
gbeauche
2bff888cee updates 2006-05-05 05:56:20 +00:00
gbeauche
828b53b990 fix rev 1.22 commit for windows (extraneous return -1 left) 2006-05-02 19:49:25 +00:00
gbeauche
51a5e4c0da Don't build a built-in GUI if --enable-standalone-gui was requested.
The following configurations were tested:
./configure --without-mon --with-gtk=gtk1 --enable-jit-compiler	  [B.GTK1]
./configure --without-mon					  [B.GTK2]
./configure --without-mon --enable-standalone-gui --without-gtk	  [no GUI]
./configure --without-mon --enable-standalone-gui --with-gtk=gtk1 [S.GTK1]
./configure --enable-jit-compiler --enable-standalone-gui	  [S.GTK2]
2006-05-02 05:36:42 +00:00
gbeauche
62389bb3c0 Add my local changes to GTK+OSX 0.7 -- it's only correct for Basilisk II
and SheepShaver purposes. i.e. it's not fully suitable as a generic
g_main_run() replacement.
2006-05-01 23:09:12 +00:00
gbeauche
daa0af4da6 improve locks 2006-05-01 13:13:18 +00:00
gbeauche
4f07113555 Patch SynchIdleTime() to implement new "idlewait" prefs item. 2006-04-30 21:16:48 +00:00
gbeauche
fb332c4e38 Add mkstandalone -- make a standalone bundle with GTK runtime 2006-04-19 22:51:27 +00:00
gbeauche
6d15429156 Always build the STANDALONE_GUI hooks into Basilisk II. 2006-04-19 06:55:54 +00:00
gbeauche
180f3edafd Enable build of RPC code without pthreads (for Basilisk II and SheepShaver)
since we use our own custom message dispatch loop
2006-04-19 06:47:15 +00:00
gbeauche
622eca9068 Handle MacOS X bundles, search order: BasiliskII.app in the same directory
as BasiliskIIGUI.app, or /Applications/BasiliskII.app if none was found.

Also make yet another arrangement for MacOS X "difference". This scenario
was not working: WarningAlert -> ErrorAlert, the latter was not performed
because the exit status was not properly filled in sip->si_status...
2006-04-18 22:17:31 +00:00
gbeauche
d2e672c38f Fix NO_B2_EXE_FOUND (again) -- catch it very early, hence the SIGCHLD. Use
new rpc_wait_dispatch() function and gracefully get out of the main loop
when the child returns, though this is caught but the sigchld_handler().
2006-04-18 21:29:01 +00:00
gbeauche
758050ac73 Implement rpc_wait_dispatch() 2006-04-18 21:24:12 +00:00
gbeauche
3fda1a3af7 - Only start the emulator if requested (click on the "Start" button)
- Rewrote dispatch loop to accomodate GTK+1.2 for MacOS X (which doesn't
  like threads nor forks(!)). The latter also requires an additional patch
  to the version 0.7 available on SourceForge
- Run-time detect JIT capability so that we could hopefully use the ppc GUI
  on intel based Macs (check!)
2006-04-17 21:22:01 +00:00
gbeauche
02c24ed6c2 Create MacOS X bundle for BasiliskIIGUI.app. Also make sure to only link in
necessary GUI_LIBS and not all of the LIBS.
2006-04-17 15:32:37 +00:00
gbeauche
a295eea890 Fixes for GTK+1.2 GUI on MacOS X 2006-04-17 14:25:57 +00:00
gbeauche
5b1977b9f2 Fixes for MacOS X (10.2 has no <sys/poll.h> and 10.4 version is broken). 2006-04-17 09:06:32 +00:00
gbeauche
252f396ff3 Make Basilisk II main application not use GTK libraries when compiling with
STANDALONE_GUI. This is the second step towards a more interesting GUI alike
to VMware. Communication from/to the GUI is held by some lightweight RPC.

Note: The step should be enough to provide a tiny GTK GUI for MacOS X.
2006-04-16 21:25:41 +00:00
gbeauche
6994ab671e Enable build of a standalone GUI (first step). 2006-04-16 16:32:45 +00:00
gbeauche
896ada92dc Try to improve slirp performance again (though passive mode is still slower) 2006-04-02 21:06:50 +00:00
gbeauche
db76383246 decode movslq (generated by gcc4.1) 2006-03-30 22:45:49 +00:00
gbeauche
a4a070bc4a - add Linux/PPC linker script
- always relocate Basilisk II binary to 0x78048000 on MacOS X (including x86,
  to be tested later)
2006-03-25 07:08:50 +00:00
gbeauche
41ee2520b6 freebsd linker script 2006-03-15 06:54:34 +00:00