Commit Graph

1317 Commits

Author SHA1 Message Date
Axel Dörfler 0b46f622d1 * Made struct ring_buffer public (within the kernel).
* Added "syslog" command that dumps the contents of the syslog ring buffer into
  KDL. Use the '-n' option to only show what hasn't been sent to the syslog
  daemon yet.
* When entering the kernel debugger, the current thread ID and name are also
  printed (not only the current CPU).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26684 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-30 10:03:22 +00:00
Axel Dörfler 47ca7595ca First patch by Salvatore to implement XSI semaphores with a few changes
by myself:
* renamed xsi_do_undo() to xsi_sem_undo() (there is more to XSI than sems).
* Fixed coding style issues in sys/sem.h and xsi_sem.cpp.
* Added _kern_*() syscall prototypes to syscalls.h.
* Added a TODO in xsi_sem.cpp and xsi_semaphore.h about moving union semun to
  a shared header.
* Made the team::xsi_sem_undo_requests int32 - due to padding, it would have
  needed 4 bytes anyway; please always use specific types over int/short/long.
* xsi_sem_undo() now checks if it needs to do anything - the calls in team.cpp
  no longer needs to do this.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26676 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-29 12:03:41 +00:00
Ingo Weinhold cfae07b6ac Added kernel private vfs_vnode_io() which performs an io_request on a
vnode (falling back to synchronous I/O if the io() is not supported).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26672 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-28 23:46:50 +00:00
Ingo Weinhold ec598fe493 * Added FS interface hooks io() and cancel_io(). The former is supposed
to provide asynchrounous (or only synchronous, if asynchronous is not
  supported) I/O request support. It will eventually replace
  {read,write}_pages(). None of the FS implementations implement them
  yet.
* Implemented some support functions for request-based I/O. File system
  implementations can use do_fd_io() which passes an I/O request to the
  layer responsible for a given FD, and do_iterative_fd_io(), which
  translates a request for a file to subrequests for the underlying
  device and passes them on. Both fall back to synchrounous processing
  when the io() hook is not supported.
  Furthermore added vfs_synchronous_io() which should be handy for the
  devfs to perform io_requests synchronously for devices that don't
  support the io() hook.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26655 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-28 02:07:20 +00:00
Ingo Weinhold c53e844a89 Moved ENABLE_SWAP_SUPPORT definition to vm_types.h
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26640 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-26 14:36:24 +00:00
François Revol e70ba4e482 Fix build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26634 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-25 15:36:05 +00:00
François Revol 60b11851d4 partial support for 68901 MFP chip as interrupt controller, untested.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26633 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-25 15:05:52 +00:00
François Revol 36ee9f5c62 - use a physical page for natfeat debug output for now
- add 040 cpu and mmu stuff
- use leftover from the page root table to put interrupt vector table to set VBR to


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26627 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-25 00:25:27 +00:00
Ingo Weinhold 3f59678453 Missed in r26625.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26626 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-24 23:34:40 +00:00
François Revol 0ae1957465 - Cleanup
- rewrote early_query() to use the TT0 mapping to remove the page_hole stuff.
- fixed natfeat, using a page set up from the bootloader for now as it wants physical address. At least it's enough to see from the debugger:
load kernel...
kernel entry at 8003711a
Welcome to kernel debugger output!
Haiku revision: 26582
PANIC: unknown cpu_type 68040

Welcome to Kernel Debugging Land...
Running on CPU 0
kdebug>


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26599 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-24 02:59:47 +00:00
François Revol 77cbdee787 Add platform specific kernel args, use them to pass nat_feat info so at least the kernel can print something from the emulator...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26596 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-24 01:10:36 +00:00
Axel Dörfler b4395038ee * Replaced the sAreaHashLock with an rw_lock.
* As this was the last user of the READ_COUNT/WRITE_COUNT definitions in
  vm_priv.h, I removed those as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26582 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-23 16:10:52 +00:00
François Revol 8881176ff3 A module that hooks into the debugger to provide it with a demangle() so at least when using C++ in the kernel stack crawls are meaningful.
It does its job by using part of libsupc++, with fake malloc and friends to make sure it won't double fault.
Works here, but cp-demangle must be extracted by hand from the lib, can't get the rule to work as I want, Ingo ?
Maybe using it directly without malloc hack would be ok with 16KB buffer, but I'm not sure of that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26581 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-23 16:08:16 +00:00
Ingo Weinhold e6bd90c58d * bfs_fsync() was the only place which could cause the
fs_vnode_ops::write_pages() to be called with fsReenter = true. Since
  this is no longer the case, the argument has become superfluous. For
  read_pages() it always was. Removed the argument from the functions
  and all functions that propagated it.
* Some whitespace at the end of lines was removed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26579 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-23 15:47:47 +00:00
Axel Dörfler 4ed05c6869 * Replaced the simplistic semaphore based R/W lock in the vm_address_space with
the new rw_lock locking primitive.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26578 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-23 15:45:40 +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
Stefano Ceccherini 85f2668898 Patch by Dustin Howett (GSOC): Move ACPI probing out of the
bootloader's smp init and into its own unit.
ACPI tables can now generally be found with acpi_find_table(signature).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26538 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-21 07:13:51 +00:00
François Revol 1b5a395d01 Cleanup and fix 040 definitions.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26529 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-20 22:08:39 +00:00
François Revol d14351d2c6 - better not check an entry for validity when we want to fill it
- bitfield definitions of page dirs were reversed... 040 is still wrong though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-20 21:16:37 +00:00
François Revol 74c5e8bd10 - move VADDR_TO_* to headers
- move part of mmu handling to mmu-dependant files and extend ops
- implemented 040 mmu init. doing so I spotted a bug in ARAnyM which ignored [ID]TT0. Linux likely doesn't use them but I was too lazy touse temporary page tables. I also noticed bitfields were in wrong order, to be fixed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26527 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-20 20:31:48 +00:00
Ingo Weinhold 7cb66f0ff0 Added __printf__ format attribute to TraceOutput::Print().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26520 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-20 12:30:22 +00:00
Michael Lotz 69dddbdea1 Initial work towards supporting IO APICs. This cannot work for PCI interrupts
though until we use ACPI for proper PCI IRQ routing through the IO APIC.
Therefore the IO APIC code path is not yet enabled and the IO APIC isn't used.
ISA interrupts would work though, as would PCI interrupts if you'd hardcode
them for your specific configuration.
Note that this change also modifies some parts in the bootloader and in the PIC
setup to make local APICs available even on non-SMP systems. This causes APIC
timers to be used instead the normal PIT if it is available (also on non-SMP
configurations).
Also fixes some general errors in SMP and PIC code as well as some code cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26492 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-18 23:19:41 +00:00
Michael Lotz eb0dca1d33 Add a KDEBUG_ONLY macro for easier handling of code only needed in case of KDEBUG.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26483 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-18 02:05:27 +00:00
Axel Dörfler 50baef55f2 * Removed some old working_set/page daemon stuff from the address space.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26457 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-16 23:36:25 +00:00
Axel Dörfler 6db6b628d6 * Added B_PHYSICAL_BASE_ADDRESS address specification for anonymous areas.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26456 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-16 23:32:25 +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
Axel Dörfler cb9191556c bonefish + axeld:
* Removed the superfluous "flags" parameter from ConditionVariable::Add()
  that we forgot there when we moved the flags field from
  ConditionVariableEntry::Add() to Wait().
* Using this method was therefore not a good idea - only UnixFifo did, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26454 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-16 22:43:50 +00:00
Axel Dörfler b4147ed317 * RescanDiskSystems() now locks the disk device manager, as it clobbers the
disk system lists.
* Added module watching; on module changes, it will now automatically rescan
  the disk systems.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26368 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-10 12:21:05 +00:00
Axel Dörfler 30e5affa9f * Added comment about a missing Remove() variant.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26367 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-10 12:19:22 +00:00
Axel Dörfler a120934388 * Moved KMessage field printing from vfs_boot.cpp::get_boot_partitions() into
KMessage::Dump().
* Improved message dump output a bit (more concise).
* get_boot_partitions() now simply calls KMessage::Dump() instead.
* Added a KMessage::IsEmpty() method.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26365 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-10 10:06:17 +00:00
Axel Dörfler 8d79c7db81 * Made Dump() const.
* Removed superfluous whitespace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26347 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-09 21:32:37 +00:00
Ingo Weinhold 383a9ac435 * Added an explicit boot_splash_uninit(). Not really needed, but makes
it clear when boot_splash_set_stage() must no longer be used.
* Free the memory associated with the kernel args before starting the
  init process. Unlike the original TODO stated there are quite a few
  more users of the kernel args (including the boot splash screen),
  hence we can't really do that earlier, unless we decide to copy the
  data over to the kernel heap. 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26344 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-09 15:25:01 +00:00
Axel Dörfler 191a03fd11 * {add|remove}_node_listener() erroneously had "dev_t" as type of "node".
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26340 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-09 13:04:54 +00:00
Axel Dörfler 78b32dd026 * The rw_lock is now able to nest read/write locks when you have a write lock.
It follows the semantics of the BFS R/W lock, though, that is, if you unlock
  your write lock before the read locks, the read locks effectively become
  write locks, too.
* Added a mutex_transfer_lock() function that will allow you to unlock a mutex
  in a different thread than the one which locked it (only matters if KDEBUG
  is enabled, though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26316 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-08 07:56:49 +00:00
Axel Dörfler 06d5e1b3b6 * Added ReadLocker/WriteLocker classes to auto lock an rw_lock.
* Added *_init_etc() functions to the fs_shell.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26302 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 18:12:33 +00:00
Axel Dörfler af370c702a * Added a recursive_lock_trylock() function.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26297 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 16:17:34 +00:00
Axel Dörfler 52ecda6ecf * Added some optional KDL command and statistics to the file map implementation.
* Turned them on for now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 12:02:24 +00:00
François Revol 26e45f0523 Would work better with the definition...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26289 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 11:30:12 +00:00
Stefano Ceccherini 165db546bf should've been part of the previous commit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26266 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-05 20:45:17 +00:00
Stefano Ceccherini 6e29a04d36 Patch by Dustin Howett which 'modularizes' timers. The best timer is
automatically selected at boot time. Pit and Apic timers are implemented
for now. Thanks Dustin!



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26265 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-05 20:40:06 +00:00
Axel Dörfler 0875ae984f * Preparations for a module listener API - this will be used in the (disk)
device managers.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26239 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-03 11:52:36 +00:00
Michael Lotz b1f4df4a62 Implement heap classes that each have their own range of allocation sizes they
serve, bin sizes and page size. This minimizes the amount of "large"
allocations made in heaps that don't have a bin for the allocation size
(combining multiple pages). This is desirable as such large allocations
are generally pretty inefficient, and also because it separates larger from
smaller allocations better, making the chance of a heap becoming empty higher.
For now there are three heap classes "small", "large" and "huge", with a
predefined set of bin sizes for each. This might need some finetuning later on.
Reduce the grow size to 4MB though as the allocations should now be spread
across heap classes which each grow on their own.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26210 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 23:19:35 +00:00
Axel Dörfler 8531599a27 * KDiskDeviceManager::RescanDiskSystems() now also rescans all partitions with
the newly found disk systems.
* _ScanPartition() now allows to restrict the disk systems to a predefined set.
* _ScanPartition() now even scans partitions that already have a disk system
  assigned; if a better one is found, the existing one is replaced. It will
  ignore mounted or partitions with children, though.
* KPartition now also stores the priority of the disk system assigned to it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26177 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-30 10:36:47 +00:00
François Revol ff41eb66a3 Fix build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26171 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-29 21:08:12 +00:00
François Revol f41c3a5bcd - Move Atari platform class out to a platform file.
- Use the platform object to determine the platform type in system_info.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26166 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-29 18:22:34 +00:00
Ingo Weinhold e1b630c55d * Replaced the global cache pages hash table by an IteratableSplayTree
per cache.
* Changed the strategy vm_cache_acquire_page_cache_ref() uses to ensure
  that the cache isn't deleted while trying to get a reference. Instead
  of the global cache pages hash table lock, it holds the global cache
  list lock now. We acquire + release this lock in delete_cache() after
  removing all pages and just before deleting the object.
* Some small optimizations using the property that the cache's pages are
  ordered, now (vm_cache_resize(), vm_page_write_modified_page_range(),
  vm_page_schedule_write_page_range()).
* Replaced some code counting a cache's pages by simply using
  vm_cache::page_count.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26160 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-28 23:42:41 +00:00
Ingo Weinhold c84d037f75 Added templatized SplayTree class derived from a Java implementation by
D. Sleater. Also added a IteratableSplayTree class that extends
SplayTree, additionally maintaining a singly-linked list, thus allowing
for efficient forward iteration.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26159 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-28 23:22:43 +00:00
Ingo Weinhold 276aa463ef * Replaced the useless InitCheck() method in {Open,Multi}HashTable (it
always returned B_OK) by a Init() method, which sets the initial size
  and returns an error, if that fails.
* Adjusted code using the classes accordingly. Replaced a few
  InitCheck() methods in the network code by Init().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26127 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-24 22:23:57 +00:00
Ingo Weinhold 2965c99fea * Changed the _kern_exec() and _kern_load_image() syscalls. They expect
a flattened argument/environment buffer now. This simplifies the work
  for the kernel a bit, since it can just copy the buffer and check
  whether it looks OK instead of messing around with individual strings.
  The runtime loader also gets a flattened array.
* Set the maximum size of the arguments/environment buffer to 128 KB.
  When more arguments are passed, we fail with a proper error code
  (instead of just truncating the arguments as before).
* On exec*() the first argument was silently replaced by the given path
  name, which is not correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26119 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-24 03:37:07 +00:00
François Revol 5da61ace79 - 040 mmu descriptors, FIXME
- remove unneeded include to make those usable by bootloader.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26117 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-23 23:15:43 +00:00