Commit Graph

990 Commits

Author SHA1 Message Date
Axel Dörfler 5af1dda793 bonefish+axeld:
* Removed the ref_count from vm_areas. You now always need to have the address
  space locked (read or write, depending on what you do) when dealing with
  areas.
* Added helper classes for locking the address space: AddressSpace{Read|Write}Locker,
  and MultiAddressSpaceLocker which can lock several spaces at once and makes
  sure no dead locks can happen.
* resize_area() is now using the MultiAddressSpaceLocker instead of no locking
  at all; ie. it should now be safely to use.
* Disabled transfer_area() for now; it will be changed to work like an atomic
  clone_area()/delete_area(), that is, it will hand out a new ID for the
  transfered area.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21848 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-07 21:46:58 +00:00
Ingo Weinhold cf1539e1a3 Added debug macros ASSERT_ALWAYS_PRINT and ASSERT_PRINT which take
additional parameters that are fed into a dprintf() before panic() is
invoked.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21838 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-06 17:35:57 +00:00
Axel Dörfler edb15b5565 bonefish+axeld:
* Simplified the notification framework: removed the updater stuff completely;
  it was only there to account for some peculiarities of the node monitor which
  we now solved differently.
* NotificationListener no longer includes a doubly linked list link for convenience;
  it might want to listen to more than just one service.
* NotificationService cannot have an abstract destructor.
* Changed the _user_stop_watching() syscall to mirror the Be API; ie. it's no
  longer possible to just remove some flags separately, just to stop listening
  completely.
* Adapted the node monitor implementation to live in the NodeMonitorService class
  that uses the new notification framework.
* Removed the public kernel node monitor API - it wasn't useful that way since you
  couldn't do a lot with the KMessage in the kernel without using a private API.
  Now you will have to use the (private) notification manager to use the node monitor
  from inside the kernel. At a later point, we might introduce a public API for that,
  too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21780 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-01 14:48:44 +00:00
Axel Dörfler 5102d49461 * Added the default constructor to the Iterator class.
* Added a Current() method to the same class that returns the current element again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21779 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-01 14:28:50 +00:00
Axel Dörfler a898ee19d6 Ahem... build fix. Forgot that there were some last minute changes that shouldn't have been part of the commit...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21773 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-31 17:17:51 +00:00
Axel Dörfler bec0386d82 bonefish+axeld: Implemented a robust notification framework for the kernel.
Will be used for node monitoring and other stuff, too (like the Registrar or the
VM low memory handler).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21768 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-31 16:23:40 +00:00
Axel Dörfler 8405223037 axeld+bonefish: Got rid of the ParentType in the HashTableDefinition; it doesn't really
belong there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21766 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-31 16:14:58 +00:00
Axel Dörfler 4bef3723a1 * Followed Ingo's suggestion and send the message manually in the runtime loader;
therefore, we could remove the ugly defines from KMessage again, and compile it
  with KMESSAGE_CONTAINER_ONLY.
* Added KMessage::SetDeliveryInfo() to be able to send messages with a correct
  header.
* Fixed a bug in KMessage::SendTo() that would not send the senderTeam when passing
  a negative value for the parameter, but override it when passing in a valid
  value.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21740 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-29 21:36:49 +00:00
Ingo Weinhold d86af8ce27 * Style cleanup.
* Moved method documentation from headers to source files.
* Fixed small problems (memory leaks, unsafe string duplication,...).
* Added TODOs where I spotted problems.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21721 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-27 16:32:47 +00:00
Ingo Weinhold 2dc6403ddc Addition of write support to the disk device manager. Courtesy of Tomas
Kucera and Jan Matejek.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21719 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-27 12:12:35 +00:00
Axel Dörfler 74c0424a43 * Added a mechanism to retrieve a BMessage with eventual error descriptions
for _kern_load_image().
* Added KMessage to the runtime_loader (a bit hacky, though) - it will use
  it to deliver the above mentioned functionality.
* load_dependencies() did return the wrong status code in case a library
  was missing; now it returns B_MISSING_LIBRARY.
* load_dependencies() will now try to load all dependencies when a report
  message is requested; therefore, all missing libraries are listed.
* Renamed uspace_program_args to user_space_program_args.
* The kernel filled in various members of the user_space_program_args structure
  unsafely, ie. was not using user_memcpy().
* Renamed some local variables in team.c to better fit our style guide (ie.
  uargs to userArgs).
* Changed Tracker to use the new _kern_load_image() variant on Haiku to retrieve
  and report all missing libraries. This fixes bug #1324.
* Adapted kernel_cpp.cpp to the runtime loader as well; the latter will now
  compile with _LOADER_MODE defined.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21715 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-27 02:32:19 +00:00
Axel Dörfler de52a13af7 Unconditionally enable all ASSERTs in the kernel for now; should obviously
be turned off for non-development releases later :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21691 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-23 00:59:30 +00:00
Ingo Weinhold 6d1c68155a axeld + bonefish:
* More conditional debug code (wrt page transitions between caches).
* Replaced debugger command cache_chain by a nicer cache_tree.
* While handling a soft fault: When we temporarily unlock a cache, it
  can theoretically become busy. One such occurrence is now handled
  properly, two more panic() ATM, though should be fixed.
* When merging caches, we do now always replace a dummy page in the
  upper cache, not only when the concurrent page fault is a read fault.
  This prevents a page from the lower (to be discarded) cache from still
  remaining mapped (causing a panic).
* When merging caches and replacing a dummy page, we were trying to
  remove the dummy page from the wrong cache (causing a panic).

The Haiku kernel seems now to run shockingly stable. ATM, we have more
than two hours uptime of a system booted and running over network. We
didn't manage to get it down by fully building Pe, downloading, unzipping,
and playing with various stuff. Someone should finally fix all those app
server drawing bugs, though (hint, hint! ;-)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21672 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-19 22:52:23 +00:00
Ingo Weinhold aeb67bdb8f Increased kernel stack size by another page. The network boot is more
stack hungry and would previously hit the stack limit and thus cause a
double fault. Hopefully we'll be able to reduce the stack foot print at
some time.
PXE boot does now fully work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21663 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-19 14:03:49 +00:00
Ingo Weinhold 16f392da37 Missing in the previous commit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21656 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-19 13:33:41 +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
Ingo Weinhold 9e8dc2a9bb [Sorry, couldn't split this one up any further.]
* Images preloaded by the boot loader had to be modules to be of any use
  to the kernel. Extended the mechanism so that any images not accepted
  by the module code would later be tried to be added as drivers by the
  devfs. This is a little hacky ATM, since the devfs manages the drivers
  using a hash map keyed by the drivers inode ID, which those drivers
  obviously don't have.
* The devfs emulates read_pages() using read(), if the device driver
  doesn't implement the former (all old-style drivers), thus making it
  possible to BFS, which uses the file cache which in turn requires
  read_pages(), on the device. write_pages() emulation is still missing.
* Replaced the kernel_args::boot_disk structure by a KMessage, which can
  more flexibly be extended and deals more gracefully with
  arbitrarily-size data. The disk_identifier structure still exists,
  though. It is added as message field in cases where needed (non net
  boot). Moved the boot_drive_number field of the bios_ia32 platform
  specific args into the message.
* Made the stage 1 PXE boot loader superfluous. Moved the relevant
  initialization code into the stage 2 loader, which can now be loaded
  directly via PXE.
* The PXE boot loader does now download a boot tgz archive via TFTP. It
  does no longer use the RemoteDisk protocol (it could actually be
  removed from the boot loader). It also parses the DHCP options in the
  DHCPACK packet provided by PXE and extracts the root path to be
  mounted by the kernel.
* Reorganized the boot volume search in the kernel (vfs_boot.cpp) and
  added support for network boot. In this case the net stack is
  initialized and the network interface the boot loader used is brought
  up and configured. Since NBD and RemoteDisk are our only options for
  net boot (and those aren't really configurable dynamically) ATM, the
  the boot device is found automatically by the disk device manager.

Booting via PXE does work to some degree now. The most grievous problem
is that loading certain drivers or kernel modules (or related activity)
causes a reboot (likely a triple fault, though one wonders where our
double fault handler is on vacation). Namely the keyboard and mouse input
server add-ons need to be deactivated as well as the media server.
A smaller problem is the net server, which apparently tries to
(re-)configure the network interface we're using to boot, which
obviously doesn't work out that well. So, if all this stuff is disabled
Haiku does fully boot, when using the RemoteDisk protocol (not being
able to use keyboard or mouse doesn't make this a particular fascinating
experience, though ;-)). I had no luck with NBD -- it seemed to have
protocol problems with the servers I tried.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21611 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-15 02:10:15 +00:00
Ingo Weinhold 0274089508 Never include anything in an extern "C" block.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21607 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-15 00:35:10 +00:00
Ingo Weinhold 3532662e0c Added RemoveLeaf() leaf method. Very handy for recursive directory
iteration code using a single KPath object.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21606 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-15 00:34:17 +00:00
Ingo Weinhold dad631290c * Made header includable by C code. In this case a KMessage structure
with the same size as the class is defined.
* The SetTo() methods do now accept an unspecified (negative) bufferSize
  in case of being told to initialize from the given buffer.
* Added handy Get*() methods returning a field element value or a
  supplied default value, if the field element doesn't exist.
* Added also handy Set*() methods setting the value of first element of
  a field, i.e. adding it, if it didn't exist before, otherwise
  replacing the old value. Only for fixed size types.
* Moved _FindType() inline template method into the header.
* Made the source file fit for use in the boot loader. If the macro
  KMESSAGE_CONTAINER_ONLY is defined, the message sending/receiving part
  is omitted.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21605 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-15 00:32:37 +00:00
Axel Dörfler eef8417e27 * Added (non-working) EFI module to the boot loader and its test application.
* Fixed a warning in efi_gpt.cpp.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21532 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-06-30 15:31:01 +00:00
Michael Lotz 5dc45eb4fe * Unified handling of different BMessage formats into MessageAdapter.cpp
* Removed r5_message.cpp and dano_message.cpp accordingly
* Also moved out KMessage handling from Message.cpp to MessageAdapter.cpp
* Fixed some minor style issues in Message.cpp

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21514 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-06-27 20:22:53 +00:00
Axel Dörfler 245aecda8a Got rid of vnode_id and mount_id, replaced with ino_t and dev_t.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21485 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-06-21 19:50:57 +00:00
Axel Dörfler 0cb94db539 Ingo and I fixed a couple of VM bugs in a late night debugging session:
* vm_copy_on_write_area() now does no longer overwrite the ref_count, but keeps
  it's reference to the cache until it has unlocked it.
* It now also locks its reference from the start, preventing any other thread
  to interfere.
* vm_cache_remove_consumer() now detects if it has to remove a foreign busy
  page itself in order to preserve a mapped page.
* vm_soft_fault() now keeps a reference to the cache that owns the page to be
  mapped until it has actually mapped it.
* vm_unmap_pages() removed the mappings of all pages of the area instead of only
  those that are within the requested range.
* Kept (disabled) debug output for convenience.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21482 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-06-21 13:57:46 +00:00
Travis Geiselbrecht c9788912f0 re-enable kernel asserts.
Disabled by default, but all kernel devs are *highly* recommended to turn them on for your builds and see if it trips anything, and then fix it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21477 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-06-21 05:37:46 +00:00
Axel Dörfler b2ed0e7acf Implemented "fail_safe_video_mode" boot option; if you're using it, the app_server
will not load any graphics driver (other than VESA).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21310 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-06-03 20:20:19 +00:00
Hugo Santos 77bf99deb0 fixed the way accept() works in regards to the cookie pointer. It is no longer visible to userspace, we pass the fd instead. Also renamed kernel's shutdown() to system_shutdown as it collides with Posix's shutdown().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21223 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-05-23 19:56:40 +00:00
Ingo Weinhold bdf8a2e1e7 Added Haiku revision number to the kernel (same mechanism as used for
libroot). It's available in the kernel through the private
get_haiku_revision() and added to the kernel syslog output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21173 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-05-19 15:36:32 +00:00
Axel Dörfler 8ca5764554 * Implemented APM generic syscall API to query the current power status.
* PowerStatus is now using this API when compiled for Haiku.
* Note, I'm not sure why yet, but running PowerStatus in the background
  crashes at least my laptop after some time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21154 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-05-16 15:22:23 +00:00
Hugo Santos f6cfc5af19 set ValueIterator's fIndex to the next slot so OpenHashTable's Iterator properly gets it.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20974 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-05-02 14:08:55 +00:00
Hugo Santos 8465a06910 added a ValueIterator to MultiHashTable to present a limited view in result of Lookup()s.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20946 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-05-01 12:16:36 +00:00
Hugo Santos 8aa4c7e370 prepared the ipv4 multicast code for full multicast support.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20945 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-05-01 11:38:59 +00:00
Hugo Santos 0e30c21c70 ipv4: changed the multicast filter to use an hash table to keep source states.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20920 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-30 12:31:31 +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 39af445966 added object_cache_reserve to allow cache users to pre-allocate slabs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20912 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-29 21:45:23 +00:00
Hugo Santos 11debaf6e4 added CACHE_UNLOCKED_PAGES flag to allow caches' pages to be created with no locking instead of full locking.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20911 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-29 20:55:44 +00:00
Hugo Santos 0be6e97788 minimal cleanups
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20901 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-29 13:11:30 +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 6e31ae98f9 some object cache / slab improvements.
- call the reclaimer callback when low on memory.
 - use the depot when on multi-cpu setups (for scalability).
 - fixed the amount of memory spent on slabs for very large objects.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20889 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-28 21:35:23 +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
Hugo Santos 8a96ba39e3 some slab cleanups, split the C interface to another file.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20875 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-28 09:37:38 +00:00
Hugo Santos 505e98538a introduced MultiHashTable, similiar to multimap, but with hash table semantics.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20864 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-27 15:06:30 +00:00
Hugo Santos 01a10fc527 fixed OpenHashTable::Iterator, it wasn't working for a single item.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-27 14:47:34 +00:00
Hugo Santos 8ac2dba331 added iterator to OpenHashTable.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20853 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-27 08:07:38 +00:00
Hugo Santos 5d6551d69f removed some of the slab's initial heavy debugging. we now merge the links into the slab itself resulting in zero overhead per buffer with MergedLink strategy.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20841 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-26 15:40:53 +00:00
Hugo Santos e6fb3d3947 more slab fixes, also introduced a new strategy optimized for medium sized buffers (64 >= x < 512) with lengths other than power of 2 (has an overhead of 2 words per buffer).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20839 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-26 11:38:24 +00:00
Hugo Santos dd89ad0e7e added locking to slab's Cache<>. Now we react to system's low memory conditions freeing up empty slabs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20836 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-26 07:31:19 +00:00
Hugo Santos b8c0d6618e gcc 4 compilation fixes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20835 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-26 06:32:25 +00:00
Hugo Santos 81bc570922 assorted slab fixes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20833 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-26 06:05:08 +00:00
Hugo Santos 81423c91c7 added initial slab code to the kernel. It is still unused, and there is still no VM interaction.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20832 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-26 03:41:24 +00:00