/[cebix]/SheepShaver/src/Unix/sysdeps.h
ViewVC logotype

Log of /SheepShaver/src/Unix/sysdeps.h

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (annotate)
Sticky Tag:

Revision 1.59 - (view) (annotate) - [select for diffs]
Mon Aug 17 20:44:30 2009 UTC (5 years, 3 months ago) by asvitkine
Branch: MAIN
CVS Tags: HEAD
Changes since 1.58: +9 -0 lines
Diff to previous 1.58
[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.


Revision 1.58 - (view) (annotate) - [select for diffs]
Fri Jun 20 00:50:33 2008 UTC (6 years, 5 months ago) by asvitkine
Branch: MAIN
Changes since 1.57: +1 -1 lines
Diff to previous 1.57
Don't profile by default - as this is no use to non-developers.


Revision 1.57 - (view) (annotate) - [select for diffs]
Tue Jan 1 09:47:39 2008 UTC (6 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.56: +1 -1 lines
Diff to previous 1.56
Happy New Year!


Revision 1.56 - (view) (annotate) - [select for diffs]
Sat Feb 17 09:01:30 2007 UTC (7 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.55: +1 -0 lines
Diff to previous 1.55
merge PPC_PROFILE_REGS_USE fixes from KPX branch


Revision 1.55 - (view) (annotate) - [select for diffs]
Wed Jan 17 07:05:19 2007 UTC (7 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.54: +1 -1 lines
Diff to previous 1.54
Rearrange powerpc_registers struct and nuke fp_result register which is
only needed for JIT (and to be handled differently in the future).


Revision 1.54 - (view) (annotate) - [select for diffs]
Thu Jul 6 00:01:04 2006 UTC (8 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.53: +1 -1 lines
Diff to previous 1.53
Add more micro asm optimisations to x86{,-64} (mulhw, mulhwu, slw, srw, cntlzw
and subf* series). Also now enable the optimzations on x86_64 by default.


Revision 1.53 - (view) (annotate) - [select for diffs]
Sun May 7 16:54:58 2006 UTC (8 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.52: +6 -0 lines
Diff to previous 1.52
Define UNALIGNED_PROFITABLE on x86 platforms


Revision 1.52 - (view) (annotate) - [select for diffs]
Tue May 2 19:33:10 2006 UTC (8 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.51: +0 -15 lines
Diff to previous 1.51
Move likely() definitions to dyngen-exec.h, they are only used in the CPU
core where it's most useful (give a stronger hint to gcc4)


Revision 1.51 - (view) (annotate) - [select for diffs]
Sat Apr 1 21:41:18 2006 UTC (8 years, 7 months ago) by gbeauche
Branch: MAIN
Changes since 1.50: +15 -0 lines
Diff to previous 1.50
Helper macros to annotate likely branch directions. Colateral effect: this
also fixes build with GCC 4.1 (ppc-dyngen-ops.cpp) since the branches are
re-ordered in a way there is now only one exit-point in op_jump_next_A0().


Revision 1.50 - (view) (annotate) - [select for diffs]
Wed Nov 30 07:24:53 2005 UTC (8 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.49: +0 -2 lines
Diff to previous 1.49
Always use the complete non-stubs Ethernet driver (XXX probably do that
only in Emulated PPC mode for performance reasons?)


Revision 1.49 - (view) (annotate) - [select for diffs]
Sun Nov 27 16:20:17 2005 UTC (9 years ago) by gbeauche
Branch: MAIN
Changes since 1.48: +0 -2 lines
Diff to previous 1.48
Do use predecode cache in case the JIT is disabled by the user ("jit" option)


Revision 1.48 - (view) (annotate) - [select for diffs]
Sun Jul 3 22:02:01 2005 UTC (9 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.47: +5 -0 lines
Diff to previous 1.47
Minor tweaks to support compilation of ether.cpp within MacOS. i.e. mostly
migrate the Ethernet driver to the MacOS side. This is enabled for
DIRECT_ADDRESSING cases. I didn't want to alter much of ether.cpp (as it
would have required to support that mode). Of course, in REAL_ADDRESSING
mode (the default) and for debugging purposes, the old driver is still
available.


Revision 1.47 - (view) (annotate) - [select for diffs]
Sun Jul 3 13:39:06 2005 UTC (9 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.46: +0 -14 lines
Diff to previous 1.46
Remove obsolete and broken Cygwin/X11 hacks. Forbid builds of the Windows
version from within the Unix/ directory.


Revision 1.46 - (view) (annotate) - [select for diffs]
Fri Jul 1 23:15:11 2005 UTC (9 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.45: +1 -1 lines
Diff to previous 1.45
Hopefully fix the remaining issue in the High Resolution Timing support
code and re-enable it on Linux platforms (they have clock_nanosleep). Why
did I trigger an interrupt inside a held lock? Hmmm, we should probably
add an _ack semaphore like we do e.g. for ethernet.


Revision 1.45 - (view) (annotate) - [select for diffs]
Thu Jun 30 13:29:43 2005 UTC (9 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.44: +1 -2 lines
Diff to previous 1.44
Re-enable spinlocks on {i386,x86_64} since they are now used only for really
small atomic operations (add/sub). This implementation should be enough for
that purpose.


Revision 1.44 - (view) (annotate) - [select for diffs]
Sat Jun 25 11:39:47 2005 UTC (9 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.43: +8 -7 lines
Diff to previous 1.43
Use fast spinlocks only for small enough atomic operations. Otherwise, you
run into some performance problems in e.g. video graphics experience because
of busywaits in the current spin_lock() implementation.


Revision 1.43 - (view) (annotate) - [select for diffs]
Sat Jun 25 11:06:24 2005 UTC (9 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.42: +1 -1 lines
Diff to previous 1.42
We HAVE_PTHREADS even if we use our own pthreads implementation, this also
induces availability of locking primitives. I will merge the !HAVE_PTHREADS
case (a la Basilisk II) for EMULATED_PPC when I get back to home.


Revision 1.42 - (view) (annotate) - [select for diffs]
Wed Jun 22 12:32:32 2005 UTC (9 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.41: +8 -0 lines
Diff to previous 1.41
Extend internal math library from GNU libc to accomodate older systems
with glibc 2.2.X or simply no C99 capable C library. Fix vrfiz instruction
to really truncate on float values.


Revision 1.41 - (view) (annotate) - [select for diffs]
Sun Mar 27 13:41:46 2005 UTC (9 years, 8 months ago) by gbeauche
Branch: MAIN
Changes since 1.40: +1 -1 lines
Diff to previous 1.40
Disable high-res timings as it could still hang. The advantage is that we
now can use special mutexes to debug deadlocks


Revision 1.40 - (view) (annotate) - [select for diffs]
Sat Mar 5 19:07:35 2005 UTC (9 years, 8 months ago) by gbeauche
Branch: MAIN
Changes since 1.39: +6 -0 lines
Diff to previous 1.39
Enable high precision timings on POSIX systems supporting clock_nanosleep().
Since pthread_suspend_np() is not available to Linux (but NetBSD 2.0), thread
suspend is implemented likewise to boehm-gc.


Revision 1.39 - (view) (annotate) - [select for diffs]
Sun Feb 27 21:52:06 2005 UTC (9 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.38: +1 -0 lines
Diff to previous 1.38
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.38 - (view) (annotate) - [select for diffs]
Sun Feb 20 18:08:50 2005 UTC (9 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.37: +1 -1 lines
Diff to previous 1.37
Initial support for NetBSD/ppc in native mode (some crashes occur but I
could boot MacOS 9.0.4)


Revision 1.37 - (view) (annotate) - [select for diffs]
Sun Feb 13 18:18:59 2005 UTC (9 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.36: +12 -0 lines
Diff to previous 1.36
Support FreeBSD 5.3:
- fix implementation of offsetof() with GCC >= 3.4 and C++ code


Revision 1.36 - (view) (annotate) - [select for diffs]
Sun Jan 30 21:48:20 2005 UTC (9 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.35: +1 -1 lines
Diff to previous 1.35
Happy New Year 2005!


Revision 1.35 - (view) (annotate) - [select for diffs]
Mon Nov 22 22:40:26 2004 UTC (10 years ago) by gbeauche
Branch: MAIN
Changes since 1.34: +18 -2 lines
Diff to previous 1.34
Cygwin Direct Addressing hack.


Revision 1.34 - (view) (annotate) - [select for diffs]
Sat Nov 13 14:09:16 2004 UTC (10 years ago) by gbeauche
Branch: MAIN
Changes since 1.33: +14 -9 lines
Diff to previous 1.33
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.33 - (view) (annotate) - [select for diffs]
Tue Jun 15 21:37:22 2004 UTC (10 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.32: +5 -0 lines
Diff to previous 1.32
Don't bother with predecode cache when using JIT.


Revision 1.32 - (view) (annotate) - [select for diffs]
Wed Jun 2 16:11:49 2004 UTC (10 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.31: +17 -3 lines
Diff to previous 1.31
Disable testandset() locks, use pthread's as SheepShaver occasionnally hangs
with spinlocks. Weird as those are derived from x86 linuxthreads.


Revision 1.31 - (view) (annotate) - [select for diffs]
Thu May 20 17:46:49 2004 UTC (10 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.30: +4 -5 lines
Diff to previous 1.30
add and fix testandset for x86_64


Revision 1.30 - (view) (annotate) - [select for diffs]
Thu May 20 12:33:57 2004 UTC (10 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.29: +1 -3 lines
Diff to previous 1.29
Get rid of old (and broken) ASYNC_IRQ / MUTICORE code


Revision 1.29 - (view) (annotate) - [select for diffs]
Wed May 19 21:23:15 2004 UTC (10 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.28: +1 -0 lines
Diff to previous 1.28
Make NativeOp() handler a sheepshaver_cpu handler, thus getting rid of ugly
GPR macro definition.

Make the JIT engine somewhat reentrant. This brings a massive performance
boost for applications that cause many Execute68k(). e.g. audio in PlayerPRO.


Revision 1.28 - (view) (annotate) - [select for diffs]
Fri May 14 08:25:30 2004 UTC (10 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.27: +3 -0 lines
Diff to previous 1.27
Use assembly optimizations on x86 for adde/addo/etc. emulation


Revision 1.27 - (view) (annotate) - [select for diffs]
Wed May 12 11:38:16 2004 UTC (10 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.26: +0 -4 lines
Diff to previous 1.26
Direct block chaining works on all supported platforms, enabled by default


Revision 1.26 - (view) (annotate) - [select for diffs]
Tue May 11 20:53:23 2004 UTC (10 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.25: +4 -0 lines
Diff to previous 1.25
direct block chaining, aka faster block dispatcher


Revision 1.25 - (view) (annotate) - [select for diffs]
Wed Feb 25 22:02:59 2004 UTC (10 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.24: +1 -1 lines
Diff to previous 1.24
fix for SheepThreads (native mode)


Revision 1.24 - (view) (annotate) - [select for diffs]
Tue Feb 24 23:09:39 2004 UTC (10 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.23: +6 -0 lines
Diff to previous 1.23
Portability fixes: declare Set_pthread_attr() only if HAVE_PTHREADS. Merge
add_{serial,ether}_names() from B2 prefs editor for FreeBSD/IRIX.


Revision 1.23 - (view) (annotate) - [select for diffs]
Mon Jan 26 13:52:31 2004 UTC (10 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.22: +9 -1 lines
Diff to previous 1.22
Use bswap instruction on IA-32 too. Optimize bswap_64 on little-endian
(x86 for now) systems.


Revision 1.22 - (view) (annotate) - [select for diffs]
Sun Jan 18 22:05:28 2004 UTC (10 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.21: +6 -6 lines
Diff to previous 1.21
Add spinlocks for Darwin/PPC


Revision 1.21 - (view) (annotate) - [select for diffs]
Mon Jan 12 15:37:22 2004 UTC (10 years, 10 months ago) by cebix
Branch: MAIN
Changes since 1.20: +1 -1 lines
Diff to previous 1.20
Happy New Year! :)


Revision 1.20 - (view) (annotate) - [select for diffs]
Tue Jan 6 15:05:35 2004 UTC (10 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.19: +12 -12 lines
Diff to previous 1.19
Fix IA-32 testandset(), make spinlock_t volatile int.


Revision 1.19 - (view) (annotate) - [select for diffs]
Wed Dec 31 18:16:55 2003 UTC (10 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.18: +19 -0 lines
Diff to previous 1.18
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.18 - (view) (annotate) - [select for diffs]
Sun Dec 28 17:56:03 2003 UTC (10 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.17: +4 -0 lines
Diff to previous 1.17
Declare timing functions from timer_unix.cpp


Revision 1.17 - (view) (annotate) - [select for diffs]
Mon Dec 1 13:51:35 2003 UTC (10 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.16: +2 -1 lines
Diff to previous 1.16
Add PPC_PROFILE_GENERIC_CALLS, don't enable PPC_PROFILE_COMPILE_TIME by
default.


Revision 1.16 - (view) (annotate) - [select for diffs]
Fri Nov 28 22:13:49 2003 UTC (11 years ago) by gbeauche
Branch: MAIN
Changes since 1.15: +2 -0 lines
Diff to previous 1.15
Gather stats about compile time. Define KPX_MAX_CPUS to 1 for allowing
allocation of translation cache into .data section on PowerPC.


Revision 1.15 - (view) (annotate) - [select for diffs]
Mon Nov 24 21:20:47 2003 UTC (11 years ago) by gbeauche
Branch: MAIN
Changes since 1.14: +29 -1 lines
Diff to previous 1.14
Optimized bswap_32() for AMD64


Revision 1.14 - (view) (annotate) - [select for diffs]
Tue Nov 11 11:32:24 2003 UTC (11 years ago) by gbeauche
Branch: MAIN
Changes since 1.13: +1 -2 lines
Diff to previous 1.13
Remove obsolete code related to PPC_NO_FPSCR_UPDATE, PPC_LAZY_PC_UPDATE,
PPC_LAZY_CC_UPDATE, PPC_HAVE_SPLIT_CR defines.


Revision 1.13 - (view) (annotate) - [select for diffs]
Sun Oct 26 14:16:37 2003 UTC (11 years, 1 month ago) by gbeauche
Branch: MAIN
Changes since 1.12: +1 -1 lines
Diff to previous 1.12
Fix ASYNC_IRQ build but locks may still happen. Note that with a predecode
cache, checking for pending interrupts may not be the bottle neck nowadays.


Revision 1.12 - (view) (annotate) - [select for diffs]
Sun Oct 26 13:59:02 2003 UTC (11 years, 1 month ago) by gbeauche
Branch: MAIN
Changes since 1.11: +2 -1 lines
Diff to previous 1.11
Rewrite interrupts handling code so that the emulator can work with a
predecode cache. This implies to run in interpreted mode only while
processing EmulOps or other native (nested) runs.

Note that the FLIGHT_RECORDER with a predecode cache gets slower than
without caching at all.


Revision 1.11 - (view) (annotate) - [select for diffs]
Sun Oct 12 05:44:14 2003 UTC (11 years, 1 month ago) by gbeauche
Branch: MAIN
Changes since 1.10: +1 -0 lines
Diff to previous 1.10
- Handle MakeExecutable() replacement
- Disable predecode cache in CVS for now
- Fix flight recorder ordering in predecode cache mode


Revision 1.10 - (view) (annotate) - [select for diffs]
Sat Oct 11 09:57:49 2003 UTC (11 years, 1 month ago) by gbeauche
Branch: MAIN
Changes since 1.9: +1 -2 lines
Diff to previous 1.9
- Add support for FLIGHT_RECORDER with predecode cache
- Always enable predecode cache & flight recorder for now


Revision 1.9 - (view) (annotate) - [select for diffs]
Sat Oct 11 09:34:35 2003 UTC (11 years, 1 month ago) by gbeauche
Branch: MAIN
Changes since 1.8: +4 -0 lines
Diff to previous 1.8
Move PPC emulator config to here


Revision 1.8 - (view) (annotate) - [select for diffs]
Mon Sep 29 22:41:50 2003 UTC (11 years, 2 months ago) by gbeauche
Branch: MAIN
Changes since 1.7: +1 -1 lines
Diff to previous 1.7
Make older & bogus compilers happy. aka. force "static" storage class
for SPIN_LOCK_UNLOCKED constant.


Revision 1.7 - (view) (annotate) - [select for diffs]
Mon Sep 29 15:46:07 2003 UTC (11 years, 2 months ago) by gbeauche
Branch: MAIN
Changes since 1.6: +2 -0 lines
Diff to previous 1.6
- 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.6 - (view) (annotate) - [select for diffs]
Mon Sep 29 08:27:56 2003 UTC (11 years, 2 months ago) by gbeauche
Branch: MAIN
Changes since 1.5: +123 -0 lines
Diff to previous 1.5
spinlocks from QEMU


Revision 1.5 - (view) (annotate) - [select for diffs]
Sun Sep 7 14:19:25 2003 UTC (11 years, 2 months ago) by gbeauche
Branch: MAIN
Changes since 1.4: +68 -6 lines
Diff to previous 1.4
Add byteswap routines


Revision 1.4 - (view) (annotate) - [select for diffs]
Thu May 22 22:12:05 2003 UTC (11 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.3: +3 -0 lines
Diff to previous 1.3
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.3 - (view) (annotate) - [select for diffs]
Sat Jan 4 12:23:39 2003 UTC (11 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.2: +27 -8 lines
Diff to previous 1.2
Sync with changes from cxmon and B2. I have yet to find out why my old
disk image (8.1 based) no longer boots completely. :-/


Revision 1.2 - (view) (annotate) - [select for diffs]
Thu Feb 21 15:12:12 2002 UTC (12 years, 9 months ago) by cebix
Branch: MAIN
Changes since 1.1: +3 -0 lines
Diff to previous 1.1
added dummy Set_pthread_attr()


Revision 1.1.1.1 - (view) (annotate) - [select for diffs] (vendor branch)
Mon Feb 4 16:58:13 2002 UTC (12 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.59
Imported sources


Revision 1.1 - (view) (annotate) - [select for diffs]
Mon Feb 4 16:58:13 2002 UTC (12 years, 9 months ago) by cebix
Branch: MAIN
Branch point for: cebix
Initial revision


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

Sort log by:

Christian Bauer">Christian Bauer
ViewVC Help
Powered by ViewVC 1.1.17