Commit Graph

3799 Commits

Author SHA1 Message Date
Ingo Weinhold
d8d4b902cb * The system profiler scheduling event structures sport nanotime_ts now.
* Adjusted the DebugAnalyzer to handle nanosecond times.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34546 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-07 22:56:29 +00:00
Ingo Weinhold
b2a2d5c065 The usual files forgotten to commit. The generic system_time_nsecs()
implementation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34545 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-07 22:53:53 +00:00
Ingo Weinhold
34a48c70ef Added type nanotime_t (an int64 storing a nanoseconds value) and function
system_time_nsecs(), returning the system time in nanoseconds. The function
is only really implemented for x86. For the other architectures
system_time() * 1000 is returned.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34543 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-07 21:43:19 +00:00
Ingo Weinhold
db905187d5 Implemented a class uint128 with the basic arithmetic operations and
replaced the previous, somewhat complicated and inexact method of
computing the TSC conversion factor using it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34542 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-07 21:37:56 +00:00
Ingo Weinhold
522c2f19d4 * Added a simple mechanism to wait for events to VMCache. WaitForPageEvents()
waits for certain events on a given page, NotifyPageEvents() wakes up
  waiting threads respectively.
* Used the new feature instead of condition variables for waiting on busy
  pages. We save publishing and unpublishing of a condition variable whenever
  a page is marked busy. There's only something to do, if there's at least
  one thread waiting in the list of the respective cache. The general
  assumption is that this is only rarely the case and even if it happens,
  there should be only very few threads.
* Added an apparently missing notification in cache_io(). At least I didn't
  see the reason for it not being there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34537 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-07 15:42:08 +00:00
Ingo Weinhold
be7328a9f6 Moved VMCache related definitions to <vm/VMCache.h>.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34535 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-07 14:14:21 +00:00
Ingo Weinhold
bcfdfff497 Added 64 bit TODO. We'll probably have to change the interface (cookie type)
of get_next_area_info() and others.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34533 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-07 12:26:26 +00:00
Ingo Weinhold
40cd019ea0 * Renamed VMAddressSpace::ResizeArea{Head,Tail}() to ShrinkArea{Head,Tail}()
to clarify that they never enlarge the area.
* Reimplemented VMKernelAddressSpace. It is somewhat inspired by Bonwick's
  vmem resource allocator (though we have different requirements):
  - We consider the complete address space to be divided into contiguous
    ranges of type free, reserved, or area, each range being represented by
    a VMKernelAddressRange object.
  - The range objects are managed in an AVL tree and a doubly linked list
    (the latter only for faster iteration) sorted by address. This provides
    O(log(n)) lookup, insertion and removal.
  - For each power of two size we maintain a list of free ranges of at least
    that size. Thus for the most common case of B_ANY*_ADDRESS area
    allocation, we find a free range in constant time (the rest of the
    processing being O(log(n))) with a rather good fit. This should also
    help avoiding address space fragmentation.
  While the new implementation should be faster, particularly with an
  increasing number of areas, I couldn't measure any difference in the -j2
  haiku build. From a cursory test the -j8 build hasn't tangibly benefitted
  either.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-06 17:18:04 +00:00
Ingo Weinhold
fe30b74fde Fix for stack traces in the early boot process: The thread might not have
its stack top/bottom assigned yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34527 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-06 16:01:21 +00:00
Ingo Weinhold
a54549a8cd * AVLTree:
- Renamed to AVLTreeBase and moved it into its own header/source file.
  - Renamed FindClose() to FindClosest().
  - Added CheckTree() method for debugging purposes. It checks the validity
    of the tree.
* Added a templatized class AVLTree which doesn't offer a map-like interface
  like AVLTreeMap, but rather one similar to BOpenHashMap and SplayTree. It
  is more convenient to use, if one wants to store objects that already
  contain the key.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34526 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-06 15:59:37 +00:00
Ingo Weinhold
08d9b6d462 Obvious copy and paste left-over. Totally missed it as I've been testing
the wrong image for quite a while. :-/


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34494 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-04 21:32:00 +00:00
Ingo Weinhold
2c1886aeae * Added VMArea subclasses VM{Kernel,User}Area and moved the address space list
link to them.
* VM{Kernel,User}AddressSpace manage the respective VMArea subclass now, and
  VMAddressSpace has grown factory methods {Create,Delete}Area.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34493 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-04 17:07:16 +00:00
Ingo Weinhold
e2518ddbb1 Made VMAddressSpace an abstract base class and moved the area management into
new derived classes VM{Kernel,User}AddressSpace. Currently those are
identical, but that will change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34492 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-04 14:45:08 +00:00
Ingo Weinhold
38a97b2c36 Moved all knowledge of reserved areas from vm.cpp to VMAddressSpace. It's a
pure address space feature, so it should be handled there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34491 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-04 13:33:25 +00:00
Ingo Weinhold
f69032f22b * Added VMAddressSpace::ResizeArea{Head,Tail}() to adjust an area's base
and size.
* Made VMArea::Set{Base,Size}() private and made VMAddressSpace a friend.
  In vm.cpp the new VMAddressSpace::ResizeArea{Head,Tail}() are used
  instead.
Finally all address space changes happen in VMAddressSpace only. *phew*
Now it's ready to be thoroughly butchered. :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34467 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 15:21:18 +00:00
Ingo Weinhold
bbd97b4bb4 Made the VMArea fields base and size private and added accessors instead.
This makes it more explicit where the fields are modified.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34464 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 14:18:24 +00:00
Colin Günther
af983c175d Coding style cleanups. Thanks axeld.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34462 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 13:05:39 +00:00
Ingo Weinhold
35d940014e * Changed the address space area list to doubly linked. The reason is to
simplify migration of the area management, but as a side effect, it also
  makes area deletion O(1) (instead of O(n), n == number of areas in the
  address space).
* Moved more area management functionality from vm.cpp to VMAddressSpace and
  VMArea structure creation to VMArea. Made the list and list link members
  itself private.
* VMAddressSpace tracks its amount of free space, now. This also replaces
  the previous mechanism to do that only for the kernel address space. It
  was broken anyway, since delete_area() subtracted the area size instead of
  adding it.
* vm_free_unused_boot_loader_range():
  - lastEnd could be set to a value < start, which could cause memory
    outside of the given range to be unmapped. Haven't checked whether this
    could happen in practice -- if so, it would be seriously unhealthy.
  - The range between the end of the last area in the range and the end of
    the range would never be freed.
  - Fixed potential integer overflows when computing addresses.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34459 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 12:41:11 +00:00
Colin Günther
1581b764e0 * Adding static Notify{One,All} functions. This allows a cleaner implementation
of the condition variable and synchronization subsystem of the freebsd compat
  layer which will be committed next.
* Also there was a discussion about adding these functions on the commit
  mailing list. The mail in http://www.freelists.org/post/haiku-commits/r34395-in-haikutrunksrclibscompatfreebsd-network-compatsys,3
  is a good sum up of it (need to scroll somewhat down, though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34458 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 12:24:17 +00:00
Ingo Weinhold
def9898c9b Moved the three address space locker classes into a separate pair of
header/source files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34451 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-02 20:16:31 +00:00
Ingo Weinhold
f34a1dd5d7 Created VMArea.{h,cpp} and moved VMArea and the global area hash table (new
class VMAreaHash) there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34450 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-02 19:55:59 +00:00
Ingo Weinhold
e50cf8765b * Moved the VM headers into subdirectory vm/.
* Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-02 18:05:10 +00:00
Axel Dörfler
939b3801ea * Add info if the B_NO_HANDLED_INFO flag is set in the "ints" KDL command.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-02 16:49:22 +00:00
Ingo Weinhold
90d870c155 * Moved VMAddressSpace definition to vm_address_space.h.
* "Classified" VMAddressSpace, i.e. turned the vm_address_space_*() functions
  into methods, made all attributes (but "areas") private, and added
  accessors.
* Also turned the vm.cpp functions vm_area_lookup() and
  remove_area_from_address_space() into VMAddressSpace methods. The rest of
  the area management functionality will follow soon.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34447 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-02 16:12:15 +00:00
Ingo Weinhold
fc7864091e Attempt at allowing to use C++ structures in C only code: We use the
CreateAsmStructOffsetsHeader mechanism to generate a header with macros
defined to the sizes of the structures we're interested in and when compiling
in C mode define the structures as "struct { char bytes[size]; }".
It works in principle, but due to how jam works, one would have to specify the
dependency to the generated header for all sources that include it directly or
indirectly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34441 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-02 10:56:10 +00:00
Ingo Weinhold
a477e3cf20 Finished renaming of vm_cache to VMCache.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34424 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 17:45:55 +00:00
Ingo Weinhold
a99eb6b56f vm_area -> VMArea
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34423 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 17:40:04 +00:00
Ingo Weinhold
b0db552cd9 Renamed vm_address_space to VMAddressSpace.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34422 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 17:27:09 +00:00
Ingo Weinhold
fe01182ce4 Accidentally reverted this change before committing: Invalid cast in C++.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34421 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 17:26:22 +00:00
Ingo Weinhold
bd185b4117 *.c -> *.cpp
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34417 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 17:06:26 +00:00
Axel Dörfler
7cab82a1c9 * Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34415 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 16:20:41 +00:00
Axel Dörfler
943bec1287 * Made a class out of free_chunk.
* Fixed realloc() - "size" wasn't what I thought it would be.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34412 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 15:39:55 +00:00
Axel Dörfler
3c627a2751 * Reimplemented realloc() to reuse the previous buffer if possible and useful.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34409 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 14:50:33 +00:00
Ingo Weinhold
e182b46db6 Since there were no further complaints: Added mutex_lock_with_timeout().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34403 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 09:38:34 +00:00
Ingo Weinhold
f39f7a05a2 Add init_once.cpp to the build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34401 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 09:35:25 +00:00
Ingo Weinhold
840be9d6e6 Added __init_once(), an almost exact clone of pthread_once(), with the
difference that the initialization function has an additional void* argument,
so that it is suitable for initializing stuff in objects.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34400 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 09:34:58 +00:00
Axel Dörfler
be62abafab * Use a condition variable when waiting for a syscall to be done calling.
* Use C++ DoublyLinkedList class instead of the struct list.
* Note, this code is untested yet, but I will test it now (Qemu doesn't work
  on Haiku anymore for some reason) :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34382 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 16:10:11 +00:00
Axel Dörfler
4c3744b8d7 * Added missing license.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34372 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 12:37:16 +00:00
Ingo Weinhold
258b34c594 * Fixed wrong parameter of lazy_mutex_destroy().
* Split locks.cpp into mutex.cpp, recursive_lock.cpp, and rw_lock.cpp (new
  subdirectory locks/).
* runtime_loader no longer includes the rw_lock, allowing removal of the TLS
  dependency again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34364 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 10:29:51 +00:00
Axel Dörfler
c598298047 * Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34363 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 08:31:31 +00:00
Axel Dörfler
a4faebeb11 * Replace the FD used for fopendir() instead of closing the old one - according
to the specs, the application may still use the FD without changing its state,
  and only closedir() should finally close it.
* This fixes bug #5055.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34362 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 08:29:12 +00:00
Jérôme Duval
f6379d4127 added tls.o to runtimeloader. It linked successfully on x86 because of inlining.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34360 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-29 21:58:35 +00:00
Ingo Weinhold
ea77094b24 Replaced the hown-grown recursive lock implementation by a shared lazy
recursive lock. I haven't investigated it closer, but the previous
implementation was even broken -- "strace /bin/true" showed two
release_sem() calls, but no acquire_sem().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34342 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-29 11:17:53 +00:00
Ingo Weinhold
8bef23107e Added a lazy_recursive_lock implementation -- identical to recursive_lock,
just using a lazy_mutex instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34341 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-29 11:14:50 +00:00
Ingo Weinhold
6e06922908 Replace semaphores/benaphores in the env, fork, and user/group code by lazy
mutexes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34340 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-29 10:47:01 +00:00
Ingo Weinhold
937b23cb21 Added locking primitive lazy_mutex, which has essentially the same behaviour
as a mutex, but allocates its semaphore lazily. This comes at the cost of an
additional atomic_add() when the semaphore has actually to be acquired, but
saves the semaphore creation completely in single-threaded programs and in
any program when there's no lock contention.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34339 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-29 10:44:07 +00:00
Ingo Weinhold
f2bb2575e6 Use the shared recursive lock implementation instead of the home-grown stuff.
The shared implementation is benaphore style, saving unnecessary syscalls.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34338 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-29 09:57:26 +00:00
Ingo Weinhold
93b9f21335 Added recursive lock implementation (an adapted kernel version).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34337 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-29 09:54:58 +00:00
Ingo Weinhold
d78ffde5d1 * Some minor cleanup and improved comments.
* Fixed check in hoardSbrk(): resize_area() was invoked, even if the area was
  already large enough.
* Increased the initial heap size to 64 pages. Apparently the hoard
  implementation is rather generous and the first malloc() (caused by
  __init_heap()) already required enlarging the area.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34336 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-29 09:20:58 +00:00
Axel Dörfler
dec91a9754 * Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34321 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-27 18:10:03 +00:00
Ingo Weinhold
a492466dad Created new private system header computed_asm_macros.h defining the macro we
use for the asm_offsets.cpp file, so it can be reused elsewhere.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34311 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-27 14:07:05 +00:00
Axel Dörfler
1db31d4dbd * The slab and the block cache now both also react on address space shortages.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34310 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-27 13:04:30 +00:00
Axel Dörfler
b8a73945cf * The kernel's address space is now also a resource that is known to the low
resource manager.
* Could be drastically improved, though, by taking the fragmentation into
  account.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34309 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-27 13:03:28 +00:00
Axel Dörfler
95235380f1 * Minor clarification.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34307 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-27 12:26:37 +00:00
Axel Dörfler
f4ab5d73ce * This fixes the remaining warnings in exit.c
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34294 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-26 17:00:09 +00:00
Axel Dörfler
52d6f78a9a * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34292 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-26 16:58:36 +00:00
Axel Dörfler
f31ffa6b8a * Use O_CLOEXEC when open directories, attribute directories, indexes, and
queries.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-26 16:38:54 +00:00
Axel Dörfler
d82802841c * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34290 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-26 16:33:03 +00:00
Axel Dörfler
486fffdaaf * Forgot to add linkat(), this really closes #4928 now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34289 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-26 16:30:16 +00:00
Axel Dörfler
fb2500da15 * Added missing AT_EACCESS.
* Implemented renameat(), faccessat(), fchownat(), fchmodat(), and mkfifoat().
* Added stub for mknodat().
* The kernel backend for faccessat() does not yet differentiate between
  effective and real user/group IDs, though.
* Removed B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT, as we now support everything
  (more or less). This also closes ticket #4928.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34288 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-26 16:17:17 +00:00
Axel Dörfler
7ce581d7eb * Eliminated the extra buffer in dir_vnode_to_path(); we write directly to the
specified buffer now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34282 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-26 14:28:55 +00:00
Axel Dörfler
00362625b9 * Added support for O_NOFOLLOW.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34279 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-26 14:18:23 +00:00
Axel Dörfler
432bb91f34 * dir_vnode_to_path() now uses B_* error codes instead of POSIX ones, and also
returns the correct error code if the buffer was too small (should be ERANGE
  instead of ENOBUF).
* Also, it is now independent of B_PATH_NAME_LENGTH, and therefore should
  fulfill POSIX getcwd() requirements. This should also close ticket #3352.
* Is there any reason to allocate another buffer instead of using memmove()
  at the end instead of memcpy()?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34276 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-26 12:46:51 +00:00
Axel Dörfler
1ba04177d3 * load_image() now has exec() semantics wrt file descriptors; before each team
would always inherit them all, causing quite a number of open files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34247 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-25 16:16:22 +00:00
Axel Dörfler
3a6fc6d0aa * Improved debug output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34246 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-25 16:14:52 +00:00
Axel Dörfler
40fddd06d6 * Introduced a flag to decide whether it's still okay to call a certain
syscall.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34238 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-25 11:50:45 +00:00
Axel Dörfler
23f179da55 * Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34237 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-25 11:48:39 +00:00
Axel Dörfler
24ce75c3d8 * Added a use counter for the syscalls, so that they are no longer removed
while a hook is called.
* This closes ticket #5027.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34233 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-25 09:37:31 +00:00
Axel Dörfler
5472c0c23e * The VESA driver now tries to find the PCI card that it is controlling by
checking the physical frame buffer location.
* This allows us to map the whole frame buffer at once, which means there is no
  need anymore to remap the memory on mode change.
* Also, this will ease the burden of the MTRRs, as the memory size will be
  properly aligned.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34206 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-24 15:26:52 +00:00
Ingo Weinhold
bb163c0289 * Added a set_mtrrs() hook to x86_cpu_module_info, which is supposed to set
all MTRRs at once.
* Added a respective x86_set_mtrrs() kernel function.
* x86 CPU module:
  - Implemented the new hook.
  - Prefixed most debug output with the CPU index. Otherwise it gets quite
    confusing with multiple CPUs.
  - generic_init_mtrrs(): No longer clear all MTRRs, if they are already
    enabled. This lets us benefit from the BIOS's setup until we install our
    own -- otherwise with caching disabled things are *really* slow.
* arch_vm.cpp: Completely rewrote the MTRR handling as the old one was not
  only slow (O(2^n)), but also broken (resulting in incorrect setups (e.g.
  with cachable ranges larger than requested)), and not working by design for
  certain cases (subtractive setups intersecting ranges added later).
  Now we maintain an array with the successfully set ranges. When a new range
  is added, we recompute the complete MTRR setup as we need to. The new
  algorithm analyzing the ranges has linear complexity and also handles range
  base addresses with an alignment not matching the range size (e.g. a range
  at address 0x1000 with size 0x2000) and joining of adjacent/overlapping
  ranges of the same type.

This fixes the slow graphics on my 4 GB machine (though unfortunately the
8 MTRRs aren't enough to fully cover the complete frame buffer (about 35
pixel lines remain uncachable), but that can't be helped without rounding up
the frame buffer size, for which we don't have enough information). It might
also fix #1823.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34197 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-23 15:06:08 +00:00
Ingo Weinhold
12fef51bc7 Since r33809 dprintf() acquires a mutex when called with interrupts enabled.
This is something must must not do in an idle thread or we get the scheduler
into trouble.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34196 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-23 14:19:09 +00:00
Stephan Aßmus
f89fd840a0 bonefish+stippi:
PThreads didn't have their array for the TLS values initialized.
From what we can tell, this would have been a problem for any program using
pthreads, but since all threads are pthreads now, it was much more likely to
be encountered. Like in Beam as reported in #4949 (which via libbind seems
to use some pthread stuff).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34161 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-20 18:08:56 +00:00
Axel Dörfler
5cea99288b * Unlock the auto locker before deleting the object or else you will find
yourself in KDL.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34158 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-20 16:33:09 +00:00
Ingo Weinhold
0d1fab522b * Added flag KMESSAGE_CLONE_BUFFER, which will cause buffer passed to SetTo()
to be cloned.
* Added "flags" parameter to the SetTo(const void*,...) version.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34155 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-20 13:52:23 +00:00
Ingo Weinhold
395fb0895f Style cleanup. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34152 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-20 11:04:12 +00:00
Ingo Weinhold
1c61ec1aad Fixed gcc 4 warning.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34151 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-20 11:03:27 +00:00
Ingo Weinhold
c89002c82c * Added missing include.
* Made buildable for userland.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34146 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-20 07:56:18 +00:00
Ingo Weinhold
9837ec16c8 Fixed spelling.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34144 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-20 07:10:23 +00:00
Ingo Weinhold
1748a3cb45 IOBuffer::SetVecs(): fUser was initialized incorrectly, if the vecs referred
to physical memory whose address would accidentally satisfy the
IS_USER_ADDRESS() check.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34136 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-19 16:23:22 +00:00
Ingo Weinhold
778aa3bf62 transfer_io_request_data(): There was some confusion about the isWrite
parameter and request->IsWrite(). The parameter means whether we want to
write to the request's I/O buffer (therefore renamed it to writeToRequest),
while request->IsWrite() indicates whether the request is a write request.
One can only write to a read request's buffer and vice versa.
IOBuffer::LockMemory() also wants to know whether the request is a write
request, not whether we want to write to the memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34135 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-19 16:19:59 +00:00
Ingo Weinhold
62b3c49b85 Added missing "static". Spotted by Axel "Eagle Eye" Doerfler. ;-)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34123 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-19 08:41:13 +00:00
Ingo Weinhold
59d51abc40 Removed obsolete uncommented function stubs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34122 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-19 07:39:47 +00:00
Ingo Weinhold
1ca0b78f54 Extended the public I/O request C API.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34121 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-19 07:38:33 +00:00
Axel Dörfler
dcf71e1cae * Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34094 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-17 16:08:22 +00:00
Axel Dörfler
8fd850fca9 * Added "address" specifier for the "allocations" KDL command.
* Removed superfluous malloc.h include.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34093 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-17 16:07:58 +00:00
Axel Dörfler
931d8b07e8 * Reverted r32216 (by mmlr): it's not a good idea to access a variable on the
stack after that has just been changed, and does not contain the data one
  would assume.
* This fixes the leaking the vm_translation_map_arch_info objects, and thus
  bug #4957.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34090 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-17 14:56:51 +00:00
Axel Dörfler
3917e20402 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34089 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-17 14:54:32 +00:00
Ingo Weinhold
713cc7fc84 Added fs_read_attr().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34085 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-17 11:35:47 +00:00
Axel Dörfler
96c4511a25 * Shuffled functions around, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34083 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-17 10:23:53 +00:00
Axel Dörfler
07d4556346 * Change get_next_sem_info() to be index based, not ID based - the semaphore IDs
aren't monotonically increasing which this code was assuming. This fixes bug
  #4917.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34074 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-16 13:08:36 +00:00
François Revol
fbe3b5b994 Force C linkage on those two, fixes them being undefined after the .c to .cpp rename.
Fixes part of #4965.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34042 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-14 19:44:00 +00:00
Ingo Weinhold
6c00aabc9e Implemented POSIX.1-2008 functions unlinkat(), symlinkat(), mkdirat(),
utimensat(), and futimens().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34010 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-12 19:14:42 +00:00
Ingo Weinhold
db2b554fa3 Moved the POSIX *at() functions and AT_* macros out of the default namespace
as long as the full set hasn't been implemented. They are guarded by the
B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT macro until then. Fixes the build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33990 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-10 17:12:03 +00:00
Ingo Weinhold
a6147679a3 Added AT_SYMLINK_[NO]FOLLOW constants and fstatat(). Fixes the findutils
gnulib build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33987 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-10 14:51:25 +00:00
Axel Dörfler
492dd892ce * Removed /system/etc directory.
* /etc now points to /boot/common/etc/, and the remaining contents of the former
  "etc" are put there now, as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33986 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-10 14:26:42 +00:00
Axel Dörfler
0491552bc3 * Moved the "fonts" directory into the "data" directory.
* Moved fonts to where they belong.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33981 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-10 12:30:06 +00:00
Ingo Weinhold
9c71b326c9 Fixed build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33980 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-10 12:20:26 +00:00
Ingo Weinhold
b189a2014e Added readlinkat().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33978 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-10 11:24:46 +00:00
Ingo Weinhold
fdec1a3f87 Should have been part of r33976: fcntl.c and open.c have been joined to
fcntl.cpp.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33977 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-10 11:16:44 +00:00
Ingo Weinhold
098906f1d4 * src/system/libroot/posix: Moved open.c and fcntl.c out of the unistd
directory, where they were misplaced, and joined them to fcntl.cpp.
* Added openat().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33976 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-10 11:15:35 +00:00
Ingo Weinhold
9e81ddee87 * Fixed fdopendir(): We have to explicitly (re-)open the directory, because FDs
returned by open() aren't suitable for directory iteration and because checks
  have to be performed (like whether this is a directory at all and whether the
  user has read permission).
* Added __create_dir_struct() for the attribute, index, and query open
  functions to use instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33974 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-10 10:55:43 +00:00
Ingo Weinhold
c3dbe62619 _user_open_dir(): Allow a NULL path to be passed.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33973 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-10 10:51:08 +00:00
Axel Dörfler
ecf6b86c92 * The pthread_thread structure is now allocated for all threads.
* Therefore, all pthread functions should now work fine on all threads.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33967 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-09 21:33:35 +00:00
Axel Dörfler
7249de5e61 * Changed the affine scheduler to have more or less the same characteristics
as the BeOS scheduler. This makes MediaPlayer playback much better, as high
  priority threads could lose their quantum to a worker thread twice in a row
  with 4% probability before.
* I did not yet change the simple scheduler as well yet; maybe this isn't the
  final one either.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33965 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-09 19:00:42 +00:00
Axel Dörfler
a0439d88df * Adjusted thread priorities of several system services based on a mail from
Mikhail Panasyuk: since worker threads often end up with B_NORMAL_PRIORITY,
  it might be a good idea to give system threads a higher priority.
* Minor cleanup (mostly automatic whitespace).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33961 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-09 15:25:48 +00:00
Axel Dörfler
6242fd5977 * Added the possibility to debug latency issues with spinlocks.
* When DEBUG_SPINLOCK_LATENCIES is 1, the system will panic if any spinlock is
  held longer than DEBUG_LATENCY micro seconds (currently 200). If your system
  doesn't boot anymore, a new safemode setting can disable the panic.
* Besides some problems during boot when the MTRRs are set up, 200 usecs work
  fine here if all debug output is turned off (the output stuff is definitely
  problematic, though I don't have a good idea on how to improve upon it a lot).
* Renamed the formerly BeOS compatible safemode settings to look better; there
  is no need to be compatible there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33953 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-08 20:26:48 +00:00
Axel Dörfler
bec53b590f * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33952 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-08 20:20:27 +00:00
Axel Dörfler
01ce3f26d2 * Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33951 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-08 17:31:39 +00:00
Michael Lotz
8665c30ace That was not such a good destruction order in the error case. As the scheduler
accesses the scheduler data inside the thread structure, freeing it first lead
to a crash when a thread couldn't be created.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33940 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-07 16:33:29 +00:00
Axel Dörfler
bde1f75946 * Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33937 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-07 10:58:18 +00:00
Axel Dörfler
ebcdd1fc61 * r33436 broke user_strlcpy() semantics: with a size of 0, "to" can be ignored,
and it's still a valid call.
* This fixes ktrace_printf() from userland.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33934 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-07 10:42:39 +00:00
Ingo Weinhold
9c7b2520c2 Added get_pthread_thread_id() function returning the Haiku thread_id of a
pthread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33927 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-07 08:19:24 +00:00
Axel Dörfler
f40c5e3211 * common_rename() now checks the name for validity before passing it on to the
file systems, so those checks don't have to be duplicated there, anymore.
* Minor cleanup, mostly automatic whitespace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33895 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-05 13:03:06 +00:00
Axel Dörfler
a10ac91f6d * NewBlock(), and Allocate() will now try to reuse existing memory in low
resource situations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33892 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-05 11:14:12 +00:00
Jérôme Duval
15f18c0947 added missing posix functions
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33867 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-03 20:04:10 +00:00
Oliver Tappe
7e0d60f5b7 adding POSIX-functions llround*(), which Maxime reported missing
* copied implementations for llround(), llroundf() and llroundl() from
  glibc-2.3.2
* added corresponding declarations to math.h


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33863 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-02 19:13:15 +00:00
Axel Dörfler
8cd9a52477 * delete_owned_ports() did not maintain the sUsedPorts variable, and thus led
to bug #4864.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33823 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-29 08:08:31 +00:00
Axel Dörfler
13ce48d922 * Moved dprintf_args()/debug_puts() guts to a new dedicated private function
debug_output().
* Added a second buffer to be used when interrupts are turned off, otherwise
  dprintf_args() will now use a mutex guarded buffer to fill with vfprintf() -
  the actual sending to the outputs still needs the spinlock, so things only
  slightly improved.
* Moved private functions into the private section of the source file.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33809 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-28 13:31:55 +00:00
Axel Dörfler
7d6c7206c1 * There is no need for the sPageLock to be a spinlock - a mutex should do. This
should improve the kernel latencies, as things like
  vm_page_allocate_page_run() is very expensive.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33807 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-28 10:44:29 +00:00
Axel Dörfler
954da749a5 * Added SCHED_SPORADIC, and sorted the constants the way it's done in the specs.
* Also changed their numbering.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33788 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-27 13:10:17 +00:00
Axel Dörfler
d88b4037b0 * Reduce maximum priority to B_URGENT_DISPLAY_PRIORITY; real time threads isn't
really something to play with without knowing the outcome.
* Fixed indentation/coding style violations introduced with r33783. Please take
  more care when accepting patches!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33787 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-27 12:34:27 +00:00
Jérôme Duval
f386c5910b Patch from Michael Franz (ticket #4696): sched.h and pthreads to allow setting of the thread priority
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33783 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-26 22:56:43 +00:00
Jérôme Duval
91844cc151 Patch from Olivier Coursiere (ticket #4064): cond_wait always return EAGAIN with an unitialized pthread_cond_t
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33779 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-26 19:28:14 +00:00
Axel Dörfler
250288397d * Somehow, I forgot to update set_port_owner() for the new team port list.
* Now, killing a team shut properly cause the app_server to close the windows
  of that team, too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33777 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-26 17:23:07 +00:00
Axel Dörfler
ebcd4e1ada * Applied patch by "v" with minor changes; this allows the posixtestsuite's
pthread_create 2-1 interface conformance test to pass.
* Also fixed return values to be in the POSIX error range in case we ever switch
  them by default.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33775 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-26 17:11:02 +00:00
Axel Dörfler
b716ef33bf * pthread_create() will now check if attr is initialized, thus fixing bug #4827.
* pthread_kill() no longer sets errno.
* Use POSIX error codes in POSIX code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33774 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-26 16:49:11 +00:00
Axel Dörfler
0087f9409b * sem_entry no contains a pointer to the owning team, instead of only its
ID.
* Accidently, this should also fix bug #4839.
* Optimized _get_next_sem_info() a whole lot by iterating over the team's
  semaphore list.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33773 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-26 15:09:08 +00:00
Axel Dörfler
86a999adfb * delete_owned_ports() no longer scans the whole port array for ports belonging
to the owning team.
* Instead, the team now maintains a list containing the ports it owns.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33771 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-26 13:34:43 +00:00
Axel Dörfler
07e9fd1d84 * sem_delete_owned_sems() now grabs the team lock for a very short time, and
once only.
* Improved missing team warning.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33770 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-26 13:29:29 +00:00
Axel Dörfler
bd56fd8a4c * Removed the superfluous handOverPort variable I introduced earlier.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33748 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-23 15:08:47 +00:00
Axel Dörfler
ddbe12007a * Semaphores are now put into the team struct in a doubly linked list.
* This makes sem_delete_owned_sems() a lot more efficient; before it would need
  to scan the entire semaphore table.
* This speeds up the test build of the kernel by another 2 seconds (with
  KDEBUG=2) on my laptop.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33743 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-23 02:06:51 +00:00
Axel Dörfler
6390c0ca80 * _get_next_thread_info() should be a bit more picky about its team needs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33741 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-23 01:15:55 +00:00
Axel Dörfler
3530c3eb6b * Reimplemented the insane _get_next_thread_info() which previously just
iterated over all known thread *IDs* with interrupts disabled.
  Now it iterates over the team's thread list (going from back to front, since
  new threads are added at the front of the singly linked queue).
* Alexandre restarted Tracker quite a lot, and let the shell script run to
  reproduce a certain bug - and then wondered why ProcessController would
  take several seconds to open its windows until it passed through more than
  8 million IDs... :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33737 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-23 00:09:45 +00:00
Axel Dörfler
f28dd36b82 * The alphabet is obviously hard, moved some tracing defines at their
(hopefully) correct place.
* It seems to be even harder to understand basic locking primitives: when you
  think about it, it shouldn't surprise you that conditional variables never
  return B_WOULD_BLOCK. This fixes gdb again.
* Added tracing support to the ports subsystem.
* get_port_message() will now resize the port heap if needed (but will also
  take timeouts into account while doing so, more or less). The initial port
  space is 4MB (as before), the growth rate is the same, and the system wide
  limit is arbitrarily set to 64 MB (all swappable). A team limit has been set
  to 8 MB, but is not enforced yet. Since ports are using up address space in
  the kernel, those seems to be proper limits.
* This also fixes a strange, and rare lockup where the mouse cursor would still
  move, but everything else would basically hang, but look perfectly normal from
  KDL on the first look. As recently happened on Brecht's laptop, and debugged
  by mmlr and me: the cbuf space got used up when lots of windows wanted to
  redraw after a workspace switch. The app_server wouldn't answer anymore to
  client requests, but thought it would have done so, as LinkSender::Flush()
  doesn't care if it got a B_NO_MEMORY (the ports will now block until memory
  is available if possible, so that should not be a problem anymore).
* Improved "port" KDL command, it now also prints the messages in the port.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33735 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-22 23:14:10 +00:00
Axel Dörfler
5c056f9f10 * set_port_owner() was the only usable call of the port API, and of course it
was used this way in the debugger. Doing this later should be harmless,
  AFAICT, but Ingo will probably know better.
* Beware, though, the debugger currently does not work anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33730 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-22 16:10:28 +00:00
Axel Dörfler
e8885f2097 Basically rewrote the ports subsystem to use:
* its own heap allocator instead of cbuf - this makes cbuf superfluous, and I
  therefore removed it from the kernel. The heap is swappable, so lifts the
  kernel's resource usage a bit. In the future, the heap should grow as well;
  right now it should be at least as good as before.
* it no longer uses spinlocks, but just mutexes now for better scalability - it
  was not usable with interrupts turned off anyway (due to its semaphore usage).
* it no longer uses semaphores, but condition variables.
* Needed to move the port initialization to a later point, as swappable memory
  wasn't usable that early.
* All ports test are still passing, hopefully I didn't mess anything up :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33728 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-22 13:24:12 +00:00
Michael Lotz
ee7ec20503 Account for single page allocations. They aren't used anywhere right now because
the bin sizes ensure that when hitting this case it always allocates multiple
pages. This makes it more flexible for other use cases though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33726 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-22 13:06:15 +00:00
Axel Dörfler
4e61885e4a mmlr+axeld:
* Fixed some minor issues of heap_create_allocator() when it should use the
  kernel heap to allocate its heap structure.
* Fixed an off by one error in the max bin check.
* Changed the KDL "heap" command to allow the "stats" for any heap as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33725 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-22 12:30:53 +00:00
Michael Lotz
6bb413270b The allocation size wasn't updated on an area based realloc that would still
fit into the existing area. In that case further reallocs could then assume the
wrong previous size and then not copy enough from the original buffer, leading
to lost bytes at the end of the new buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33724 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-22 12:05:50 +00:00
Axel Dörfler
e0aad96f94 * Allow to use symbols as variables (prefixed with '@'). Now only tab completion
for variable names is missing B-}


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33723 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-22 11:44:29 +00:00
Axel Dörfler
68d9d8809b * Just use the heap instead of cbuf for send_data().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33722 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-22 11:42:51 +00:00
Michael Lotz
4bee71c211 * Implement per-CPU heaps. They only get enabled in case there's enough memory.
* Allow an allocator to be created on the heap to allow for non-locked
  allocators to be created.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33721 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-22 08:57:34 +00:00
Michael Lotz
5ee1f125e5 Make use of the wait status field so it can be provided in Notify() and then
read out in the ConditionVariableEntry::WaitStatus(). That way you can notify
with a specific status that can be read out on the other end.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33718 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-21 23:44:59 +00:00
Axel Dörfler
d4563f903d * Use kprintf() instead of dprintf() in KDL.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33711 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-21 18:03:07 +00:00
Axel Dörfler
e7baaab3ae * "sc" and "call" will no longer ignore if they couldn't find the thread you
asked them for.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33709 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-21 17:08:52 +00:00
Michael Lotz
432cc51cc7 Add small but very important missing detail. Before blocking it didn't set the
wait status and therefore would return directly without actually blocking.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33681 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-20 19:05:35 +00:00
Oliver Tappe
571d840abf * dropped svn:keywords property from all files that carried it
to avoid recurring problems during migration of subversion checkouts
  (restored binary files that were garbled by subversions during checkout)
* added appropriate svn:mime-type property for problematic (binary) files
* removed a single (mistyped) svn:mimetype property 
* dropped svn:eol-style property for cleanup (they all contained 'native')



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33670 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-19 22:42:52 +00:00
Axel Dörfler
86860a0c07 * debug_printf() from userland actually only worked if serial debug output was
turned on. That should explain Bruno's problems to get debug output from an
  accelerant. Thanks to Michael for the hint!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33651 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-19 08:32:38 +00:00
Axel Dörfler
39e3058e5b * Reverted r33643 - while it doubled the performance for my test case (with
high contention of the read lock (I experimented with the VM page mapping
  lock)), it actually hurt the compile performance pretty obviously.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33647 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-19 00:16:54 +00:00
Jérôme Duval
095a7d8415 using chroot with a mount point wrongly exposed the mount point name: we now avoid resolving the volume root in case we hit the IO context root.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33645 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-18 22:58:29 +00:00
Axel Dörfler
22ea088498 * The rw_lock is now using a mutex to protect its reader/writer counts. This
makes the reader case a lot less expensive, and should relieve the thread
  spinlock contention a bit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33643 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-18 19:52:09 +00:00
Axel Dörfler
b2a7fcb404 * Added an arch_debug_stack_trace() function that is called from the KDL loop
in case there aren't any KDL commands available yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33642 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-18 19:50:13 +00:00
Michael Lotz
b501a0387d anevilyak+korli+mmlr:
* Check for overflows in memory allocation. If someone happened to (erroneously)
  try to allocate a negative amount of memory we could overflow and crash
  because of the sizes getting messed up.
* Review and update the alignment logic which was a bit broken for the huge
  allocation case (reaching the area threshold). Also assert the results so
  next time this will be easier to spot.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33638 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-18 12:35:49 +00:00
Michael Lotz
b7204bd774 Make the swap hash lock into a rw_lock to reduce lock contention a bit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33622 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-17 17:24:59 +00:00
François Revol
6c21b53416 This should fix m68k build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33619 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-17 16:01:10 +00:00
François Revol
c9f536d7b1 Fix ARM build, thx Axel :P
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33618 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-17 15:26:58 +00:00
Axel Dörfler
e0d8627a73 * When you pressed ctrl-alt-del during the boot process, interrupts are disabled
when you enter arch_cpu_shutdown(), so you must not try to load the ACPI
  module to reboot. DaaT, that should fix the problem you showed me.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33617 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-17 14:59:26 +00:00
François Revol
8be612127e When debugging interrupt handlers is enabled, keep count of handled irq for each handler, to ease tracking which driver is unfriendly to others for shared irqs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33614 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-17 12:05:02 +00:00
Axel Dörfler
ec2719329c * Fixed timezones directory path.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33607 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-16 08:26:56 +00:00
Axel Dörfler
3e236885ab * Replaced C with C++ files, should fix BOM's build problem, but will likely
introduce new ones I currently cannot check.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33602 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-15 15:10:01 +00:00
Axel Dörfler
358b93352e * Moved SIGABRT to the signals that kill the process. Not sure if it's a good
idea to always send SIGKILL to the main thread, though. I'm not really getting
  more insight by reading the POSIX specs.
* Anyway, in the mean time, this fixes bug #4784.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33599 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-15 11:53:19 +00:00
Axel Dörfler
f1488adbf7 * While r33037 fixed the alignment of areas put into reserved areas, it actually
broke their placement at the end of the reserved area, which was the main
  reason #4778 happened so often (it would have been more hidden else).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33598 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-15 11:35:31 +00:00
Axel Dörfler
4124f4801b * Reserved areas would also be created in existing reserved areas in case the
space was becoming tight. This actually fixes #4778.
* Fixed overflow problem in find_reserved_area().
* Cleaned up the test app, added license.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33597 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-15 11:23:38 +00:00
Axel Dörfler
3066f3dbf8 * Reverted r33547, this closes bug #4782 - this is obviously a regression in
GCC4.
* Adapted code accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33592 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-15 07:48:31 +00:00
Axel Dörfler
d5a396a60b * r33037 broke the handling of reserved areas, more specifically, it ignored
the RESERVED_AVOID_BASE flag of those, and introduced a way to fill them
  from the start. This caused #4778.
* Turned IS_VALID_SPOT() macro into an inline function.
* Removed already resolved TODO comment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33581 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-14 07:53:45 +00:00
Axel Dörfler
ea95b4d03e * Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33580 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-14 07:50:53 +00:00
Axel Dörfler
273dbd0916 * The network syscalls now check if you try to pass a non-userland address to
them (which you previously could use to easily crash/take over Haiku).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33570 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-13 07:19:18 +00:00
Axel Dörfler
361f5cdfaf * Build fix for the boot loader (it's now using the new utility functions as
well). Sorry!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33560 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-12 19:42:50 +00:00
Axel Dörfler
b74a098352 * Got rid of the duplicated functionalities provided by RWLocker.cpp, and
Locker.cpp.
* The services are now using recursive_locks, and rw_locks instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33548 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-12 14:29:05 +00:00
Michael Lotz
3bb69a8235 * Use mutex and rw_lock and the proper AutoLockers as in the kernel version, as
these interfaces are now available.
* Don't be quite so paranoid by default, the checks that are on by default
  should be enough to detect most memory corruptions.

This makes the debug heap way more usable, so much that you can even use it as
your normal everyday heap without noticing much performance impact (it has quite 
a bit of additional memory overhead though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33544 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-12 11:29:25 +00:00
Michael Lotz
93b63126e1 Adding mutex and rw_lock with the same interface as the kernel versions to
libroot. The mutex is a simple benaphore, the rw_lock is pretty much the same
as the one from libkernelland_emu but uses a mutex per lock instead of emulating
a global thread lock. Also added MutexLocking and RWLock{Read|Write}Locking and
AutoLockers based on them. It's cased with __cplusplus so the locks are also
usable from C. Everything's currently exposed in shared/private/locks.h but I
think we should make these locking primitves public.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33543 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-12 11:19:33 +00:00
François Revol
dc33329747 First attempt at an Amiga boot sector, not yet working.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33535 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-11 20:28:44 +00:00
Bruno G. Albuquerque
891a50b2ae - Fix typo that broke the GCC4 build but not the GCC2 build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33529 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-11 17:31:00 +00:00
Michael Lotz
7ebd7cfc40 Add a vm_page_allocate_page_run_no_base. It bases its search on the pages found
in the free and/or clear queue. This performs better in the case where only few
pages are free/clear but performs worse in the case where there are a lot of
usable pages. It's not used anywhere but it might come in handy one time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33527 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-11 16:55:21 +00:00
Michael Lotz
7a4d60459e Implement combining scattered physical pages using seperate iovecs in
PageWriteTransfer. This makes the transfer accept virtually contiguous pages,
where the offset is contiguous on either end of the current transfer, but where
the pages aren't physically contiguous. It will then add seperate iovecs for
these pages (32 at max right now). This reduces the number of IO requests
generated and allows for optimizations down the IO path (like in the physical to
virtual mapping case for example).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33526 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-11 16:52:19 +00:00
Michael Lotz
303727515e Virtualize the buffers using IOBuffer::GetNextVirtualVec(). This removes the
need for the IO -> InternalIO indirection as it is always fed virtual buffers,
which simplifies things a bit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33525 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-11 16:50:50 +00:00
Michael Lotz
32e2b6a118 Provide a way to directly request virtual vecs from an IOBuffer. If the buffer
is virtual already it just returns the vecs directly, if it is physical it takes
over the task of virtualizing the vecs either using vm_map_physical_memory_vecs,
if there are multiple vecs or more than one page, or falls back to page wise
mapping if mapping fails or is not needed. In the best case, scattered physical
pages are mapped into one linear virtual buffer so that subsystems operating on
virtual memory only get a single vector and can then burst read/write.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33524 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-11 16:49:44 +00:00
Michael Lotz
44778a8a28 Introduce vm_map_physical_memory_vecs. It is like vm_map_physical_memory but
takes a list of iovecs describing the physical pages to be mapped. With it one
can map a set of physically disjoint pages into one linear virtual range. This
is a private API right now, but we might want to make it public as
map_physical_memory_vecs alongside map_physical_memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33523 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-11 16:48:03 +00:00
Michael Lotz
1af7d11504 * Rework page writing to combine page writes where possible. For now the pages
are required to be physically contiguos, which should be reworked to put them
  into seperate iovecs. Still this manages to combine a great deal of page
  writes into larger bursts already. Reduces the amount of IO requests being
  scheduled (and greatly benefits media where page wise writes are slow when
  they are accessed through a non-IOScheduler path, i.e. USB mass storage until
  that is properly implemented).
* Abstracted per page page writing tasks into a PageWriteWrapper class.
* Abstracted per transfer page writing tasks into PageWriteTransfer class which
  formerly was the PageWriterCallback.
* Use both classes from the PageWriterRun and from
  vm_page_write_modified_page_range to remove code duplication.
* Adjusted synchronous VMAnonymousCache::Write() to cope correctly with larger
  iovecs and more than one iovec. It assumed that there was exactly one page per
  vector previously.
* Introduced MaxPagesPerWrite() and MaxPagesPerAsyncWrite() to VMCache to allow
  a cache to specify restricitions. VMAnonymousCache does restrict the max pages
  to 1 for WriteAsync right now as I didn't feel like reworking that one to cope
  with non single page writes just yet.
* Pulled out PageWriteTransfer methods for better readability.
* Some typo fixes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33507 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-10 22:37:26 +00:00
Michael Lotz
f3bd145c09 When the need for physical to virtual mapping arises because of emulating IO
reads or writes for old style drivers, map the physical memory at once. Since
USB is pretty much the only one affected and there small reads/writes are
exponentially slower, the performance gain of the burst transfer far outweighs
the additional overhead of the mapping. Still this could be further optimized
and will eventually be superseeded by also providing a physical memory API in
USB. For now it should bring back USB reads to an acceptable level. Writes are
still page wise though because of how writing back memory works in general.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33503 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-10 19:55:13 +00:00
Ingo Weinhold
aa6f54aa24 Amended the {user,debug}_strlcpy() fix: Due to the strlcpy() semantics to
always return the source string length, we can't really prevent an overflow
of the source address.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33489 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-09 03:07:11 +00:00
Michael Lotz
0b4d87da22 Add missing word in comment.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33479 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-07 13:29:19 +00:00
Axel Dörfler
ab7516c8f3 * Fixed a dead lock when drivers were scanned: we must not hold the devfs lock
when scanning for drivers, as that reverts the standard locking order with
  locks like the device manager lock. There is now a dedicated scan_lock for
  each directory.
* get_device_name() now locks itself which also adds a missing lock in the
  B_GET_PATH_FOR_DEVICE ioctl().
* Minor refactoring; the directory init code was duplicated over several places
  in the source file.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33465 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-06 12:56:21 +00:00
Axel Dörfler
c0f44af061 * Fixed PXE boot loader build again (hey mmu_man!).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33456 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-06 09:25:35 +00:00
Ingo Weinhold
8a71915a9d Made the {debug,user}_{mem,strl}cpy() and user_memset() functions deal with
address overflows. Apparently at least the x86 string instructions generate
a general protection fault instead of a page fault, and we only use the fault
handler in the latter case (maybe we should change that, too). Fixes #4714.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33436 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-05 09:54:40 +00:00
Ingo Weinhold
8ad4a2e971 Improved comment.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33392 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-01 09:31:20 +00:00
Ingo Weinhold
d815bfef61 Fixed build with tracing enabled.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33391 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-01 09:30:46 +00:00
Ingo Weinhold
37e6de5d4c Don't destroy tracing entries. This is not necessary and even harmful, if the
code is no longer loaded, e.g. when the module has been unloaded or the tracing
buffer was reattached from a previous session.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33389 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-01 04:38:19 +00:00
Ingo Weinhold
d6778355ee * <DiskDeviceTypes.h>: Removed kPartitionTypeIntel{Primary,Logical} constants.
* Added new header headers/private/system/disk_device_types.h, which defines
  the <DiskDeviceTypes.h> constants as macros and which can be used where the
  constants cannot be used. The constants are defined using the macros, so now
  there's only one place where the string literals should be specified.
* Use the macros in the partitioning systems. I was too lazy to also adjust the
  file systems -- most of them seem to hard-code the string literal yet.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33386 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-01 03:07:42 +00:00
Ingo Weinhold
a9689e8492 * VFS:
- Fixed vfs_get_vnode_from_fd() return type.
  - Added vfs_open_vnode().
  - Added a "bool traverseLeafLink" parameter to vfs_get_fs_node_from_path().
    It was always resolving symlinks.
* device manager/devfs:
  - devfs: get_node_for_path() no longer resolves leaf symlinks. That still
    doesn't help with file disk devices, as creating partition wouldn't work
    anyway.
  - Pulled the module-related implementation part of BaseDevice into new class
    AbstractModuleDevice and made all methods of BaseDevice virtual. Small
    adjustments to devfs to be happy with the new BaseDevice interface.
  - Added BaseDevice subclass FileDevice, which maps the interface to a file's
    file descriptor. Still got a few TODOs, but should basically work.
  - Use FileDevice for publishing file disk devices in devfs. Now those do
    actually work, though there's some BFS trouble with one of the images I
    tested.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33385 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-01 03:06:34 +00:00
Ingo Weinhold
3c4721f516 The B_DISK_DEVICE_IS_FILE flag is cleared by KDiskDevice and needs to be reset.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33383 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-01 03:04:32 +00:00
Ingo Weinhold
80ea5e3508 Fixed incorrect return value of _user_get_file_disk_device_path().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33382 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-01 03:03:56 +00:00
Ingo Weinhold
c51d6579e4 Fixed incorrect uses of user_{strl,mem}cpy() in the kernel debugger. This could
break stack traces.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33381 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-01 03:03:16 +00:00
Ingo Weinhold
be51dd0f4c Added debug_strlcpy() for use in the kernel debugger.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33380 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-01 03:02:34 +00:00
Ingo Weinhold
268335a069 After creating a userland thread we didn't set up the breakpoints for it.
Fixes #4665.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33369 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-30 08:40:55 +00:00
Stefano Ceccherini
fee1bc8eed Back to timer 2, since timer 0 doesn't work at all.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33368 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-30 06:34:15 +00:00
François Revol
858a20cab8 Patch by Vincent Duvert:
Remove the 4 cores limit at boot, and fix the allocator to handle 8 cores.
There are still performance problems, but this allows booting with 8 cores.
WARNING: since this changes x86 platform kernel args, you really don't want to update haiku_loader and kernel_x86 separately!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33349 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-29 13:07:10 +00:00
Stefano Ceccherini
ea40a61a84 Some big changes, still not working on my laptop, since hpet interrupts
aren't routed correctly over the 8259, it seems.
- Removed passing the hpet_regs around, since there's a static variable.
- Added lots of debug dprintfs.
- Fixed setting the timer interrupt to edge
- Timer is initialized once.
- Use the timer 0 instead of 2.
- Renamed register definitions to be more readable
- Use 64 bits registers and unions where applicable.
- Other things I don't remember


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33345 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-29 08:36:36 +00:00
Stefano Ceccherini
8593bcad87 Use the hpet defines in the source.
Also shortened some defines using "TN" instead of "TIMER". It's also
the same scheme used in the specs


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33334 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-28 13:14:16 +00:00
Stefano Ceccherini
1d958a301e Moved the "disable APIC" menu(s) to smp.cpp.
Also only enable them if there's an APIC.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33333 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-28 09:42:59 +00:00
Ingo Weinhold
ac106be534 Inherit the disable_debugger() flag to a fork()ed child. load_image() doesn't
-- I'm undecided whether it should, too. Fixes #4642.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33330 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-28 02:54:38 +00:00
Stefano Ceccherini
6dc4fd11a2 Uncommented the hpet timer from the timers list.
Lowered its priority of hpet timer so it doesn't get picked up first
(yet)
Changed the debug output to be conditional.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33292 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-25 10:48:37 +00:00
Stefano Ceccherini
6d92e80531 - Moved timer conversion to a method, and added LL to the conversion
factor to avoid compiler issues.
- Removed some useless and commented debug stuff.
- Now prints also the global HPET configuration.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-25 10:36:39 +00:00
Stefano Ceccherini
4687d95b68 Renamed x86_hpet.c to x86_hpet.cpp and fixed the compile errors.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33290 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-25 09:50:32 +00:00
Stefano Ceccherini
8626c1aa5f the HPET timers resolution is REALLY high. The time conversion was off by
1000. XenServer boots correctly and in reasonable time,
now (meaning hpet timers work). I guess on real hw the bios doesn't
correctly program the hpet timers, so we'll need a bit more work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33289 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-25 09:49:02 +00:00
Stefano Ceccherini
9ea40f7802 Cosmetics.
XenServer actually boots (but slow as hell) with hpet timers enabled, real hardware does
not.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33287 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-25 08:29:42 +00:00
Stefano Ceccherini
dd9b76727d Enable hpet_init() in the boot loader. All it does is searching the hpet
table and mapping it if needed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33286 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-25 07:06:58 +00:00
Stefano Ceccherini
d54e62b2c8 Added dumping the timer configuration, and the possibility to use any of
the hpet timer, not just the first 3.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33285 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-25 05:08:22 +00:00
Stefano Ceccherini
b1c4413c56 Turns out the selection sort algorithm was broken for more than... 2 entries,
if they were not already ordered. Or, to say id differently, it was completely
broken.
Luckily no one noticed....
Also disabled again printing the timers, since it could print not available ones.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33235 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-22 19:58:40 +00:00
Stefano Ceccherini
7ddaf32ecc Second (or third) try at getting the timers ordered by priority, in
r33218 I had ordered the timers in the wrong order.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33225 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-21 14:44:11 +00:00
Stefano Ceccherini
ca7ba3eb23 pretty much reverted r33218.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33224 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-21 13:16:13 +00:00
Stefano Ceccherini
77a9df0a47 Disable tracing.
Wow! 4 commits for a simple thing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33223 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-21 10:21:57 +00:00
Stefano Ceccherini
249346009f Fix for the fix. The previous commit actually broke initalizing timers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33222 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-21 10:21:00 +00:00
Stefano Ceccherini
9091ba579c Don't print an error if the initialization actually succeeded.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33221 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-21 10:18:56 +00:00
Stefano Ceccherini
cb35a69347 Introduce the PIT commands as defines and used them in the pit timer
module. They should be used also in the bootloader.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33220 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-21 10:14:15 +00:00
Stefano Ceccherini
bf7902cb4b Fix build with tracing enabled
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33219 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-21 09:50:30 +00:00
Stefano Ceccherini
bed1c0d42e Sort timers by priority before initializing them, so we avoid initializing
timers which we will never use.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33218 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-21 09:49:41 +00:00
Stefano Ceccherini
e5f7219f3a Fixed typo for real. Also disabled tracing for HPET
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33157 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-16 20:23:06 +00:00
Stefano Ceccherini
1412a38e9b Fixed build with tracing enabled.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33153 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-16 12:20:27 +00:00
Stefano Ceccherini
483651906f Fix typo
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33152 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-16 10:40:12 +00:00
Stefano Ceccherini
e08bb3e0f2 Removed leftover
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33151 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-16 10:16:35 +00:00
Stefano Ceccherini
1d5026909d Basically reverted previous commit, since at that point we haven't yet
checked the existence of the apics.
Moved the code to disable the local apic from arch_timer.c to arch_int.cpp, so
we also avoid installing the interrupt handler for it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33149 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-15 20:22:04 +00:00
Stefano Ceccherini
44f6eb85bd removed the 'smp' part from apic_smp_init_timer(), since it's used also without smp (I guess this was a leftover)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33148 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-15 20:00:57 +00:00
Stefano Ceccherini
24ca62447c Only show the "Disable APIC" option if an APIC is found.
Same for the IOAPIC, but commented out the code, since we're not using the
IOAPIC yet.
Also renamed the option to "Disable LOCAL APIC", since it's more correct.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33147 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-15 17:43:30 +00:00
Jérôme Duval
40d6120c3b Patch from Vincent Duvert (edited by myself): Implement reboot via ACPI (#4459)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33135 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-14 17:37:53 +00:00
Stefano Ceccherini
da11bb8dcb Use TRACE() instead of dprintf()
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33134 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-14 11:54:48 +00:00
Stefano Ceccherini
4f5ca99156 Added dprintf() to be able to see which driver hangs on load
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33133 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-14 11:47:16 +00:00
Stefano Ceccherini
f0bf38026a Add safemode option to disable the use of APIC timers
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33132 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-14 09:02:15 +00:00
Michael Lotz
1bcca32a9e * Also take into account that the alignment due to B_ANY_KERNEL_BLOCK_ADDRESS
can cause overflows.
* Added a generic IS_VALID_SPOT() macro that checks for overflows and checks if
  the area will fit with the given constraints.
* Use the macro to simplify the places where these checks are necessary.
* Use the provided "end" limit instead of the address space end. It currently
  doesn't matter but makes more sense.
* Rename newBase variables to alignedBase as that's what they are.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33061 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-11 07:29:36 +00:00
Michael Lotz
e717a35b6f * Change the way we check for enough available space when searching for spots
to insert areas so we don't overflow.
* Consequently use the area end (base + size - 1) where appropriate which
  prevents overflows in a few places.
* Properly check for reaching the address space end.
* If we've already found a spot we don't need to recheck if we've found one.
* Simplify the B_EXACT_ADDRESS checks down to a simpler single if statement
  instead of the four seperate ones.
* Properly calculate the search end for B_EXACT_ADDRESS as well, it's also
  base + size - 1.
* Block the full last page now that this actually works without overflowing.
* Some style changes and added spacing.

This should now really fix #2550. Previously the overflow protection didn't
actually work because on allocation we overflowed and completely missed the
protecting area.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33037 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-10 17:58:19 +00:00
Michael Lotz
5332eb402b Style fix. I really tried hard, but still failed...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33034 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-10 02:11:40 +00:00
Michael Lotz
65b5e4d7ed Make use of the address range blocking to guarantee that accessing 0xdeadbeef
and 0xcccccccc (and 64 pages thereafter) in any way will always lead to a crash.
Before it could happen that these ranges were allocated for an area and then
accessing these would not be as evident anymore. Only enabled when the
corresponding paranoid setting is enabled (which it currently is).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33033 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-10 02:09:16 +00:00
Michael Lotz
9aff7f1593 Block the very last page of kernel address space. The problem here is that non
of the VM functions handling areas are overflow safe. If an area is created that
spans across the last page many places will run into an integer overflow. This
mostly concerns the area allocation path in find_and_insert_area_slot() and also
vm_create_anonymous_area() where the loop for mapping pages for B_FULL_LOCK
areas overflows and runs more times than it should leading to #2550.
This could be seen as a workaround. The real fix would be to make everything
overflow safe. The thing is that this does also concern the user of the area
which could easily have forgotten to check for overflows as well, so I am a bit
uneasy with handing out areas that could easily lead to such hard to debug
problems. Since this is really an edge case and this single step safes quite a
bit of extra checks I'd actually be OK with keeping it that way.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33032 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-10 02:03:31 +00:00
Michael Lotz
3794518c2d Also check for read-protection of an area. Adjusted naming from read-only to
write-protected and read-protected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33031 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-10 01:47:22 +00:00
Michael Lotz
0f4242de40 Implement a vm_block_address_range() function which creates an area with no
mapped pages and a non-read and non-write protection to block a certain address
range from being used by anything.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33030 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-10 01:40:46 +00:00
Oliver Tappe
425cb3d716 * revert r32999 and adjusted each filesystem to return B_NOT_A_DIRECTORY in
its open_dir() implementation instead (as suggested by Ingo).
-alphabranch (it's only a cleanup)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33025 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-09 13:45:12 +00:00
Michael Lotz
1a053eedc0 Revert r32994 and add a comment to explain the intention. Thanks Ingo for the
clarification.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33001 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-08 16:24:43 +00:00
Oliver Tappe
be628a94e2 * opendir() is supposed to return ENOTDIR if the given path is not
a directory, we returned EINVAL instead, which caused Perl's internal
  glob() implementation to fail prematurely
+alphabranch (will do that myself in a minute)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32999 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-08 15:59:51 +00:00
Michael Lotz
fbcf5f3f92 Don't know what this was supposed to do, but with the VADDR_TO_PDENT() it would
end up as 0 again in any case. It certainly looks correct without it, removing
so it doesn't confuse the next one reading over it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32994 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-08 03:51:17 +00:00
Michael Lotz
257f000bd2 * When reserving pages and there aren't yet enough free pages, only steal as
many pages as are actually missing, not the full count.
* Take into account that free_page_queue_count() can be less than sReservedPages
  (when some of the reserved pages have been allocated already) in
  vm_page_num_unused_pages(). Before it could return negative and therefore
  wrapped numbers.
* Simplify the page scrubber loop by continuing early. Also avoids a needless
  interrupt spin lock acquisition when there's nothing to do.
* Some minor coding style cleanup.
* Fix a typo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32980 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-07 02:08:09 +00:00
Michael Lotz
1dd6345561 If the boot volume is BFS and read-only mount it with the write_overlay. This
allows for BFS based LiveCDs. Still this whole name matching feels hacky.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32976 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-06 23:15:23 +00:00
Michael Lotz
aad5c04223 Add valloc() and posix_memalign() to malloc debug heap.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32954 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-06 05:13:01 +00:00
Michael Lotz
a712373138 Apply fix of r32951 to malloc debug heap as well.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32953 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-06 05:11:48 +00:00
Michael Lotz
da3412492a When we actually delete the area, we can obviously not access the next pointer
stored in there anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32951 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-06 05:04:55 +00:00
Michael Lotz
c39414002f Give an IORequest user the possibility to suppress child finish notifications.
This allows for synchronous uses where subrequests are forked off and waited on.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32936 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-05 01:16:56 +00:00
Michael Lotz
c24f6c7b06 When deleting all subrequests the pending children count should probably be
reset as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32935 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-05 00:26:29 +00:00
Michael Lotz
230153f133 Reset the error variable to B_OK in case we want to continue after allocating
only some sub requests worked. Previously we would have simply canceled all
of the subrequests in the loop because we cancel after the first error.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32914 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-03 05:40:06 +00:00
Michael Lotz
b2350565ba Fix two problems in devfs_io:
* An off by one error prevented the very last block of a device to be accessed
  through IO.
* In case of error the request wasn't notified causing anyone (the page writer
  for example) to wait forever for the request to complete.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32913 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-03 05:36:23 +00:00
Michael Lotz
185fd1c5d2 Ported over the kernel heap to libroot to make use of it's validation
capabilities to aid in debugging memory corruption issues.

It does:
* Initialize memory to 0xcc to help turn up use of uninitialized memory
* Set freed memory to 0xdeadbeef to help find accesses of freed memory
* Use the paranoid heap validation to turn up many cases of memory corruption
* Use a simplistic wall check to turn up memory overwrites past allocations
* Take extra steps to validate freed addresses to turn up misaligned frees

It has an interface to en-/disable paranoid validation and to start/stop regular
wall checking. Both are currently just enabled. At a later stage a debug version
of libroot could be used by an application and the checks enabled at will. Note
that due to the paranoid validation and the suboptimal locking this allocator
will perform horribly. Still to find memory corruption issues in the system or
also in your applications it can be helpful to build your installation with it
turned on. To enable it you currently need to edit the Jamfile to sub-include
the malloc_debug instead of the malloc directory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32894 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-01 18:15:30 +00:00
Axel Dörfler
7945b22962 * Quick fix to send notifications on mount/unmount/initialize.
* This closes #2081.

+alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32891 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-01 13:59:36 +00:00
Axel Dörfler
a2bb341447 * Cleanup, no functional change.
+ alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32890 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-01 13:23:05 +00:00
Michael Lotz
419f2d6f3e Fix errors in maintaining the area list due to assumptions that are only true
for the page list but not the area one. Since multiple pages can be allocated
at once, even an area that is not at the top of the list can become empty. In
such a case the area list would previously have lost entries. Also because
we can remove more than one page from any area, not just the top one, we may
need to move forward in the list so that it stays ordered by free pages.
+alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32880 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-01 08:46:39 +00:00
Michael Lotz
5bfffb9d94 The block size wasn't initialized, causing usages of an IOScheduler without
a DMAResource not to work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32879 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-01 03:37:20 +00:00
Axel Dörfler
9cca7d50e9 * Backported r32851 from the r1alpha branch.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32859 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-31 14:50:38 +00:00
Stephan Aßmus
9e15ae596c Added TODO about solving the renaming /boot problem differently as discussed
with Ingo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32856 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-31 13:16:40 +00:00
Marcus Overhagen
a26bf7958f truncate strings to allow building the debug version
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32837 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-30 15:04:04 +00:00
Rene Gollent
92e143c14a Fix regression introduced in r32526: registering the device watcher for node monitoring needs to happen synchronously, otherwise a race condition occurs: unless you're very lucky, the event for creating the raw device would happen before the async thread had a change to add the node monitor, and as such the listener would miss it, and never trigger a filesystem/partition scan. As a result, whether or not adding a USB stick would actually show a volume was essentially russian roulette. Fixes ticket #4345.
+alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32820 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-29 21:49:59 +00:00
Ingo Weinhold
adbf8b25f8 * Added fdopendir() (POSIX).
* Got rid of <dirent_private.h> -- the __DIR structure is private to dirent.c,
  now. The attribute directory, index directory, and query functions use the
  the public POSIX API, so does the kernel module code. Those components were
  not initializing the structure correctly anymore since the introduction of
  telldir()/seekdir().

+alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32819 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-29 20:25:24 +00:00
Axel Dörfler
6a9eee5845 * We support the timespec stat times, so why not allowing the user to set
the times with higher resolution as well?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32814 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-29 15:53:15 +00:00
Michael Lotz
d18b04298a Cleanup, remove needless line-break and trailing space. Also switched that "& "
to " &" as really the whole rest of the file uses that style.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32813 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-29 15:35:11 +00:00
Stephan Aßmus
8c5ad61d4b * Prevent the /boot entry from ever being renamed. You couldn't even try to
switch /boot to a different volume in two operations, unless you have first
  linked /system/lib into /bin. This patch assumes that / will always have the
  ID 1. Don't know if that is proper. Note that I also thought about solving
  this in the VFS, since perhaps it isn't the job of root-fs to know about
  /boot, but that would of course introduce another check for every rename
  operation, which I decided against.

+alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32806 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-29 10:43:51 +00:00
Axel Dörfler
e09d819b6c * Since the Media/Translation Kit errors are now in Errors.h as well, we don't
need to include those two anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32781 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-28 13:01:33 +00:00
Stefano Ceccherini
11dbc6cf7a Reverted r28531 since we have working wcrtomb() and mbrtowc().
Seems like we didn't remember to change it back, even
with the #warning. :-)
I tested ftp and it works fine. This also closes ticket #4176.
+alphabranch 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32766 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-27 20:33:18 +00:00
Stefano Ceccherini
1c2a5ae241 Fixed gcc4 warnings.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32764 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-27 20:26:31 +00:00
Axel Dörfler
89294b5084 * Added option for enabling serial debug output.
* Moved device_manager/settings.cpp to debug/safemode_settings.cpp.
* Removed the somewhat hacky concatenation of kernel settings and safemode
  settings in the boot loader. Instead, get_safemode_option() will now fall
  back to the kernel settings, if it couldn't spot a setting in the safemode
  settings. This allows for more control, and also makes enabling serial
  debug output actually work (ie. overriding the kernel settings via safemode
  options).
* Adjusted debug_init_post_vm(), and smp_init_other_cpus() to use
  get_safemode_boolean().
* Therefore, I added safemode_settings.cpp to the boot loader as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32685 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-26 08:47:54 +00:00
Axel Dörfler
e17f8de82d * Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32684 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-26 08:27:54 +00:00
Axel Dörfler
f8ebd1a328 * Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32683 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-26 08:05:22 +00:00
Ingo Weinhold
2fb48fb46b Added missing ENOATTR text.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32681 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-26 01:01:43 +00:00
Ingo Weinhold
b02c147c05 Implemented seekdir() and telldir(). They were declared in <dirent.h> already.
So either +alphabranch or remove the declarations from <dirent.h>.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32679 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-25 22:16:40 +00:00
Jonas Sundström
9fbc65a94d Modified *jmp stubs for arch mipsel. Removed PowerPC asm.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32623 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-23 03:17:13 +00:00
Jonas Sundström
893988af82 Added and modified kernel stubs and headers for arch mipsel. Correctness not included.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32621 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-23 02:52:09 +00:00
Michael Lotz
f1a7a3752f * Use the locked version of inherit_parent_user_and_group() by moving the call
into the scope of the lock. Saves an InterruptsSpinLocker.
* Use an InterruptsSpinLocker() as in other places.
* When creating/forking a team fails because the kernel thread cannot be spawned
  balance the already sent TEAM_ADDED notification by sending a TEAM_REMOVED one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32595 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-22 03:07:11 +00:00
Jonas Sundström
8e8130d1f0 Adding routerboard_mipsel platform stubs and linker script.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32594 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-22 01:48:18 +00:00
Rene Gollent
c3350a57ff Squashed a TODO: When delivering signals, check if a) any threads were in fact enqueued, and b) if the scheduler's preemption hint indicates that a reschedule is desired. This prevents unnecessarily invoking the scheduler every single time a signal is delivered, regardless of result.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32592 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-21 23:48:42 +00:00
Michael Lotz
29bd9bfd7d Remove SMP_MSG_RESCHEDULE_IF_IDLE as it is not used anymore.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32574 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-21 16:14:18 +00:00
Michael Lotz
861b223cf2 * Strip down scheduler_simple. Anything related to multiple CPU handling has
been removed. That includes CPU disabling and thread pinning, as that becomes
  pointless with only one CPU.
* Return a proper reschedule hint on enqueing a thread, based on the priority
  of the current thread vs. the enqueued one.
* Enable dynamic scheduler selection. With one CPU the simple scheduler will
  be used, otherwise affine is selected.
* Removed the scheduler type define as we now always auto-select it.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32573 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-21 16:10:27 +00:00
Rene Gollent
009ccc2962 anevilyak+mmlr:
* scheduler_enqueue_in_runqueue() now allows the scheduler to return a hint as to whether a reschedule is desirable or not. This is used in a few other places in order to relegate scheduling decisions entirely to the scheduler rather than the priority hacks previously used. There are probably other places in the kernel that could now make use of that information to more intelligently call reschedule() though.
* Switch over the default scheduler to scheduler_affine().



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32554 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-21 04:11:40 +00:00
Rene Gollent
66dde0a85d Fix build with TRACE_SMP enabled.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32550 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-20 23:39:22 +00:00
Axel Dörfler
6d908f83f3 * Must be careful which functions to call in the notifications handler, or else
you can easily produce a dead lock. This should fix the system hang
  experienced as part of bug #4223.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32526 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-19 17:09:33 +00:00
Michael Lotz
152132f08a mmlr+anevilyak:
* Keep track of the currently running threads.
* Make use of that info to decide if a thread that becomes ready should preempt
  the running thread.
* If we should preempt we send the target CPU a reschedule message.
* This preemption strategy makes keeping track of idle CPUs by means of a bitmap
  superflous and it is therefore removed.
* Right now only other CPUs are preempted though, not the current one.
* Add missing initialization of the quantum tracking code.
* Do not extend the quantum of the idle thread based quantum tracking as we want
  it to not run longer than necessary. Once the preemption works completely
  adding a quantum timer for the idle thread will become unnecessary though.
* Fix thread stealing code, it did missed the last thread in the run queue.
* When stealing, try to steal the highest priority thread that is currently
  waiting by taking priorities into account when finding the target run queue.
* Simplify stealing code a bit as well.
* Minor cleanups.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32503 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-19 03:19:17 +00:00
Jonas Sundström
fe3763173c Add jamfile to build generic memcpy and memset for arch mipsel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32497 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-18 15:34:23 +00:00
Michael Lotz
100487755f We explicitly remove the thread from the (priority sorted) run queue to
re-insert it at a new place, but by only setting the priority and not the
next_priority field, the thread would actually be enqueued at the same priority
level as before. Didn't cause any real damage, guess it was just an oversight.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32494 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-18 13:19:12 +00:00
Rene Gollent
f940f1e99c Initialize variable.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32485 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-17 23:28:58 +00:00
Rene Gollent
494fe97976 Cleanups and some changes to avoid looping to compute the quantum average as suggested by Axel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32484 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-17 23:26:22 +00:00
Michael Lotz
65411f56b7 We can return directly as we use handy locker objects. Adjusted and added
comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32483 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-17 22:51:01 +00:00
Jonas Sundström
a245e6b444 Removing Axel's copyright. Permission given here: https://lists.berlios.de/pipermail/haiku-commits/2009-August/019513.html
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32482 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-17 22:26:09 +00:00
Jonas Sundström
c175f2a63e Adding placeholder machine dependent kernel code for arch mipsel. Copied from src/system/kernel/arch/arm and gutted.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32480 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-17 20:01:11 +00:00
François Revol
541dd9330e I'm obviously not that old. Not officially at least.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32477 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-17 19:22:44 +00:00
Michael Lotz
73c035dc11 * Set freed memory to 0xdeadbeef before returning it to page. This allows us to
not hold the bin lock while setting and only protect the actual freeing. May
  reduce bin lock contention a little bit.
* Tiny optimization for force-clearing 0xdeadbeef. Do it after setting to 0xcc,
  so that it's less likely we have to do it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32473 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-17 17:25:24 +00:00
Jonas Sundström
ac5f5cdf01 Define IEEE-endianness for arch mipsel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32464 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-17 14:59:19 +00:00
Michael Lotz
699bf40942 Add scheduling notifications to scheduler_affine.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32463 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-17 14:51:07 +00:00
Jonas Sundström
31a36e3021 mipsel wip
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32462 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-17 14:49:04 +00:00
Ingo Weinhold
4e4ff20294 common_poll():
* Always select POLLNVAL. We wouldn't get notified, if the FD was closed while
  waiting.
* Skip negative FDs (as per POSIX standard).
* When encountering an invalid FD, we must not wait. Previously we did that as
  long as any FD was valid.
* The return count must consider all FDs with non-null revents, including
  invalid ones (revents is POLLNVAL then).

common_poll()/common_wait_for_objects():
* Don't bail out early, when no FDs/objects have been selected. We always want
  to wait.

_user_poll()/_user_wait_for_objects():
* Copy the array back to userland even if common_*() returned an error. The
  functions do now always fill in the resulting events.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32418 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-15 16:42:18 +00:00
Ingo Weinhold
57dc0e2a53 Changed the FD selection/deselection handling a bit:
* B_EVENT_INVALID is no longer passed to the FD's select()/deselect() hooks.
* Now we always attach the select info to the I/O context, even if no event has
  been selected. The reasoning is that B_EVENT_INVALID is always automatically
  selected and handled by the VFS, so we need the handle to notify on close().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32417 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-15 16:28:15 +00:00
François Revol
5ce6cb5c32 [GSoC] [ARM] Patch by Johannes Wischert.
Some debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32416 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-15 14:31:14 +00:00
François Revol
4b953dec79 [GSoC] [ARM] Patch by Johannes Wischert.
Do call mmu_init_for_kernel() here.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32415 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-15 14:29:20 +00:00
François Revol
d10d43315b [GSoC] [ARM] Patch by Johannes Wischert.
Fix arch_int_are_interrupts_enabled().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32414 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-15 14:28:00 +00:00
François Revol
33a3c23a00 [GSoC] [ARM] Patch by Johannes Wischert.
- cleanup,
- implement atomic_set() for PXA and other pre-arm6.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32413 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-15 14:22:53 +00:00
François Revol
f6e18219c3 [GSoC] [ARM] Patch by Johannes Wischert.
Add assembler code to actually jump to the kernel.
The terminal now says:

kernel entry at 80048228
PANIC: acquire_spinlock: attempt to acquire lock 0x8012a59c with interrupts enabled
Welcome to Kernel Debugging Land...
Thread 0 "" running on CPU 0
kdebug>



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32408 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-15 02:16:23 +00:00
François Revol
d20ab0b9af [GSoC] [ARM] Patch by Johannes Wischert.
Add missing kernel stub.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32407 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-15 02:14:51 +00:00
François Revol
12f64a3b27 [GSoC] [ARM] Patch by Johannes Wischert.
- don't panic on missing page table, just add it,
- less debug output,
- include PXA LCD regs in hw memory map.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32406 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-15 02:13:39 +00:00
François Revol
bb7479a182 [GSoC] [ARM] Patch by Johannes Wischert.
Turn off interrupts at loader entryn and make sure the mmu is disabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32405 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-15 02:11:07 +00:00
François Revol
639b8a4905 [GSoC] [ARM] Patch by Johannes Wischert.
This seems to work around the dynamic segment having a huge file size in headers, it must also be in the data segment...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32404 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-15 01:15:18 +00:00
François Revol
98a3545295 [ARM]
Add support for boot splash, only for PXA.
Disabled for now as it forces the framebuffer onto some useful data.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32399 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 22:14:07 +00:00
François Revol
477d2636d8 Return B_OK on success.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32397 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 21:04:29 +00:00
François Revol
7db9fbfe80 Factor out the splash image display logic too.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32395 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 20:51:29 +00:00
Ingo Weinhold
7435db9ff0 * _user_read_dir(): Allocate a temporary heap buffer passed into the kernel
instead of using the user buffer. This frees the VFS and FS implementations
  from handling user buffers.
* Adjusted fix_dirent() accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32384 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 18:31:35 +00:00
François Revol
0573d397e1 Factor out the RLE and blitting functions from bios_ia32 to platform/generic/ so it can be reused by other platforms.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32383 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 18:15:44 +00:00
Axel Dörfler
55be27517f * Also print the capabilities on boot up.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32360 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 14:31:38 +00:00
François Revol
3f6f17cf36 [ARM]
Start of framebuffer initialization for the Verdex board.
For now it points to the data section as framebuffer for testing and shows an RGB pattern.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32352 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 12:40:16 +00:00
Axel Dörfler
bb693d7764 * Added VESA capabilities field to the kernel args.
* The vesa driver no longer uses VGA programming if the chip does not support
  VGA compatibility.
* The VESA driver now tries to set the DAC to 8 bits per color gun.
* In VESA modes, the driver no longer tries to use VGA programming; introduced
  the new vesa_set_indexed_colors() that is now used for palette programming.
  This should fix wrong colors of 8 bit BWindowScreen users with VESA on real
  hardware (emulators usually didn't mind either way).
* Note that the app_server needs to maintain a palette per 8 bit screen, as
  right now, the colors are garbled after a workspace switch. Stefano, are you
  looking into that already?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32347 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 09:49:28 +00:00
François Revol
3f366cdc39 [ARM]
Don't forget the ELF header else we end up loading at 0x7fff8000...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32341 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 01:10:19 +00:00
François Revol
d9c434dc91 [ARM]
Use the same trick as for m68k (r26536) to get separate text & data segments for the kernel, though this should really not be needed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32340 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 00:18:25 +00:00
François Revol
7ac9833646 [GSoC] [ARM] Patch by Johannes Wischert.
Update the memory map to account for passed tgz mapping. It's still hardcoded for now though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32339 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 00:10:59 +00:00
François Revol
f5ad74ca68 [ARM]
Actually enable mmu_init() since it works for verdex now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32338 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-14 00:10:03 +00:00
François Revol
89fd3a7d20 [ARM]
move checking for the tgz after debug init, and print something when found.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32337 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 23:43:56 +00:00
François Revol
78db3ad125 [GSoC] [ARM] Patch by Johannes Wischert.
Fix wrong string comparison.
(btw the coding style police will inspect this, beware :p)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32336 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 23:41:40 +00:00
François Revol
d8417ee73b [ARM]
- cleanup,
- fix getimg().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32335 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 23:35:02 +00:00
François Revol
715a9925f1 [ARM]
Move ARM MMU definitions to a separate header file.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32332 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 21:09:48 +00:00
François Revol
38ec40dcbe [GSoC] [ARM] Patch by Johannes Wischert.
Partial implementation of mmu support for the bootloader, with lot of debugging output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32330 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 20:30:20 +00:00
François Revol
c2662f0d22 [GSoC] [ARM] Patch by Johannes Wischert.
- empty u-boot specific platform code for the kernel,
- add various objects needed by the kernel from libroot or the generic C implementation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32328 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 18:48:21 +00:00
François Revol
23eafdaf31 [GSoC] [ARM] Patch by Johannes Wischert.
- stubbed out many arch kernel functions (borrowed from other archs),
- partially implement ELF relocations code, enough to load the kernel,
- move uart.c to kernel sources and use the same one for the loader,
- default implementation for gensyscalls,
- assembler code functions for interrupt masking (enable/disable/restore/query).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32327 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 18:34:15 +00:00
Artur Wyszynski
818ef0e501 Fixed wrong check
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32326 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 17:46:39 +00:00
François Revol
79cf966c2c [ARM]
Add unwind symbols to the kernel too... not sure it goes here though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32325 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 17:36:42 +00:00
François Revol
a2577dbfd1 [ARM]
Stubbed out config_manager and pci bus_manager arch code.
Now really use the boot floppy tgz for the netbsd uimage as it all builds, but with other kernel arch code not yet commited.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32324 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 17:29:46 +00:00
Axel Dörfler
368fc35adf * Also have the uppper limit check in the assert.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32323 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 16:49:53 +00:00
François Revol
b927aacaf9 [GSoC] [ARM] Patch by Johannes Wischert.
Add UART initialization for OMAP. uncomment polling wait loops.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32317 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 14:56:40 +00:00
Axel Dörfler
48cb56d8ef * We also shouldn't try to copy if the dirent is too large, obviously.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32314 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 14:21:18 +00:00
François Revol
0f282bc263 Use a more logical and native error here.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32313 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 14:03:43 +00:00
François Revol
0e20032995 [ARM]
Move the unwind data out of the bss section, it broke bss init which ended up erasing real data and making dprintf do weird things...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32308 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 12:48:33 +00:00
Axel Dörfler
f9ba5c92e3 * Let fix_dirent() handle invalid reclen's gracefully.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32306 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 12:05:20 +00:00
Bryce Groff
6f0f2e9ecd * Cleaned up pointer style
* Added new line that was missing from previous commit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32298 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 08:38:58 +00:00
François Revol
01c8294cc7 [ARM]
- don't clobber the parameter regs in the entry point,
- fix entry point address for netbsd loader emulation,
- added a gUImage global to point to the uimage blob with the tgz,
- added tgz info to platform stage2 args,
- add simple uimage support, just dumps the header and gets the nth blob in the image, (seems we have a bug in the math code, some infos don't print),
- made devices.cpp use them to publish the MemoryDisk,
- add an haiku_loader_nbsd.ub target which puts both the loader and kernel_arm for now (need to replace with the tgz).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32295 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 05:28:30 +00:00
François Revol
f4e0ad68b3 [ARM]
- fixed copyright,
- added a naive armv5 implementation for __swap_int{16,32}.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32294 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 04:32:05 +00:00
Michael Lotz
68b6dce107 We already panic to indicate that something's wrong, no real need to crash
afterwards instead of returning gracefully.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32293 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 02:00:49 +00:00
François Revol
1e33c1136e [ARM]
- cleanup,
- moved the startup asm code to u-boot/arch/arm/shell.S
- added netbsd loader entry point,
- store the invocation type (0: standalone, 1: netbsd),
- store the global data in a variable,
- added some debug code to see what U-Boot gives us.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-13 01:15:21 +00:00
François Revol
cd5d972ea0 [ARM]
Name the FAT; no need to list the contents.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32290 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 22:06:14 +00:00
François Revol
2807c5413f fix PXE build with multiboot. GRUB supports netboot btw, could be interesting to explore... but the pxe shell doesn't check for the info yet.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32289 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 20:30:03 +00:00
Axel Dörfler
b5cc4c1958 * Disabled multiboot for now, as it breaks the PXE build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32286 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 17:48:18 +00:00
François Revol
e4b608db5b [ARM]
Missed this one in previous commit: remove board.ld include as we now give LD the address directly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32285 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 16:25:02 +00:00
François Revol
feb750d331 [ARM]
- consolidate board specific definitions into build/jam/board/*/BoardSetup to avoid duplicating address values everywhere,
	- add various addresses, boot script, custom C/C++ flags and SD card definition,
	- not sure BoardSetup is included at the best place though,
	- replaced board-specific ldscript with passing the loader address directly to LD from BoardSetup,
- added haiku.mmc target which generates an mmc/SD card image with a FAT partition with the files needed to boot for the board, should later be integrated with haiku.image with the BFS partition offset passed to bfs_shell, requires apt:sfdisk,mtools on GNU/Linux,
- added some more rules, one to build a script for the SD image,
- fake a NetBSD loader for now, U-Boot doesn't know haiku, and we'll need a way to pass the tgz image and RAM size, we'll either use standlone way (usual C argv[]) or the NetBSD args,
- style fixes,
- 80 cols, /me pets Ingo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32284 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 16:12:35 +00:00
Axel Dörfler
30f4c392a4 * Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32281 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 14:39:37 +00:00
François Revol
43da1b4f11 [ARM]
Condition the exclusive ops to >= armv6 instead of specific version.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32277 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 14:17:05 +00:00
Axel Dörfler
9e90c30ebd * Fixed warnings.
* Removed FAT support from the boot loader for now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32276 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-12 14:12:09 +00:00
Axel Dörfler
a068dcb15a * cdda_read_dir() could copy too many bytes into the provided buffer (worst
case was an unterminated string, though).
* fix_dirent() did not copy the trailing null-byte.
* Not yet entirely sure why, but this caused #4214.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32254 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-11 15:46:07 +00:00
François Revol
166983b771 [ARM]
Stub out swap funcs for pre armv6 which lack REV/REV16. WRITEME.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32240 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-11 03:24:22 +00:00
François Revol
e3db8e35e3 [ARM]
Temporary (?) solution to linking the loader: generate symbols needed by the unwinding code, which should actually not be used since we disable exceptions...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32239 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-11 03:21:29 +00:00
Bryce Groff
1987b05aa0 * Added open_partition to disk_device_manager
* Rewrote PartitionMapWriter
* Updated style to match current style guide for the intel partitioning system.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32235 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-10 22:28:47 +00:00
Michael Lotz
60a5ced394 Adding a disabled debug helper.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32217 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-09 19:54:41 +00:00
Michael Lotz
50d22f83ef The reference of the currently active translation map shouldn't be released
until the data it protects isn't in active use anymore. Previously it would
release the translation map and therefore the page directory reference while
the page dir was still set on the CPU, as only the actual call to
i386_context_switch() will replace the page directory in the control register.
This didn't cause any harm though, as during the context switch interrupts are
disabled and therefore the page directory would only be deferred_delete()ed and
not directly freed/overwritten. Still this is logically more correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32216 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-09 17:39:05 +00:00
François Revol
ac15f9dd16 [ARM]
Add rule to handle uimage, and board-specific stuff to handle load addresses. Need to fix them, u-boot doesn't like loading the file with the header where the header says it should go, must copy to a different address.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32214 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-09 16:40:17 +00:00
François Revol
71c5ee196b [ARM]
Remove debug leftover.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32208 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 16:12:02 +00:00
François Revol
e60a2810f6 [ARM]
Include board-specific file from the u-boot ldscript, to allow linking to different load addresses.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32207 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 16:02:34 +00:00
François Revol
0693778cee [ARM]
Move uart.c to arch/arm/ where it belongs, it has nothing u-boot specific.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32203 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 02:38:44 +00:00
François Revol
f875744d56 [ARM]
Remove duplicate header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32202 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 02:26:01 +00:00
François Revol
658d387ad5 [ARM]
- cleanup,
- add an uart_debug_port() to avoid using the #define in serial.cpp,
- use board_config defines in uart.c.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32201 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 02:23:22 +00:00
François Revol
67a0108c3b [ARM]
- add board specific headers to includes,
- some unused flash image targets.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32199 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 02:01:59 +00:00
François Revol
541e58f98f Seems r31815 got MIA due to r31919+r31925...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32196 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-08 00:18:59 +00:00
Axel Dörfler
f7a6506e0f * Replaced all "status < B_OK" with != B_OK - this should make the VFS layer
more robust against broken (userland) file systems.
* 80 character column cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32184 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-07 12:29:17 +00:00
Axel Dörfler
f7be7fea76 * Setting the depth to 1 for VGA mode in frame_buffer_console_init() was not
a good idea; it didn't have any consequences in there, but actually broke
  the app_server's support for the VGA mode.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32181 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-07 11:07:14 +00:00
Axel Dörfler
86766d6aca * handle_driver_events() kept the sDriversListLock locked over the whole
time. But since this is also locked from within the driver/directory watcher
  (with the node monitor lock held), and handle_driver_events() could cause
  node monitoring updates, the locking order could be reverted, causing a
  deadlock (I just ran into).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32152 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-06 08:24:23 +00:00
Axel Dörfler
13247f3a8c * This fixes VGA mode frame buffer use, no idea when this got broken. It might
be broken in the app_server now, but I haven't checked yet.
* Fixed typo in vesa.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32141 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-05 17:24:23 +00:00
Axel Dörfler
45ed4939f9 * area_for() now also returns the area ID for kernel areas if they are
accessible to the userland - this fixes #2405 (ie. MediaPlayer overlay now
  works).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32135 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-05 15:04:45 +00:00
Axel Dörfler
cfd22919f2 * FileMap::Translate() did not choke on negative offsets, and _Cache() does not
necessarily return an error in this case.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32129 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-05 13:05:58 +00:00
Ingo Weinhold
af31cb589c Added comment.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32119 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-05 02:31:00 +00:00
Michael Lotz
ee280b59e9 Prevent the user TLB invalidation function from being preempted by turning off
interrupts when invoking it. The user TLB invalidation function essentially only
reads and writes back control register 3 (cr3) which holds the physical address
of the current page directory. Still a preemption between the read and the write
can cause problems when the last thread of a team dies and therefore the team
is deleted. The context switch on preemption would decrement the refcount of the
object that holds the page directory. Then the team address space is deleted
causing the context switch returning to that thread to not re-acquire a
reference to the object. At that point the page directory as set in cr3 is the
one of the previously run thread (which is fine, as all share the kernel space
mappings we need). Now when the preempted thread continues though, it would
overwrite cr3 with the physical page directory address from before the context
switch still stored in eax, therefore setting the page directory to the one of
the dying thread that now doesn't have the corresponding reference. Further
progressing the thread would release the last reference causing the deletion
of the object and freeing of the, now active again, page directory. The memory
getting overwritten (by deadbeef) now completely corrupts the page directory
causing basically any memory access to fault, in the end resulting in a
triplefault. This should fix bug #3399.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32118 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-04 23:15:05 +00:00
François Revol
f676f30b36 Remove those antique misleading leftovers, the good ones are at headers/private/kernel/boot/images.h
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32116 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-04 18:50:08 +00:00
François Revol
f335531bbc Remove file map disk support by default, it's not used anyway, and we'll use layers for CD anyway. Doesn't spare that many bytes though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32110 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-04 09:00:10 +00:00
François Revol
98977abc9b Fix m68k build, still unimplemented.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32102 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 21:17:03 +00:00
François Revol
af9475fd3d Initialize args.arguments on ARM too.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32100 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 19:53:17 +00:00
Ingo Weinhold
1d099cad03 Patch by Bryce Groff: Allow passing an ID of any partition contained in the
disk device to the locking functions, not only the ID of the disk device
itself.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32094 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 19:01:20 +00:00
François Revol
696e647c0f Implemented getting bootargs from OF. Untested.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32081 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 15:12:24 +00:00
François Revol
56c6c0fefb - introduced an "argumetns" field in stage2_args to hold command line args from chaining loader,
- added some multiboot support code:
	- dump some of the passed info,
	- parse command line (skip the 'kernel' name and pass the rest to stage2_args.arguments),
- added an add_stage2_driver_settings() function which takes stage2_args.arguments and translates it into safe mode driver settings, a bit dumb for now.
This allows using qemu -kernel haiku_loader -append 'debug_screen true' and get debug output without having to enter the menu (once multiboot info is used to determine the boot device too).
The idea is to allow passing driver settings and using them to pass extra stuff (like 'force_keymap fr' and other stuff for demo), and to help automate tests ('run_test /bin/sometest').
This should answer Axel's question :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32076 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 14:39:41 +00:00
Michael Lotz
255c9104e5 * Rework the heap locking strategy. Use a read-write lock for the area lock to
allow for more parallelism. Also introduce seperate locks for the bins and
  for page allocation. This greatly reduces lock contention and reduces the
  duration the locks are held due to them overall protecting less code. Now only
  allocations of the same size hitting the same allocator or allocating larger
  chunks of memory should block. Previously, basically any allocation and also
  free would be mutually exclusive, making it scale pretty badely.
* Added memalign_nogrow(). As it uses heap_memalign() anyway, there's no real
  reason not to allow for an alignment.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32074 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 13:59:45 +00:00
Ingo Weinhold
ea2abd110b * Renamed the ROUNDOWN macro to ROUNDDOWN. Also changed the implementation of
ROUNDUP to use '*' and '/' -- the compiler will optimize that for powers of
  two anyway and this implementation works for other numbers as well.
* The thread::fault_handler use in C[++] code was broken with gcc 4. At least
  when other functions were invoked. Trying to trick the compiler wasn't a
  particularly good idea anyway, since the next compiler version could break
  the trick again. So the general policy is to use the fault handlers only in
  assembly code where we have full control. Changed that for x86 (save for the
  vm86 mode, which has a similar mechanism), but not for the other
  architectures.
* Introduced fault_handler, fault_handler_stack_pointer, and fault_jump_buffer
  fields in the cpu_ent structure, which must be used instead of
  thread::fault_handler in the kernel debugger. Consequently user_memcpy() must
  not be used in the kernel debugger either. Introduced a debug_memcpy()
  instead.
* Introduced debug_call_with_fault_handler() function which calls a function
  in a setjmp() and fault handler context. The architecture specific backend
  arch_debug_call_with_fault_handler() has only been implemented for x86 yet.
* Introduced debug_is_kernel_memory_accessible() for use in the kernel
  debugger. It determines whether a range of memory can be accessed in the
  way specified. The architecture specific back end
  arch_vm_translation_map_is_kernel_page_accessible() has only been implemented
  for x86 yet.
* Added arch_debug_unset_current_thread() (only implemented for x86) to unset
  the current thread pointer in the kernel debugger. When entering the kernel
  debugger we do some basic sanity checks of the currently set thread structure
  and unset it, if they fail. This allows certain commands (most importantly
  the stack trace command) to avoid accessing the thread structure.
* x86: When handling a double fault, we do now install a special handler for
  page faults. This allows us to gracefully catch faulting commands, even if
  e.g. the thread structure is toast.

We are now in much better shape to deal with double faults. Hopefully avoiding
the triple faults that some people have been experiencing on their hardware
and ideally even allowing to use the kernel debugger normally.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32073 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 12:39:56 +00:00
Ingo Weinhold
16357dea6b Don't lock when the debugger is running.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32072 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 11:54:25 +00:00
Ingo Weinhold
885b7b4a85 Removed unsupported architectures.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32071 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 11:32:08 +00:00
François Revol
4b8d0e6856 Some ppc fixes for #4115, patch by kallisti5 (without the #ifdef _BOOT_MODE):
- stubbed out arch_cpu_init_percpu(),
- make atomic ops declarations extern "C",
- move calls to [i]sync inside the asm code that needs it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32067 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-03 10:10:22 +00:00
François Revol
91517f4f12 Minimal definition of the MultiBoot Info struct, should be enough for now.
We use official names for defines & struct members.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32060 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-01 12:32:18 +00:00
François Revol
a9c45a68ef Add MultiBoot support.
Based on a patch from Dustin Howett, reworked, and help from Vladimir 'phcoder' Serbinenko.
- used defines for clarity, the rest of teh code could make use of them too...
- added a gMultiBootInfo pointer to the passed args, to let C code handle it instead of faking the boot drive ID,
- conditionalized the copy back, maybe we can get rid of it when QEMU handles our default load address correctly,
- added video mode info to ask for 1024x768 but QEMU ignores it anyway, and we might need to show the menu, so it's disabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32059 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-01 12:03:22 +00:00
Ingo Weinhold
671a2442d9 More work towards making our double fault handler less triple fault prone:
* SMP:
  - Added smp_send_broadcast_ici_interrupts_disabled(), which is basically
    equivalent to smp_send_broadcast_ici(), but is only called with interrupts
    disabled and gets the CPU index, so it doesn't have to use
    smp_get_current_cpu() (which dereferences the current thread).
  - Added cpu index parameter to smp_intercpu_int_handler().
* x86:
  - arch_int.c -> arch_int.cpp
  - Set up an IDT per CPU. We were using a single IDT for all CPUs, but that
    can't work, since we need different tasks for the double fault interrupt
    vector.
  - Set the per CPU double fault task gates correctly.
  - Renamed set_intr_gate() to set_interrupt_gate and set_system_gate() to
    set_trap_gate() and documented them a bit.
  - Renamed double_fault_exception() x86_double_fault_exception() and fixed
    it not to use smp_get_current_cpu(). Instead we have the new
    x86_double_fault_get_cpu() that deducts the CPU index from the used stack.
  - Fixed the double_fault interrupt handler: It no longer calls int_bottom to
    avoid accessing the current thread.
* debug.cpp:
  - Introduced explicit debug_double_fault() to enter the kernel debugger from
    a double fault handler.
  - Avoid using smp_get_current_cpu().
  - Don't use kprintf() before sDebuggerOnCPU is set. Otherwise
    acquire_spinlock() is invoked by arch_debug_serial_puts().

Things look a bit better when the current thread pointer is broken -- we run
into kernel_debugger_loop() and successfully print the "Welcome to KDL"
message -- but we still dereference the thread pointer afterwards, so that we
don't get a usable kernel debugger yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32050 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-01 01:53:54 +00:00
Ingo Weinhold
1af695be01 Automatic whitespace cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32044 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-01 01:18:39 +00:00
Ingo Weinhold
cc77aba101 * Allocate a separate double fault stack for each CPU.
* Added x86_double_fault_get_cpu(), a save way to get the CPU index when in
  the double fault handler. smp_get_current_cpu() requires at least a somewhat
  intact thread structure, so we rather want to avoid it when handling a double
  fault. There are a lot more of those dependencies in the KDL entry code.
  Working on it...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32028 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 16:14:18 +00:00
Axel Dörfler
61b6f38cfc * Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32021 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 14:11:12 +00:00
Axel Dörfler
061d2ed1a2 * Creating a symlink now fails with B_NOT_SUPPORTED instead of
B_READ_ONLY_DEVICE if it has a write hook.
* This fixes bug #4141.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32004 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-31 00:40:52 +00:00
Axel Dörfler
c32499b4f7 * Since the file_map reports its chunk with a file system specific alignment, we
cannot assume that the file is that long - we need to check for the actual
  file size specifically, and then clear the extraneous bytes based on that one.
* This fixes seeing old file left-overs in the space beyond the file size in
  mmapped file. Thanks to Oliver who provided me with a nice test program to
  reproduce this problem (this should also fix gcc's fix_includes app (although
  I wonder what it does if a file actually ends on a page boundary).
* Also fixed a bug in precaching that would cause the last page of the cache
  to be discarded, causing it to be re-read later on.
* Moved partial page clearing into its own function
  read_pages_and_clear_partial(), even though it's currently only used once.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32001 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 23:12:12 +00:00
Ingo Weinhold
ce50cdc3ed When recovering a tracing buffer from a previous session we do now check the
tracing buffer entry list at least. Eventually we should check the entries
themselves, too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31999 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 22:00:16 +00:00
Ingo Weinhold
3fccf0679f C++ified the code. Introduced new trace entry flags, which will eventually be
used to mark entries after recovering a tracing log from a previous session.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31991 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 19:50:50 +00:00
Ingo Weinhold
57a25014b0 Statically initialize sTracingMetaData to sDummyTracingMetaData. This causes
tracing use before real initialization to be ignored gracefully again. Fixes
#4158.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31973 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 15:12:21 +00:00
Ingo Weinhold
213d2d8f9d Added syscall _kern_kernel_debugger() to enter the kernel debugger.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31965 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-30 12:35:42 +00:00
Axel Dörfler
ca39f8d89f * Use parse_expression() instead of strtoul().
* "owner count" contained an extra tab.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31951 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 23:01:27 +00:00
Ingo Weinhold
d829579dc0 mmlr + bonefish:
Moved the static variables for managing the tracing buffer into a separate
area. The area is mapped at one of a few possible physical addresses and can
be found again when rebooting. This allows us to resurrect the tracing buffer
from the previous session, which could help tremendously when tracking certain
bugs (like triple faults). There's very little checking done yet, so it is
probably not as robust as we would wish it to be.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31942 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 21:34:51 +00:00
Ingo Weinhold
d3b44ccb14 Added explicit physical address parameter to vm_create_anonymous_area() and
create_area_etc(). 0 for the default behavior.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31941 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 21:30:35 +00:00
Ingo Weinhold
069b477dd7 * Introduced CREATE_AREA_DONT_CLEAR create_area_etc() flag, which allows the
call to fetch non-clear pages.
* B_PHYSICAL_BASE_ADDRESS does now imply B_CONTIGUOUS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31932 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 18:57:21 +00:00
Ingo Weinhold
00e22bae44 Use B_SYSTEM_TEAM instead of the hard-coded 1.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31931 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 18:53:38 +00:00
Oliver Tappe
a50f9555a8 * re-added the broken bsd-version of strtod.c, as our kernel depends on strtod,
too, and I do not dare to add a glibc-based source to our kernel.
  This means that our kernel will have to live with strod() yielding
  inaccurate results, but since the only use I have found was for fs-queries,
  I think we can cope for now.
* added a comment to the top of strtod.c that explains the current state.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31925 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 17:07:00 +00:00
Oliver Tappe
8c359d8eb4 * small cleanup
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31920 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 16:22:00 +00:00
Oliver Tappe
4f86db4973 * replaced broken bsd-inherited implementation of strtod() with the glibc
version that lives in our repo, too, and actually works as intended
* removed the broken strtod() implementation from the repo
This fixes all floating-point test regressions reported in #3308.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31919 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 16:03:14 +00:00
Axel Dörfler
4cb7d2e55d * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31915 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 15:46:21 +00:00
Oliver Tappe
c11fb6fd9f * removed a TODO that no longer applies
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31914 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 15:45:14 +00:00