Commit Graph

41 Commits

Author SHA1 Message Date
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
Axel Dörfler
a2ff38d818 vm_page no longer keeps a pointer to the vm_cache_ref but to the vm_cache.
This cleans the page handling when having to make an area copy-on-write;
regions belong to vm_cache_ref, pages to vm_cache.
Added prototype for new call vm_copy_area().
Fixed some return types.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9263 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-08 22:54:42 +00:00
Axel Dörfler
1a705b91b7 Removed team::_aspace_id since it already has a direct pointer to it.
Changed the way a vm_address_space is deleted: instead of having to explicitly
call vm_delete_aspace(), the last vm_put_aspace() will remove it.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9254 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-07 17:11:54 +00:00
Axel Dörfler
b1018b0dca Added exec() support function vm_delete_areas().
Fixed some return types.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9246 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-07 15:08:00 +00:00
Axel Dörfler
85f6117e32 Moved the user_memcpy()/strlcpy()/memset() calls to KernelExport.h.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9104 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-29 10:29:00 +00:00
Axel Dörfler
36ce5c0164 Changed the way the vnode cache is set - it's now cleaner and can no longer
allocate a cache twice.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8815 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-03 14:07:00 +00:00
Ingo Weinhold
383cdedbd2 Several follow-up changes required by the changes either to the VFS
syscalls or to the syscall mechanism (which exposed naming and parameter
inconsistencies).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8703 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-08-28 20:45:00 +00:00
Axel Dörfler
e1f53d9bbe Added prototype for vm_unreserve_address_range().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7874 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-09 02:17:16 +00:00
Axel Dörfler
dd9e837ebd Added prototype for vm_reserve_address_range().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7872 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-09 01:05:32 +00:00
Axel Dörfler
ac526351a8 Removed user_strncpy()/strcpy() and backends.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6699 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-02-23 05:26:08 +00:00
Axel Dörfler
f236d16605 Removed the vm_get_region_info() call and the vm_region_info structure -
they are now replaced by get_area_info() and the area_info structure.
get_area_info() still misses some pieces, though.
Added all missing VM user/kernel syscalls.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4352 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-08-20 15:47:52 +00:00
Axel Dörfler
d4055614a4 Made the "name" argument const for create_area_etc() and vm_map_physical_memory().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4329 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-08-20 02:10:14 +00:00
Axel Dörfler
425b6cdf15 Added the new kernel private delete_area_etc() call.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4322 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-08-19 17:22:47 +00:00
Axel Dörfler
640d0ba831 Replaced old create/delete area syscalls with the new ones, added
new kernel private create_area_etc() call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4314 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-08-19 14:11:58 +00:00
Axel Dörfler
41415a1bc0 Now compilable with C++.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3674 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-06-27 02:27:43 +00:00
Axel Dörfler
564cba312e Some header work: removed unnecessary dependencies to stage2.h, fixed
some broken C++ export definitions, added missing licenses etc.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3152 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-05-03 16:03:26 +00:00
Axel Dörfler
1a72f541b5 Added function prototypes for forbid_page_faults() and permit_page_faults().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2135 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-03 01:51:39 +00:00
Axel Dörfler
11fe0cb8de Added prototypes for the sys_/user_ attribute calls.
Changed the file_descriptor structure (more status_t, name removed).
Changed "extern inline" to "static inline" in thread.h/arch_thread.h as those
also work with -O0 -g.
Added prototypes for [arch_cpu_]user_strlcpy().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1454 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-10-08 03:19:57 +00:00
ejakowatz
52a3801208 It is accomplished ...
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-09 12:24:59 +00:00