Commit Graph

343 Commits

Author SHA1 Message Date
Axel Dörfler
c1b5724035 My last commit broken vm_clone_area(): it didn't grab a reference to its
cache, and therefore, let the kernel crash easily.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15649 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-22 00:04:28 +00:00
Axel Dörfler
db39fa281e Moved the headers of the different store implementations into the VM source
directory; they are not used outside the VM.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15648 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-21 20:08:49 +00:00
Axel Dörfler
16cfe613cd Fixed vfs_lookup_vnode() - it's not called with the mutex already locked anymore.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15647 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-21 20:07:33 +00:00
Axel Dörfler
14e132e2bc Reactivated check for failed semaphore creation - after kernel startup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15644 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-21 17:58:49 +00:00
Axel Dörfler
a8a13a0ae5 During early boot, there are no semaphores - but vm_cache_ref are already created...
Must be further investigated (if the locks are created later or not...)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15643 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-21 17:47:50 +00:00
Axel Dörfler
1e12fe8e5d A vm_cache can no longer be created with a NULL vm_store (nobody did it before,
but it would have worked - and crashed soon after).
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15642 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-21 17:05:50 +00:00
Axel Dörfler
ea2cd27e57 * Fixed the strange vm_cache_ref reference count mechanism: now, a fresh
vm_cache_ref starts with a reference count of 1. When acquiring a vm_cache,
  you no longer need to worry if that should go through the vm_store, or not;
  as it now always does.
* map_backing_store() no longer needs to play with the vm_cache_ref
  references.
* that simplified some code.
* vfs_get_vnode_cache() now grabs a reference to the cache, if successful.
* better balanced vnode ownership on vnode_store creation (vnode_store
  released the vnode before if its creation failed).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15641 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-21 17:00:03 +00:00
Axel Dörfler
d5abe15e84 The name elf_load_user_image() chooses for the area is now actually limited
to B_OS_NAME_LENGTH bytes, instead of 64. Also, it will now only consider
the leaf name for the area.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15640 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-21 16:47:46 +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
4318316c65 This should fix PPC build after recent changes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15610 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-20 13:31:38 +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
9d845483cf Got rid of two ToDo-items: instead of clearing the PAGE_MODIFIED flag after having
written the page, we now do it before, so that it cannot lose any changed data
anymore; it doesn't matter if the page is written to while writing it back, the
worst thing that can happen is that we write the same page twice. Also, we don't
rely on the PAGE_MODIFIED bit anymore, we now check all mappings of that page
to find all modified pages, no matter how far the (currently disabled) page
daemon had come.
Also, destroying an area will now result in writing back changed pages - this
is only really important for memory mapped files, though, and should probably
be avoided for other vm_store types.
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15597 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-19 23:01:11 +00:00
Axel Dörfler
89f5f72a15 * Added debug output to vm_low_memory.cpp.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15568 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-16 17:35:03 +00:00
Axel Dörfler
d0d37bdfd1 * vfs_init() is now called later in the startup sequence - since no core kernel
service depends on it, it doesn't make any sense to call it that early in the
  game.
* The VFS now has a low memory handler for vnodes as well. If there is enough
  memory left, it won't free any vnodes anymore.
* Potential crashing bug fix: some functions did not check if the FD passed
  in belonged to the right type; they just assumed it had a valid vnode, but
  it could have had a mount structure associated as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15566 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-16 16:11:36 +00:00
Axel Dörfler
4c0f46e2a3 The block_cache::LowMemoryHandler() must check if it could acquire the cache's lock;
it might have been deleted in the mean time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15565 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-16 15:50:13 +00:00
Axel Dörfler
182f88dda1 * block_cache_delete() now deletes the cache with with its lock held.
* the link were not initialized in cached_block, as its constructor were never called
  (was using malloc/free instead of new/delete).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15564 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-16 15:45:00 +00:00
Axel Dörfler
005108a262 Forget to remove debug output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15563 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-16 14:33:10 +00:00
Axel Dörfler
37bd67edb8 Now also flushes dirty blocks correctly (cannot happen if transactions are used,
ie. never happens with BFS).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15562 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-16 13:53:34 +00:00
Axel Dörfler
41e866f3ae The block cache now registers and uses a low memory handler that will flush
unused blocks when needed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15561 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-16 13:49:23 +00:00
Axel Dörfler
7d7f4675bb * Added some cpuid eax == 1 feature definitions to arch_cpu.h
* Renamed IA32_MTR_WRITE_COMBINED to IA32_MTR_WRITE_COMBINING.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15559 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-16 12:25:49 +00:00
Axel Dörfler
ebdb9dfebf Blocks are now put into an unused list when they aren't used.
When memory gets low, the blocks on that list are also freed - but right now,
that only happens when a block is put back (not directly on demand, ie. via
a low memory handler).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15552 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-15 21:35:19 +00:00
Axel Dörfler
1534aa236c Added new function vm_low_memory_state() that returns the current low
memory status.
Added new B_NO_LOW_MEMORY constant for the usual case.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15551 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-15 21:30:28 +00:00
Axel Dörfler
b3e26f5b8f Documented the block cache allocator a bit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15546 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-15 16:23:30 +00:00
Rudolf Cornelissen
09116ce3bc removed the switch statement for determining number of CPU's in a system. This should fix CPU 'hlt' instruction not being executed in SMP systems idle loop. Thanks Axel and Ingo for pointing me at this.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15544 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-15 12:25:11 +00:00
Axel Dörfler
e0e9a3e69f * We now support the global page feature of x86 processors that prevents
kernel TLBs from being flushed on context switch.
* new arch_cpu_user_TLB_invalidate() that now does what arch_cpu_global_TLB_invalidate()
  did before.
* arch_cpu_global_TLB_invalidate() will now flush all TLBs, even those from the
  kernel.
* some cleanups.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15535 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-14 17:07:37 +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
b7e7814c79 Prints a warning if open_modules_list() or get_next_loaded_module_name() are
called before module_init(). Maybe it's even better to drop into the kernel
debugger.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15524 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-13 00:01:19 +00:00
Axel Dörfler
97ec781e94 Added (empty) memory type functions to the PPC port.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15521 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-12 17:13:15 +00:00
Axel Dörfler
7c0a93573b Preparation for MTRR support, code is completely untested, though.
The CPU specific MTRR code will be in modules.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15520 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-12 17:04:36 +00:00
Axel Dörfler
381d6b57f6 Make sure system can continue after panic.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15519 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-12 17:00:46 +00:00
Axel Dörfler
b53cc465d6 Moved declaration of gBootDevice into its own header.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15518 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-12 16:06:33 +00:00
Axel Dörfler
aa9d29ba97 Another SMP oversight: the TSS was not explicetly loaded for all CPUs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15517 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-12 14:38:26 +00:00
Axel Dörfler
185a5a57cd Removed old PPC framebuffer console (this code is superseded by the on screen KDL). Updated files to match current arch API. This fixes the kernel build for PPC.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15411 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-08 11:03:24 +00:00
Axel Dörfler
82e9603fbf Disabled page daemon for now - it doesn't any good yet (but easily sucks up your CPU power).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15308 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-04 16:47:52 +00:00
Axel Dörfler
6aae81b3e1 Quick and dirty fix to allow our heap to allocate more than 64kB.
However, it will never free those allocations again.
This fixes the problems due to Rudolf's recent driver updates.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15248 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-30 19:28:46 +00:00
Ingo Weinhold
353d20c0c5 * libroot and the runtime loader are no longer built with kernel rules.
* New rule Ld, analogously to KernelLd.
* Added StaticLibrary parameter for supplying additional objects.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15191 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-27 13:31:50 +00:00
Ingo Weinhold
38f6264454 Reorganized building of kernel, boot loader, and libroot.
Each component is built in the respective subdirectory now
and no longer in src/system/Jamfile.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15184 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-27 00:27:19 +00:00
Axel Dörfler
2bea891d75 Debug output change: vm_page_fault() doesn't kill the team anymore, it just
sends a SIGSEGV signal (and lets the debugger handle the rest).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15145 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-25 12:43:14 +00:00
Axel Dörfler
ecf2e38db2 Reset last_acquirer in case the semaphore gets released.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15144 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-25 12:34:54 +00:00
Axel Dörfler
9240f51352 Fixed a major oversight in the interrupt handling: when a user space
application got interrupted, thread_at_kernel_exit() was called - but
that expected interrupts to be enabled for signal handling.
However, only exceptions 3 (breakpoint) and 99 (syscall) are trap
gates, and thus, only those actually had interrupt enabled at that
point.
If a KILL signal was pending when a hardware interrupt interrupted a
user space thread you were entering KDL before ("acquire_sem() called
with interrupts turned off").
Thanks to mouse interrupts I finally got this often enough to find
this...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15143 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-25 12:26:56 +00:00
Axel Dörfler
2b028fcaa0 Removed one TODO from the list: in case pages_io() fails, read_chunk_into_cache()
will no longer panic, but free its allocated pages.
I ran into this because BFS managed to create a file without data stream but
with a length larger than 0...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15093 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-23 18:36:38 +00:00
Ingo Weinhold
aeef8a1098 Reverted to the previous version. I was too quick; the boot loader
doesn't link against libsupc++ and still needs the symbol.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14972 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-16 20:51:17 +00:00
Ingo Weinhold
9b2e76121b No need to define __cxa_pure_virtual. We're linking against libsupc++ anyway.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14967 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-16 17:35:41 +00:00
Ingo Weinhold
6d865282d4 Link the kernel against libsupc++.a -- we're using RTTI after all. Added
missing symbols to kernel_cpp.cpp.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14965 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-16 17:25:54 +00:00
Ingo Weinhold
758b1d0e05 Fixes that make Haiku build with gcc 4. Mainly out of the following
categories:
* Missing includes (like <stdlib.h> and <string.h>).
* Linking against $(TARGET_LIBSTDC++) instead of libstdc++.r4.so.
* Local variables shadowing parameters.
* Default parameters in function definitions (as opposed to function
  declarations).
* All C++ stuff (nothrow, map, set, vector, min, max,...) must be imported
  explicitly from the std:: namespace now.
* "new (sometype)[...]" must read "new sometype[...]", even if sometype is
  something like "const char *".
* __FUNCTION__ is no longer a string literal (but a string expression), i.e.
  'printf(__FUNCTION__ ": ...\n")' is invalid code.
* A type cast results in a non-lvalue. E.g. "(char *)buffer += bytes"
  is an invalid expression.
* "friend class SomeClass" only works when SomeClass is known before.
  Otherwise the an inner class with that name is considered as friend.
  gcc 4 is much pickier about scopes.
* gcc 4 is generally stricter with respect to type conversions in C.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14878 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-12 23:27:14 +00:00
Axel Dörfler
04cd47db59 common_access() now follows the same logic as traversing paths: if the file system
doesn't export the fs_access() function, it assumes access is granted.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14816 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-10 11:17:03 +00:00
Marcus Overhagen
9ae89b4535 bugfix
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14710 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-04 20:01:47 +00:00
Axel Dörfler
c5eb28a359 Now uses the new image_debug_lookup_user_symbol_address() call.
The stack frame that got interrupted were missing from the stack output
(and thus the call that got us into the kernel).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14706 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-04 17:28:08 +00:00
Axel Dörfler
4d18991268 Added a image_debug_lookup_user_symbol_address() that one day may find symbol names
in user images - right now, it only finds the image name and base address.
Fixed "images" debugger command - it actually acquired a mutex to dump the images...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14705 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-04 17:25:58 +00:00
Marcus Overhagen
378e08b775 improved debug output
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14704 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-04 17:10:50 +00:00
Axel Dörfler
7b7c38a2a7 The "where" or "sc" command now switches the page directory to the specified thread
to be able to follow the stack trace into userland.
No symbols there, yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14697 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-04 15:58:04 +00:00
Marcus Overhagen
164426a506 added a unreal kernel debugger command
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14670 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-03 21:03:51 +00:00
Marcus Overhagen
93d0c77a96 added debugging code, can be disabled, currently enabled
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14669 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-03 21:03:06 +00:00
Ingo Weinhold
571bb2b2a6 Simplified the x86 syscall interface a bit. We no longer pass a pointer
to the parameters nor the number of parameters; the kernel is able to
get both without problems.

The syscall functions in libroot (_kern_*()) are now self-contained
(they don't "jmp" to separate code anymore), which at least
theoretically allows gdb to print a stack trace with the syscall
function on the top when a thread is currently performing a syscall.
Practically it doesn't work yet, though, since those functions are
frameless (i.e. create no stack frame) which needs special support
I haven't implemented yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14661 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-03 14:36:46 +00:00
Ingo Weinhold
37a25a6ceb * Fail, if debug_thread() is invoked for the debug nub thread.
* To always be on the safe side, thread_hit_debug_event() now checks
  whether the thread is the debug nub thread.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14655 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-03 00:40:36 +00:00
Axel Dörfler
06be24a748 The spurious debug exception sometimes comes very often in QEMU - it's now only
printed when tracing is turned on.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14634 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-02 12:41:44 +00:00
Axel Dörfler
2e8eec5722 Now also prints the parent's team ID as part of the team info.
No longer uses dprintf() in the kernel debugger.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14631 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-02 10:43:30 +00:00
Axel Dörfler
05a7818c85 Removed the "list all team" functionality from the debugger command "team", and
moved it into the new command "teams". Now also lists the parent team.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14630 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-02 10:38:28 +00:00
Axel Dörfler
dcdebb933e The debugger command "threads" now accepts an argument that let's you filter the
threads listed by team ID. Also, the thread's team is now printed in the list as
well.
Minor cleanup (renamed "t" to "thread" where appropriate).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14629 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-02 10:24:37 +00:00
Axel Dörfler
0e1358bd5c Applied a patch from Alexander Deynichenko: added missing signal definitions.
That also includes some XSI signals, SIGPOLL and SIGVTALRM, dunno if we will every support
those in a useful way.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14593 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-31 12:39:29 +00:00
Axel Dörfler
ce357f41f9 Removed "bootfs" and the support for it in other components.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14585 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-30 23:00:14 +00:00
Ingo Weinhold
338b8dc301 Merged changes from branch build_system_redesign at revision 14573.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14574 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-29 16:27:43 +00:00
Axel Dörfler
90ce9e8305 Added calls to read and write the MSR, the machine state register.
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14537 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-26 23:39:38 +00:00
Axel Dörfler
8fcd6b8e61 * renamed smp_boot.c to smp.cpp
* there is now a "Disable Hyper-Threading" safemode in the boot loader
* the SMP & HT menu items are now added in smp.cpp - and are only added
  if the system supports one of them.
* more cleanup to smp_apic.h
* removed cpuid() from the boot loader's support.S - instead, it will now
  use the one from the kernel.
* added a very weak HT detection: if the MP config only listed one CPU,
  and this CPU supports HT, we enable the other logic processor manually -
  as this currently doesn't work, it's disabled, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14536 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-26 22:57:13 +00:00
Axel Dörfler
3207006695 send_signal_etc() is now safe to be used on an SMP machine.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14523 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-25 20:18:29 +00:00
Axel Dörfler
ef7bac18bb Implemented call_all_cpus(), and get_cpuid() properly (tested only the latter, though).
The "data_ptr" parameter is now only freed if you specify SMP_MSG_FLAG_FREE_ARG
when sending the ICI message.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14519 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-25 18:18:11 +00:00
Axel Dörfler
6cd505cee7 Changed the boot procedure a bit.
Extracted scheduler_init() from start_scheduler() (which is now called scheduler_start()).
Moved scheduler related function prototypes from thread.h to the new scheduler.h.
Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14518 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-25 16:59:12 +00:00
Axel Dörfler
888248d42e The kernel now panics if it didn't found any possible boot partitions.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14506 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-24 22:12:41 +00:00
Marcus Overhagen
31b6023a85 Fixed an off-by-one error in the read_from_buffer function,
testcase: size=7, in=7, first=0, read length=7

Fixed an off-by-(buffer->size) error in the write_to_buffer function,
testcase: size=7, in=2, first=3, write length=3



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14473 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-22 21:43:54 +00:00
Axel Dörfler
3d5ecf962c Minor cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14472 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-22 16:53:49 +00:00
Axel Dörfler
9386f2e6a1 Missed a warning.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14466 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-21 14:04:17 +00:00
Axel Dörfler
8210eff8e8 Didn't compile with debug output turned on.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14465 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-21 14:02:17 +00:00
Axel Dörfler
a4c373515e When a team died, only the time of its children were added to its parent
dead children time counters - not its own time.
Moved time calculation to team_remove_team().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14464 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-21 00:15:17 +00:00
Axel Dörfler
7d9e0897ed Implemented sigsuspend() - not tested, though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14459 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-20 18:09:50 +00:00
Axel Dörfler
e4d36dd1f4 Implemented sigpending().
Forgot to atomically get some thread_debug_info values.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14458 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-20 17:19:46 +00:00
Axel Dörfler
50374cbdca Changed the signal handling code so that handle_signals() can be called without
having the thread lock held and interrupts disabled.
Cleaned up the signal handling code, and fixed some minor bugs with blockable
vs. non-blockable signals.
thread_debug_info was using uint64 for signals sets instead of sigset_t.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14457 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-20 16:56:04 +00:00
Axel Dörfler
7121425eb5 Turns out we could remove a mount point...
Under BeOS remove_vnode() is failing in this case, which looks like a good idea to imitate.
Also, pipefs/rootfs didn't handle that case - they even removed the entry before calling
remove_vnode() - they now behave correctly. And also BFS now returns the actual error code
received from remove_vnode() instead of B_ERROR.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14456 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-20 16:34:18 +00:00
Axel Dörfler
1c88c851ad Turned off debug output again - also temporarily removed the file cache warning
about our block_io module not honouring the total length in read_pages().
Removed drops into the debugger when there is a block without an "original"
data buffer - that's completely normal and happens when someone asks for
a cleared block that is not yet in the cache.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14437 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-19 23:01:57 +00:00
Axel Dörfler
d7f0a6f215 If register_preloaded_module_image() fails, a warning is printed.
get_next_loaded_module_name() no longer prints anything if tracing is enabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14436 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-19 22:45:13 +00:00
Axel Dörfler
ca7c5a9e13 Implemented cache_detach_sub_transaction() - not tested yet, though.
Added and implemented new functions cache_blocks_in_[sub_]transaction().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14431 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-19 16:46:17 +00:00
Axel Dörfler
94752292dd First go at an implementation of sub transactions - code is not yet tested, though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14429 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-19 14:37:29 +00:00
Axel Dörfler
0fc0129604 Fixed another stupid bug in all readv()/writev() versions: the position of
the read/write access was only correct for the first entry in the iovec.
These functions should be updated to use read_pages()/write_pages() where
possible, anyway - right now, they only save some kernel calls, while they
could be processed by the device at once.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14413 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-18 19:51:47 +00:00
Axel Dörfler
28953e6c2b Fixed two stupid bugs in _kern_writev() and _kern_readv() - they accidently
tried to write from/read to the userland file descriptor instead of the one
of the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14412 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-18 19:11:07 +00:00
Axel Dörfler
3ea780cdf9 If booted from an image, the list of possible boot partitions is now ordered by
some heuristic: when you booted from a CD, CDs are preferred; else, volumes with
names like "Haiku" or "System" are preferred - if someone has better ideas, please
shout.
Note, this heuristic will only come into play if the boot loader was loaded from
an image (ie. floppy/CD/network), and you didn't choose any boot device.
Added evil methods to the Stack class that come in handy (you can now directly
access the array) for this.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14410 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-18 18:45:55 +00:00
Axel Dörfler
2db3fced5f Moved vfs_bootstrap_file_systems() and vfs_mount_boot_file_system() out of vfs.cpp
and into its own file vfs_boot.cpp.

Added basic support for booting from CD - it doesn't give CDs a higher priority,
so you could end up booting from HD when you didn't explicetly select "CD-ROM"
in the boot loader. Eventually, it should only boot from HD in this case, if
booting from CD failed (because of a missing boot partition or whatever).

fs_mount(), _kern_mount(), and _user_mount() will now return the dev_t of the
mounted device, and not just B_OK. Maybe we should have fs_unmount() work on
a dev_t instead of a path as well...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14403 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-17 14:01:04 +00:00
Axel Dörfler
76a377394e arch_debug_console_init() is called with args == NULL in case of an early
boot message - unfortunately, it crashed when used this way until now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14399 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-17 10:15:42 +00:00
Axel Dörfler
313ffb09da Improved debugging output a bit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14379 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-14 11:20:42 +00:00
Axel Dörfler
9a63d90397 Added kernel private VFS functions vfs_entry_ref_to_vnode() and vfs_vnode_to_node_ref().
Minor cleanup of vfs.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14314 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-06 09:26:27 +00:00
Axel Dörfler
681779f1c8 Our close-on-exec flag handling was broken: it's supposed to be specified per slot, not
per file descriptor (a descriptor can be shared among several slots). There is now a
second table in the io_context structure that contains that information in a bitmap.
There are now two new (private) functions to control the close-on-exec flag, fd_close_on_exec(),
and fd_set_close_on_exec().
F_DUPFD, dup(), and dup2() are supposed to clear the close-on-exec flag on the duplicated
slot - this fixes bug #57 (no output after a redirect of a shell builtin).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14313 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-06 09:02:59 +00:00
Axel Dörfler
e90c3fec10 dup2() didn't close the evicted file descriptor (ie. call its close hook) - it just
removed it.
Added comment why there is an explicit dup2() at all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14312 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-06 08:55:19 +00:00
Axel Dörfler
1670b8f596 num_used_fds counting was broken for dup2() and vfs_new_io_context() when it was
used with a parent context.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14311 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-06 08:53:17 +00:00
Axel Dörfler
e8d4a05d8b Renamed the "iocontext" command to "io_context" to match the structure name.
It now also accepts a team ID and will then dump its io_context.
Accidently mixed used/max FD counter.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14310 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-06 08:47:03 +00:00
Axel Dörfler
9e3ebf4033 exit_thread() no longer sends a signal when it's called from a kernel thread - instead,
it will exit directly to have the same behaviour as in user space (where it doesn't
return to the caller, since signals are handled before returning to user space).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14309 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-06 08:43:10 +00:00
Axel Dörfler
8d3256a4ad The "thread" debugger command now also accepts an address for the thread structure.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14308 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-06 08:40:35 +00:00
Axel Dörfler
7dc1c65f2f Improved "team" debugger command: it will no longer crash on the kernel team, it
will no longer use vm_get_kernel_aspace() (which acquired a semaphore) and it now
accepts decimal team IDs as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14307 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-06 08:36:37 +00:00
Axel Dörfler
759a38d144 load_kernel_add_on() leaked FDs in case the image was already loaded.
And that was causing bug #50 (which is fixed now).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14305 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-05 16:41:04 +00:00
Axel Dörfler
333735e881 Added a new debugger command "iocontext" that prints out info about the kernel's
I/O context (or a specified one) including its FDs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14304 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-05 16:39:45 +00:00
Axel Dörfler
08da6fccdd Introduced a sane concept of ownership for the team_args structure: now load_image_etc()
and exec_team() have an additional "kernel" argument and will copy the arguments
themselves (or rather, delegate that to create_team_arg()).
When team_create_thread_start() is called, it will take over ownership and is
responsible for deleting it - this also fixed a memory leak in case the user
stack area couldn't be created.
Also changed comment after exit_thread(): since this call only delivers a signal, the
code after it will still get executed.
This fixes the crashing symptom of bug #50.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14303 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-05 15:32:48 +00:00
Axel Dörfler
f10cba9aec Changed get_mount() to return a status code instead of just the mount or NULL.
Some fields of fs_mount were not properly initialized when FS's mount function
was called, and therefore, could let get_mount() return a mount structure that
was not yet read for public consumption (this should fix bug #51).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14223 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-09-22 17:45:43 +00:00
Axel Dörfler
d86d4063b0 thread_create_thread_start() is a thread_func and therefore returns int32 not status_t
(that's what our headers say).
Some style fixes in signal.c.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14192 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-09-16 12:52:59 +00:00
Jérôme Duval
ab38c90461 added a libroot sigpending, kernel support isn't implemented
(fixed partly bug #49)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14181 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-09-13 16:12:20 +00:00
Jérôme Duval
3f84430938 added a trace and changed err type in team_create_thread_start()
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14180 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-09-13 15:44:30 +00:00
Jérôme Duval
96e6579454 added a libroot sigsuspend, kernel support isn't implemented
(fixed partly bug #48)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14129 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-09-08 12:26:16 +00:00
Axel Dörfler
47a54bea53 Rootfs now starts with 1 for the first inode ID.
Instead of -1, vnode_path_to_vnode() now returns the ID of the starting vnode when it
doesn't need to traverse the path at all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14081 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-28 20:08:32 +00:00
Axel Dörfler
b3373253a4 The generic syscall now returns more correct status codes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14078 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-28 14:10:12 +00:00
Axel Dörfler
43ffbcc46e If a page fault happens from within the kernel debugger, vm_page_fault() is no
longer called - instead, it get its own mini page fault handler: if the thread
has a fault handler, that one will be executed.
Exiting the debugger (with the "continue" command) no longer causes the
vm_page_fault() routine to be called if interrupts were disabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14070 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-26 02:43:15 +00:00
Axel Dörfler
29cf7df355 kernel_debugger_loop() now memorizes the last sDebuggerOnCPU value, so that
the CPU value doesn't get lost when exiting a nested debugger.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14069 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-26 02:39:24 +00:00
Axel Dörfler
e432cef296 Updated a few more hash functions to be able to deal with negative numbers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14067 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-26 02:07:41 +00:00
Axel Dörfler
f26e4a1c98 Made hash functions able to deal with keys with negative numbers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14066 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-26 02:02:33 +00:00
Axel Dörfler
7b285866ff Fixed hash functions: when the key was lower than 0 (could happen with entry_refs
and node_refs passed in) they returned an invalid index (larger than range).
Fixed rootfs compilation with tracing turned on.
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14065 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-26 02:01:21 +00:00
Axel Dörfler
19dfa58852 add_wall() first added the memory block to the list, and then added the wall - there
was a race condition between that and the wall checker daemon (if enabled): it could
occasionally report an overwritten wall in that very moment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14051 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-22 21:01:03 +00:00
Axel Dörfler
5793da1edc Renamed elf_lookup_symbol_address() to elf_debug_lookup_symbol_address() and
removed the locking it did, as that doesn't work anymore in the kernel debugger.
The function was not thought to be used outside the debugger, anyway.
Improved usage message from debugger command "ls".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14050 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-22 20:35:42 +00:00
Axel Dörfler
c2ee3ca134 Added a comment on how to deal with directly writable memory mapped files.
There, we need to detect the modified state from the mapping, too - the
vm_page state itself might not be up to date.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14049 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-22 20:33:19 +00:00
Axel Dörfler
4784eca19d cache_io() did not set the state of a page to PAGE_STATE_MODIFIED when it wrote
to it - if that page was read from disk unmodified before (or written back in
the mean time), the updated contents coult not be detected, and therefore, were
never written back.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14048 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-22 20:31:32 +00:00
Axel Dörfler
67a7102658 Fixed a pretty fatal bug in the page fault handling: interrupts were enabled
even if "kernel_startup" was "true". Page faults are now no longer allowed
during kernel startup (and could be easily avoided). The only situation where
we accept page faults with interrupts turned off now is during a kernel debugger
session.
Added a command debug_debugger_running() to test for that situation.
kernel_debugger() no longer sets kernel_startup while it's running; there should
be no situation when this could be helpful.
Interrupts are no longer enabled when a page fault happens in the kernel
debugger.
This potentially fixes all sorts of problems, and not only in the kernel debugger,
it could also have affected SMP (will test later).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14045 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-21 23:27:51 +00:00
Axel Dörfler
8a4462f51c Turned off debug output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14044 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-21 23:19:39 +00:00
Axel Dörfler
96643545c5 Removed unnecessary and stupid code - the doubled chain allocation also caused
a page fault during startup, because the chain memory is B_NO_LOCK.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14043 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-21 23:18:43 +00:00
Axel Dörfler
099ceb8f9d map_physical_memory() and its backend vm_map_physical_memory() did not map in the
pages, ie. they considered the areas to be B_LAZY_LOCK. But that doesn't really make
sense and potentially cause page faults where you wouldn't expect them (and where
it's not a good idea to trigger them).
Reworked display_mem() (used by the dw/db/ds commands in the kernel debugger) to
be a bit more sane, improved formatting, and allows it to work on non-existing
memory without a panic.
The "area" debugger command now also accepts an address (contained by the area)
as argument - and it will now always print out an error message if no matching
area could be found.
Replaced all dprintf() calls to kprintf() calls for the kernel debugger functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14042 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-21 23:17:09 +00:00
Axel Dörfler
72a263b6cf Make sure only ASCII characters are rendered.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14039 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-21 15:09:43 +00:00
Axel Dörfler
e0481f928e Now marks a partition unmounted on unmount - that allows a volume to be remounted as often as you like.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14036 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-21 13:45:15 +00:00
Axel Dörfler
23e13b2e9b The number of semaphores available is now computed based on the amount of memory.
Just like on BeOS, the overall maximum is 65536 semaphores for now - the mechanism
tends to make more semaphores available than the one under BeOS, though (which is
intended).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14035 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-21 12:20:43 +00:00
Axel Dörfler
30616a3243 block_cache::Free() now accepts NULL pointers (it was already used this way before...).
Unmounting BFS volumes should now work as expected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14034 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-21 11:57:36 +00:00
Axel Dörfler
5b14757a30 We now have a consistent scheme what the file system should do with its root
node: like in BeOS, it *must* own the root node (ie. via publish_vnode()),
unlike in BeOS, it must also drop that reference on unmount (symmetrical
behaviour definitely makes more sense to me than the Be way).
Since all existing file systems for Haiku behaved differently, I brought them
in line (only pipefs already adhered to that new standard for some reason,
rootfs did only released the node, devfs did nothing - despite it's probably
not really useful to be able to unmount them).
fs_mount() will now panic if a file system does not do this correctly (useful
for file system developing).
Unmounting is now theoretically working again: when trying to unmount a BFS
volume, the kernel crashes in the block cache destruction... (but that's work
for tomorrow).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14017 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-21 00:41:16 +00:00
Axel Dörfler
e6b682541e Fixed a stupid bug in the recently updated write_chunk_to_cache(): lastPageOffset
was incorrectly calculated, and could therefore cause all sorts of troubles with
writes over 4 kB.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14011 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-20 23:22:13 +00:00
Axel Dörfler
99e1c71ee6 - fixed a locking bug in the file cache: get_file_map() could been called with either
only a read lock on the inode, or without a lock at all (in case of prefetching) - it
  is now using the cache_ref's lock to make sure it's retrieved only once and doesn't
  waste/corrupts any memory.
- since that fix made it mandatory to fix write_chunk_into_cache() to not call pages_io()
  while holding the cache_ref's lock (was a to-do item before), I changed it to make
  that possible.
- It now also supports write-through caches in theory - as there is no way yet to tell
  a cache to work this way.
- Optimized for the not so uncommon case of writing the last part of a file that is not
  a multiple of the page size - it won't call pages_io() anymore then, but zero the rest
  of the page directly.
- vm_page_write_modified() is now calling write_page() without holding the cache_ref's
  lock as well.
The updated write_chunk_to_cache() is not so well tested, though, but appears to work
so far.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14006 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-20 21:32:31 +00:00
Axel Dörfler
07810890b5 Entering an empty line to the debugger will no longer match the first best command
available.
Broken escape sequences are now properly ignored (read one character too much before).
Since the current line buffer is part of the history, we now delete that buffer when
crossing the current line again while traversing the history (restoring the former
buffer would be the nicest way, but that would require another empty buffer and more
copying).
Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14005 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-20 21:24:13 +00:00
Axel Dörfler
70c3e1a42c The escape sequence for erasing lines is now also supported (it's used by KDL command history).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14001 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-20 20:55:02 +00:00
Axel Dörfler
ed73e0eefa arch_debug_blue_screen_getchar() can now also return escape sequences for cursor
movement - IOW, the history of kernel debugger calls is now working also from
the on-screen KDL.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14000 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-20 20:53:44 +00:00
Axel Dörfler
a10cd10b2b Fixed a hypothetical bug: switch_sem_etc() was using thread_get_current_thread()
in an error message without checking for a NULL pointer (which happens during
early boot, and even though it would be impossible to get there at that time,
it shouldn't be accidently copied to anywhere else this way).
Added a compile time option to monitor the last thread that successfully
acquired a semaphore (disabled, though, only enable it when needed).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13998 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-20 20:13:05 +00:00
Axel Dörfler
61aceefd6e The debugger command "waiting" now also accepts a semaphore as argument (specified by ID),
and will only list those threads waiting for that one if used that way.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13996 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-20 15:57:56 +00:00
Axel Dörfler
d6c32d2bf3 The debugger's "sc"/"where" command now accepts a thread ID as parameter (and
then shows the stack crawl of that stack instead of the current one).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13984 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-19 12:53:58 +00:00
Axel Dörfler
c987e126de Testing against IS_KERNEL_ADDRESS() is more correct.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13983 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-19 12:52:19 +00:00
Axel Dörfler
851028d043 Fixed a warning I accidently introduced with the last change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13978 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-18 23:33:54 +00:00
Axel Dörfler
cd661dfcf8 Now dumps all semaphores matching the name you are searching for, not only the first one.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13974 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-18 15:13:03 +00:00
Axel Dörfler
f79ba0f9ba Now always prints out a message if the searched sem could not be found, and not
only under certain conditions.
Now also accepts decimal numbers as IDs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13973 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-18 15:11:18 +00:00
Axel Dörfler
e5c0e4a655 Now prints an error if no thread matching the requested criteria could be found.
Simplified parsing the ID (no need to differentiate between hex and decimal, if
we do both anyway).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13972 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-18 15:09:30 +00:00
Axel Dörfler
e8e4accd16 Add some useful debugger commands to the VFS layer for dumping a vnode, an fs_mount, and
the mounts/vnodes list.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13971 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-18 15:07:38 +00:00
Axel Dörfler
5913a657df Added two possible "ToDo" comments.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13970 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-18 12:41:18 +00:00
Axel Dörfler
b96ea69c37 You really can do the same mistake twice, even in two subsequent lines of code...
get_file_map() now seems to work correctly in all regular cases.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13947 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-13 12:37:13 +00:00
Axel Dörfler
4430d71191 Better error checking (at least panic if something goes wrong, instead of ignoring).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13942 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-12 19:51:17 +00:00
Axel Dörfler
139353cf1a Fixed two bugs in the new file extent caching code:
- under certain situations, the wrong extent could be chosen (off-by-one error)
- the resulting length of the first vector was incorrectly calculated for all
  extents but the first
Improved error checking a bit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13941 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-12 19:50:42 +00:00
Axel Dörfler
7964c56d67 Added vfs_get_cwd() call to get the mount_id and vnode_id of the current
working directory (instead of the full path).
Cleanup of some remaining "int" status variables (where it should have
been a "status_t").


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13924 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-09 16:25:01 +00:00
Axel Dörfler
8733b7318d The stack trace in the kernel debugger is now safe against accessing invalid
user memory (it got its own fault handler). IOW the stack frame is not changed
in that case anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13921 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-09 16:09:26 +00:00
Axel Dörfler
eab435cd59 vfs_get_vnode_cache() now only allocates a new cache if requested: this
prevents the system to allocate caches for files that don't use or have
a file cache (ie. only those can be mmap()ed!).
Therefore, cache_prefetch() no longer crashes when trying to prefetch
files without a file cache.
read_into_cache() no longer does anything if the requested size is 0.
Fixed a bug in cache_prefetch_vnode(): if the cache couldn't be retrieved,
it put the vnode, but didn't own it (the caller does).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13904 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-05 11:52:22 +00:00
Axel Dörfler
06ae92cd04 Maybe it's better to free the team resources after notifying the watchers;
since the hooks are called in the context of the team.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13903 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-05 10:27:08 +00:00
Ingo Weinhold
7d11acca6d Spotted by Axel: If the caller of a load_image_etc() was waiting for the new team to be loaded, but the team died before finishing loading we were notifying the caller only in case the team had already more than one thread.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13900 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-04 22:45:04 +00:00
Axel Dörfler
67f207164b Copied some code from the console driver: we now understand cursor movements,
and even color changes :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13898 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-04 14:55:11 +00:00
Axel Dörfler
95839f5c92 The file cache now has another init method that is called after the boot
device becomes available.
Currently, it opens the "launch_speedup" module (if available), later it
should consult a settings file for what to do.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13894 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-08-03 17:25:03 +00:00