Commit Graph

1335 Commits

Author SHA1 Message Date
Ingo Weinhold
c79e66abb7 Added block_cache_used_memory() that returns the memory allocated by all
block caches for the block cache buffers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26836 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-06 00:09:31 +00:00
Ingo Weinhold
5db876653b Added object_cache_get_usage() function that returns the memory
allocated by an object cache.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26835 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-06 00:07:55 +00:00
Ingo Weinhold
57f2b5a013 * Changed the meaning of the {KERNEL,USER}_STACK_SIZE macros to not
include the guard pages. Adjusted the kernel and boot loader code
  accordingly -- the guard pages size is added/not removed respectively.
  The stack size passed to _kern_spawn_thread() is now the actually usable
  size, and it is no longer possible to specify a size smaller than or
  equal to the guard pages size.
* vm_create_anonymous_area(): Precommit two pages maximum -- a stack with
  only one page usable size obviously doesn't need two pages.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26819 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-05 17:19:46 +00:00
Ingo Weinhold
783c4e20b4 Added comment.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26806 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-04 21:45:50 +00:00
Axel Dörfler
423fcd43ae * Shuffled initializers around: the team, ELF, and module initializers come
now a lot earlier.
* That makes it now possible to use modules pretty early in the kernel (like
  before timer_init(), or int_init_post_vm()).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26790 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-04 13:26:13 +00:00
Ingo Weinhold
bf877a18ab Should have been part of r26779.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26781 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-04 03:19:10 +00:00
Ingo Weinhold
bca3215f8a * Introduced x86_get_double_fault_stack(), which returns the address
and size of the double fault stack.
* is_kernel_stack_address() does now also check whether the given
  address is on the double fault stack. This fixes stack traces on
  double faults, which were broken (i.e. went only to the double fault
  iframe) since we started checking whether the addresses are on the
  kernel stack at all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26775 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-04 02:51:38 +00:00
François Revol
39eb52d83b Implemented keyboard input for KDL.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26758 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-03 15:57:03 +00:00
Axel Dörfler
011d716270 * Removed the feature_string from the cpu_ent structure.
* Dumping the features as string is now a one time thing, that only happens
  when DUMP_FEATURE_STRING is defined to 1.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26733 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-02 15:50:50 +00:00
Axel Dörfler
272457553e * Renamed kernel_startup to gKernelStartup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26731 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-02 15:03:03 +00:00
Axel Dörfler
15374c5dbd * Renamed thread_spinlock and team_spinlock to gThreadSpinlock and
gTeamSpinlock.
* Renamed the static global variables in smp.c to match our style guide.
* Minor other cleanup.
* Removed superfluous white space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26730 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-02 14:55:53 +00:00
Salvatore Benedetto
51daeb7147 - Fixed warnings
- Fixed deadlock in xsi_sem_undo - RecordUndo
- Fixed issue in xsi_sem_undo: if the semaphore set does not exist
anymore, ignore the request but do remove the process from the sUndoList,
which wasn't previously done.
- free() in ClearUndos was called with interrupts disabled
- when a semaphore set ends to exist, remove all it's sem_undo request as it's ID
will be reused in the future.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26727 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-02 11:30:55 +00:00
François Revol
2fc21d4fad Use a bool to check if an irq was acknowledged by the MFP, else we don't call the handler.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26725 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-02 00:36:33 +00:00
Axel Dörfler
aaad303e67 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26712 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-01 09:57:14 +00:00
Ingo Weinhold
12c9f1761f * Added thread block type constant for rw_locks, so that they are listed
correctly by the "thread" and "threads" debugger commands.
* Added "rwlock" debugger command.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26703 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-31 20:43:40 +00:00
Axel Dörfler
f9ae429701 * Replaced our SinglyLinkedList with one that has a similar interface as the
DoublyLinkedList. Not yet tested.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26697 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-31 11:47:17 +00:00
Ingo Weinhold
7f12cc54a7 * It is now supported that I/O operations and requests are only handled
partially (e.g. due to hitting the end of file). The respective
  classes have grown new methods and attributes to deal with that. The
  "finished" callbacks have got additional parameters to indicate
  whether the transfer was only partial and how much has been
  transferred. Other callbacks and functions have a size_t* in/out
  parameter instead of a simple size_t, now.
* vfs_{read,write}_pages() do now use the I/O request framework instead
  of the underlying FS's {read,write}_pages() hooks (those should be
  unused now). Furthermore they've got an additional "flags" parameter,
  which is passed to IORequest::Init(), i.e. it allows to specify that
  the given vecs refer to physical addresses.
* The file cache's read_into_cache() reads directly into physical
  pages, now.
* Fixed bug in DoIO::IO(): The offset was not adjusted, so that all
  pages were incorrectly transferred from/to the same location.
* Fixed broken subrequest scheduling loop head in
  do_iterative_fd_io_iterate().
* Adjusted the test driver and implemented its io() hook. Using this
  driver I/O requests are passed all the way from the VFS/VM to the
  driver and through the I/O scheduler. It even seems to work. :-)
* Added missing const to the iovec* parameter of the IORequest::Init()
  methods.
* Disabled some debug output by default. Added new optional debug
  output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26692 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-30 23:34:10 +00:00
Axel Dörfler
37de5a0d83 * The rw_lock now behaves just like a recursive locker if KDEBUG_RW_LOCK_DEBUG
is defined to 1; this allows asserting the read lock case, too.
* Added ASSERT_{READ|WRITE}_LOCKED_RW_LOCK() macros. The read assertion is only
  working when KDEBUG_RW_LOCK_DEBUG is defined to 1, the write assertion works
  always.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26686 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-30 15:27:58 +00:00
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