ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/vm_alloc.cpp
Revision 1.35 - (view) (annotate) - [select for diffs]
2012-01-01T22:32:24Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
CVS Tags: HEAD
Changes since 1.34: +5 -9 lines
Diff to previous 1.34
cleanup ifdef chain syntax

Revision 1.34 - (view) (annotate) - [select for diffs]
2011-12-31T19:47:16Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.33: +3 -7 lines
Diff to previous 1.33
make the ifdef chain more readable

Revision 1.33 - (view) (annotate) - [select for diffs]
2011-12-30T20:37:30Z (12 years, 10 months ago) by asvitkine
Branch: MAIN
Changes since 1.32: +19 -0 lines
Diff to previous 1.32
Fix CrashReporter poping up when PPC is not emulated on pre-10.5 systems.

Revision 1.32 - (view) (annotate) - [select for diffs]
2009-08-11T07:43:46Z (15 years, 3 months ago) by asvitkine
Branch: MAIN
Changes since 1.31: +31 -2 lines
Diff to previous 1.31
[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.

Revision 1.31 - (view) (annotate) - [select for diffs]
2008-01-20T00:38:52Z (16 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.30: +3 -0 lines
Diff to previous 1.30
HP-UX does support 32-bit memory mappings.

Revision 1.30 - (view) (annotate) - [select for diffs]
2008-01-17T23:19:01Z (16 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.29: +1 -1 lines
Diff to previous 1.29
Fix build on 64-bit Vista.

Revision 1.29 - (view) (annotate) - [select for diffs]
2008-01-16T22:36:35Z (16 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.28: +110 -2 lines
Diff to previous 1.28
Wrap the Windows write-watch API.

Revision 1.28 - (view) (annotate) - [select for diffs]
2008-01-12T21:43:02Z (16 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.27: +13 -5 lines
Diff to previous 1.27
LLP64 fixes (64-bit Windows)

Revision 1.27 - (view) (annotate) - [select for diffs]
2008-01-01T09:40:33Z (16 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.26: +1 -1 lines
Diff to previous 1.26
Happy New Year!

Revision 1.26 - (view) (annotate) - [select for diffs]
2007-01-13T18:21:30Z (17 years, 10 months ago) by gbeauche
Branch: MAIN
Changes since 1.25: +0 -144 lines
Diff to previous 1.25
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.

Revision 1.25 - (view) (annotate) - [select for diffs]
2006-07-19T21:23:41Z (18 years, 4 months ago) by gbeauche
Branch: MAIN
CVS Tags: nigel-build-19
Changes since 1.24: +1 -1 lines
Diff to previous 1.24
Fix remove_shm_range() to actually return something

Revision 1.24 - (view) (annotate) - [select for diffs]
2006-05-02T19:49:25Z (18 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.23: +0 -1 lines
Diff to previous 1.23
fix rev 1.22 commit for windows (extraneous return -1 left)

Revision 1.23 - (view) (annotate) - [select for diffs]
2006-02-27T07:16:40Z (18 years, 8 months ago) by gbeauche
Branch: MAIN
Changes since 1.22: +1 -1 lines
Diff to previous 1.22
Start allocating memory from 0x10000000 with linker scripts since the system
sometimes has a problem to make a decision when next_address == 0.

NOTE: this makes it possible to allocate up to 1 GB with DIRECT_ADDRESSING

Revision 1.22 - (view) (annotate) - [select for diffs]
2006-02-27T00:04:12Z (18 years, 8 months ago) by gbeauche
Branch: MAIN
Changes since 1.21: +0 -15 lines
Diff to previous 1.21
Memory allocated through win32 VirtualAlloc() is zero-filled. Likewise for
memory mmap()'ed with MAP_ANONYMOUS (equivalent to /dev/zero mapping but
faster)

Revision 1.21 - (view) (annotate) - [select for diffs]
2006-02-26T23:45:07Z (18 years, 8 months ago) by gbeauche
Branch: MAIN
Changes since 1.20: +32 -4 lines
Diff to previous 1.20
add 33-bit addressing support to vm_acquire_fixed()

Revision 1.20 - (view) (annotate) - [select for diffs]
2005-06-20T03:54:46Z (19 years, 5 months ago) by gbeauche
Branch: MAIN
CVS Tags: nigel-build-17
Changes since 1.19: +9 -3 lines
Diff to previous 1.19
Get real page size on Windows for vm_get_page_size() [64 KB]

Revision 1.19 - (view) (annotate) - [select for diffs]
2005-06-06T19:40:17Z (19 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.18: +4 -1 lines
Diff to previous 1.18
Robustify: only close zero_fd if actually allocated

Revision 1.18 - (view) (annotate) - [select for diffs]
2005-03-24T23:45:40Z (19 years, 7 months ago) by gbeauche
Branch: MAIN
Changes since 1.17: +13 -0 lines
Diff to previous 1.17
Gracefully catch SIGSEGV & SIGBUS for TEST_VM_PROT_* test cases. This should
avoid dumping core, and especially Windows fault alerts when natively
configuring with MinGW32.

Revision 1.17 - (view) (annotate) - [select for diffs]
2005-01-30T21:42:14Z (19 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.16: +1 -1 lines
Diff to previous 1.16
Happy New Year!

Revision 1.16 - (view) (annotate) - [select for diffs]
2004-12-18T22:20:27Z (19 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15
s/vm_page_size/vm_get_page_size/ to avoid name clash on MacOS X

Revision 1.15 - (view) (annotate) - [select for diffs]
2004-12-11T10:19:34Z (19 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.14: +12 -5 lines
Diff to previous 1.14
implement vm_page_size() to get the actual size of a page

Revision 1.14 - (view) (annotate) - [select for diffs]
2004-11-13T23:39:58Z (20 years ago) by gbeauche
Branch: MAIN
Changes since 1.13: +80 -1 lines
Diff to previous 1.13
Windows memory allocators

Revision 1.13 - (view) (annotate) - [select for diffs]
2004-11-08T21:07:07Z (20 years ago) by gbeauche
Branch: MAIN
Changes since 1.12: +132 -5 lines
Diff to previous 1.12
Enable 33-bit memory addressing on 64-bit JIT capable platforms (e.g. x86-64).
This is useful to get rid of address offset sign extensions. It uses POSIX
shared memory to create aliased regions, fallback to usual sign-extension
way if shm_open et al. don't work (e.g. no /dev/shm mounted)

Revision 1.12 - (view) (annotate) - [select for diffs]
2004-01-12T15:29:25Z (20 years, 10 months ago) by cebix
Branch: MAIN
CVS Tags: nigel-build-15, nigel-build-16
Changes since 1.11: +1 -1 lines
Diff to previous 1.11
Happy New Year! :)

Revision 1.11 - (view) (annotate) - [select for diffs]
2003-12-20T21:44:52Z (20 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10
Fix build with DEC C++ compiler on Tru64.

Revision 1.10 - (view) (annotate) - [select for diffs]
2003-11-24T23:27:18Z (20 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.9: +42 -8 lines
Diff to previous 1.9
Enable possibility to manually pass VM_MAP_32BIT & friends. This is needed
for the PowerPC "JIT1" engine.

Revision 1.9 - (view) (annotate) - [select for diffs]
2003-10-03T18:18:12Z (21 years, 1 month ago) by gbeauche
Branch: MAIN
Changes since 1.8: +22 -4 lines
Diff to previous 1.8
Make sure a 32-bit B2/JIT works reasonnably well on AMD64 too. This implies
to force RAMBaseHost < 0x80000000. This is empirically determined to work on
Linux/x86 and Linux/amd64.

Revision 1.8 - (view) (annotate) - [select for diffs]
2003-05-13T16:56:37Z (21 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.7: +1 -1 lines
Diff to previous 1.7
Fix check against return value of memset() in vm_acquire_fixed

Revision 1.7 - (view) (annotate) - [select for diffs]
2002-03-16T10:51:17Z (22 years, 8 months ago) by gbeauche
Branch: MAIN
CVS Tags: nigel-build-12, nigel-build-13
Changes since 1.6: +4 -4 lines
Diff to previous 1.6
- Check for caddr_t. On some systems like Solaris/SPARC, mmap() address
  type (first parameter) is caddr_t instead of void *. Explicitly cast
  address to (caddr_t) type and C++ implicit pointer conversion rules
  will do the rest. aka. caddr_t -> void * is OK unlike the opposite.

Revision 1.6 - (view) (annotate) - [select for diffs]
2002-02-11T14:28:02Z (22 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5
- vm_acquire_fixed: Fix memset() and vm_protect() calls so that the address
  is really the one specified instead of always zero.

Revision 1.5 - (view) (annotate) - [select for diffs]
2002-01-15T14:58:37Z (22 years, 10 months ago) by cebix
Branch: MAIN
CVS Tags: snapshot-15012002
Changes since 1.4: +1 -1 lines
Diff to previous 1.4
- documentation updates
- 2001 -> 2002
- version 0.9 -> 1.0

Revision 1.4 - (view) (annotate) - [select for diffs]
2001-07-14T18:41:05Z (23 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.3: +6 -5 lines
Diff to previous 1.3
- video_x.cpp: the_buffer shall always be mapped through vm_alloc() so
  that it can be vm_protect()'ed at will afterwards
- video_x.cpp: let driver_base free() the_buffer_copy and the_host_buffer,
  if necessary
- video_vosf.h: reverted to use malloc() for mainBuffer.dirtyPages and
  mainBuffer.pageInfo
- vm_alloc.cpp: small cleanups
- fixed typos

Revision 1.3 - (view) (annotate) - [select for diffs]
2001-07-07T09:07:38Z (23 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.2: +8 -1 lines
Diff to previous 1.2
- Try to map memory contiguously with base addresses returned in increasing
  order. No host memory region used for Mac emulation (ScratchMem, RAM, ROM,
  frame buffer) shall be allocated below the RAM space. Actually, MEMBaseDiff
  should be set to the min(above-mentioned address spaces).
  ==> Temporary fix for 64-bit addressing systems (e.g. Linux/ia64)

Revision 1.2 - (view) (annotate) - [select for diffs]
2001-07-06T22:37:23Z (23 years, 4 months ago) by cebix
Branch: MAIN
Changes since 1.1: +1 -1 lines
Diff to previous 1.1
fixed memory leaks in video mode switching

Revision 1.1 - (view) (annotate) - [select for diffs]
2001-06-26T22:35:41Z (23 years, 4 months ago) by gbeauche
Branch: MAIN
- added SIGSEGV support for Linux/Alpha (to be checked), Darwin/PPC
- added uniform virtual memory allocation
  (supports mmap(), vm_allocate(), or fallbacks to malloc()/free())
- cleaned up memory allocation in main_unix.cpp

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