ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/main_unix.cpp
Revision 1.103 - (view) (annotate) - [select for diffs]
2012-03-01T04:25:10Z (12 years, 8 months ago) by asvitkine
Branch: MAIN
CVS Tags: HEAD
Changes since 1.102: +1 -4 lines
Diff to previous 1.102 , to selected 1.8
fix some unused vars warnings

Revision 1.102 - (view) (annotate) - [select for diffs]
2012-01-01T23:18:36Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.101: +1 -15 lines
Diff to previous 1.101 , to selected 1.8
remove some code that was accidentally committed

Revision 1.101 - (view) (annotate) - [select for diffs]
2012-01-01T19:11:31Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.100: +19 -13 lines
Diff to previous 1.100 , to selected 1.8
better cleanup of shared memory on failure

Revision 1.100 - (view) (annotate) - [select for diffs]
2012-01-01T18:51:40Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.99: +2 -0 lines
Diff to previous 1.99 , to selected 1.8
wrap init_sdl() in USE_SDL ifdef

Revision 1.99 - (view) (annotate) - [select for diffs]
2012-01-01T18:50:01Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.98: +16 -1 lines
Diff to previous 1.98 , to selected 1.8
fix compile error introduced by my recent refactoring

Revision 1.98 - (view) (annotate) - [select for diffs]
2011-12-30T17:38:39Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.97: +1 -0 lines
Diff to previous 1.97 , to selected 1.8
fix ppc build breakage

Revision 1.97 - (view) (annotate) - [select for diffs]
2011-12-28T23:33:04Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.96: +30 -22 lines
Diff to previous 1.96 , to selected 1.8
refactor init_sdl() into a function

Revision 1.96 - (view) (annotate) - [select for diffs]
2011-12-28T23:30:25Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.95: +58 -51 lines
Diff to previous 1.95 , to selected 1.8
refactor install_signal_handlers() into its own function

Revision 1.95 - (view) (annotate) - [select for diffs]
2011-12-28T23:24:30Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.94: +36 -31 lines
Diff to previous 1.94 , to selected 1.8
refactor load_mac_rom() into a function

Revision 1.94 - (view) (annotate) - [select for diffs]
2011-12-28T23:17:29Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.93: +194 -184 lines
Diff to previous 1.93 , to selected 1.8
refactor get_system_info() into a function

Revision 1.93 - (view) (annotate) - [select for diffs]
2011-12-28T20:21:40Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.92: +0 -1 lines
Diff to previous 1.92 , to selected 1.8
delete unused vars

Revision 1.92 - (view) (annotate) - [select for diffs]
2011-12-26T22:44:22Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.91: +3 -3 lines
Diff to previous 1.91 , to selected 1.8
correct whitespace

Revision 1.91 - (view) (annotate) - [select for diffs]
2011-12-26T22:41:53Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.90: +3 -1 lines
Diff to previous 1.90 , to selected 1.8
[Douglas Mencken]
Add recognition for 970MP processors.

I took these values from this kernel patch from year 2005:
http://lists.ozlabs.org/pipermail/linuxppc64-dev/2005-July/004688.html

Revision 1.90 - (view) (annotate) - [select for diffs]
2010-08-22T18:57:11Z (14 years, 2 months ago) by asvitkine
Branch: MAIN
Changes since 1.89: +1 -1 lines
Diff to previous 1.89 , to selected 1.8
fix printf safety warning

Revision 1.89 - (view) (annotate) - [select for diffs]
2010-08-22T18:56:11Z (14 years, 2 months ago) by asvitkine
Branch: MAIN
Changes since 1.88: +2 -2 lines
Diff to previous 1.88 , to selected 1.8
use setenv in preference of putenv

Revision 1.88 - (view) (annotate) - [select for diffs]
2010-02-21T09:59:29Z (14 years, 8 months ago) by cebix
Branch: MAIN
Changes since 1.87: +2 -2 lines
Diff to previous 1.87 , to selected 1.8
fixed warnings

Revision 1.87 - (view) (annotate) - [select for diffs]
2009-08-26T00:11:56Z (15 years, 2 months ago) by asvitkine
Branch: MAIN
Changes since 1.86: +2 -2 lines
Diff to previous 1.86 , to selected 1.8
[Michael Schmitt]
Attached is a patch to SheepShaver, to fix a problem where the ROM file can only be found on the first boot.

When a user creates a new SheepShaver machine, there is no preference file, so there is not ROM path preference. SheepShaver has logic so that in this case, it will look for a ROM file named "ROM" or "Mac OS ROM" in the current directory.

The user starts SheepShaver in order to get to the built-in Preferences Editor, and changes various settings (such as creation of a hard disk). Then the user reboots.

If the user forgot to set the ROM path at this time, then SheepShaver can no longer boot. The only recourse is for the user to find and delete the preferences file, or use an external preferences editor to set the ROM path.

The fix is to change SheepShaver to use the default ROM names when either the rom path is null (no preference) OR an empty string (preference exists with no rom path).

Revision 1.86 - (view) (annotate) - [select for diffs]
2009-08-18T18:26:10Z (15 years, 2 months ago) by asvitkine
Branch: MAIN
Changes since 1.85: +80 -47 lines
Diff to previous 1.85 , to selected 1.8
[Michael Schmitt]
Attached is a patch to SheepShaver to fix memory allocation problems when OS X 10.5 is the host. It also relaxes the 512 MB RAM limit on OS X hosts.


Problem
-------
Some users have been unable to run SheepShaver on OS X 10.5 (Leopard) hosts. The symptom is error "ERROR: Cannot map RAM: File already exists".

SheepShaver allocates RAM at fixed addresses. If it is running in "Real" addressing mode, and can't allocate at address 0, then it was hard-coded to allocate the RAM area at 0x20000000. The ROM area as allocated at 0x40800000.

The normal configuration is for SheepShaver to run under SDL, which is a Cocoa wrapper. By the time SheepShaver does its memory allocations, the Cocoa application has already started. The result is the SheepShaver memory address space already contains libraries, fonts, Input Managers, and IOKit areas.

On Leopard hosts these areas can land on the same addresses SheepShaver needs, so SheepShaver's memory allocation fails.


Solution
--------
The approach is to change SheepShaver (on Unix & OS X hosts) to allocate the RAM area anywhere it can find the space, rather than at a fixed address.

This could result in the RAM allocated higher than the ROM area, which causes a crash. To prevent this from occurring, the RAM and ROM areas are allocated contiguously.

Previously the ROM starting address was a constant ROM_BASE, which was used throughout the source files. The ROM start address is now a variable ROMBase. ROMBase is allocated and set by main_*.cpp just like RAMBase.

A side-effect of this change is that it lifts the 512 MB RAM limit for OS X hosts. The limit was because the fixed RAM and ROM addresses were such that the RAM could only be 512 MB before it overlapped the ROM area.


Impact
------
The change to make ROMBase a variable is throughout all hosts & addressing modes.

The RAM and ROM areas will only shift when run on Unix & OS X hosts, otherwise the same fixed allocation address is used as before.

This change is limited to "Real" addressing mode. Unlike Basilisk II, SheepShaver *pre-calculates* the offset for "Direct" addressing mode; the offset is compiled into the program. If the RAM address were allowed to shift, it could result in the RAM area wrapping around address 0.


Changes to main_unix.cpp
------------------------
1. Real addressing mode no longer defines a RAM_BASE constant.

2. The base address of the Mac ROM (ROMBase) is defined and exported by this program.

3. Memory management helper vm_mac_acquire is renamed to vm_mac_acquire_fixed. Added a new memory management helper vm_mac_acquire, which allocates memory at any address.

4. Changed and rearranged the allocation of RAM and ROM areas.

Before it worked like this:

  - Allocate ROM area
  - If can, attempt to allocate RAM at address zero
  - If RAM not allocated at 0, allocate at fixed address

We still want to try allocating the RAM at zero, and if using DIRECT addressing we're still going to use the fixed addresses. So we don't know where the ROM should be until after we do the RAM. The new logic is:

  - If can, attempt to allocate RAM at address zero
  - If RAM not allocated at 0
      if REAL addressing
         allocate RAM and ROM together. The ROM address is aligned to a 1 MB boundary
      else (direct addressing)
         allocate RAM at fixed address
  - If ROM hasn't been allocated yet, allocate at fixed address

5. Calculate ROMBase and ROMBaseHost based on where the ROM was loaded.

6. There is a crash if the RAM is allocated too high. To try and catch this, check if it was allocated higher than the kernel data address.

7. Change subsequent code from using constant ROM_BASE to variable ROMBase.


Changes to Other Programs
-------------------------
emul_op.cpp, main.cpp, name_registery.cpp, rom_patches.cpp, rsrc_patches.cpp, emul_ppc.cpp, sheepshaver_glue.cpp, ppc-translate-cpp:
Change from constant ROM_BASE to variable ROMBase.

ppc_asm.S: It was setting register to a hard-coded literal address: 0x40b0d000. Changed to set it to ROMBase + 0x30d000.

ppc_asm.tmpl: It defined a macro ASM_LO16 but it assumed that the macro would always be used with operands that included a register specification. This is not true. Moved the register specification from the macro to the macro invocations.

main_beos.cpp, main_windows.cpp: Since the subprograms are all expecting a variable ROMBase, all the main_*.cpp pgrams have to define and export it. The ROM_BASE constant is moved here for consistency. The mains for beos and windows just allocate the ROM at the same fixed address as before, set ROMBaseHost and ROMBase to that address, and then use ROMBase for the subsequent code.

cpu_emulation.h: removed ROM_BASE constant. This value is moved to the main_*.cpp modules, to be consistent with RAM_BASE.

user_strings_unix.cpp, user_strings_unix.h: Added new error messages related to errors that occur when the RAM and ROM are allocated anywhere.

Revision 1.85 - (view) (annotate) - [select for diffs]
2009-08-18T02:36:59Z (15 years, 2 months ago) by asvitkine
Branch: MAIN
Changes since 1.84: +3 -1 lines
Diff to previous 1.84 , to selected 1.8
support both foo.sheepvm and foo.sheepvm/ command-line parameters

Revision 1.84 - (view) (annotate) - [select for diffs]
2009-07-23T19:12:50Z (15 years, 3 months ago) by asvitkine
Branch: MAIN
Changes since 1.83: +26 -2 lines
Diff to previous 1.83 , to selected 1.8
support for .sheepvm bundles on macosx, containing "prefs" and "nvram" files

Revision 1.83 - (view) (annotate) - [select for diffs]
2009-02-11T20:44:49Z (15 years, 8 months ago) by asvitkine
Branch: MAIN
Changes since 1.82: +0 -9 lines
Diff to previous 1.82 , to selected 1.8
don't re-declare sigsegv_info_t, instead use the one from the header

Revision 1.82 - (view) (annotate) - [select for diffs]
2009-02-11T19:22:16Z (15 years, 8 months ago) by asvitkine
Branch: MAIN
Changes since 1.81: +11 -7 lines
Diff to previous 1.81 , to selected 1.8
[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.

Revision 1.81 - (view) (annotate) - [select for diffs]
2008-06-22T20:30:12Z (16 years, 4 months ago) by asvitkine
Branch: MAIN
Changes since 1.80: +5 -2 lines
Diff to previous 1.80 , to selected 1.8
[patch from Kelvin Delbarre] SDL's Quartz video implementation maps command
clicks to right-clicks and option-clicks to middle-clicks, a feature intended
for Mac users with single-button mice who are running SDL-based games that
require a multi-button mouse. This is unhelpful in SheepShaver, where we want
command-clicks and option-clicks to be passed through unchanged to the emulated
Mac OS. We can disable the unwanted behavior by setting an environment variable
SDL_HAS3BUTTONMOUSE intended for this very purpose.

A similar change in main_windows.cpp is NOT required, because only the Quartz
video implementation is involved.

By SDL convention, putenv is used in preference to setenv, although for Unix
platforms it doesn't matter.

Revision 1.80 - (view) (annotate) - [select for diffs]
2008-01-01T09:47:38Z (16 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.79: +1 -1 lines
Diff to previous 1.79 , to selected 1.8
Happy New Year!

Revision 1.79 - (view) (annotate) - [select for diffs]
2007-12-30T09:18:40Z (16 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.78: +14 -4 lines
Diff to previous 1.78 , to selected 1.8
Sync with new SIGSEGV API.

Revision 1.78 - (view) (annotate) - [select for diffs]
2007-08-27T21:45:13Z (17 years, 2 months ago) by asvitkine
Branch: MAIN
Changes since 1.77: +5 -0 lines
Diff to previous 1.77 , to selected 1.8
use the new SDL 1.2.12 env variable to allow the OS to launch the screensaver
when sheepshaver is running - must be linking to sdl 1.2.12 or later for it
to take effect

Revision 1.77 - (view) (annotate) - [select for diffs]
2006-10-26T05:25:19Z (18 years ago) by gbeauche
Branch: MAIN
Changes since 1.76: +9 -3 lines
Diff to previous 1.76 , to selected 1.8
Update CPU table to kernel 2.6.17+ code (POWER6, Cell, PA6T). Fix detection
of the CPU string (separator is actually ','). Fix detection of CPU clock
frequency when it is expressed as a float.

Revision 1.76 - (view) (annotate) - [select for diffs]
2006-05-09T19:53:31Z (18 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.75: +4 -0 lines
Diff to previous 1.75 , to selected 1.8
Don't let SDL catch SIGINT and SIGTERM signals. This is not suitable for
SheepShaver since we are typically translating SDL_QUIT events to PowerOff()
on MacOS side. And, if MacOS is not fully booted, it's not really convenient
to shut it down, even with ctrl-C. i.e. you had to kill -9 it.

Revision 1.75 - (view) (annotate) - [select for diffs]
2006-05-06T10:42:51Z (18 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.74: +27 -18 lines
Diff to previous 1.74 , to selected 1.8
Add linker scripts from Basilisk II and make it possible to allocate up to
1 GB of Mac memory. Only tested on Linux/x86_64 so far but with a somewhat
interesting (MacOS, ROM, RAM size) matrix.

XXX: It should be possible to allocate up to 1.5 GB by relocating the ROM
base to something like 0x60800000.

Revision 1.74 - (view) (annotate) - [select for diffs]
2006-05-01T22:33:34Z (18 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.73: +70 -15 lines
Diff to previous 1.73 , to selected 1.8
Port --enable-standalone-gui support to SheepShaver

Others changes include:
- Factor out STR_SIG_INSTALL_ERR messages
- Process command line arguments early (prior to calling PrefsInit())
- GUI: set start_clicked only if the "Start" button was clicked
- GUI: save changes to the "Input" pane when the "Start" button was clicked

Revision 1.73 - (view) (annotate) - [select for diffs]
2006-01-18T22:12:26Z (18 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.72: +2 -1 lines
Diff to previous 1.72 , to selected 1.8
recognize POWER5+ CPUs (e.g. p5-520)

Revision 1.72 - (view) (annotate) - [select for diffs]
2005-12-11T23:18:47Z (18 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.71: +9 -53 lines
Diff to previous 1.71 , to selected 1.8
remove obsolete cygwin bits and fix allocation of NanoKernel region on
IRIX (aka make it POSIX compliant)

Revision 1.71 - (view) (annotate) - [select for diffs]
2005-07-06T05:11:56Z (19 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.70: +4 -0 lines
Diff to previous 1.70 , to selected 1.8
Add upcoming 7448 and new PPC970FX CPU ids.

Revision 1.70 - (view) (annotate) - [select for diffs]
2005-07-06T04:58:34Z (19 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.69: +1 -0 lines
Diff to previous 1.69 , to selected 1.8
Map latest 7447A CPU to a plain G4 (7400)

Revision 1.69 - (view) (annotate) - [select for diffs]
2005-07-04T05:34:33Z (19 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.68: +1 -88 lines
Diff to previous 1.68 , to selected 1.8
Move sigregs handling to dedicated header

Revision 1.68 - (view) (annotate) - [select for diffs]
2005-06-30T22:26:12Z (19 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.67: +9 -9 lines
Diff to previous 1.67 , to selected 1.8
Restore clobbered registers before calling SDL_PumpEvents().

Revision 1.67 - (view) (annotate) - [select for diffs]
2005-06-30T10:17:58Z (19 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.66: +3 -1 lines
Diff to previous 1.66 , to selected 1.8
Improve idle wait mechanism. Now, the emulator thread can be suspended
(idle_wait) until events arrived and notified through TriggerInterrupt().
i.e. we no longer sleep a fixed amount of time on platforms that support
a thread wait/signal mechanism.

Revision 1.66 - (view) (annotate) - [select for diffs]
2005-06-28T16:50:30Z (19 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.65: +3 -3 lines
Diff to previous 1.65 , to selected 1.8
Clean-ups: comments, ticks per sec output, don't restore r13 twice.

Revision 1.65 - (view) (annotate) - [select for diffs]
2005-06-28T16:47:32Z (19 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.64: +39 -61 lines
Diff to previous 1.64 , to selected 1.8
The alternate stack trick never worked as you can't modify an active stack.
i.e. it returned EPERM and ran into stack corruption to eventually crash the
emulator. This is noticeable in !hw_mac_cursor_accl mode (e.g. fullscreen DGA).

In order to the sigalstack() to be effective, we must kludge the kernel to
think it's running on another stack. In practise, we provide another stack
for the SIGUSR2 handler. sigusr2_handler_init() fulfills that purpose.

I hope this fixes remaining issues forever. At some point, I had multiple
*_init() handlers in case this is necessary.

Revision 1.64 - (view) (annotate) - [select for diffs]
2005-06-23T16:23:31Z (19 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.63: +2 -2 lines
Diff to previous 1.63 , to selected 1.8
Don't fake the TVECT value on non-BeOS native systems. This is important
for systems that use a global r2 as the TLS register, e.g. Linux/ppc with
newer glibc. Also remove the syscall junk which were simply workarounds
for this bug. Remove a duplicate r2 restoration in EmulOp.

BTW, it's possible to get SheepShaver running on Linux/ppc systems with
NPTL rather than SheepThreads.

Revision 1.63 - (view) (annotate) - [select for diffs]
2005-06-08T12:12:50Z (19 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.62: +1 -0 lines
Diff to previous 1.62 , to selected 1.8
Recognize POWER5 CPUs. ;-)

Revision 1.62 - (view) (annotate) - [select for diffs]
2005-03-28T09:50:58Z (19 years, 7 months ago) by gbeauche
Branch: MAIN
Changes since 1.61: +9 -10 lines
Diff to previous 1.61 , to selected 1.8
better logics in sigstack allocation on native platforms

Revision 1.61 - (view) (annotate) - [select for diffs]
2005-03-27T19:05:18Z (19 years, 7 months ago) by gbeauche
Branch: MAIN
Changes since 1.60: +0 -15 lines
Diff to previous 1.60 , to selected 1.8
- Implement fullscreen DGA via fbdev access under Linux. Besides, r/w access
to /dev/mem is required on Linux to use XF86 DGA mode. Otherwise, there is
now a fallback to fbdev.
- Forward port some features from Basilisk II (set_window_name,
disable_mouse_accel).
- Don't SIGSTOP the emulation thread on suspend since that would completely
stop the process on Linux. Use a frame buffer lock instead (as B2 does)

Revision 1.60 - (view) (annotate) - [select for diffs]
2005-02-27T21:52:06Z (19 years, 8 months ago) by gbeauche
Branch: MAIN
Changes since 1.59: +45 -6 lines
Diff to previous 1.59 , to selected 1.8
Fix native Linux/ppc with recent enough glibc that supports TLS; r2 is used
in that case. Tell me if I broke other arches, e.g. r13 is no longer saved
in Video and Ethernet stubs, though it seems to be OK.

Colateral feature: SheepShaver should now run on Linux/ppc64 with relevant
32-bit runtime. Native Linux/ppc64 support is harder as low mem globals are
32-bit in mind and e.g. the TLS register there is %r13, %r2 is the TOC
(PowerOpen/AIX ABI)

Revision 1.59 - (view) (annotate) - [select for diffs]
2005-02-20T18:08:50Z (19 years, 8 months ago) by gbeauche
Branch: MAIN
Changes since 1.58: +20 -0 lines
Diff to previous 1.58 , to selected 1.8
Initial support for NetBSD/ppc in native mode (some crashes occur but I
could boot MacOS 9.0.4)

Revision 1.58 - (view) (annotate) - [select for diffs]
2005-01-30T21:48:20Z (19 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.57: +1 -1 lines
Diff to previous 1.57 , to selected 1.8
Happy New Year 2005!

Revision 1.57 - (view) (annotate) - [select for diffs]
2005-01-30T21:25:24Z (19 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.56: +3 -3 lines
Diff to previous 1.56 , to selected 1.8
really invalidate caches when ROM was patched in native mode

Revision 1.56 - (view) (annotate) - [select for diffs]
2005-01-30T21:19:07Z (19 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.55: +5 -225 lines
Diff to previous 1.55 , to selected 1.8
Add InitAll() which covers common initializations so that to avoid duplicate
code and possible bugs (e.g. on BeOS/PPC). Likewise for ExitAll().

Revision 1.55 - (view) (annotate) - [select for diffs]
2005-01-30T18:49:48Z (19 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.54: +14 -0 lines
Diff to previous 1.54 , to selected 1.8
Fix Kernel Data for Gossamer ROMs: PVR, CPUClockSpeed et al.

Revision 1.54 - (view) (annotate) - [select for diffs]
2004-11-22T23:17:32Z (19 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.53: +1 -1 lines
Diff to previous 1.53 , to selected 1.8
fix build on unixish platforms

Revision 1.53 - (view) (annotate) - [select for diffs]
2004-11-22T21:33:32Z (19 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.52: +137 -52 lines
Diff to previous 1.52 , to selected 1.8
New SheepShaver globals layout, move ZeroPage into the middle. Since it is
a read-only page, it can also be used to detect overlaps between Procedure
space and Data space.

Provide native Windows implementation of shared MacOS KernelData allocation.
This is moved under main() so that to avoid a weird linking error. This native
implementation is independent of Cygwin IPC (and possible background server)

Revision 1.52 - (view) (annotate) - [select for diffs]
2004-11-13T14:09:15Z (19 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.51: +57 -48 lines
Diff to previous 1.51 , to selected 1.8
Implement Direct Addressing mode similarly to Basilisk II. This is to get
SheepShaver working on OSes that don't support maipping of Low Memory globals
at 0x00000000, e.g. Windows.

Revision 1.51 - (view) (annotate) - [select for diffs]
2004-07-19T19:42:21Z (20 years, 3 months ago) by gbeauche
Branch: MAIN
Changes since 1.50: +3 -0 lines
Diff to previous 1.50 , to selected 1.8
SDL audio support

Revision 1.50 - (view) (annotate) - [select for diffs]
2004-07-10T06:15:42Z (20 years, 3 months ago) by gbeauche
Branch: MAIN
Changes since 1.49: +61 -35 lines
Diff to previous 1.49 , to selected 1.8
Better PowerPC / POWER CPU detection from Linux cpu_specs[] table.

Revision 1.49 - (view) (annotate) - [select for diffs]
2004-07-07T04:33:37Z (20 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.48: +9 -0 lines
Diff to previous 1.48 , to selected 1.8
Remap any newer G4/G5 processor to plain G4 for compatibility

Revision 1.48 - (view) (annotate) - [select for diffs]
2004-07-04T05:19:44Z (20 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.47: +2 -0 lines
Diff to previous 1.47 , to selected 1.8
get timebase-frequency on osx too.

Revision 1.47 - (view) (annotate) - [select for diffs]
2004-07-03T10:39:06Z (20 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.46: +29 -2 lines
Diff to previous 1.46 , to selected 1.8
Introducce TimebaseSpeed which represents exact timebase-frequency instead
of supposing it to be (BusClockSpeed/4), which is no longer true on G5 et al.

Revision 1.46 - (view) (annotate) - [select for diffs]
2004-07-01T22:55:02Z (20 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.45: +2 -0 lines
Diff to previous 1.45 , to selected 1.8
Try to recognize and handle PowerPC 970 (G5). Untested as I don't have such
platforms handy.

Revision 1.45 - (view) (annotate) - [select for diffs]
2004-06-29T20:25:55Z (20 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.44: +8 -0 lines
Diff to previous 1.44 , to selected 1.8
Handle 750FX, 7450, 7455, 7457.

Revision 1.44 - (view) (annotate) - [select for diffs]
2004-06-26T16:25:22Z (20 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.43: +21 -21 lines
Diff to previous 1.43 , to selected 1.8
Make sure to initialize alt stacks before SIGSEGV handlers

Revision 1.43 - (view) (annotate) - [select for diffs]
2004-06-26T15:26:17Z (20 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.42: +32 -19 lines
Diff to previous 1.42 , to selected 1.8
Performance of VOSF is heuristically determined at run-time, so have to
initialize SIGSEGV handlers early, as in Basilisk II. Besides, also add
missing call to vm_init() in case host system doesn't have MAP_ANON.

Revision 1.42 - (view) (annotate) - [select for diffs]
2004-06-24T15:37:25Z (20 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.41: +37 -2 lines
Diff to previous 1.41 , to selected 1.8
SDL support in SheepShaver too, though it doesn't work in native mode
on Linux/ppc as libSDL is pulling in libpthread which conflicts with
our sheepthreads.

Revision 1.41 - (view) (annotate) - [select for diffs]
2004-06-22T17:10:07Z (20 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.40: +8 -0 lines
Diff to previous 1.40 , to selected 1.8
Don't handle XLM_IRQ_NEST atomically in emulated mode. That's useless since
this variable is modified only within a single thread and interrupts are
not handled asynchronously.

Revision 1.40 - (view) (annotate) - [select for diffs]
2004-06-22T12:20:17Z (20 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.39: +32 -13 lines
Diff to previous 1.39 , to selected 1.8
Improve timing of periodic threads (from Basilisk II), aka. make 10 seconds
really last 10 seconds, not 18. ;-)

Revision 1.39 - (view) (annotate) - [select for diffs]
2004-06-17T05:15:25Z (20 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.38: +33 -0 lines
Diff to previous 1.38 , to selected 1.8
Get PVR information et al. through (slow) ioreg -c IOPlatformDevice

Revision 1.38 - (view) (annotate) - [select for diffs]
2004-05-31T10:55:42Z (20 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.37: +7 -0 lines
Diff to previous 1.37 , to selected 1.8
Make DR Cache executable by default in native PowerPC mode.

Revision 1.37 - (view) (annotate) - [select for diffs]
2004-05-31T10:02:20Z (20 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.36: +10 -2 lines
Diff to previous 1.36 , to selected 1.8
Enable DR emulator with OldWorld ROMs too. It turned out that translated
code was also trying to access Serial memory.

Note however that I noticed some rare crashes with the DR emulator.
Probably caused by nested runs from EmulOps? We'd really want a native
68k emulator too for Execute68k() things.

Revision 1.36 - (view) (annotate) - [select for diffs]
2004-05-31T09:04:44Z (20 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.35: +25 -0 lines
Diff to previous 1.35 , to selected 1.8
Enable Apple DR emulator from NewWorld ROMs only.

Revision 1.35 - (view) (annotate) - [select for diffs]
2004-05-20T12:33:57Z (20 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.34: +2 -11 lines
Diff to previous 1.34 , to selected 1.8
Get rid of old (and broken) ASYNC_IRQ / MUTICORE code

Revision 1.34 - (view) (annotate) - [select for diffs]
2004-05-15T11:07:11Z (20 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.33: +15 -6 lines
Diff to previous 1.33 , to selected 1.8
Fix bus frequency detection for more realistic timers.
Also add bus-frequency and timebase-frequency values to the Name Registry.

Revision 1.33 - (view) (annotate) - [select for diffs]
2004-04-14T20:25:26Z (20 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.32: +65 -28 lines
Diff to previous 1.32 , to selected 1.8
Fix nested ppc_interrupt() stack corruption problem by allocating yet
another stack when next signal is triggered. I am still unsure if
even MacOS would normally handle nested calls to NanoKernel interrupt
routine.

Revision 1.32 - (view) (annotate) - [select for diffs]
2004-04-06T19:47:56Z (20 years, 7 months ago) by gbeauche
Branch: MAIN
Changes since 1.31: +30 -0 lines
Diff to previous 1.31 , to selected 1.8
Load XPRAM default values if signature not found. i.e. don't hang on first
boot.

Revision 1.31 - (view) (annotate) - [select for diffs]
2004-02-24T11:12:52Z (20 years, 8 months ago) by gbeauche
Branch: MAIN
Changes since 1.30: +7 -5 lines
Diff to previous 1.30 , to selected 1.8
Make SheepShaver work with OS 8.6 out-of-the-box with no extra patch for
the time being. i.e. ignore writes to the zero page when faking SCSIGlobals

Revision 1.30 - (view) (annotate) - [select for diffs]
2004-02-15T17:20:36Z (20 years, 8 months ago) by gbeauche
Branch: MAIN
Changes since 1.29: +4 -2 lines
Diff to previous 1.29 , to selected 1.8
Now that we have AltiVec emulation, we can pretend for a G4 processor
Also make sure to actually fix PVR code for 7400

Revision 1.29 - (view) (annotate) - [select for diffs]
2004-01-31T11:10:49Z (20 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.28: +5 -1 lines
Diff to previous 1.28 , to selected 1.8
Recognize 7400 & 7410 cpus

Revision 1.28 - (view) (annotate) - [select for diffs]
2004-01-18T22:59:06Z (20 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.27: +9 -9 lines
Diff to previous 1.27 , to selected 1.8
Post-merge fixups: machine state wrappers, Apple assembler perticularities.

Revision 1.27 - (view) (annotate) - [select for diffs]
2004-01-18T22:22:28Z (20 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.26: +5 -5 lines
Diff to previous 1.26 , to selected 1.8
No need to map ROM executable on emulated/ppc. Make sure to detect unaligned
EA for lmw/stmw with real addr instead of relying on the signal number.

Revision 1.26 - (view) (annotate) - [select for diffs]
2004-01-18T22:14:31Z (20 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.25: +160 -102 lines
Diff to previous 1.25 , to selected 1.8
Wrappers around machine state registers within signal handlers.

Revision 1.25 - (view) (annotate) - [select for diffs]
2004-01-12T15:37:21Z (20 years, 9 months ago) by cebix
Branch: MAIN
Changes since 1.24: +1 -1 lines
Diff to previous 1.24 , to selected 1.8
Happy New Year! :)

Revision 1.24 - (view) (annotate) - [select for diffs]
2004-01-07T18:24:45Z (20 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.23: +3 -0 lines
Diff to previous 1.23 , to selected 1.8
Also cache native routine descriptor instead of recreating them at each
invokation to ExecuteNative().

Revision 1.23 - (view) (annotate) - [select for diffs]
2004-01-04T18:35:21Z (20 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.22: +48 -5 lines
Diff to previous 1.22 , to selected 1.8
Emulated lmw/stmw with unaligned EA. e.g. for BBEdit under MacOS 8.6.
This may be due to some switch mode that needs to save r13 and upwards.
The faultive code seems to explicitly add 0xee to r1, which causes it to
be unaligned for upcoming lmw/stmw.

Revision 1.22 - (view) (annotate) - [select for diffs]
2004-01-04T05:45:50Z (20 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.21: +6 -0 lines
Diff to previous 1.21 , to selected 1.8
Fix ADB problems with unitinialized mutex

Revision 1.21 - (view) (annotate) - [select for diffs]
2003-12-31T18:16:55Z (20 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.20: +3 -0 lines
Diff to previous 1.20 , to selected 1.8
Add fast X11 display locking routines based on spinlocks, or on pthreads
in the worst case. Optimize out GetScrap() case when we already own the
selection. i.e. make it smoother. Use our own XDisplay{Un,}Lock() routines.

Revision 1.20 - (view) (annotate) - [select for diffs]
2003-12-05T13:37:54Z (20 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.19: +36 -5 lines
Diff to previous 1.19 , to selected 1.8
Use an alternate stack base while servicing PowerPC interrupts.

Revision 1.19 - (view) (annotate) - [select for diffs]
2003-12-05T12:41:19Z (20 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.18: +1 -0 lines
Diff to previous 1.18 , to selected 1.8
Really clear the zero page.

Revision 1.18 - (view) (annotate) - [select for diffs]
2003-12-05T12:36:10Z (20 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.17: +15 -2 lines
Diff to previous 1.17 , to selected 1.8
Add XLM_ZERO_PAGE globals which points to a read-only page with all bits
set to zero.

Revision 1.17 - (view) (annotate) - [select for diffs]
2003-12-04T23:37:36Z (20 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.16: +5 -30 lines
Diff to previous 1.16 , to selected 1.8
Use a unique ExecuteNative() interface in any case, i.e. native & emulated

Revision 1.16 - (view) (annotate) - [select for diffs]
2003-12-04T22:33:24Z (20 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 , to selected 1.8
Fix ExecutePPC() merge with new SheepRoutineDescriptor

Revision 1.15 - (view) (annotate) - [select for diffs]
2003-12-04T17:26:37Z (20 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.14: +52 -29 lines
Diff to previous 1.14 , to selected 1.8
Add new thunking system for 64-bit fixes.

Revision 1.14 - (view) (annotate) - [select for diffs]
2003-11-10T16:05:52Z (20 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.13: +24 -1 lines
Diff to previous 1.13 , to selected 1.8
Merge Set_pthread_attr() from Basilisk II.

Revision 1.13 - (view) (annotate) - [select for diffs]
2003-11-03T21:28:25Z (21 years ago) by gbeauche
Branch: MAIN
Changes since 1.12: +8 -2 lines
Diff to previous 1.12 , to selected 1.8
Implement partial block cache invalidation. Rewrite core cached blocks
execution loop with a Duff's device. Gather some predecode time statistics.
This shows that only around 2% of total emulation time is spent for
predecoding the instructions.

Revision 1.12 - (view) (annotate) - [select for diffs]
2003-10-26T09:14:11Z (21 years ago) by gbeauche
Branch: MAIN
Changes since 1.11: +42 -5 lines
Diff to previous 1.11 , to selected 1.8
- enable multicore cpu emulation with ASYNC_IRQ
- move atomic_* operations to main_unix so that they could use spinlocks or
  other platform-specific locking mechanisms

Revision 1.11 - (view) (annotate) - [select for diffs]
2003-10-26T07:54:02Z (21 years ago) by gbeauche
Branch: MAIN
Changes since 1.10: +1 -1 lines
Diff to previous 1.10 , to selected 1.8
allow DGA & Xshm only on local displays

Revision 1.10 - (view) (annotate) - [select for diffs]
2003-10-26T00:32:31Z (21 years ago) by cebix
Branch: MAIN
Changes since 1.9: +2 -3 lines
Diff to previous 1.9 , to selected 1.8
- fixed compilation problems under BeOS
- boot drive wasn't set correctly

Revision 1.9 - (view) (annotate) - [select for diffs]
2003-10-12T05:44:14Z (21 years ago) by gbeauche
Branch: MAIN
Changes since 1.8: +5 -3 lines
Diff to previous 1.8
- Handle MakeExecutable() replacement
- Disable predecode cache in CVS for now
- Fix flight recorder ordering in predecode cache mode

Revision 1.8 - (view) (annotate) - [selected]
2003-09-29T15:46:07Z (21 years, 1 month ago) by gbeauche
Branch: MAIN
Changes since 1.7: +38 -33 lines
Diff to previous 1.7
- Share EmulatorData & KernelData struct definitions
- Introduce new SheepShaver data area for alternate stacks, thunks, etc.
- Experimental asynchronous interrupts handling. This improves performance
  by 30% but some (rare) lockups may occur. To be debugged!

Revision 1.7 - (view) (annotate) - [select for diffs]
2003-09-28T21:20:38Z (21 years, 1 month ago) by gbeauche
Branch: MAIN
Changes since 1.6: +61 -12 lines
Diff to previous 1.6 , to selected 1.8
Disable SIGUSR2 handler in EMULATED_PPC mode for now

Revision 1.6 - (view) (annotate) - [select for diffs]
2003-09-07T14:33:53Z (21 years, 1 month ago) by gbeauche
Branch: MAIN
Changes since 1.5: +27 -16 lines
Diff to previous 1.5 , to selected 1.8
- Integrate new NativeOp instructions to be used as trampolines to call
  native functions from ppc code.
- Little endian fixes in emul_op.cpp
- Add new 'gpch' 750 patch to workaround crash with MacOS 8.6
- Don't crash in Process Manager on reset/shutdown with MacOS 8.6
- We also have an experimental interrupt thread in emulation mode

Revision 1.5 - (view) (annotate) - [select for diffs]
2003-05-22T22:12:04Z (21 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.4: +21 -30 lines
Diff to previous 1.4 , to selected 1.8
Import VOSF from Basilisk II for faster and more accurate video refresh.
There may be some bugs left though. Rework sigsegv_handler() a little to
accomodate VOSF way of life.

TODO: merge video drivers infrastructure from B2.

Revision 1.4 - (view) (annotate) - [select for diffs]
2003-05-13T16:59:57Z (21 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.3: +22 -7 lines
Diff to previous 1.3 , to selected 1.8
Use vm_acquire/vm_acquire_fixed/vm_release API. Prepare use of SIGSEGV
handlers and instruction skippers. Fix test prior to including posix_sem.cpp.

Revision 1.3 - (view) (annotate) - [select for diffs]
2002-04-21T15:07:08Z (22 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.2: +5 -81 lines
Diff to previous 1.2 , to selected 1.8
Add support to decode parcels-based ROMs
- include/rom_patches.h (DecodeROM): Declare.
- rom_patches.cpp (DecodeROM): Define.
- Unix/main_unix.cpp, BeOS/main_beos.cpp (decode_lzss): Move to...
- rom_patches.cpp (decode_lzss): ... here.
- Unix/main_unix.cpp (main): Call DecodeROM().
- BeOS/main_beos.cpp (SheepShaver::load_rom): Call DecodeROM().

Revision 1.2 - (view) (annotate) - [select for diffs]
2002-02-21T15:12:12Z (22 years, 8 months ago) by cebix
Branch: MAIN
Changes since 1.1: +10 -0 lines
Diff to previous 1.1 , to selected 1.8
added dummy Set_pthread_attr()

Revision 1.1.1.1 - (view) (annotate) - [select for diffs] (vendor branch)
2002-02-04T16:58:13Z (22 years, 9 months ago) by cebix
Branch: cebix
CVS Tags: start
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 , to next main 1.103 , to selected 1.8
Imported sources

Revision 1.1 - (view) (annotate) - [select for diffs]
2002-02-04T16:58:13Z (22 years, 9 months ago) by cebix
Branch: MAIN
Branch point for: cebix
Diff to selected 1.8
Initial revision

Convenience Links

Links to HEAD: (view) (annotate)

Compare Revisions

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, select a symbolic revision name using the selection box, or choose 'Use Text Field' and enter a numeric revision.

  Diffs between and
  Type of Diff should be a