Commit Graph

3496 Commits

Author SHA1 Message Date
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
Axel Dörfler
533cba7eff bonefish + axeld:
* Reverted r31809 as it introduced a race condition; if the I/O request had been
  notified, it could already been deleted at that point.
* Instead, we need to notify the request in each file system/driver that uses
  it. Added new notify_io_request() function that does that exactly.
* Added a TODO comment to the userlandfs where the request notification needs
  a bit more thought.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31903 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 12:16:15 +00:00
Axel Dörfler
8ae594ffd4 * Introduced dedicated syscalls for the deprecated BeOS fs_attr API. Before,
each attribute access needed 3 syscalls, now only one as it should.
* Renamed the new Haiku call fs_open_attr() to fs_fopen_attr(), and added a new
  function fs_open_attr() that takes a path (same semantics as the
  fs_[f]open_attr_dir() functions already present in BeOS).
* Merged former _kern_open_attr(), and _kern_create_attr() into one syscall.
* Cleaned up vfs.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31881 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 00:34:44 +00:00
Axel Dörfler
0a5bfde225 * Added stack traced to the Abort tracing output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31870 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 21:50:42 +00:00
Axel Dörfler
61efcc328d * Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31869 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 21:49:28 +00:00
Axel Dörfler
71d2034366 * Enhanced cache_blocks_in_main_transaction() to also return the correct number
of blocks in case there is no sub-transaction at all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31868 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 21:47:06 +00:00
Michael Lotz
ebc89d1766 Remove extra newline in debug command description which caused empty lines in
the KDL help to be printed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31866 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 21:35:16 +00:00
Michael Lotz
ab5421283b Accommodate for the two lines of clearing ahead when in KDL. This avoids over-
writing lines that are printed below the previously cleared lines when paging.
Fixes bug #4145.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31865 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 21:31:27 +00:00
Axel Dörfler
483acc4382 * has_sub_transaction was never initialized, no clue why this didn't come up
earlier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31845 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 14:09:28 +00:00
François Revol
f2a3f51996 jam target to build a flash image. Requires passing UBOOT_IMAGE to jam.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31823 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 17:11:40 +00:00
François Revol
6f14ecb425 [GSoC] [ARM] Patch by Johannes Wischert.
Misc. Assembler functions (atomic ops, byte swapping, longjmp and libc).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31822 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 16:27:13 +00:00
François Revol
1f4fe94583 [GSoC] [ARM] Patch by Johannes Wischert.
LD scripts for u-boot based bootloader and the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31819 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 16:21:20 +00:00
François Revol
20cbef82a4 [GSoC] [ARM] Patch by Johannes Wischert.
Stubbed u-boot platform code. Mostly copied from other platforms.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31818 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 16:13:38 +00:00
François Revol
811662afae [GSoC] [ARM] Patch by Johannes Wischert.
Default arm arch Jamfile for bootloader.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31817 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 16:10:29 +00:00
François Revol
95337b50b0 [GSoC] [ARM] Patch by Johannes Wischert.
Include ARM in the endian test.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31815 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 16:08:32 +00:00
Michael Lotz
fec23a53d7 Add another paging mode to onscreen debug output. Activated by pressing "t" it
will show the next page after a timeout of 3 seconds instead of waiting for a key
to be pressed. This allows you to enjoy onscreen debug output even when you only
have a USB keyboard. Should be enough time to take a quick look or take a photo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31814 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 15:51:02 +00:00
Axel Dörfler
eb26e782f3 * Decoupled block_cache_used_memory() from the sCachesLock - this should fix the
UI freezes (ActivityMonitor and ProcessController both use get_system_info() a
  lot), although this is only the symptom of another problem.
* The downside is that the block cache usage information isn't as up to date as
  it was previously - it's updated by the block write/notifier thread now (worst
  case every 2 seconds).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31812 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 14:59:39 +00:00
Michael Lotz
5efec82035 * Fix KDL output to use kprintf instead of dprintf.
* Make the allocations command available even without leak checking. The sizes
  that are dumped aren't as accurate without leak checking info, but having the
  address and max size is already helpful.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31811 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 14:47:04 +00:00
Axel Dörfler
2c8ad7ab3e * If the fs_io() hook failed, we need to check if the request has been notified
about it (there is also no public API to do that in the FS yet).
* This could have caused bug #2719, although the specific reason why the FS hook
  failed remains unknown. At least it won't hang in this case anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31809 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 14:38:29 +00:00
Stephan Aßmus
5147963dcd headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than
Tracker's OpenHashTable.h which it should eventually replace. We've renamed the
class to BOpenHashTable and changed the interface slightly so that HashTableLink
became superfluous.
Adapted all the code that used it. Since the OpenHashTables no longer clash,
this should fix the GCC4 build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31791 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 00:39:12 +00:00
Axel Dörfler
f75b8de3fc * Discarded the "parametersSize" parameter from various disk device manager
functions.
* Since we now use UserStringParameter, this fixes the missing null termination
  of the parameter string, and thus bug #4045.
* Removed UserMemoryParameter, as it's no longer in use.
* Adjusted syscalls accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31779 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-26 17:27:27 +00:00
Axel Dörfler
6def1a637b * In order to resolve mount points, fix_dirents() retrieved all vnodes from
disk; but since mount points are always kept in memory, it makes much more
  sense to use lookup_vnode() instead.
* As a side effect, directory listings are no longer aborted when they contain
  broken files that could not be retrieved anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31775 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-26 15:07:27 +00:00
Axel Dörfler
71e439ea3e * Moved most utility functions from bfs.h to Utility.h.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31770 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-26 13:44:31 +00:00
Axel Dörfler
813d9285bf * Fixed a number of problems of the "block_cache_data" command.
* Also added stack traces to each BlockData entry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31763 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-26 12:18:11 +00:00
Axel Dörfler
27a88ee6b2 * Fixed typo.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31762 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-26 12:13:20 +00:00
Axel Dörfler
6102f0788a * file_cache_set_size() now clears the last page of its cache if needed. This
fixes #4106 for good.
* Also removed a bit of dead code in that function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31732 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-24 09:19:24 +00:00
Axel Dörfler
c06e68d0c8 * Added partitioning system modules efi_gpt, amiga_rdb, and apple to the image.
* Changed the boot loader to have architecture dependent partition/file system
  support. Amiga/Apple partitions, and the AmigaFFS file system are now only
  supported on PPC, while EFI GPT, and the FAT file system is now only supported
  on x86.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31713 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-23 12:10:09 +00:00
Axel Dörfler
664683a7d2 * Fixed just another typo.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31709 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-23 08:33:57 +00:00
Axel Dörfler
bdee97bc3a * Applied slightly changed patch by Alexander von Gluck.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31708 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-23 08:22:01 +00:00
Axel Dörfler
1ad5198c09 * Reset keyboard state when an emergency key has been processed - it's likely
that we lost a few keystrokes, and would make keys (like SysReq) stick.
  Thanks to Rene for the note!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31688 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-22 08:02:51 +00:00
Ingo Weinhold
0b11ecb18c * Always include the public arch_debugger.h headers. The structures defined
there are prefixed with the respective architecture name. Useful for remote
  debugging a different architecture.
* <x86/arch_debugger.h>: Introduced a structure for the FPU state, so that it
  isn't left to the debugger.
* Removed the _kern_get_thread_cpu_state() syscall. Was originally intended for
  bdb compatiblity, but isn't really needed.
* Kernel x86 arch_get_debug_cpu_state(): The use of fnsave was broken, since
  it reinits the FPU after saving the state. This resulted in weird results
  when debugging functions using the FPU. We now use fxsave, if available.
  Otherwise fnsave + frstor should be used -- not fully implemented yet.
  Same for arch_set_debug_cpu_state().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31682 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-21 22:18:39 +00:00
Axel Dörfler
a64c204e23 * The module iteration code now ignores entries named "dev", and "bin" - this
reduced the boot time in VMware by several seconds, and should also help with
  booting from CD.
* Added TODOs on how to further improve the situation in the future.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31672 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-21 12:33:15 +00:00
Axel Dörfler
13aa1795dd * It seems we always have to specify all flags to make it work; removed "flags"
parameter from start_system_profiler().
* Added stack depth, and interval parameters to it, though.
* Profiling the boot process is now possible.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31671 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-21 12:09:15 +00:00
Axel Dörfler
db8fb4fdf0 * The file cache must clear partial pages as well, since they can be mapped
directly via mmap().
* This fixes bug #4106.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31669 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-21 10:17:57 +00:00
Axel Dörfler
c755ecfe96 * Added an emergency key mechanism to the kernel, inspired by Jan Klötzke's
patch from about a year ago (I couldn't use any code of his yet, though,
  but there are a few things left). The emergency keys are triggered by
  pressing Alt-SysReq + key.
* By default, only Alt-SysReq+'d' is used as a means to deliberately enter
  the kernel debugger. F12 belongs to userland again, now :-)
* Debugger add-ons now have another optional method to implement their own
  emergency keys - 'd' for the debugger cannot be overridden, though.
* The mechanism can be turned off via a new kernel setting, so it's not that
  easy anymore to "crash" Haiku if you don't want to.
* Right now, the PS/2 driver, and the pre-input_server in-kernel debugger
  keyboard mini-driver support this, USB not yet.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31660 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-20 20:39:37 +00:00
Ingo Weinhold
7f96148cac Patch by Bryce Groff with changes by myself:
* Added missing name parameter to the partitioning system module child creation
  and child creation validation hooks. Pass the name to them.
* Added BPartitionParameterEditor interface, which is/will be used for editing
  disk system specific parameters.
* Implemented partition parameter editors for BFS initialization and Intel
  partition map child creation.
* Fixed the incorrect supported child partition type iteration in the Intel
  partition map add-on. It does now return actual types.
* Handle the "active" flag parameter in the Intel partitioning system module.
* DriveSetup:
  - Replaced the "Create" submenu by a simple menu item. The type can now by
    chosen in the dialog.
  - Make use of initialization and child creation parameter editors. Some
    non-generic code has been moved to the respective editor implementations
    (BFS, intel partitioning system).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31658 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-20 20:29:16 +00:00
Axel Dörfler
24a9c1bbba * Added option "-r, --recorded" to profile: this will now retrieve the kernel
profile data area, and evaluate its data - it doesn't produce any output yet,
  though.
* _user_system_profiler_recorded() now also makes sure the userland app can read
  from the buffer area.
* Fixed leak in SharedImage::Init().
* Made the symbol retriever more smart when it deals with kernel images; if the
  image ID is no longer available, it will now use the path based image symbol
  iterator (and also adds the boot kernel path, in case the module don't have
  one).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31653 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-20 14:50:14 +00:00
Axel Dörfler
5fbad060b3 * Work-in-progress on a kernel profile service that can be evaluated from
userland afterwards.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31621 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-17 16:21:06 +00:00
Ingo Weinhold
ecece29dd8 thread_hit_serious_debug_event(): Incorrect return value. Fixes #4098.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31584 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-15 11:37:04 +00:00
Rene Gollent
008ec58d9f When building the block cache for UserlandFS's haiku emulation lib, don't include tracing since that's unavailable outside of the kernel. Fixes ticket #4092. Axel or Ingo, please review.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31525 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-12 03:52:52 +00:00
Ingo Weinhold
a365e1cfbb Patch by Bryce Groff, some changes by myself:
* devfs:
  - devfs_[un]publish_partition(): They no longer get the partition path as
    parameter, but rather the device path and the partition name.
  - Added devfs_rename_partition(), which renames an already published
    partition node.
* KPartition/KDiskDevice:
  - Replaced the fPublished flag by fPublishedName, the name under which the
    partition is published. This simplifies UnpublishDevice() and makes it
    practically infallible.
  - Added GetFileName(), which only returns the partition's file name.
    Simplified GetPath() by using it.
  - When a partition is added/removed the subsequent sibling partitions get a
    new index. Now we also rename their published device nodes (and those of
    their descendents). When something goes wrong we unpublish the concerned
    partition's device to be on the safe side. Would be a shame to accidentally
    format the wrong partition, eh? :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31520 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-11 14:35:04 +00:00
Axel Dörfler
a9b9937a3d * Fixed remove(): it should behave like rmdir() for directories.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31500 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-10 13:31:02 +00:00
Axel Dörfler
3f7eb638dc * Ah, well. Now it's really replaced.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31499 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-10 13:04:13 +00:00
Axel Dörfler
6de41102e5 * Replaced the broken BSD realpath() that is neither thread-safe nor POSIX
compliant with one that is both, and magnitudes faster at that, too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31498 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-10 12:27:05 +00:00
Clemens Zeidler
4ce5127b79 Also I missed this file.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31489 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-09 18:39:15 +00:00
Oliver Tappe
be1f4fe800 * find_symbol_breadth_first() didn't ever set _foundInImage, although
it's signature indicates that it should - the callers just never use
  the value currently, so it caused no harm
* squashed a TODO in the runtime_loader about the resolving strategy
  for undefined symbols in add-ons: I've implemented the breadth-first
  strategy (leaving out the add-on itself), as that one made most sense to
  me.
This avoids loader problems with older optional packages of Pe on gcc4, as some
add-ons (e.g. "Expand Tabs") could not be loaded due to them containing undefined
symbols that are found in second level dependencies (libstdc++.so in this case).

Ingo: please review.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31465 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-08 21:22:12 +00:00
Ingo Weinhold
1cc5e46925 Added offset and size parameters to create_child_partition() and
KPartition::CreateChild(). CreateChild() calls AddChild(), which publishes
the new partition, though at that point offset and size were not set, so that
the published devices would not be usable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31463 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-08 20:26:43 +00:00
Ingo Weinhold
4dceabd707 * Publish the newly added child partition, not the (already published) parent
partition.
* Don't fail, if publishing failed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31460 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-08 12:50:13 +00:00
Ingo Weinhold
34bc7f03ed Patch by Bryce Groff:
* SetBusy(): Use AddFlags() instead of SetFlags() so that the other flags
  aren't cleared.
* AddChild(): Publish the newly added child partition. Otherwise no-one can do
  anything with it without rebooting first. Other children may need to be
  republished under a new name, if their index changes, which doesn't happen
  yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31444 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-07 13:10:52 +00:00
Oliver Tappe
16d5c24e53 * merged 32bit-wchar_t branches of buildtools and haiku back into
the respective trunk

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31443 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-07 10:30:09 +00:00
Ingo Weinhold
811467dd8f Added missing dependency to generated header.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31415 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-06 02:00:43 +00:00
Axel Dörfler
7af3465eb5 * Made set_timezone() argument const - it's not supposed to mess with it.
* Renamed time.c to time.cpp.
* set_timezone() now uses localtime_r() instead of localtime(), and will also
  no longer fail in case there was no timezone symlink before.
* Cleaned up OS.h header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31371 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-02 14:07:46 +00:00
Axel Dörfler
215c1a6c75 * _user_{get|set}_tzfilename() can now be used with NULL filename pointers
in case one just want to get or set the timezone.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-02 14:05:44 +00:00
Axel Dörfler
d1084ff757 * Renamed fs_attr.c to fs_attr.cpp and cleaned it up a bit.
* Always use _kern_create_attr() in fs_write_attr(), or otherwise it might not
  be created when it should.
* Stippi special: fixed typo "in another words" -> "in other words" ("a" is
  singular, not plural).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31312 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-29 09:56:22 +00:00
Stephan Aßmus
181593ba0b * Properly document why fs_write_attr() does what it does.
* As even the author of fs_attr.c was trying to use fs_write_attr() in an
  unsupported way in the cp copy_attributes() implementation, try to be
  more forgiving and support writing attributes at an offset. The method is
  required to behave inconsistent in that replacing bytes at offset 0 is
  not supported as replacing bytes at any other offset. Writing at offset 0
  will clobber the existing attribute to stay compatible with BeOS.

NOTE: BFS itself still does not support writing attributes at an offset which
are withing the "small data section". To work around this problem, programs
which copy attributes in a loop must make sure that their buffer is large
enough that such "small data section" attributes require only one loop
iteration.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31309 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-29 09:08:43 +00:00
Axel Dörfler
e0965f2727 * reload_driver() now also checks if the binary node changed, and will update
the node listener, to make sure it won't lose track.
* The DriverWatcher now also listens for B_ENTRY_REMOVED. This causes drivers to
  be unpublished even if they are only symlinked.
* However, to detect new drivers in a symlinked location, we'd need special
  support for those, and also need to watch the parent directory of the symlink
  target - this is close to overkill, so I stayed away from implementing that
  for now :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31267 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-27 14:24:55 +00:00
Ingo Weinhold
5afb8ea7d7 Patch by Bryce Groff: Implemented DeleteChild().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31234 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-25 15:35:16 +00:00
Ingo Weinhold
fab1c05c05 Split the commpage initialization into two parts. The second part is executed
after all CPUs have been queried for their features. On SMP machines
sysenter/sysexit weren't used before due to the non-boot CPUs appearing not
to have the feature.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31226 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 13:53:58 +00:00
Ingo Weinhold
6a1f462e72 * arch_debug_get_interrupt_pc() does now optionally return whether the iframe
is a syscall iframe.
* User debugger support: Don't to call BreakpointManager::PrepareToContinue(),
  if the thread returns from a syscall. We don't want to skip breakpoints in
  that case.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31223 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 11:49:35 +00:00
Ingo Weinhold
b0f12d64f4 Added transparent software breakpoint support for user debuggers:
* The bulk of the work -- i.e. juggling the software and hardware breakpoints,
  watchpoints, and memory reads/writes -- is done in the new class
  BreakpointManager.
* For the architectures a few capability macros have to be defined, one
  pointing to the software breakpoint instruction opcode. Done for x86.
* Some more simplifications in the user debugger code, made possible by the
  recently introduced debugger_changed_condition attribute.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31214 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 21:03:57 +00:00
Ingo Weinhold
ba391bcc56 Added team_debug_info::debugger_changed_condition to serialize changes to the
installed team debugger and adjusted the code accordingly. It's not needed yet,
but I intend to add support for software breakpoints and those require a bit of
uninitialization that needs to be synchronized with debugger changes and can't
be done with interrupts disabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31194 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 01:39:51 +00:00
Ingo Weinhold
6a6974b63e gcc 4 warnings.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31192 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 01:29:47 +00:00
Ingo Weinhold
6dcc2a7e00 Made destroy_team_debug_info() static, as it's not used outside the source
file.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31190 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 23:46:55 +00:00
Axel Dörfler
3609af391d * Renamed _kern_reserve_heap_address_range() to _kern_reserve_address_range(),
and added a _kern_unreserve_address_range() as well.
* The runtime loader now reserves the space needed for all its areas first
  to make sure there is enough space left for all areas of a single image.
* This also fixes the final part of bug #4008.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31115 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 11:09:21 +00:00
Axel Dörfler
82db8a9e15 * Added an "unmapAddressRange" argument to the file mapping syscall. This is
the first part of making the runtime loader behave itself; it should already
  make Clockwerk run okay with any number of translators (even if not all of
  them will work yet).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31113 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 08:23:11 +00:00
Axel Dörfler
c39811b8b3 * Fixed stupid typo with big consequences as pointed out by Rene. Thanks!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31098 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-18 14:29:15 +00:00
Axel Dörfler
160f2d1081 * Added private header defining __gUmask which is now used everywhere where
needed.
* Some cleanup in Directory.cpp, and File.cpp.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31086 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-17 14:09:40 +00:00
Axel Dörfler
75557e0ac3 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31078 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-17 09:55:07 +00:00
Ingo Weinhold
bbe9c7b15e Rewrote user_debug_thread_deleted():
* It was broken since the support for debugger handovers. Using
  debugger_write() couldn't work, since the thread didn't belong to the
  debugged team anymore (but to the kernel) and thus getting the debug info
  for team would always fail. This makes B_DEBUGGER_MESSAGE_THREAD_DELETED
  notifications work again.
* Allow the thread to block. Locking/writing to the port was non-blocking
  before, but there shouldn't be a problem, if the thread has to wait.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31076 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-17 01:02:33 +00:00
Ingo Weinhold
995aa3f06a broadcast_debugged_thread_message(): Only send the message to threads that are
stopped. Besides that the message won't be interesting to the other threads
anyway, we also risk filling the port and blocking the nub thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31075 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-17 00:28:36 +00:00
Ingo Weinhold
e4b912a7f4 Fixed comments and removed superfluous code.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31074 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-17 00:17:37 +00:00
Axel Dörfler
fa00207c50 * Made the internal file systems correctly handle the timespec struct stat
times.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31059 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-15 14:03:24 +00:00
Ingo Weinhold
568ade58d0 User debugger support:
* Generalized address checks. The debugger can now also read the commpage.
* Added new syscall _kern_get_thread_cpu_state() to get the CPU state of a
  not running thread. Introduced arch_get_thread_debug_cpu_state() for that
  purpose, which is only implemented for x86 ATM (uses the new
  i386_get_thread_user_iframe()).
* Don't allow a debugger to change a thread's "esp" anymore. That's the esp
  register in the kernel. "user_esp" can still be changed.
* Generally set RF (resume flag) in eflags in interrupt handlers, not only
  after a instruction breakpoint debug exception. This should prevent
  breakpoints from being triggered more than once (e.g. when the breakpoint is
  on an instruction that can cause a page fault). I still saw those with bdb
  in VMware, but that might be a VMware bug.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31045 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-14 12:14:06 +00:00
Ingo Weinhold
58e784dfe6 Don't build compatibility.c for non-gcc2 anymore.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31043 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-14 11:10:36 +00:00
Ingo Weinhold
6ad4a777b6 Also set user_thread to NULL. It shouldn't make a difference, though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31040 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-14 10:58:54 +00:00
Michael Lotz
f835a75f31 Make two runs of MTRR setting when setting memory ranges to write-back. At the
first run only set up uncacheable MTRRs and in the second run set the write-back
ones up. If this order is not followed, we could set too large ranges to
cacheable first and then limit it back to uncacheable later. On systems with
enough physical memory this would lead to a temporary situation in which areas
become cacheable that must not be, resulting in system hangs or other unexpected
behaviour. Fixes last part of #4018.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31027 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-13 11:40:05 +00:00
François Revol
1fcdc25661 Fix build due to stricter type checking in C++ than C.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31021 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-12 22:02:21 +00:00
Axel Dörfler
874f23496b * Returning random stat data isn't really nice.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31010 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-11 21:47:19 +00:00
Axel Dörfler
477a4ca70e * vfs_boot.cpp now also exports gReadOnlyBootDevice which is true when the
boot device is actually read-only (even if it's using the write overlay).
* Do not create a swap file on a read-only device - this would really be a
  stupid use of the write overlay (just saw this happening on an older
  machine).
* Made swap_file_{add|delete}() take a const char* path - there was no reason
  this was writable, and this also avoids casting away the const when adding
  the default swap file.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30975 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-05 15:52:58 +00:00
Axel Dörfler
cb8948154c * Only call Removed() on the device if the device actually got removed, not if
only one of its partitions went away. This should fix #3983.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30961 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-04 21:06:06 +00:00
Axel Dörfler
9ca4077700 * Fixed a bug that let _InvalidateAfter() access already freed memory, and would
also mess up the file map, causing all sorts of file corruption.
* This fixes bug #3991 (and eventually some others).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30960 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-04 12:29:15 +00:00
Ingo Weinhold
7927ebb672 Moved the appending of '*'/'&' for pointer/reference parameters to the gcc 2
demangler, where it belongs. The gcc 4 stack traces look correct now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30955 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-04 02:00:45 +00:00
Axel Dörfler
cf2a26ea96 * Don't overwrite the history buffer when you issue the same command more than
once.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30953 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-03 21:05:29 +00:00
Ingo Weinhold
813d6a742f print_demangled_call(): Use a heap allocated buffer. This allows us to be more
generous with the size.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30950 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-03 13:36:35 +00:00
Ingo Weinhold
360d4974b9 Replaced the temporary storage used in the kernel debug command parser. We now
have a simple dedicated heap for the kernel debugger with stacked allocation
pools (deleting a pool frees all memory allocated in it). The heap should
eventually be used for all commands that need temporary storage too large for
the stack instead of each using its own static buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30949 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-03 12:28:49 +00:00
Jérôme Duval
59d67522ea added lrint and llrint functions to math.h
added generic implementations for ppc and m68k


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30945 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-02 20:24:18 +00:00
Ingo Weinhold
fa773c0ae5 vnode_path_to_vnode(): Don't propagate the traverseLeafLink flag, if we've
decided to recursively resolve a symlink. We only have to do the resolution
when the flag is true anyway or the symlink is not the last component of
our path, in which case we have to resolve it anyway. Fixes #3986.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30937 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-01 11:12:12 +00:00
Ingo Weinhold
eb0262fc4c * Reworked vm_soft_fault() and friends:
- While walking down the cache chain, we keep all upper caches locked.
  - When we have to unlock -- when waiting for a busy page or reading a page in
    -- we unlock completely, including the address space, and restart
    vm_soft_fault().
  - Folded fault_get_page() and fault_find_page() into one.
  This simplifies and improves things considerably:
  - We no longer need dummy pages.
  - We no longer need vm_area::no_cache_change.
  - #2710 is fixed, since we no longer hold the address space lock while
    waiting.
* vm_soft_fault(): When we have found our page, we first check whether a page
  is already mapped at the address. If it is already our page, we just change
  its protection. If not, we unmap it first. Fixes race conditions when multiple
  threads fault at the same address at the same time.
* fault_get_page(): When copying a read-only page from a lower cache, no longer
  mark it active, since at least for the fault area it is shadowed from then on.
* vm_set_area_protection(): Fixed potential overflow for in the
  vm_translation_map::protect() call.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30911 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-29 12:55:25 +00:00
Jérôme Duval
591bc3f2d9 * various fixes identified by gcc4, provided by Joe Prostko
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30902 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-28 20:36:22 +00:00
Ingo Weinhold
c533f813a2 Normalized the FATAL messages. The image path is always printed, now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30878 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-27 14:32:11 +00:00
Ingo Weinhold
6a79745b4c Disabled the stack traces on unhandled userland page faults. As was already
known those can cause a deadlock. Besides, when the debug server is running,
it prints an even nicer stack trace. Not removing the code yet to make things
easier for architectures on which we don't have a userland yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30877 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-27 13:57:07 +00:00
Oliver Tappe
78176019e6 * squashed a TODO in parsedate() about missing timezones - now both textual
(3-letter) and numerical timezones (e.g. -0700) are supported
This means that the workaround in mail_util.cpp of the mail kit could be
removed, but since I do not know if that should still support other versions
of BeOS, I have chosen to leave it alone.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30864 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-26 15:11:05 +00:00
Ingo Weinhold
c7d1aa192f Added system_info::abi field. It contains the system's ABI version, which
might be different from that of the caller (on hybrid builds).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30858 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-26 01:02:39 +00:00
Michael Lotz
f2d4d6f676 Invalidate the elfHeader variable when the image struct is deleted on error, as
they share the same pointer. Should fix bug #3955.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30848 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-24 23:10:55 +00:00
Ingo Weinhold
bcfe344c53 * Made our struct stat POSIX compliant again -- the time_t fields have been
replaced by timespec fields. Via macros the structure is still source
  compatible with the old one.
* Introduced header <compat/sys/stat.h> that defines the old stat structure
  (as stat_beos) and conversion functions
* Introduced versions for [l,f]stat().
* Added symbol versions for BDirectory::GetStatFor() for sake of binary
  compatibility.
* BStatable::GetStat(): Renamed the old method, changed its parameter to
  stat_beos*, and and made it private. Added a new version (using up a
  reserved vtable slot). It remains source and binary compatible.
* BRefFilter::Filter(): Changed the struct stat* parameter to struct stat_beos*
  for sake of binary compatibility. This breaks source compatibility, though,
  which we can't help, since the class doesn't have reserved vtable slots.
* Fixed several issues with the stat structure change, mostly adjusted uses of
  BRefFilter.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30830 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-22 15:15:16 +00:00
Ingo Weinhold
f15e418bab Removed remapping of the *stat() symbols for BeOS executables. We'll use
symbol versioning instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30829 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-22 14:59:19 +00:00
Ingo Weinhold
544e3d2523 Commented out more unused glibc stuff. Scary...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30827 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-22 14:55:28 +00:00
Ingo Weinhold
ef3966e888 Added version scripts for the kernel, libroot, and libbe. ATM each has two
version nodes: *_BASE and *_1_ALPHA1.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30826 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-22 14:53:31 +00:00
Ingo Weinhold
79182ad1e5 Reverted r30822, fixing the build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30824 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 20:44:04 +00:00
Jérôme Duval
d5dbb2e3b1 TARGET_STATIC_LIBSUPC++ needs strcat on gcc4, get it before libruntime_loader.a
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30822 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 19:36:52 +00:00
Ingo Weinhold
9bf61a0ecc * Added GNU style ELF symbol versioning support in the kernel, too.
* Fixed memory leak in insert_preloaded_image() in error case.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30820 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 15:08:42 +00:00
Ingo Weinhold
0f7d5a0010 Should have been part of r30818. The version "glue".
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30819 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 15:05:45 +00:00
Ingo Weinhold
c154b94624 Added haiku_version_glue.o "glue code" containing the Haiku/ABI version
symbols recently introduced. Until init_term_dyn.o is linked into kernel
add-ons, too, we link with haiku_version_glue.o, so we have those symbols
in kernel add-ons as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30818 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 15:04:37 +00:00
Ingo Weinhold
b3f709b800 Removed unused elf_version_info::hidden field.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30817 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 13:11:54 +00:00
Ingo Weinhold
94830eb226 * Moved most code of the heavy elf.cpp into several smaller source files.
* Some style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30808 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 00:57:46 +00:00
Oliver Tappe
b327a1bc7d * when forking a team, not only the signal mask, but also the sig_actions
and the signal stack must be copied into the new thread (at least that's
  what I could make of IEEE Std 1003.1-2001 regarding the expected behaviour
  of fork)
This brings down the failures of the rsync test suite from 24 to 18 ...

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30807 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-20 23:10:13 +00:00
Ingo Weinhold
003ebb0e83 * Also define the build system variables TARGET_STATIC_{LIBSTDC++,LIBSUPC++}.
* runtime loader:
  - Fixed gcc 4 warnings.
  - Enabled -Werror.
  - Renamed all remaining *.c source files to *.cpp.
  - Implemented GNU style ELF symbol versioning support.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30806 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-20 02:22:36 +00:00
Axel Dörfler
e85f80eedf * So many style violations in so few lines of code...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30775 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-16 22:48:45 +00:00
Bruno G. Albuquerque
1bf034d2f5 - Check if we had any changes in status before sending a notification for a new
inserted media. This fixes ticket #3921.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30774 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-16 21:41:33 +00:00
Axel Dörfler
ce4db6ae11 * The covered vnode release was never put when it already was a mount point
during fs_mount(). This fixes bug #3934.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30773 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-16 21:28:12 +00:00
Axel Dörfler
d88527df5c * Applied a patch by Rene that fixes bug #3856.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30770 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-16 20:00:59 +00:00
Ingo Weinhold
6a1e04b121 Symbol resolution functions in the kernel: Removed the unused parameter
allowing optional prepending of a string to the symbol names.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30750 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-13 15:25:27 +00:00
Ingo Weinhold
f91194e546 Removed the gcc_version from the runtime loader's image_t. Instead we always
determine (or guess) Haiku version and ABI and use those for compatibility
decisions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30747 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-13 14:44:17 +00:00
Ingo Weinhold
593ee7bbc3 Extended image_info by fields for the Haiku version and ABI. The runtime loader
and the kernel read those values from the shared object (if available). In the
runtime loader this should eventually replace the gcc version guessing method
currently used (at least for shared objects built for Haiku). The optional
packages need to be rebuilt first, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30729 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-12 21:08:56 +00:00
Ingo Weinhold
51c706f70c Added variables to the glue code that identify the Haiku version and ABI.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30728 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-12 21:01:26 +00:00
Axel Dörfler
6015793f57 * Instead of deleting the device directly, we now only remove it from its
parent.
* Additionally, when a vnode is deleted, the new BaseDevice::Removed() method is
  called that will remove the device from its parent if needed, and delete it
  then.
* This should fix #3856.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30726 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-12 20:03:58 +00:00
Stephan Aßmus
f04362eac3 * Change the drivers that use the ATA stack (ata_adapter) to publish
themselves in busses/ata instead of busses/ide.
* Re-introduce Francois change to install these drivers in busses/ata
  when building with HAIKU_ATA_STACK = 1.
* Adopted the device manager to look for drivers in busses/ata
  additionally to busses/ide.

This change works fine with a clean installation on a computer where I can
(and indeed have to) use the new ATA stack.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30695 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-10 09:22:35 +00:00
Michael Lotz
03a574d8cd * Check for disk extensions before using them (mostly for good practice reasons)
* A CHS read error would previously be hidden by a successful disk system reset.
  Not that it matters much because it'd have resulted in a non-booting system
  anyway.
* Add some more debug output, minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30643 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-06 11:55:19 +00:00
Axel Dörfler
c24d3c0d98 * Fixed two bugs in rootfs_rename(): the check of the result of
rootfs_find_in_dir() was wrong, leading to never be able to find the fromName
  in the directory. Furthermore, the parent of the root directory is itself, but
  the check to see whether or not the target is valid did not take this into
  account, and therefore ran into an endless loop. This fixes bug #3864.
* Rearranged rootfs_rename() to be clearer.
* Style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30633 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-05 11:53:46 +00:00
Axel Dörfler
a5dbd78b7a * Since PrecacheIO is used as asynchronous callback object, we must not access
it anymore after having called vfs_asynchronous_read_pages().
* Now, Prepare() does all the preparation work, and ReadAsync() does the actual
  work - this must be called without having the cache locked. This also fixes
  another bug where the callback would be deleted twice in case the I/O request
  failed.
* This fixes bug #3847.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30632 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-05 10:13:55 +00:00
Axel Dörfler
3873c5f3f2 * Style cleanup, mostly 80 character limit per line.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30631 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-05 10:05:11 +00:00
Jonas Sundström
cb8f3e2698 More mipsel
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30621 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-03 22:41:38 +00:00
Jonas Sundström
4ba7f1c0ed Staking out some more mipsel ground.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30620 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-03 22:26:23 +00:00
Ingo Weinhold
a866fa9466 panic() when a page that is still mapped is freed.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30606 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-03 12:37:51 +00:00
Ingo Weinhold
88b29adcbd VMCache::Resize(): When shrinking the cache unmap the pages we're removing.
Theoretically, not doing that could have caused still mapped pages to get
into the free queue. This could have been a cause of #3110, but the reported
circumstances don't look quite fitting.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30605 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-03 12:32:20 +00:00
Axel Dörfler
c39ecc608f * If getting a new port message failed, we must release the port's write sem
again, or else the port loses capacity.
* This fixes bug #2720.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30517 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-30 19:07:38 +00:00
Axel Dörfler
d5ad762913 Fixed several problems of the prefetching code:
* Did claim to have reserved pages when calling vm_page_allocate_page(), but
  didn't have any (copy&paste bug). We cannot use it without reserved pages,
  as we need to call vm_page_allocate_page() with a cache locked.
* No longer use low_resource_state() to determine whether to precache or not,
  but use the new vm_page_num_used_pages() instead.
* Also don't (try to) precache when the cache already has more than 2/3 of its
  pages to safe some unnecessary work.
* The size to precache was limited to the file size incorrectly.
* When precaching failed, the cache reference was not released.
* The precaching started one page too late, causing bug #3835.
* Reenabled precaching.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30515 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-30 15:53:41 +00:00
Axel Dörfler
2d8073a9dc * Added a TODO about a problematic use of vm_page_allocate_page() in combination
with vm_cache_acquire_locked_page_cache().
* Added new function vm_page_num_unused_pages() which returns the pages that are
  actually completely free and unused.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30514 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-30 15:46:55 +00:00
Ingo Weinhold
9073b0dccc Made _debuggerAssert()'s "message" parameter const. Fixes building with gcc4.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30502 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-30 12:21:20 +00:00
Axel Dörfler
9431509f5c * Fixed broken socket_get_next_stat() that was responsible for bug #3830.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30500 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-30 11:59:11 +00:00
François Revol
e5ea3d8c41 Print the zlib-provided message in case of error.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30483 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-29 01:53:58 +00:00
François Revol
ff6382031e Build only the required part of zlib with correct options instead of reusing the userland version. This fixes some weird m68k issue, and still works on x86.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30482 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-29 01:52:01 +00:00
François Revol
12442ce54b - add a gBootDriveAPI variable telling which method was used to load,
- move gBoot* out of the boot sector,
- fix the FAT params to actually indicate 1.44kB floppy,
- fix the FloppyDrive class to also use 18 sectors/track, so now tarfs won't get data from start of disk when on the middle.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30481 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-29 01:35:37 +00:00
Stephan Aßmus
996af6d997 Disable pre-fetching until we fix bug #3835.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30477 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-28 10:01:44 +00:00
Stephan Aßmus
aff0fbbe57 axeld:
* vfs_read_pages_async() must not be called with locked cache,
  since it cannot be guaranteed that the operation will be
  performed asynchronously. (The ISO9660 FS for example does not
  implement the new IO hooks... yet.)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30476 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-28 08:03:39 +00:00
Stephan Aßmus
eb2bd0e8e3 axeld:
* Implemented a way to do asynchronous pre-fetching when mapping files.
* There are slight code duplications in some places that could benefit
  from cleaning up, but nothing too bad.
* Implementing smarter ways to trigger prefetching and more analysis of
  the situations in the kernel would be nice. Currently up to 10 MB
  of every mapped file are pre-fetched without further analysis.
* The speed improvement is nice for certain operations. On our test
  system (real hardware), Firefox took 9 seconds from being launched
  to display a window. Now it takes 5 seconds. Both measurements
  right after booting. The same system took 35 seconds from launching
  Haiku in the GRUB menu to displaying the Tracker desktop background
  image. Now it takes 27 seconds.
* We didn't have the chance to check out the effects of this on the
  CD boot, but potentially, they could speed it up a lot.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30465 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-27 18:16:58 +00:00
François Revol
f77b0a6b83 Implemented a FloppyDrive class that uses Floprd, this allows the loader to start reading the tgz, but it fails after 2 blocks.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30464 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-27 16:18:08 +00:00
François Revol
4fd7901292 Finally managed to get floppy boot working for Atari \o/
- loop on Floprd() alternating sides every sect/track, currently hardcoded from the FAT bootblock as probing like the NetBSD loader asserts ARAnyM,
- print a dot / sector read in the great tradition of bootloaders,
- set gBootedFromImage correctly,
- fix the script, make it jam later on.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30455 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-27 02:37:31 +00:00
François Revol
901b8dd28a No reason to keep the .prg startup asm code inside the first 512 bytes, this frees up some space for the floppy code.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30446 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-26 21:45:36 +00:00
François Revol
f2cec6b732 Just keep this around before it get lost... Failed attempt at generating a bootable floppy for Atari.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30444 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-26 21:17:19 +00:00
Michael Lotz
5c8e597e90 Don't try to use disk extensions for non-disk devices (like actual floppies or
emulated ones on CD-boot). One of my laptops returns bogus drive parameters
and another one silently fails the read, previously preventing CD-boot on both.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30389 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-24 23:16:26 +00:00
Ingo Weinhold
106fd6b5cb * Make the wait object hash table larger than the maximum number of wait
objects we're going to add, so we get less slot collisions.
* Use the "Unchecked" versions of the OpenHashTable Insert()/Remove() methods,
  since we have interrupts disabled.
* Fixed wrong check that caused the wait object info events not to be filled in.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30384 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-24 22:44:26 +00:00
Ingo Weinhold
a7ccfc910c Added WaitObjectListener destructor. Hopefully fixes the gcc 2 build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30346 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-23 14:53:18 +00:00
Ingo Weinhold
227fe7d34a * Scheduler/wait object listener:
- Moved scheduler listening interface to <listeners.h> and added more
    convenient to use templatized notification functions.
  - Added a listener mechanism for the wait objects (semaphores, condition
    variables, mutex, rw_lock).
* system profiler:
  - Hopefully fixed locking issues related to notifying the profiler thread
    for good. We still had an inconsistent locking order, since the scheduler
    notification callbacks are invoked with the thread lock held and have to
    acquire the object lock then, while the other callbacks acquired the object
    lock first and as a side effect of ConditionVariable::NotifyOne() acquired
    the thread lock. Now we make sure the object lock is the innermost lock.
  - Track the number of dropped events due to a full buffer.
    _user_system_profiler_next_buffer() returns this count now.
  - When scheduling profiling events are requested also listen to wait objects
    and generate the respective profiling events. We send those events lazily
    and cache the infos to avoid resending an event for the same wait object.
  - When starting profiling we do now generate "thread scheduled" events for
    the already running threads.
  - _user_system_profiler_start(): Check whether the parameters pointer is a
    userland address at all.
  - The system_profiler_team_added event does now also contain the team's name.
* Added a sem_get_name_unsafe() returning a semaphore's name. It is "unsafe",
  since the caller has to ensure that the semaphore exists and continues to
  exist as long as the returned name is used.
* Adjusted the "profile" and "scheduling_recorder" according to the system
  profiling changes. The latter prints the number of dropped events, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30345 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-23 13:47:52 +00:00
Ingo Weinhold
1c800aa1f9 Updated TODO.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30344 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-23 12:19:36 +00:00
Ingo Weinhold
146f113fec Fixed issues with the scheduling events. In the listener callbacks we
potentially want to notify the profiler thread (i.e. wake it up), which can
cause another scheduling event notification. That is we have to make sure that
event buffer is in a consistent state at that point (i.e. wake up the thread
at the very end of the callbacks). Furthermore the ThreadEnqueuedInRunQueue()
callback can be called with spinlocks besides the thread spinlock being held. In
particular waking up threads also happens in the condition variable code with
a static spinlock being held. Trying to notify the condition variable the
profiler thread is waiting on in such a case would be a guaranteed deadlock.
Hence we avoid doing that, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30339 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-22 22:15:27 +00:00
Ingo Weinhold
4a559f388b simple_enqueue_in_run_queue(): Between having found the insertion point and
manipulating the queue is a particularly unsuitable place for calling the
listeners, as they wouldn't be allowed to e.g. unblock threads, since that
would screw the run queue.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30338 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-22 22:03:56 +00:00
Ingo Weinhold
bc2e00c1c7 _user_system_profiler_start(): Check the sampling related parameters only when
sampling is requested at all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30294 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 15:26:16 +00:00
Ingo Weinhold
e0518baa0c Fixed incorrect loop condition. Thanks Francois for reviewing! (and sorry for
mistreating your name -- Haiku's svn is to blame :-)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30293 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 12:30:54 +00:00
Ingo Weinhold
8b3b05cbf9 Synchronize the TSCs of all CPUs early in the boot process, so system_time()
will return consistent values. This helps with debug measurements for the time
being. Obviously we'll have to think of something different when we support
speed-stepping on models with frequency-dependent TSCs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30287 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 00:38:11 +00:00
Ingo Weinhold
65d2b8a8e9 * Introduces VMCache::CanWritePage() returning whether the given cache can
theoretically write the given page.
* page writer: Fixed the incorrect check whether a temporary page can be
  written by using the new CanWritePage().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30281 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-20 15:19:41 +00:00
Axel Dörfler
8a26f35a6d * Sequential write accesses were never detected, due to an incorrect check.
* The previous code would have scheduled a single page to be written out (if it
  would have ever been triggered), now we schedule the complete previous write
  access. This greatly speeds up a "dd if=/dev/zero of=test ..." beyond the
  size of available memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30276 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-20 08:02:51 +00:00
Ingo Weinhold
1cdc2fb608 Align the entries in the event buffer to 4 bytes at least. Usually CPUs like
that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30272 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-19 23:36:59 +00:00
Ingo Weinhold
5b2f0f33f9 * Changed the interface of _kern_system_profiler_start(). The parameters are
passed in a structure now, so it is easier to extend it and ignore unused
  parameters.
* One can now select which system profiling events one is interested in.
* Added scheduling events to the system profiling interface. Those are pretty
  much the ones recorded when scheduler tracing is enabled. Still missing are
  the "wait object" events that allow to interpret what a thread is waiting
  for.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30243 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-18 17:35:28 +00:00
Ingo Weinhold
79257a4ad6 Added a listener mechanism to the scheduler (ATM only for scheduler_simple).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30242 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-18 17:24:58 +00:00
Ingo Weinhold
3539fc6e19 page writer:
* When writing a page failed it is not a good idea to re-enqueue it at the tail
  of the modified queue, since that is definitely behind the page writer's
  marker and the page would be picked up again before reaching the end of the
  queue. If that happened with more than 256 pages, the page writer would keep
  picking up only those non-writable pages and make no more progress.
* When selecting pages also skip temporary pages, if there's no more swap space
  available, since trying to write those pages would most likely fail anyway
  (triggering the first problem).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30230 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-17 14:26:17 +00:00
Ingo Weinhold
8342d4cdd2 * Updated to use add_debugger_command_etc().
* Added "step" debugger command to single-step to the next instruction (of the
  topmost iframe).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30212 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 22:56:53 +00:00
Ingo Weinhold
8753babd62 Handle kernel debug exceptions similar to those in userland. This allows to
continue kernel breakpoints -- we would just retrigger the breakpoint when
continuing before.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30210 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 22:18:02 +00:00
Ingo Weinhold
31d9352ff6 Make sure kernel breakpoints are installed on all CPUs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30209 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 21:57:52 +00:00
Ingo Weinhold
48b0c6f93a debug_trap_cpu_in_kdl(): If the CPU running the kernel debugger exited and
re-entered it fast enough, we wouldn't leave the loop and thus cause a
deadlock, since we wouldn't process the ICI message telling us to halt. We do
now call smp_intercpu_int_handler() in the loop and guard the function from
being re-entered. This also has the advantage that we can execute code on all
CPUs in the kernel debugger, if we have to.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30208 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 21:55:40 +00:00
Ingo Weinhold
b447670286 * Removed most of the special-casing for kernel breakpoints in the kernel
enter/exit code. There's no real reason not to keep kernel breakpoints
  enabled when in userland (unless there are breakpoints installed for the
  team, of course).
* Enabled kernel breakpoints by default (check your kernel_debug_config.h,
  if you have overridden it!), since they don't really add any overhead
  anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30206 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 19:56:11 +00:00
Axel Dörfler
78e7cdaede * Removed the get_next_removed_vnode() call again - besides the problems Ingo
pointed out, there is also an unsolvable race condition with BFS that other
  file systems should share.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30204 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 18:29:12 +00:00
Axel Dörfler
09a60e4bd4 * Since we moved the socket stuff into the kernel, we lost the ability to
unload the network stack. This now works again, although I didn't manage to
  do it without another lock.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30196 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 10:49:21 +00:00
Ingo Weinhold
1b9d2885d3 * Also pass the team arguments and thread names with the respective system
profiling events.
* profile: Avoid using get_{team,thread}_info() in common code paths. The
  system profiling mode is asynchronous, so the team or thread in question
  could already be gone.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30193 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 10:02:33 +00:00
Axel Dörfler
4e98292b8e * Introduced new call get_next_removed_vnode() to be able to iterate over
removed but not yet deleted vnodes.
* Simplified get_vnode_removed().
* Header cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30176 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-15 16:14:04 +00:00
Ingo Weinhold
e2ae69da52 The kernel side of a new system-wide sampling-based profiling mechanism.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30127 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-11 22:20:51 +00:00
Ingo Weinhold
efd536ff89 * Cleared up a misconception in the notification mechanism. We already had
methods that used an "event mask" field. There was no need to introduce
  a "flags" field for the same purpose.
* Renamed protected DefaultNotificationService methods (removed "_" prefix).
* Adjusted the code providing a notification service accordingly.
* Changed the event message several notification services generated by renaming
  the "opcode" field to "event".
* Implemented the TEAM_ADDED event and also added a TEAM_EXEC event.
* Added notifications for threads and images.
* Added visitor-like iteration functions for teams, threads, and images.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30126 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-11 21:45:25 +00:00
Axel Dörfler
d1cad26854 * Added an insane block cache tracing mode that will also log the whole block
data. This is available when BLOCK_CACHE_BLOCK_TRACING is 2 or greater.
* Completely untested as of now, though. Will do so soon.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30104 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-10 09:55:04 +00:00
Axel Dörfler
00e8c084e6 Extremely important cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30103 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-10 09:53:50 +00:00
David McPaul
2ecebae14f ignore Stack type in elf loader
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30099 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-10 03:28:00 +00:00
Ingo Weinhold
90d46a5c43 * Fixed the "qOffsets" return value. At least how I understand the
documentation the segment offsets it shall return are relative to the
  address specified in the program header.
* Added "qSupported".
* Added the mandatory commands and some additional ones. Partially implemented
  only.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30038 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 16:54:57 +00:00
Ingo Weinhold
7be389053f Don't use exit() when compiling for the kernel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30037 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 16:48:32 +00:00
Ingo Weinhold
b36c8ba26a Added elf_get_kernel_image() returning the image for the kernel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30036 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 16:47:45 +00:00
Ingo Weinhold
777ae2fbb5 More style fixes. Sorry, missed those before.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30027 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 13:15:16 +00:00
Ingo Weinhold
c970c6e8f3 Converted C to C++ comments.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30026 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 13:13:08 +00:00
Ingo Weinhold
ae2e6c439f * Style cleanup.
* gdb.c -> gdb.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30025 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 12:56:02 +00:00
Stephan Aßmus
6cf94c8595 Removed unintentional thought mumbling left-over that would fortunately cause
no harm.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30002 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 17:40:16 +00:00
Ingo Weinhold
0228ef3608 IOOperation::Finish():
* Fixed the read with bounce buffer case. When skipping a partial bounce
  buffer before the part we're interested in, we forgot to update "offset".
* Added some more comments for readability.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29999 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 16:06:30 +00:00
Axel Dörfler
093e00573f * Added --stacktrace to the flat list of options.
* Removed superfluous and uncommon '"' around options.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29997 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 15:53:37 +00:00
Axel Dörfler
28a650e94d * Made the WeakReferenceable class templatized. Not really sure yet I like that
better, though :-)
* Also fixed a mixup of the unintuitive argument order of our
  atomic_test_and_set(); I guess I will change that sooner or later.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29994 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 15:14:15 +00:00
Ingo Weinhold
8c91d29b34 * PageWriterRun::Go(), vm_page_write_modified_page_range(): When writing the
page failed since the cache has been shrunk, we need not only remove the
  page from the cache, we also need to remove all of its area mappings and
  free it. Not removing the area mappings might have been the cause of #3110,
  not freeing it would cause it to be leaked for good.
* vm_page_write_modified_page_range(): When writing failed for another reason
  and the page wasn't in the modified queue before, we would lose the info
  in which queue it was before and setting the page state to modified would
  assume the active queue. This could potentially screw up our page queue
  structures.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29992 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 14:06:07 +00:00
Axel Dörfler
e1fed132d2 * Added a WeakReferenceable implementation, completely untested yet.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29990 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 12:01:30 +00:00
Axel Dörfler
fd0803f300 * Added RemoveTail() method.
* Renamed DoublyLinkedList::Size() to Count(), since it actually counts the
  items (ie. O(n)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29979 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-06 21:06:19 +00:00
Oliver Tappe
f9ae64e9a5 zooey + bonefish:
* optimized unmapping of a single page that was rather inefficient
  for large areas

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29978 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-06 20:46:18 +00:00
Stephan Aßmus
e18d4a2d06 Patch by Olivier Coursiere: When rebooting, shutdown all the system teams,
most importantly input_server, which then closes the drivers for input devices.
This in turn will do some cleanup. The touch pad driver will then be reset to
act as normal PS/2 mouse, so that OS like BeOS can use it again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29948 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-05 19:04:25 +00:00
François Revol
80e1f0e419 Fix error reporting to conform to the POSIX ttyname_r and ttyname.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29917 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-05 07:34:37 +00:00
Ingo Weinhold
53e1017720 bonefish + mmlr:
* We started the "main2" thread too late. Since the scheduler was already
  started on all CPUs, the idle thread could wait (for a mutex) while
  spawing the "main2" thread. This violated the assumption in the scheduler
  that all idle threads would always be ready or running. We now create the
  thread while the kernel runs still single-threaded.
* scheduler_start() is now invoked with interrupts still disabled. We enable
  them after the function returns. This prevents scheduler_reschedule() from
  potentially being invoked before scheduler_start().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29914 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-04 23:54:01 +00:00
Ingo Weinhold
ec29f0842c bonefish + mmlr:
Don't really resume the undertaker thread after creating it, since at that
point the scheduler has not been started yet. Didn't do any harm, since it was
only the second thread anyway and the idle thread was rescheduled almost
immediately.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29908 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-04 21:59:37 +00:00
Ingo Weinhold
73b118b633 bonefish + mmlr:
Check gKernelStartup to avoid sending ICI when entering the kernel debugger
(after ICI is enabled). Moreover it's more obvious than to use that instead
of relying on ICIs not being enabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29907 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-04 21:57:07 +00:00
Philippe Houdoin
23614f0aeb Another fix after /boot/beos -> /boot/system change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29888 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-03 23:50:12 +00:00
Axel Dörfler
317bd7dda3 * Changed directory structure as suggested on the mailing list.
* Made the TimeZoneView less error prone, and also actually use Haiku code (the
  previous check didn't work since it used #if, not #ifdef).
* Also took the liberty to rename our boot loader to haiku_loader, since I had
  to update the nasm binary anyway. Updated the assembly sources to nasm 2.0.
* I haven't found where the synth location in the MIDI code is specified,
  though.
* Also, NetBootArchive, and FloppyBootImage haven't been updated yet. Will do
  so next.
* Some optional packages still put their license to beos/etc/licenses. I didn't
  update them yet, as we'll probably do so anyway at some point. Also, I think
  we might want to introduce a common/data/licenses instead for those.
* If you encounter any problems, please tell!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29876 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-03 09:02:44 +00:00
Axel Dörfler
7a517c04b0 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29875 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-03 08:05:25 +00:00
Axel Dörfler
49fb53ee7e * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29868 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-02 16:07:09 +00:00
Rene Gollent
14df3c2bed Various tweaks - 1) while enqueued, keep track of which run queue a thread is in on the scheduler data structure, and use this information so that set_thread_priority doesn't have to search every CPU to find the thread. Also slightly tweak the enqueue and steal operations to take advantage of some of the stats we're now tracking, and experiment with variable quantum sizes for low priority CPU bound threads. Still lots of work to do with respect to balancing and/or affinity though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29857 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-02 03:13:55 +00:00
Stephan Aßmus
d30acbf30b Patch by maxime.simon: Don't allow to enter sub-menus by the space bar anymore.
This allows to have the first item selected when entering a menu, since still
pressing space would not enter it unintentionally anymore, in case it's a sub-
menu again. Even though it makes some sense to have "Continue booting" selected
by default, it somehow feels more natural to have the first item always selected
instead. Thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29832 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-31 16:28:50 +00:00
Ingo Weinhold
328029e178 Patch by Alexander von Gluck (kallisti5) to get the PPC build going again
(mostly at least). Also disables -Werror for the binutils, but those should
be fixed eventually.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29804 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-30 15:00:10 +00:00
Rene Gollent
4cabb4a077 Integer precision is good enough for us here. Thanks Axel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29796 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-29 21:44:44 +00:00
Rene Gollent
6ad5d4edc0 dump_run_queue() now outputs the average quantum usage for threads as well. Not quite formatted properly due to what appear to be limitations in kprintf's handling of float format specifiers. Need to investigate.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29789 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-29 18:11:28 +00:00
Rene Gollent
bd037e94a0 Track the number of threads in each CPU's runqueue.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29786 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-29 17:14:52 +00:00
Rene Gollent
6c990aa4af Start tracking thread timeslice usage. Not actually used for any determinations just yet, but will be.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29785 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-29 17:08:10 +00:00
Rene Gollent
dc707c28aa Small cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29784 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-29 16:53:38 +00:00
Rene Gollent
a27b5524c8 Fix code style violation (thanks Axel! ;-)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29733 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-26 15:26:15 +00:00
Ingo Weinhold
880d0bde5a acquire_spinlock[_nocheck]() do now panic() when they couldn't acquire the
spinlock for a long time. That should help to analyze system "freezes"
involving spinlocks. In VMware on a Core 2 Duo 2.2 GHz the panic() is
triggered after 20-30 seconds. The time will be shorter on faster machines.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29732 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-26 15:16:39 +00:00
Rene Gollent
0296b82ae6 Add several extra scheduler hook functions to allow the scheduler(s) to maintain private housekeeping data on the thread structs. These hooks are called on thread creation/destruction and when prepping a thread for use. Review welcome.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29721 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-26 00:58:20 +00:00