Commit Graph

68 Commits

Author SHA1 Message Date
Oliver Tappe f9ae64e9a5 zooey + bonefish:
* optimized unmapping of a single page that was rather inefficient
  for large areas

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29978 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-06 20:46:18 +00:00
Ingo Weinhold 47c40a10a1 * Prefixed memset_physical() and memcpy_to_physical() with "vm_",
added vm_memcpy_from_physical() and vm_memcpy_physical_page(), and
  added respective functions to the vm_translation_map operations. The
  architecture specific implementation can now decide how to implement
  them most efficiently. Added generic implementations that can be used,
  though.
* Changed vm_{get,put}_physical_page(). The former no longer accepts
  flags (the only flag PHYSICAL_PAGE_DONT_WAIT wasn't needed anymore).
  Instead it returns an implementation-specific handle that has to be
  passed to the latter. Added vm_{get,put}_physical_page_current_cpu()
  and *_debug() variants, that work only for the current CPU,
  respectively when in the kernel debugger. Also adjusted the
  vm_translation_map operations accordingly.
* Made consequent use of the physical memory operations in the source
  tree.
* Also adjusted the m68k and ppc implementations with respect to the
  vm_translation_map operation changes, but they are probably broken,
  nevertheless.
* For x86 the generic physical page mapper isn't used anymore. It is
  suboptimal in any case. For systems with small memory it is too much
  overhead, since one can just map the complete physical memory (that's
  not done yet, though). For systems with large memory it counteracts
  the VM strategy to reuse the least recently used pages. Since those
  pages will most likely not be mapped by the page mapper anymore, it
  will keep remapping chunks. This was also the reason why building
  Haiku in Haiku was significantly faster with only 256 MB RAM (since
  that much could be kept mapped all the time).
  Now we're using a different strategy: We have small pools of virtual
  page slots per CPU that are used for the physical page operations
  (memset_physical(), memcpy_*_physical()) with CPU-pinned thread.
  Furthermore we have four slots per translation map, which are used to
  map page tables.

These changes speed up the Haiku image build in Haiku significantly. On
my Core2 Duo 2.2 GHz 2 GB machine about 40% to 20 min 40 s (KDEBUG
disabled, block cache debug disabled). Still more than factor 3 slower
than FreeBSD and Linux, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28244 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-20 00:06:09 +00:00
Ingo Weinhold 901f1930e1 * Moved memset_physical() to vm.cpp and made it available in the kernel.
* Added memcpy_to_physical().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28219 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-17 16:32:12 +00:00
Axel Dörfler ca7cb625b9 * Implemented a (private for now) get_system_info_etc() call, that can retrieve
various system information.
* Implemented retrieving some VM stats via this call.
* The VM now maintains a page fault counter, and sets system_info::page_faults
  accordingly.
* Added a (pretty simple) "vmstat" command line app.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27597 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-17 16:27:17 +00:00
Ingo Weinhold 1e90630527 * Added a "flags" parameter to vm_create_anonymous_area() and
create_area_etc().
* When the new flag CREATE_AREA_DONT_WAIT is specified, the functions
  don't wait for memory or pages to become available. They fail
  immediately instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27117 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-21 22:50:11 +00:00
Ingo Weinhold 1cda5944ad Added object_cache_set_minimum_reserve() which sets the minimal number
of free objects an object cache should try to have ready. If the number
of free objects drops below the threshold, a new urgent priority thread
is asked to asynchronously resize the object cache (pretty similar to
the heap grower thread). Such a mechanism is necessary for code paths
that are supposed to free pages, but may need memory themselves (like
the swap support).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27100 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-21 03:21:37 +00:00
Ingo Weinhold a9d7be0708 * Implemented mprotect(). A vm_area does now have an optional array
specifying the protection of each page (4 bits per page).
* Added no-op implementation of posix_madvise().
* Replaced a few "addr_t size" parameters by "size_t size".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26871 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-08 01:00:06 +00:00
Ingo Weinhold 5c99d63970 Merged branch haiku/branches/developer/bonefish/vm into trunk. This
introduces the following relevant changes:
* VMCache:
  - Renamed vm_cache to VMCache, merged it with vm_store and made it a
    C++ class with virtual methods (replacing the store operations).
    Turned the different store implementations into subclasses.
  - Introduced MergeStore() callback, changed semantics of Commit().
  - Changed locking and referencing semantics. A reference can only be
    acquired/released with the cache locked. An unreferenced cache is
    deleted and a mergeable cache merged when it is unlocked. This
    removes the "busy" state of a cache and simplifies the page fault
    code.
* Added VMAnonymousCache, which will implement swap support (work by
  Zhao Shuai). It is not integrated and used yet, though.
* Enabled the mutex/recursive lock holder asserts.
* Fixed DoublyLinkedList::Swap().
* Generalized the low memory handler to a low resource handler. And made
  semaphores and reserved memory handled resources. Made
  vm_try_resource_memory() optionally wait (with timeout), and used that
  feature to reserve memory for areas.
...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26572 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-22 20:36:32 +00:00
Axel Dörfler 736352dcf5 * Added [un]lock_memory_etc() versions that accept a team_id as first argument.
This allows drivers to lock the memory outside of the original team context.
* create_area_etc() got a struct team as first argument, but that should have
  been a team_id.
* Removed delete_area_etc() - there is already vm_delete_area() doing the same
  thing.
* Renamed vm_get_address_space_by_id() to vm_get_address_space(), as there is
  no other method of getting an address space.
* Removed erroneous white space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26455 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-16 22:55:17 +00:00
Ingo Weinhold 0f448d21e5 * Added vm_page_write_modified_page_range(), which is similar to
vm_page_write_modified_pages(), save that it only writes pages in the
  given range.
* Added vm_page_schedule_write_page_range() which schedules all modified
  pages in the given cache's range for writing by the page writer.
* Added _kern_sync_memory() syscall and the msync() POSIX function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25620 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-22 21:51:12 +00:00
Ingo Weinhold 6b202f4e3d * Introduced new header directory headers/private/system which is supposed
to contain headers shared by kernel and userland (mainly libroot).
* Moved quite a few private kernel headers to the new location. Split
  several kernel headers into a shared part and one that is still kernel
  private. Adjusted all affected Jamfiles and source in the standard x86
  build accordingly. The build for other architectures and for test code
  may be broken.
* Quite a bit of userland code still includes private kernel headers.
  Mostly those are <util/*> headers. The ones that aren't strictly
  kernel-only should be moved to some other place (maybe
  headers/private/shared/util).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25486 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-14 03:55:16 +00:00
Ingo Weinhold 58148e2e02 Added new private area protection flag B_KERNEL_AREA, which prevents all
changes to the area (delete, resize, clone) from userland.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25450 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-11 16:02:13 +00:00
Ingo Weinhold 3cf7ecd1e4 * Added <sys/mman.h> header. It declares only mmap() and munmap() yet
and defines the macros needed by them.
* Renamed syscall sys_vm_map_file() to _kern_map_file() and changed the
  path to an FD parameter. Changed vm_map_file() accordingly and
  adjusted the kernel ELF loader and the runtime loader.
* Added syscall _kern_unmap_memory().
* Added bool unmapAddressRange parameter to vm_create_anonymous_area()
  and map_backing_store(). If true and the address specification is
  B_EXACT_ADDRESS, all areas in the specified address range will be
  deleted (unless an area is covered only partially).
* Introduced B_SHARED_AREA flag, which is set on areas that have been
  created by {vm,_user}_map_file() with REGION_NO_PRIVATE_MAP. When
  fork()ing those areas won't be copied CoW, but rather be cloned. This
  is needed for mmap() MAP_SHARED.
* {vm,_user}_map_file() also accept an FD argument < 0, in which case an
  anonymous area is created.
* Implemented mmap() and munmap(). Currently there's the restriction
  that we can't partially unmap areas. Otherwise the functions should be
  rather compliant. We also support the non-POSIX extension
  MAP_ANONYMOUS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24964 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-13 22:52:11 +00:00
Axel Dörfler 6b53669383 * Renamed vm_get_available_memory() to vm_available_memory() to fit better
into our usual naming scheme.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24745 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 12:30:06 +00:00
Axel Dörfler 41f8d41647 Applied patch by Rene Gollent:
* Add a cached_pages field to the system_info structure, and change the
  meaning of the used_pages field to not include cached pages.
* Provide the needed info using the new calls vm_get_available_memory(),
  and vm_page_num_available_pages().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24571 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-25 11:51:45 +00:00
Michael Lotz d1189f0b05 Naive implementation of transfer_area(). It follows the suggested sematics
of the resolved ToDo, but could probably be made more efficient. Instead of
transfering the area, the area is cloned into the target teams' address space
and the original is deleted. This generates a new area_id for the transfered
area (as suggested by the ToDo). Updated syscall prototypes according to the
status_t to area_id return type change.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24320 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-09 12:56:59 +00:00
Axel Dörfler 477c9d1dc0 * vm_set_area_protection() would remap the whole area instead of just the page
it intended to. That resulted in more writable pages where you wouldn't want
  them (ie. allowing the area to change pages in lower caches).
* We were losing modified pages: vm_unmap_pages() sometimes has to preserve
  the modified flag (eg. when called from page fault).
* Both of these were responsible that stealing active pages would crash
  applications - even if less likely, this could also have happened when
  stealing inactive pages. Therefore, I've activated stealing active pages
  again.
* The page writer now pushes the pages of busy vnodes to the end of the queue,
  so that it won't pick them up again too soon (the vnode destruction would
  be in the process of writing those pages back, anyway).
* The page thief now triggers the page writer to run once it has to steal
  active pages. This might be a bit too aggressive, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22495 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-09 11:05:50 +00:00
Axel Dörfler 9d8c209014 * vm_remove_all_page_mappings() now returns an accumulation of the flags of
the unmapped page.
* This is needed by everyone who calls this to make sure modifications to a
  page aren't ignored. Namely, the page scanner and the page thief were
  affected.
* Cleaned up locking the page's cache a bit in page_thief(); there is now
  a helper class that takes care of everything.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22438 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-04 16:36:35 +00:00
Axel Dörfler a6778735f9 bonefish+axeld:
* We now have a page writer that takes some pages from the modified queue
  and writes it back every few seconds. It can be triggered by the page
  scanner to do that more often, though. That mechanism can be greatly
  improved once we have our I/O scheduler working.
* Removed vm_page_write_modified_page() again - it was all "eaten up" by
  the page writer.
* Reworked vm_page_write_modified_pages() a bit: it now uses
  vm_test_map_modification() and vm_clear_map_flags() instead of the
  iterating over all areas which wouldn't even work correctly.
  The code is much simpler now, too.
* You usually put something to the tail of a queue, and remove the contents
  from the head, not vice versa - changed queue implementation to reflect this.
* Additionally, there is now a enqueue_page_to_head() if you actually want the
  opposite.
* vm_page_requeue() allows you to move a page in a queue to the head or tail.
* Replaced vm_clear_map_activation() with vm_clear_map_flags() which allows
  you to clear other flags than PAGE_ACCESSED.
* The page scanner dumps now some arguments with each run.
* Removed the old disabled pageout_daemon() from NewOS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22348 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-28 15:50:26 +00:00
Axel Dörfler 5c4ed86b56 * Moved some definitions from vm_types.h that functions in vm.h need as
arguments into vm.h.
* This should fix the broken build from earlier - thanks Stefano for the note!
* That also allowed to clean some other includes a bit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22331 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-27 13:01:18 +00:00
Axel Dörfler e6dc7903e4 * vm.h no longer includes vm_types.h - only those that actually need access
to the private VM types are including vm_types.h now.
* Removed vm_page, vm_area, vm_cache, and vm_address_space typedefs; it's
  cleaner this way, and the actual types are only used in C++ files now,
  anyway.
* And that caused changes in many files...
* Made commpage.h self-containing.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22329 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-27 12:21:33 +00:00
Axel Dörfler 6d4aea4796 bonefish+axeld:
* Removed the vm_cache/vm_store ref_count duality that besides being a bit ugly
  also created the page dameon cache retrieval problem: now, only areas (and
  cache consumers) retrieve a reference to the store (and therefore, the vnode).
  The page daemon doesn't need to care about this at all anymore, and the pseudo
  references of the vm_cache could be removed again.
* Rearranged deletion of vnodes such that its ID can be reused directly after
  fs_remove_vnode() has been called.
* vm_page_allocate_page() no longer panics when it runs out of pages, but just
  waits for new pages to become available using the new sFreeCondition condition
  variable - to make sure this happens in an acceptable time frame, it'll
  trigger a run of the low memory handlers.
* Implemented a page_thief() that steals inactive pages from caches and puts
  them into the free queue. It runs as a low memory handler.
* The file cache now sets the usage count on the pages it inserts into the
  cache (needs some rework though, cache_io() doesn't do it yet).
* Instead of panicking, the kernel will currently dead lock in low memory
  situations, since BFS does a bit too much in bfs_release_vnode().
* Some minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22315 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-26 00:20:23 +00:00
Axel Dörfler 87689e25ea * sMappingLock is now a mutex instead of a spinlock.
* The vm_translation_map is now correctly held in all of the vm_ mapping
  functions.
* Removed the old vm_daemons.c file - there is now a new vm_daemons.cpp
  which contains the beginnings of our new page daemon.
  So far, it's pretty static and not much tested. What it currently does
  is to rescan all pages in the system with a two-handed clock algorithm
  and push pages into the modified and inactive lists.
* These inactive pages aren't really stolen yet, even though their mappings
  are removed (ie. their next access will cause a page fault). This should
  slow down Haiku a bit more, great, huh? :-)
* The page daemon currently only runs on low memory situations, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22156 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-03 15:41:14 +00:00
Axel Dörfler 58f6e8e5e4 * Merged vm_cache_ref and vm_cache to a single structure (Axel & Ingo).
* Renamed vm_cache.c to vm_cache.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21642 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-18 00:16:27 +00:00
Hugo Santos 698b6d7195 cache/slab: when CACHE_DURING_BOOT is specified, use vm_allocate_early to obtain pages for slabs, and create the associated areas on post bootup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20913 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-29 22:58:46 +00:00
Hugo Santos 6bad493439 pushed the slab init a bit deeper. added a object cache based allocator, including a bootstrap mechanism to have it init during bootup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20896 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-29 02:23:37 +00:00
Hugo Santos 11b5020f2f rewrote the object cache (slab) implementation a bit, preparing for further integration.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20887 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-28 18:53:58 +00:00
Axel Dörfler c6a7ff7a9f * The new vm_page_mappings weren't updated correctly in many cases.
* Added a comment to vm_remove_all_page_mappings() that shows that we need to
  change the mapping spinlock into a mutex.
* Pointed out some potential problems in the code.
* Added vm_page_at_index(), vm_clear_map_activation(), and vm_test_map_activation()
  in preparation of the page scanner rewrite.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20407 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-03-23 11:48:37 +00:00
Axel Dörfler 1594e83f84 * All mapped pages that are not wired (ie. locked) now have a vm_page_mapping object
that points to both, the page and the area the page is in. This will allow a page
  scanner to steal unused pages when necessary.
* The locking is currently done with a spinlock which we might want to have another
  look at one day.
* dump_page() and dump_area_struct() now dump the page mappings as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20356 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-03-08 14:35:26 +00:00
Axel Dörfler ca954b7816 Another work-in-progress towards having extra structures per mapping per page:
* vm_area and vm_page now have a new field "mappings" where they will store lists
  of vm_page_mapping structures. vm_page::ref_count is gone, as it's no longer
  needed (it was never updated correctly, anyway).
* vm_caches now have a type field, ie. CACHE_TYPE_RAM for anonymous areas - this
  makes the stores a bit less independent, but is quite handy in several places.
* Added new vm_map_page() and vm_unmap_pages() functions to be used whenever you
  map in or unmap pages into/from an area. They don't do much more than handling
  vm_page::wired_count correctly right now, though (ie. B_LAZY_LOCK is now working
  as expected as well).
* Moved the device fault handler to vm_map_physical_memory(); it was not really
  used as a fault handler, anyway.
* Didn't notice Ingo's changes to the I/O space region broke lock_memory(). It
  now checks the type of the area that contains the memory, and doesn't lock
  anymore if not needed which solves the problem in a platform independent way.
* Implemented lock_memory() and unlock_memory() for real: they now change the
  vm_page::wired_count member to identify pages that shouldn't be paged out.
* vm_area_for() now uses vm_area_lookup() internally.
* Fixed various potential overflow conditions with areas that reach 0xffffffff.
* Creating anonymous areas with B_FULL_LOCK no longer causes vm_soft_fault()
  to be called, instead, the pages are allocated and mapped (via vm_map_page())
  directly.
* Removed the _vm_ prefix for create_area_struct() and create_reserved_area_struct().
* Fixed a bug in vm_page_write_modified() that would not have enqueued pages that
  failed to be written to the modified queue again when needed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20251 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-02-28 13:24:53 +00:00
Axel Dörfler 3eca858515 * Moved the early startup VM allocation functions from vm_page.c to vm.cpp.
* Renamed them, made everything static besides vm_allocate_early() (previous
  vm_alloc_from_kernel_args()) which now allows you to specify a different
  virtual than physical size, and therefore makes vm_alloc_virtual_from_kernel_args()
  superfluous (which isn't exported anymore, and is now called allocate_early_virtual()).
* Enabled printing a stack trace on serial output on team crash - it doesn't hurt
  for now, anyway.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20244 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-02-27 19:26:40 +00:00
Axel Dörfler f39acd678c * Made vm_area_lookup() part of the kernel private API.
* "sc"/"where"/"bt" now prints the area where the function of the stack frame
  is located in case there is no other information (using the above function).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19800 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-01-14 23:26:20 +00:00
Axel Dörfler 66b7a0f477 Renamed the _kern_init_heap_address_range() syscall to _kern_reserve_heap_address_range()
and made it more powerful.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16825 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-18 12:52:01 +00:00
Axel Dörfler 79f73dbc56 * vm_page::offset is now called cache_offset and is now an uint32 instead of off_t;
this saves 4 bytes per page. To compensate the loss of bytes, the offset is now
  stored in page size units, that's enough to address 2^44 or 16 TB (which is now
  the maximal supported file size!).
* Renamed vm_page::ppn to physical_page_number.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15637 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-21 12:38:31 +00:00
Axel Dörfler d608540b67 Separated vm_address_space.h from vm.h.
Some more cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15614 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-20 15:54:45 +00:00
Axel Dörfler 96e01a27bf * Merged vm_virtual_map with vm_address_space - there was no reason to have
them apart (this even saves a pointer from vm_virtual_map to its address space)
* aspace -> address_space
* vm_create_address_space() did not check if creating the semaphore succeeded
* Removed team::kaspace - was not really needed (introduced a new vm_kernel_address_space()
  function that doesn't grab a reference to the address space)
* Removed vm_address_space::name - it was just a copy of the team name, anyway,
  and there is always only one address space per team
* Removed aspace_id - the address space is now using the team_id
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15609 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-20 13:29:11 +00:00
Axel Dörfler 51a3c450be The short story: we now have MTRR support on Intel and AMD CPUs (the latter
has not yet been tested, though - I'll do this after this commit):
* Removed the arch_memory_type stuff from vm_area; since there are only 8 memory
  ranges on x86, it's simply overkill. The MTRR code now remembers the area ID
  and finds the MTRR that way (it could also iterate over the existing MTRRs).
* Introduced some post_modules() init functions.
* If the other x86 CPUs out there don't differ a lot, MTRR functionality might
  be put back into the kernel.
* x86_write_msr() was broken, it wrote the 64 bit number with the 32 bit words
  switched - it took me some time (and lots of #GPs) to figure that one out.
* Removed the macro read_ebp() and introduced a function x86_read_ebp()
  (it's not really a time critical call).
* Followed the Intel docs on how to change MTRRs (symmetrically on all CPUs
  with caches turned off).
* Asking for memory types will automatically change the requested length to
  a power of two - note that BeOS seems to behave in the same, although that's
  not really very clean.
* fixed MTRRs are ignored for now - we should make sure at least, though,
  that they are identical on all CPUs (or turn them off, even though I'd
  prefer the BIOS stuff to be uncacheable, which we don't enforce yet, though).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-13 16:34:29 +00:00
Axel Dörfler 2ed21b8525 Some work in progress of the MTRR support. Shouldn't do any harm yet :-)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15525 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-13 00:06:52 +00:00
Axel Dörfler 4393552b4d The heap is now located at 384 MB, and creates a reserved range that spans over the
following 1152 MB - that area only guarantees that the heap can grow this much before
the application need the memory for something else. And even then, the heap range
is reused from top-to-bottom, allowing for maximum heap usage. Of course, if the
memory after the heap range is not claimed yet, it can still be claimed by the heap,
too. Added new syscall to create the reserved range.
Fixed a bug in vm_delete_areas(): when it removed reserved areas, the area list
could get messed up.
Fixed a bug in resize_area(): resized areas could never be deleted (missing vm_put_area())!
resize_area() now supports reserved regions (but not perfectly yet, see ToDo items).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12692 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-16 22:15:13 +00:00
Axel Dörfler a3e9996e9d Added support for special reserved address ranges: they will be used
only if memory becomes tight, and then the range is used from end to
start.
This is useful to reserve heap address ranges.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12675 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-15 15:56:55 +00:00
Axel Dörfler 74b043d98d Removed execute property that was set accidently (since CVS days).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11896 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-18 01:50:45 +00:00
Axel Dörfler 14771b1547 Added _kern_transfer_area() syscall.
Added team_id parameter to vm_create_aspace().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11083 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-27 07:06:49 +00:00
Axel Dörfler c00c141557 vm_create_vnode_cache() now fills a vm_cache_ref instead a void pointer.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10427 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-12-13 22:04:26 +00:00
Axel Dörfler 921c7286c3 Added some missing consts.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9871 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 19:23:29 +00:00
Axel Dörfler a49a5623f1 Got rid of regions - we're now back in area-land.
Renamed vm_area::lock to vm_area::protection to be less confusing - wiring
is still called wiring, though (might be renamed to lock later, as that's
how BeOS calls it).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9858 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 14:16:35 +00:00
Axel Dörfler c9293f364f vm_get_region_by_id() and vm_put_region() are now private.
Removed vm_find_region_by_name() (superseded by find_area()).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9845 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 11:14:32 +00:00
Axel Dörfler 95e3a7215d Added prototype for vm_free_kernel_args().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9455 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-23 13:49:19 +00:00
Axel Dörfler afad65ded7 Replaced all remaining PAGE_SIZE with B_PAGE_SIZE, addr with addr_t.
Removed the definition of PAGE_SIZE and addr.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9433 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-20 00:33:06 +00:00
Axel Dörfler 67a53f72af - the arch_vm_translation_map.c exported functions now have the arch_ prefix
- the above file now also exports a function to finally complete the kernel's
  address space translation map after semaphores became available (was just
  not done before)
- renamed some functions, especially the *_init2() functions are now called
  like *_init_post_area() to indicate they are called after the area functionality
  became available
- removed the _struct suffix from certain structures
- fixed some return types
- added prototype for vm_free_unused_boot_loader_range() to be called by
  arch code.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9423 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-19 23:19:10 +00:00
Axel Dörfler 024bab9721 Added vm_delete_aspace() again (although it works a bit differently then before).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9273 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-10 14:55:36 +00:00