History log of /haiku/src/system/kernel/Jamfile
Revision Date Author Comments
# 788b1b12 09-Oct-2023 Augustin Cavalier <waddlesplash@gmail.com>

Get rid of kernel_c++_structs mechanism.

This undoes fc7864091e2463c0e446f8b3954df4d29e9465af.

It was only ever used by the FreeBSD compatibility layer,
only supported one structure, and created problems with
concurrent builds.


# f66d2b46 26-Jul-2023 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Add event queue implementation to wait for objects efficiently.

Based on hamishm's original patch from 2015, but heavily modified,
refactored, and reworked.

From the original commit message:

> When an object is deleted, a B_EVENT_INVALID event is delivered,
> and the object is unregistered from the queue.
>
> The special event flag B_EVENT_ONE_SHOT can be passed in when adding
> an object so that the object is automatically unregistered when an
> event is delivered.

Modifications to the original change include:

* Removed the public interface (syscalls remain private for the moment)

* Event list queueing/dequeueing almost entirely rewritten, including:
- Clear events field when dequeueing.

- Have B_EVENT_QUEUED actually indicate whether the event has been
appended to the linked list (or not), based around lock state.
The previous logic was prone to races and double-insertions.

- "Modify" is now just "Deselect + Select" performed at once;
previously it could cause use-after-frees.

- Unlock for deselect only once at the end of dequeue.

- Handle INVALID events still in the queue upon destruction,
fixing memory leaks.

* Deduplified code with wait_for_objects.

* Use of C++ virtual dispatch instead of C-style enum + function calls,
and BReferenceable plus destructors for teardown.

* Removed select/modify/delete flags. Select/Modify are now the same
operation on the syscall interface, and "Delete" is done when 0
is passed for "events". Additionally, the events selected can be fetched
by passing -1 for "events".

* Implemented level-triggered mode.

* Use of BStackOrHeapArray and other convenience routines in syscalls.

Change-Id: I1d2f094fd981c95215a59adbc087523c7bbbe40b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6745
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# ddde98b0 24-Jul-2023 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Move some source files around.

* stack_protector.cpp now lives with other files in "lib".

* Notifications.cpp, wait_for_objects.cpp go to a new "events" directory,
which will soon contain more files related to the event_queue.

No functional change.


# 84f45724 02-Mar-2022 Augustin Cavalier <waddlesplash@gmail.com>

kernel/Jamfile: Remove invalid character.


# c00a982d 28-Oct-2021 PulkoMandy <pulkomandy@pulkomandy.tk>

kernel: do not allow undefined symbols

If there are undefined symbols, we can't load the kernel (the bootloader
complains about missing relocations). It makes sense to not allow that
at compile time.

Change-Id: I430bebada16544ffa8be293cd6c075338970d8ce
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4668
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 7aa55747 30-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

kernel & addons: Build with the non-legacy GCC even on x86_gcc2h.

Only one code change: for some reason, GCC chokes on the cr3 functions
as macros (throwing errors about invalid registers.) The BSDs have them
as inline functions instead, so they are converted to that here.

Tested and working. There seems to be about a 10% decrease in CPU time
on some compilation benchmarks that I briefly tried.

Change-Id: I31666297394d7619f83fca6ff5f933ddd6f07420
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4515
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 04be20a7 01-May-2021 Jérôme Duval <jerome.duval@gmail.com>

Implement stack protection support

this adds kernel & libroot stack protector hooks. it uses /dev/random in userspace.
A configure option --enable-stack-protector is added to activate -fstack-protector
on selected system components (ATM apps, kits, servers).

Change-Id: If3a2920ba9aa0a85eaff4ba6778947f8c76ade31
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3895
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 1f96a3cb 08-Oct-2018 Jessica Hamilton <jessica.l.hamilton@gmail.com>

system/boot: Add support for multiple bootloaders


# 4a459f06 16-Jun-2018 Augustin Cavalier <waddlesplash@gmail.com>

:kernel: Fix stack alignment in syscall entry on x86_64.

The user iframe and associated data that the syscall entry pushes to the
stack directly were causing the stack to be mis-aligned by 8 bytes. Since
we re-aligned %rsp afterwards, for most usecases this wasn't a problem.
However, since we stored the pre-realinged %rsp in %rbp (as we need it to
access the iframe data), this also meant that anything which depended on
%rbp being 16-byte-aligned would run into serious problems.

As it turned out, GCC 7 assumed that %rbp was indeed 16-byte-aligned, and
so optimized certain accesses to use SSE instructions that depended on this
alignment. Since inside any callstack begining with a syscall this was not
the case, a "General Protection Exception" resulted (see #14160 for an example)
at the first usage of such an instruction. I wasn't really sure what was going
on when it first came up, and so "fixed" it by disabling the GCC optimization
that used such instructions. Replacing the -fdisable... with -mstackrealign thus
also "fixes" the problem, as I discovered earlier today, as it forces GCC to
realign the stack in function prologues.

So instead of rounding %rsp down to the nearest aligned address after the
pushes are complete, we offset %rsp by the amount the pushes are not,
thus fixing both %rsp and %rbp in syscall handling routines. This of course
depends on syscall_rsp being already aligned, which it is.

Thanks to PulkoMandy and js for the advice and guidance (and PulkoMandy
for the ASCII art), as this is essentially my first time working with
kernel assembly.


# 64d4515a 14-Jun-2018 Alexander von Gluck IV <kallisti5@unixzen.com>

kernel: Only apply rtl-stv1 hack to x86 & x86_64

Change-Id: I971f7bf3bb95ee466a59ab777c2f6fc56fbcbd43


# 513403d4 14-Jun-2018 Augustin Cavalier <waddlesplash@gmail.com>

Revert team and thread changes for COMPAT_MODE (hrev52010 & hrev52011).

This reverts commit c558f9c8fe54bc14515aa62bac7826271289f0e4.
This reverts commit 44f24718b1505e8d9c75e00e59f2f471a79b5f56.
This reverts commit a69cb330301c4d697daae57e6019a307f285043e.
This reverts commit 951182620e297d10af7fdcfe32f2b04d56086ae9.

There have been multiple reports that these changes break mounting NTFS partitions
(on all systems, see #14204), and shutting down (on certain systems, see #12405.)
Until they can be fixed, they are being backed out.


# 44f24718 20-May-2018 Jérôme Duval <jerome.duval@gmail.com>

kernel/x86_64: add compatibility source files to the build.

* add x86 versions of fnsave frstor.
* add missing declaration for elf32_resolve_symbol().

How-to build a x86_64/x86 bootstrap build:
mkdir generated_bootstrap; cd generated_bootstrap
../configure --bootstrap /dir/to/haikuporter/haikuporter /dir/to/haikuports.cross \
/dir/to/haikuports --build-cross-tools x86_64 /dir/to/buildtools --build-cross-tools x86 -j8 --use-gcc-pipe
jam -q -sHAIKU_PORTER_EXTRA_OPTIONS="-j8 --sourceforge-mirror=freefr --no-source-packages" @bootstrap-raw

Change-Id: I6eae3653c42a53683ae307107fae595c4b8ebcfb


# 77d1e4fd 22-May-2018 waddlesplash <waddlesplash@gmail.com>

kernel: TARGET_PACKAGING_ARCH not HAIKU_ARCH for present compiler arch.

HAIKU_ARCH is CPU architecture. Sorry for the noise...


# 3acaf25e 21-May-2018 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Disable rtl-stv1 optimization on GCC 7.

See inline comment and accompanying ticket.


# 51777fe8 15-Oct-2016 Andreas Faerber <andreas.faerber@web.de>

Revert r25895: Undo ppc linkhack workaround #6210


# 220d0402 31-Jul-2014 Oliver Tappe <zooey@hirschkaefer.de>

Use libstdc++, libsupc++ and libgcc from gcc_syslibs.

* Instead of faking libstdc++.so from libstdc++.a, use libstdc++.so
from the gcc_syslibs build feature for everything except x86_gcc2.
* Use libgcc_s.so from the gcc_syslibs build feature for everything but
x86_gcc2 (which still carries libgcc as part of libroot.so).
* Drop filtering of libgcc objects for libroot, as that is no longer
necessary since we're only using libgcc-as-single-object for libroot
with x86_gcc2, where the filtered object file doesn't exist. Should
the objects that used to be filtered cause any problems as part of
libgcc_s.so, we can always filter them as part of the gcc build.
* Use libsupc++.so from the gcc_syslibs build feature for everything but
x86_gcc2.
* Adjust all Jamfiles accordingly.
* Deactivate building of faked libstdc++.so for non-x86-gcc2. For
x86_gcc2, we still build libstdc++.so from the sources in the Haiku
source tree as part of the Haiku build .
* Put gcc_syslibs package onto the image, when needed.


# ebd3bcdb 12-Feb-2014 John Scipione <jscipione@gmail.com>

exfat: handle 4-byte UTF-16 surrogate pairs

... in filenames. Replace the existing Unicode conversion functions
with UTF conversion functions from js that he relicensed MIT for us.

Put the UTF conversion functions in a private but shared code location
so that they can be accessed throughout the kernel.

Right now we only provide functions to convert between UTF-8 and UTF-16.
At some point we should also add functions to convert between UTF-8 and
UTF-32 and UTF-16 and UTF-32 but these aren't needed by exfat.

Remove the old Unicode conversion functions from exfat as they assumed
UCS-2 characters and don't work with UTF-16 used by exfat.

Rename most variables with the term length with code unit where code units
are intended. The term length, when used, means length in bytes while code
units represent either a full 2-byte UTF-16 character or half a 4-byte
surrogate pair.


# faa2d8a9 23-Feb-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

Don't link the kernel as a shared lib on ARM

We have the same problem as on x86_64: posiiton dependant code isn't
allowed in shared libraries. Since Kernel.so is not used at runtime,
we can use the same hack as on x86_64, and use elfedit to make the
linker think our kernel is a shared library.


# 96dcc73b 26-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Add scheduler profiler

A bit hackish implementation of a profiler for the scheduler.
SCHEDULER_ENTER_FUNCTION at the begining of each function aren't nice and
usage of __PRETTY_FUNCTION__ isn't any better (both gcc and clang support
it though), but it was quick to implement and doesn't lose information
on inlined functions. It's just a tool, not an integral part of the kernal
anyway.


# d287274d 05-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Code refactoring


# 9c2e74da 20-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Move mode specific logic to separate files


# 978fc080 23-Oct-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Remove support for running different schedulers

Simple scheduler behaves exactly the same as affine scheduler with a
single core. Obviously, affine scheduler is more complicated thus
introduces greater overhead but quite a lot of multicore logic has been
disabled on single core systems in the previous commit.


# 51d1e9ad 14-Oct-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Remove scheduler_simple_smp


# 0cb3f709 01-Sep-2013 Oliver Tappe <zooey@hirschkaefer.de>

Revert "Fix build problems of btrfs and packagefs for x86_64."

This reverts commit f272e63f393449d3a816970ca632764895a78cd6.


# c5c787ea 29-Aug-2013 Oliver Tappe <zooey@hirschkaefer.de>

Fix build problems of btrfs and packagefs for x86_64.

* Both filesystems used to link to a static kernel-zlib, which
was being built with -fno-pic. This doesn't work on x86_64 as the
filesystem add-ons are meant to be relocatable, which requires their
code to be compiled as position independent.
Solve that by moving zlib into the kernel, so any add-on can just use
it from there (packagefs is mandatory, so we can't really do without
zlib anyway).


# b0944c78 01-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

More work towards hybrid support

* All packaging architecture dependent variables do now have a
respective suffix and are set up for each configured packaging
architecture, save for the kernel and boot loader variables, which
are still only set up for the primary architecture.
For convenience TARGET_PACKAGING_ARCH, TARGET_ARCH, TARGET_LIBSUPC++,
and TARGET_LIBSTDC++ are set to the respective values for the primary
packaging architecture by default.
* Introduce a set of MultiArch* rules to help with building targets for
multiple packaging architectures. Generally the respective targets are
(additionally) gristed with the packaging architecture. For libraries
the additional grist is usually omitted for the primary architecture
(e.g. libroot.so and <x86>libroot.so for x86_gcc2/x86 hybrid), so that
Jamfiles for targets built only for the primary architecture don't
need to be changed.
* Add multi-arch build support for all targets needed for the stage 1
cross devel package as well as for libbe (untested).


# c864ba1a 16-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Build a separate libsupc++ for the kernel with correct flags.

Kernel mode code on x86_64 needs to be built with -mno-red-zone as
interrupts would corrupt the red zone if it were in use. However, the
kernel is linked with libsupc++, which was not compiled with
-mno-red-zone. If an interrupt occurred in libsupc++ code the red zone
would get corrupted. This was causing random panics, particularly under
heavy system load. Therefore, on x86_64 a separate build of libsupc++
with -mno-red-zone is now done for the kernel to use. Note: this commit
will require a rerun of configure and rebuild of cross tools.


# 385d69fc 19-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Made it possible to build kernel modules for x86_64.

Added the necessary build flags for modules, and added a module (dpc)
to the floppy image for x86_64 builds for testing purposes. The module
gets loaded correctly and its code runs without issue. Only non-trivial
addition is the different method for generating kernel.so, this is
explained in the kernel Jamfile.


# da80a050 02-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Preparation for merge of x86 and x86_64 kernel sources.

Since x86 and x86_64 share a lot of common code, x86_64 kernel sources/headers
are going to reside under headers/private/kernel/arch/x86 and
src/system/kernel/arch/x86 along with the existing x86 code. This commit
changes the build system to handle this. A new variable, TARGET_KERNEL_ARCH,
has been added. This is the name of the kernel/boot architecture directory
name, set to x86 on both x86 and x86_64. This is now used in all places where
TARGET_ARCH was used to get to kernel arch sources/headers (I've changed
everything necessary as far as I can tell). Kernel won't build for x86_64
at the moment as the sources have not been merged, loader does.


# 1fe24d0c 03-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add heap with guard pages to detect out of bound reads/writes.

This is a very simple heap implementation that allocates memory so that
the end of each allocation always coincides with a page end and is
followed by a guard page which is marked non-present. Out of bounds
access (both read and write) therefore cause a crash (unhandled page
fault).

Note that this allocator is neither speed nor space efficient, indeed it
wastes huge amounts of pages and address space so it is quite easy to
hit limits. It is intended as a pure debug feature.


# c9c6e365 03-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Use PropagateContainerUpdateTargetFlags rule

Propagate all update variables in CopySetHaikuRevision and for the
kernel pseudo target.


# 24df6592 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 813d4cbe 11-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved created subdirectory src/system/kernel/lock.cpp to new subdirectory
locks.
* Added syscalls for a new kind of mutex. A mutex consists only of an int32 and
doesn't require any kernel resources. So it's initialization cannot fail
(it consists only of setting the mutex value to 0). An uncontended lock or
unlock operation can basically consist of an atomic_*() in userland. The
syscalls (when the mutex is contended) are a bit more expensive than semaphore
operations, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36158 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 48e129c9 21-Jan-2010 Colin Günther <coling@gmx.de>

White space cleanup. No functional change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35213 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c7993bf 11-Dec-2009 Rene Gollent <anevilyak@gmail.com>

Small cleanup: As the cpu_ent struct now tracks the running thread directly, the affine scheduler can use that instead of keeping track internally.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34638 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3533b659 10-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Reintroduced the SMP_MSG_RESCHEDULE_IF_IDLE ICI message. This time
implemented by means of an additional member in cpu_ent.
* Removed thread::keep_scheduled and the related functions. The feature
wasn't used yet and wouldn't have worked as implemented anyway.
* Resurrected an older, SMP aware version of our simple scheduler and made it
the default instead of the affine scheduler. The latter is in no state to
be used yet. It causes enormous latencies (I've seen up to 0.1s) even when
six or seven CPUs were idle at the same time, totally killing parallelism.
That's also the reason why a -j8 build was slower than a -j2. This is no
longer the case. On my machine the -j2 build takes about 10% less time now
and the -j8 build saves another 20%. The latter is not particularly
impressive (compared with Linux), but that seems to be due to lock
contention.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34615 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fc786409 02-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Attempt at allowing to use C++ structures in C only code: We use the
CreateAsmStructOffsetsHeader mechanism to generate a header with macros
defined to the sizes of the structures we're interested in and when compiling
in C mode define the structures as "struct { char bytes[size]; }".
It works in principle, but due to how jam works, one would have to specify the
dependency to the generated header for all sources that include it directly or
indirectly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34441 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bd185b41 01-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

*.c -> *.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34417 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ef3966e8 22-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 227fe7d3 23-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 24fde47c 21-Mar-2009 Rene Gollent <anevilyak@gmail.com>

Introduce an experimental new scheduler intended to work fundamentally the same as our existing one, but with various optimizations to better handle the SMP case:
1) We now maintain a runqueue per CPU, rather than a single global shared queue. Idle threads are segregated into their own queue for simplicity.
2) Enqueueing threads is now somewhat more intelligent - if the thread is pinned, it is always enqueued onto that core. Otherwise we enqueue it on whichever CPU it previously ran, unless it either hasn't run before, or that core has been disabled via ProcessController. If so, we try to enqueue it on whichever core has been the most idle recently.
3) The above allow various simplifications to thread scheduling. Pinned threads and/or disabled cores are now no longer special cases that need to be dealt with. If a CPU has no threads ready, it looks for another one to steal a thread from, though that part still needs some tuning along with enqueueing for load balancing purposes.

The chief aim here is better load balancing and support for soft affinity. However, at the moment the overall behavior still exhibits some regressions compared to the old scheduler, so it's disabled by default. If you wish to experiment/debug with it, instructions for enabling it can be found in scheduler.cpp. Much thanks to Ingo, Axel and everyone who's helped with either code review/advice or testing so far.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29643 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3ede860e 27-Dec-2008 Axel Dörfler <axeld@pinc-software.de>

* kernel.so must link agaist kernel_misc.o as well to make all of its symbols
available for modules.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28823 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 53892c92 20-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced scheduler_remove_from_run_queue() by
scheduler_set_thread_priority(). Setting the thread priority was the
only situation in which it was used.
* Renamed scheduler.cpp to scheduler_simple.cpp.
* The scheduler functions are no longer called directly. Instead there's
an operation vector now, which is initialized at kernel init time.
This allows for picking the most suitable scheduler for the machine
(e.g. a non-SMP scheduler on a non-SMP machine).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28262 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 768036bb 20-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved scheduler.cpp into new subdirectory scheduler/. Moved the
scheduler tracing and scheduler analysis code into separate source
files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28253 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6bbe7eb8 07-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* smp.c -> smp.cpp
* Added smp_send_multicast_ici(), which sends the message to all CPUs
specified via a mask.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27910 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 56302466 17-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* image.c -> image.cpp
* Added global hash table for images.
* Improved a bit of code by using the new image hash table. E.g.
_get_image_info() can return infos for images of any team, now.
* Fixed remove_images() comment: The function must not be invoked with
the team lock being held.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27606 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a6d2523e 24-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed superfluous whitespace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26624 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c99d639 22-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged branch haiku/branches/developer/bonefish/vm into trunk. This
introduces the following relevant changes:
* VMCache:
- Renamed vm_cache to VMCache, merged it with vm_store and made it a
C++ class with virtual methods (replacing the store operations).
Turned the different store implementations into subclasses.
- Introduced MergeStore() callback, changed semantics of Commit().
- Changed locking and referencing semantics. A reference can only be
acquired/released with the cache locked. An unreferenced cache is
deleted and a mergeable cache merged when it is unlocked. This
removes the "busy" state of a cache and simplifies the page fault
code.
* Added VMAnonymousCache, which will implement swap support (work by
Zhao Shuai). It is not integrated and used yet, though.
* Enabled the mutex/recursive lock holder asserts.
* Fixed DoublyLinkedList::Swap().
* Generalized the low memory handler to a low resource handler. And made
semaphores and reserved memory handled resources. Made
vm_try_resource_memory() optionally wait (with timeout), and used that
feature to reserve memory for areas.
...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26572 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c0179e08 09-Jun-2008 François Revol <revol@free.fr>

Do not use -shared when linking linkhack.so for PPC. It is however needed for other archs.
This is a temporary workaround to get the thing building until someone has enough cafein available to update binutils.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25895 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c8b410a 28-May-2008 Axel Dörfler <axeld@pinc-software.de>

Patch by Jan Klötzke:
* Current linking scheme does not always export arch specific symbols from the
kernel. Merging all compiled arch stuff into a single .o file (and linking
that to the kernel) fixes it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25679 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7c61d84f 14-May-2008 Stephan Aßmus <superstippi@gmx.de>

Patch by Vasilis Kaoutsis:
* Renamed main.c to main.cpp
* Use find_directory() to construct the Bootscript path.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25509 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d648afb8 11-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* For each userland team the kernel creates an area in the userland
address space that is fully locked and marked B_KERNEL_AREA. It can
thus be accessed by the kernel without additional checks.
* For each userland thread we do create a user_thread structure in that
area. The structure is accessible from userland via TLS, using the
private get_user_thread() function.
* Introduced private userland functions [un]defer_signals(). They can be
used to cheaply disable/re-enable signal delivery. They use the
user_thread::defer_signals/pending_signals fields which are
checked/updated by the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25451 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 02a3b9ef 08-May-2008 Axel Dörfler <axeld@pinc-software.de>

* kernel_daemon is now a C++ file, and uses DoublyLinkedList instead of
the C list mechanism which also makes the code nicer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25375 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 98e67131 06-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved realtime_sem.{cpp,h} into new posix subdirectory.
* Renamed the old kernel_posix[_arch...].o to kernel_lib_posix...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25336 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5142c2ac 05-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for POSIX semaphores (the ones from the XSI extension
Realtime option group). The implementation should be complete, but is
totally untested yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25326 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8562499f 30-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced a new locking primitive I called "cutex" (sorry for the
name, couldn't resist :-P). It's semantically equivalent to a mutex,
but doesn't need a semaphore (it uses thread blocking and a simple
queue instead). Initialization can't fail. In fact it is ready to use
without initialization when living in the bss segment, also in the
early boot process. It's as fast as a benaphore in cases of low lock
contention, and faster otherwise. Only disadvantage is the higher
immediate memory footprint of 16 bytes.
* Changed how the "thread" and "threads" debugger commands list the
objects they are waiting for. Cutexes are also included.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25276 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e01cebeb 22-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* cancel_timer():
- If the hook of the timer we're cancelling is currently being
executed, we do now wait till it is finished. This is how the BeBook
specifies the function to behave.
- Periodic timers would not be cancelled, if their hook was being
invoked at the same time, since they weren't in the queue during
that time.
- Since we know the CPU on which the timer is scheduled (timer::cpu),
we don't have to look through any other CPU queue to find it.
- Fixed the return value. It should report whether the timer had
already fired, and was not always doing that.
* Added private add_timer() flag B_TIMER_ACQUIRE_THREAD_LOCK. It causes
the thread spinlock to be acquired before the event hook is called.
cancel_timer() doesn't wait for timers with the flag set. Instead we
check in the timer interrupt function after acquiring the thread
spinlock whether the timer was cancelled in the meantime. Calling
cancel_timer() with the thread spinlock being held does thus avoid any
race conditions and won't deadlock, if the event hook needs to acquire
the thread spinlock, too. This feature proves handy for some kernel
internal needs.
* The scheduler uses a B_TIMER_ACQUIRE_THREAD_LOCK timer now and
cancel_timer() instead of the no longer needed
_local_timer_cancel_event().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25098 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a886f802 20-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Added debug_screen_output_enabled() function.
* The boot splash code now checks wether debug screen output is enabled or not
using the above function.
* The boot splash code no longer maps it's own copy of the frame buffer, instead,
it will use the boot item feature as the VESA driver does. Also removed the
lock, as that's not needed at all.
* Renamed splash.cpp to boot_splash.cpp, and boot/splash.h to boot_splash.h
(it's not part of the boot loader, but the kernel).
* Removed dead code from boot_splash.cpp, added license. Replaced license
header in boot_splash.h to a style guide conforming one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24489 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aa727f66 18-Mar-2008 Stephan Aßmus <superstippi@gmx.de>

patch by Artur Wyszynski (aljen):
* Added the feature of an animated boot screen (icons lighting up at
different boot stages).
* Added first version of new boot splash images, generated by the new
hsbg tool. (Also finally contains the "new" Haiku logo.)

changes by myself:
* Added Artur to the contributors list in About System.
* Fixed some left overs in the patch, kept tracing turned off.

TODO:
* Remove the need for hard coding the icon positions. (Maybe generate
those from hsbg and put them into images.h? Have user provide icon
spacing/offsets at the command line for hsbg?)
* Rename the stages to something meaningful.
* Use hsbg as a build system tool and generate images.h during build
from PNGs provided in the artwork folder.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24434 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fe8b72bc 15-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

Applied patch by Vasilis:
* Fixed various warnings with GCC4 due to the double sHaikuRevision line.
* Turned system_info.c to a C++ file.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24404 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4eb35609 11-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added real, effective and saved set- user and group IDs to the team
structure. They are properly inherited and updated on
fork(), load_image(), and exec().
* Implemented the get[e]{u,g}id(), set[[r]e]{u,g}id() family for real.
* getgroups() also calls the kernel now, but only returns the effective
group ID. Supplementary groups support is still missing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24359 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c4d1c5e 10-Feb-2008 Michael Lotz <mmlr@mlotz.ch>

Complete rework of the heap implementation. Freelists are now part of the pages
and pages are now kept in lists as well. This allows to return free pages once
a bin does not need them anymore. Partially filled pages are kept in a sorted
linked list so that allocation will always happen on the fullest page - this
favours having full pages and makes it more likely lightly used pages will get
completely empty so they can be returned. Generally this now goes more in the
direction of a slab allocator.
The allocation logic has been extracted, so a heap is now simply attachable to
a region of memory. This allows for multiple heaps and for dynamic growing. In
case the allocator runs out of free pages, an asynchronous growing thread is
notified to create a new area and attach a new heap to it.
By default the kernel heap is now set to 16MB and grows by 8MB each time all
heaps run full.
This should solve quite a few issues, like certain bins just claiming all pages
so that even if there is free space nothing can be allocated. Also it obviously
does aways with filling the heap page by page until it overgrows.
I think this is now a well performing and scalable allocator we can live with
for quite some time. It is well tested under emulation and real hardware and
performs as expected. If problems come up there is an extensive sanity checker
that can be enabled by PARANOID_VALIDATION that covers most aspects of the
allocator. For normal operation this is not necessary though and is therefore
disabled by default.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23939 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0c6f7530 31-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

syscalls.cpp also includes syscall_numbers.h, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23809 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2477bce5 19-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for userland symbol lookup in "sc" and "call". Having
used it for an hour or so, I really wonder how we could live without it.
:-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23640 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bbaaf4b7 18-Jan-2008 Jérôme Duval <korli@users.berlios.de>

gcc4 requires a cast, so we prepend (void *) to cast every syscall function
fixed syscall.cpp inclusions due to renaming


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23611 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 548dcc60 17-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* syscalls.c -> syscalls.cpp
* With post syscall debugging enabled, the x86 syscall handling didn't
remove all parameters from the stack after calling the respective user
debugger hook. Should have been harmless though, since the following
code didn't rely on the stack being in order.
* Added syscall pre/post (kernel) tracing functions
trace_{pre,post}_syscall(). They are generic, but need to be invoked
by the architecture specific syscall code. Currently only done for
x86.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23600 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 224aee3f 17-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

sem.c -> sem.cpp, port.c -> port.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23585 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 34b3b26b 10-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged branch haiku/branches/developer/bonefish/optimization revision
23139 into trunk, with roughly the following changes (for details svn
log the branch):
* The int 99 syscall handler is now fully in assembly.
* Added a sysenter/sysexit handler and use it on Pentiums that support
it (via commpage).
* Got rid of i386_handle_trap(). A bit of functionality was moved into
the assembly handler which now uses a jump table to call C functions
handling the respective interrupt.
* Some optimizations to get user debugger support code out of the
interrupt handling path.
* Introduced a thread::flags fields which allows to skip handling of
rare events (signals, user debug enabling/disabling) on the
common interrupt handling path.
* Got rid of the explicit iframe stack. The iframes can still be
retrieved by iterating through the stack frames.
* Made the commpage an architecture independent feature. It's used for
the real time data stuff (instead of creating a separate area).
* The x86 CPU modules can now provide processor optimized versions for
common functions (currently memcpy() only). They are used in the
kernel and are provided to the userland via commpage entries.
* Introduced build system feature allowing easy use of C structure
member offsets in assembly code.

Changes after merging:
* Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp
(caused by refactoring and introduction of "call" debugger command).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23370 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 636bfc08 02-Oct-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed fs/vfs_select.cpp to wait_for_objects.cpp and got rid of
vfs_select.h, respectively moved most of it into the new kernel
private header wait_for_objects.h.
* Added new experimental API functions wait_for_objects[_etc](). They
work pretty much like poll(), but also for semaphores, ports, and
threads.
* Removed the "ref" parameter from notify_select_events() and the
select_sync_pool functions as well as from fd_ops::fd_[de]select(). It
is no longer needed. The FS interface select() hook still has it,
though -- the VFS will always pass 0.
* de]select_fd() take a select_info* instead of a select_sync* + ref
pair, now. Added respective functions for semaphores, ports, and
threads.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22416 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ebe6d106 26-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Turned the files I intend to devastate to C++.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22074 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 227402f2 09-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Added simple condition variables to the kernel. They are a relatively
cheap means to block threads until notified explicitely.
threads


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21874 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a898ee19 31-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

Ahem... build fix. Forgot that there were some last minute changes that shouldn't have been part of the commit...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21773 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a970df44 29-Jun-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Include HaikuImage after the Jamfiles, so they can provide/adjust info
relevant for the image creation.
* The CopySetHaikuRevision propagates the value of the
HAIKU_INCLUDE_IN_IMAGE variable from the source to the target.
* Propagate the value of HAIKU_INCLUDE_IN_IMAGE from "kernel" to
"kernel_$(TARGET_ARCH)".

Now "jam update-install kernel" should work as expected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21527 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bdf8a2e1 19-May-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Added Haiku revision number to the kernel (same mechanism as used for
libroot). It's available in the kernel through the private
get_haiku_revision() and added to the kernel syslog output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21173 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 81423c91 25-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

added initial slab code to the kernel. It is still unused, and there is still no VM interaction.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20832 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 831486a2 16-Apr-2007 Travis Geiselbrecht <geist@foobox.com>

Turn the assembly optimized memcpy (simple rep movsd) back on for x86. Had to hack around the make system a bit, and the result is pretty nasty, specifically due to the amount of places in the system where various targets poke their fingers into the libroot directory.
The solution is less than optimal, but should work for now.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20722 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9bf1f552 01-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Enabled setjmp()/longjmp() support in the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20499 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 89ae57ba 29-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

Removed sysctl(), there is no need for this BSD-ish call.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17954 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cce6f8d0 13-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

* Changed the kernel build rules, so that the executables can have resources
files, too.
* Added a temporary icon for the kernel until Stephan comes up with a better
one (hint hint!) :-))
* This even fixes bug #648.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17825 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c14a34a6 26-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* Improved kernel ELF loader (and made it more similar to the one from the boot
loader): it now supports holes between segments, and accepts any segment order.
* Renamed elf.c to elf.cpp and fixed warnings.
* Renamed elf_image_info::dynamic_ptr and eheader to dynamic_section and elf_header.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16878 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d3fbce57 06-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* Added a debugger command "info" that dumps some basic system usage info.
* Renamed OBOS_ARCH macro to HAIKU_ARCH.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16608 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5d13c758 05-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* Reduced stack usage for iterator_get_next_module() quite a bit by no
longer pushing a whole path on the stack.
* open_module_list() now adds the prefix to the paths it puts on the
stack to reduce the amount of searching to do (this probably wasn't
done before because of the earlier boot method via bootfs which
didn't allow for deep path names).
* module.c is now module.cpp (for KPath usage).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16584 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d14aab0d 01-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

Changed the way how CPU activity is monitored: instead of taking the active
time of the idle thread as a measure, we now compute the CPU activity on
each thread switch - the time the CPU worked is the total of user and kernel
time a thread spent during its quantum.
Unlike before, this mechanism works correctly on SMP machines. I hope this
works as expected :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16193 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f602da2b 26-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

* Turned the kernel platform support from a library into an object.
* Moved the Open Firmware function platform_get_next_device() from
the boot loader into the kernel (renamed to of_get_next_device()).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16101 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 957a1b17 30-Dec-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced new build system variables
{HAIKU,HOST,TARGET}_KERNEL_PIC_{CC,LINK}FLAGS which define the
compiler/linker flags specifying the kind of position independence
the kernel shall have. For x86 we had and still have -fno-pic, but the
PPC kernel has -fPIE (position independent executable) now, as we
need to relocate it.
* The boot loader relocates the kernel now. Mostly copied the relocation
code from the kernel ELF loader. Almost completely rewrote the PPC
specific relocation code, though. It's more correct and more complete now
(some things are still missing though).
* Added boot platform awareness to the kernel. Moved the generic
Open Firmware code (openfirmware.c/h) from the boot loader to the kernel.
* The kernel PPC serial debug output is sent to the console for the time
being.
* The PPC boot loader counts the CPUs now and allocates the kernel stacks
(made OF device iteration a bit more flexible on the way -- the search
can be restricted to subtree). Furthermore we really enter the kernel...
(Yay! :-) ... and crash in the first dprintf() (in the atomic_set()
called by acquire_spinlock()). kprintf() works, though.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15756 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 38f62644 26-Nov-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Reorganized building of kernel, boot loader, and libroot.
Each component is built in the respective subdirectory now
and no longer in src/system/Jamfile.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15184 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 338b8dc3 29-Oct-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged changes from branch build_system_redesign at revision 14573.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14574 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d08379a8 21-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* Now we deal with all x86 exceptions, i.e. we no longer panic() when a
user application performs a division by zero or causes a general
protection fault. For some exceptions (e.g. machine check) I wasn't
quite sure whether they can be caused by user apps at all, so we panic()
in those cases. Wouldn't harm, if someone more knowledgable would check
this, though.
* Removed the unused fault handling stuff, respectively moved the little
that was used into x86/arch_int.c.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13795 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 718b5114 13-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

This should fix the build after all the kernel/system renaming.
If anything is still broken (and was not before :)), please shout.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12361 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2d690920 13-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed system/core to system/kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12360 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 220d04022750f40f8bac8f01fa551211e28d04f2 31-Jul-2014 Oliver Tappe <zooey@hirschkaefer.de>

Use libstdc++, libsupc++ and libgcc from gcc_syslibs.

* Instead of faking libstdc++.so from libstdc++.a, use libstdc++.so
from the gcc_syslibs build feature for everything except x86_gcc2.
* Use libgcc_s.so from the gcc_syslibs build feature for everything but
x86_gcc2 (which still carries libgcc as part of libroot.so).
* Drop filtering of libgcc objects for libroot, as that is no longer
necessary since we're only using libgcc-as-single-object for libroot
with x86_gcc2, where the filtered object file doesn't exist. Should
the objects that used to be filtered cause any problems as part of
libgcc_s.so, we can always filter them as part of the gcc build.
* Use libsupc++.so from the gcc_syslibs build feature for everything but
x86_gcc2.
* Adjust all Jamfiles accordingly.
* Deactivate building of faked libstdc++.so for non-x86-gcc2. For
x86_gcc2, we still build libstdc++.so from the sources in the Haiku
source tree as part of the Haiku build .
* Put gcc_syslibs package onto the image, when needed.


# ebd3bcdb9be2d6a57fc5b3270dcb49a9e1894d11 12-Feb-2014 John Scipione <jscipione@gmail.com>

exfat: handle 4-byte UTF-16 surrogate pairs

... in filenames. Replace the existing Unicode conversion functions
with UTF conversion functions from js that he relicensed MIT for us.

Put the UTF conversion functions in a private but shared code location
so that they can be accessed throughout the kernel.

Right now we only provide functions to convert between UTF-8 and UTF-16.
At some point we should also add functions to convert between UTF-8 and
UTF-32 and UTF-16 and UTF-32 but these aren't needed by exfat.

Remove the old Unicode conversion functions from exfat as they assumed
UCS-2 characters and don't work with UTF-16 used by exfat.

Rename most variables with the term length with code unit where code units
are intended. The term length, when used, means length in bytes while code
units represent either a full 2-byte UTF-16 character or half a 4-byte
surrogate pair.


# faa2d8a95be47a39c0e068a5f271f45ef737cafd 23-Feb-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

Don't link the kernel as a shared lib on ARM

We have the same problem as on x86_64: posiiton dependant code isn't
allowed in shared libraries. Since Kernel.so is not used at runtime,
we can use the same hack as on x86_64, and use elfedit to make the
linker think our kernel is a shared library.


# 96dcc73b39cc68a59c276a35690f8af1886214ef 26-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Add scheduler profiler

A bit hackish implementation of a profiler for the scheduler.
SCHEDULER_ENTER_FUNCTION at the begining of each function aren't nice and
usage of __PRETTY_FUNCTION__ isn't any better (both gcc and clang support
it though), but it was quick to implement and doesn't lose information
on inlined functions. It's just a tool, not an integral part of the kernal
anyway.


# d287274dcec634da4973a1b92c97dd14d7c5ecd0 05-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Code refactoring


# 9c2e74da043b32ecd64a0ec4f4917f83ac6cc10f 20-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Move mode specific logic to separate files


# 978fc080654a2367cfb75a8afa196361ab56645e 23-Oct-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Remove support for running different schedulers

Simple scheduler behaves exactly the same as affine scheduler with a
single core. Obviously, affine scheduler is more complicated thus
introduces greater overhead but quite a lot of multicore logic has been
disabled on single core systems in the previous commit.


# 51d1e9ada0e963b344954f7d6b7e94399197eeaf 14-Oct-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Remove scheduler_simple_smp


# 0cb3f7092620ff73abc6daadd866a4e07117bd37 01-Sep-2013 Oliver Tappe <zooey@hirschkaefer.de>

Revert "Fix build problems of btrfs and packagefs for x86_64."

This reverts commit f272e63f393449d3a816970ca632764895a78cd6.


# c5c787ea417c1a1c9f0fdb7ef3a5b807521f0093 29-Aug-2013 Oliver Tappe <zooey@hirschkaefer.de>

Fix build problems of btrfs and packagefs for x86_64.

* Both filesystems used to link to a static kernel-zlib, which
was being built with -fno-pic. This doesn't work on x86_64 as the
filesystem add-ons are meant to be relocatable, which requires their
code to be compiled as position independent.
Solve that by moving zlib into the kernel, so any add-on can just use
it from there (packagefs is mandatory, so we can't really do without
zlib anyway).


# b0944c78b074a8110bd98e060415d0e8f38a7f65 01-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

More work towards hybrid support

* All packaging architecture dependent variables do now have a
respective suffix and are set up for each configured packaging
architecture, save for the kernel and boot loader variables, which
are still only set up for the primary architecture.
For convenience TARGET_PACKAGING_ARCH, TARGET_ARCH, TARGET_LIBSUPC++,
and TARGET_LIBSTDC++ are set to the respective values for the primary
packaging architecture by default.
* Introduce a set of MultiArch* rules to help with building targets for
multiple packaging architectures. Generally the respective targets are
(additionally) gristed with the packaging architecture. For libraries
the additional grist is usually omitted for the primary architecture
(e.g. libroot.so and <x86>libroot.so for x86_gcc2/x86 hybrid), so that
Jamfiles for targets built only for the primary architecture don't
need to be changed.
* Add multi-arch build support for all targets needed for the stage 1
cross devel package as well as for libbe (untested).


# c864ba1a2d8525aeabd6199c01675f70f5abd7bd 16-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Build a separate libsupc++ for the kernel with correct flags.

Kernel mode code on x86_64 needs to be built with -mno-red-zone as
interrupts would corrupt the red zone if it were in use. However, the
kernel is linked with libsupc++, which was not compiled with
-mno-red-zone. If an interrupt occurred in libsupc++ code the red zone
would get corrupted. This was causing random panics, particularly under
heavy system load. Therefore, on x86_64 a separate build of libsupc++
with -mno-red-zone is now done for the kernel to use. Note: this commit
will require a rerun of configure and rebuild of cross tools.


# 385d69fc0177827257822eec1274f4286bc6600d 19-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Made it possible to build kernel modules for x86_64.

Added the necessary build flags for modules, and added a module (dpc)
to the floppy image for x86_64 builds for testing purposes. The module
gets loaded correctly and its code runs without issue. Only non-trivial
addition is the different method for generating kernel.so, this is
explained in the kernel Jamfile.


# da80a0500c33176998887bcae22828d9e997477f 02-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Preparation for merge of x86 and x86_64 kernel sources.

Since x86 and x86_64 share a lot of common code, x86_64 kernel sources/headers
are going to reside under headers/private/kernel/arch/x86 and
src/system/kernel/arch/x86 along with the existing x86 code. This commit
changes the build system to handle this. A new variable, TARGET_KERNEL_ARCH,
has been added. This is the name of the kernel/boot architecture directory
name, set to x86 on both x86 and x86_64. This is now used in all places where
TARGET_ARCH was used to get to kernel arch sources/headers (I've changed
everything necessary as far as I can tell). Kernel won't build for x86_64
at the moment as the sources have not been merged, loader does.


# 1fe24d0cd0b547a771c00f6fca8f50ba6ca2fb2c 03-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add heap with guard pages to detect out of bound reads/writes.

This is a very simple heap implementation that allocates memory so that
the end of each allocation always coincides with a page end and is
followed by a guard page which is marked non-present. Out of bounds
access (both read and write) therefore cause a crash (unhandled page
fault).

Note that this allocator is neither speed nor space efficient, indeed it
wastes huge amounts of pages and address space so it is quite easy to
hit limits. It is intended as a pure debug feature.


# c9c6e365376258f4f29d474675c37f7e4ca75498 03-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Use PropagateContainerUpdateTargetFlags rule

Propagate all update variables in CopySetHaikuRevision and for the
kernel pseudo target.


# 24df65921befcd0ad0c5c7866118f922da61cb96 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 813d4cbe94b99e33ac2b921ae76df4d1b2b39b40 11-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved created subdirectory src/system/kernel/lock.cpp to new subdirectory
locks.
* Added syscalls for a new kind of mutex. A mutex consists only of an int32 and
doesn't require any kernel resources. So it's initialization cannot fail
(it consists only of setting the mutex value to 0). An uncontended lock or
unlock operation can basically consist of an atomic_*() in userland. The
syscalls (when the mutex is contended) are a bit more expensive than semaphore
operations, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36158 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 48e129c9d4aa944e4e5819aa208a5ea357d5baf1 21-Jan-2010 Colin Günther <coling@gmx.de>

White space cleanup. No functional change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35213 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c7993bfab257986a80fe20104cea2d6b2e46089 11-Dec-2009 Rene Gollent <anevilyak@gmail.com>

Small cleanup: As the cpu_ent struct now tracks the running thread directly, the affine scheduler can use that instead of keeping track internally.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34638 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3533b6597db4ad65493632da8a92c1f6ea3de149 10-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Reintroduced the SMP_MSG_RESCHEDULE_IF_IDLE ICI message. This time
implemented by means of an additional member in cpu_ent.
* Removed thread::keep_scheduled and the related functions. The feature
wasn't used yet and wouldn't have worked as implemented anyway.
* Resurrected an older, SMP aware version of our simple scheduler and made it
the default instead of the affine scheduler. The latter is in no state to
be used yet. It causes enormous latencies (I've seen up to 0.1s) even when
six or seven CPUs were idle at the same time, totally killing parallelism.
That's also the reason why a -j8 build was slower than a -j2. This is no
longer the case. On my machine the -j2 build takes about 10% less time now
and the -j8 build saves another 20%. The latter is not particularly
impressive (compared with Linux), but that seems to be due to lock
contention.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34615 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fc7864091e2463c0e446f8b3954df4d29e9465af 02-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Attempt at allowing to use C++ structures in C only code: We use the
CreateAsmStructOffsetsHeader mechanism to generate a header with macros
defined to the sizes of the structures we're interested in and when compiling
in C mode define the structures as "struct { char bytes[size]; }".
It works in principle, but due to how jam works, one would have to specify the
dependency to the generated header for all sources that include it directly or
indirectly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34441 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bd185b4117e06c1674c4d214abc3917acedc560d 01-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

*.c -> *.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34417 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ef3966e8886cdde569be02415801b2951713544b 22-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 227fe7d34aeed45d0727a0abde2ea2309352983b 23-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 24fde47c7a34e4d5088ef52efbe0c6a14ea3f65b 21-Mar-2009 Rene Gollent <anevilyak@gmail.com>

Introduce an experimental new scheduler intended to work fundamentally the same as our existing one, but with various optimizations to better handle the SMP case:
1) We now maintain a runqueue per CPU, rather than a single global shared queue. Idle threads are segregated into their own queue for simplicity.
2) Enqueueing threads is now somewhat more intelligent - if the thread is pinned, it is always enqueued onto that core. Otherwise we enqueue it on whichever CPU it previously ran, unless it either hasn't run before, or that core has been disabled via ProcessController. If so, we try to enqueue it on whichever core has been the most idle recently.
3) The above allow various simplifications to thread scheduling. Pinned threads and/or disabled cores are now no longer special cases that need to be dealt with. If a CPU has no threads ready, it looks for another one to steal a thread from, though that part still needs some tuning along with enqueueing for load balancing purposes.

The chief aim here is better load balancing and support for soft affinity. However, at the moment the overall behavior still exhibits some regressions compared to the old scheduler, so it's disabled by default. If you wish to experiment/debug with it, instructions for enabling it can be found in scheduler.cpp. Much thanks to Ingo, Axel and everyone who's helped with either code review/advice or testing so far.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29643 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3ede860e309938dc25c7fea80ab193a871d28fbf 27-Dec-2008 Axel Dörfler <axeld@pinc-software.de>

* kernel.so must link agaist kernel_misc.o as well to make all of its symbols
available for modules.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28823 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 53892c92a02939d7e657f4fbb9563bc692716318 20-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced scheduler_remove_from_run_queue() by
scheduler_set_thread_priority(). Setting the thread priority was the
only situation in which it was used.
* Renamed scheduler.cpp to scheduler_simple.cpp.
* The scheduler functions are no longer called directly. Instead there's
an operation vector now, which is initialized at kernel init time.
This allows for picking the most suitable scheduler for the machine
(e.g. a non-SMP scheduler on a non-SMP machine).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28262 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 768036bb6eff60aa41a27d0aff463384c932d364 20-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved scheduler.cpp into new subdirectory scheduler/. Moved the
scheduler tracing and scheduler analysis code into separate source
files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28253 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6bbe7eb8caad128659bb2edc617d0ccb2f2d89dd 07-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* smp.c -> smp.cpp
* Added smp_send_multicast_ici(), which sends the message to all CPUs
specified via a mask.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27910 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 56302466dcc719887577fbda9774e146da42f88a 17-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* image.c -> image.cpp
* Added global hash table for images.
* Improved a bit of code by using the new image hash table. E.g.
_get_image_info() can return infos for images of any team, now.
* Fixed remove_images() comment: The function must not be invoked with
the team lock being held.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27606 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a6d2523e37f1d0aa2a8ec920c936699a27bc33ce 24-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed superfluous whitespace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26624 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c99d639708df9b4e2cc847b38d510149d19ec78 22-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged branch haiku/branches/developer/bonefish/vm into trunk. This
introduces the following relevant changes:
* VMCache:
- Renamed vm_cache to VMCache, merged it with vm_store and made it a
C++ class with virtual methods (replacing the store operations).
Turned the different store implementations into subclasses.
- Introduced MergeStore() callback, changed semantics of Commit().
- Changed locking and referencing semantics. A reference can only be
acquired/released with the cache locked. An unreferenced cache is
deleted and a mergeable cache merged when it is unlocked. This
removes the "busy" state of a cache and simplifies the page fault
code.
* Added VMAnonymousCache, which will implement swap support (work by
Zhao Shuai). It is not integrated and used yet, though.
* Enabled the mutex/recursive lock holder asserts.
* Fixed DoublyLinkedList::Swap().
* Generalized the low memory handler to a low resource handler. And made
semaphores and reserved memory handled resources. Made
vm_try_resource_memory() optionally wait (with timeout), and used that
feature to reserve memory for areas.
...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26572 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c0179e0856e2485780abc4fda1c465c5257a3f99 09-Jun-2008 François Revol <revol@free.fr>

Do not use -shared when linking linkhack.so for PPC. It is however needed for other archs.
This is a temporary workaround to get the thing building until someone has enough cafein available to update binutils.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25895 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c8b410ad5b3ac5a413e741b972c147621b3d413 28-May-2008 Axel Dörfler <axeld@pinc-software.de>

Patch by Jan Klötzke:
* Current linking scheme does not always export arch specific symbols from the
kernel. Merging all compiled arch stuff into a single .o file (and linking
that to the kernel) fixes it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25679 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7c61d84fcd53518c0a155315f72a71e21d5c3574 14-May-2008 Stephan Aßmus <superstippi@gmx.de>

Patch by Vasilis Kaoutsis:
* Renamed main.c to main.cpp
* Use find_directory() to construct the Bootscript path.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25509 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d648afb8d7852cc7ca9819315356ec605e2e0ee7 11-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* For each userland team the kernel creates an area in the userland
address space that is fully locked and marked B_KERNEL_AREA. It can
thus be accessed by the kernel without additional checks.
* For each userland thread we do create a user_thread structure in that
area. The structure is accessible from userland via TLS, using the
private get_user_thread() function.
* Introduced private userland functions [un]defer_signals(). They can be
used to cheaply disable/re-enable signal delivery. They use the
user_thread::defer_signals/pending_signals fields which are
checked/updated by the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25451 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 02a3b9ef494a32bb45b659d19cf82102e1483c6a 08-May-2008 Axel Dörfler <axeld@pinc-software.de>

* kernel_daemon is now a C++ file, and uses DoublyLinkedList instead of
the C list mechanism which also makes the code nicer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25375 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 98e67131727de15752bc87a530612040c6955d17 06-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved realtime_sem.{cpp,h} into new posix subdirectory.
* Renamed the old kernel_posix[_arch...].o to kernel_lib_posix...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25336 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5142c2ac86c0f020ffa3fc31cea9f1f2f1b6ef91 05-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for POSIX semaphores (the ones from the XSI extension
Realtime option group). The implementation should be complete, but is
totally untested yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25326 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8562499f441ac23a80dd89310dbf2016b681fef9 30-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced a new locking primitive I called "cutex" (sorry for the
name, couldn't resist :-P). It's semantically equivalent to a mutex,
but doesn't need a semaphore (it uses thread blocking and a simple
queue instead). Initialization can't fail. In fact it is ready to use
without initialization when living in the bss segment, also in the
early boot process. It's as fast as a benaphore in cases of low lock
contention, and faster otherwise. Only disadvantage is the higher
immediate memory footprint of 16 bytes.
* Changed how the "thread" and "threads" debugger commands list the
objects they are waiting for. Cutexes are also included.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25276 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e01cebeb0afabb44d9a14013bc82863ef3648e2e 22-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* cancel_timer():
- If the hook of the timer we're cancelling is currently being
executed, we do now wait till it is finished. This is how the BeBook
specifies the function to behave.
- Periodic timers would not be cancelled, if their hook was being
invoked at the same time, since they weren't in the queue during
that time.
- Since we know the CPU on which the timer is scheduled (timer::cpu),
we don't have to look through any other CPU queue to find it.
- Fixed the return value. It should report whether the timer had
already fired, and was not always doing that.
* Added private add_timer() flag B_TIMER_ACQUIRE_THREAD_LOCK. It causes
the thread spinlock to be acquired before the event hook is called.
cancel_timer() doesn't wait for timers with the flag set. Instead we
check in the timer interrupt function after acquiring the thread
spinlock whether the timer was cancelled in the meantime. Calling
cancel_timer() with the thread spinlock being held does thus avoid any
race conditions and won't deadlock, if the event hook needs to acquire
the thread spinlock, too. This feature proves handy for some kernel
internal needs.
* The scheduler uses a B_TIMER_ACQUIRE_THREAD_LOCK timer now and
cancel_timer() instead of the no longer needed
_local_timer_cancel_event().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25098 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a886f802fca0b7d6c6e2bb4b790d8865c1807bff 20-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Added debug_screen_output_enabled() function.
* The boot splash code now checks wether debug screen output is enabled or not
using the above function.
* The boot splash code no longer maps it's own copy of the frame buffer, instead,
it will use the boot item feature as the VESA driver does. Also removed the
lock, as that's not needed at all.
* Renamed splash.cpp to boot_splash.cpp, and boot/splash.h to boot_splash.h
(it's not part of the boot loader, but the kernel).
* Removed dead code from boot_splash.cpp, added license. Replaced license
header in boot_splash.h to a style guide conforming one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24489 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aa727f664349524c88917974e83b6b3c40d65b24 18-Mar-2008 Stephan Aßmus <superstippi@gmx.de>

patch by Artur Wyszynski (aljen):
* Added the feature of an animated boot screen (icons lighting up at
different boot stages).
* Added first version of new boot splash images, generated by the new
hsbg tool. (Also finally contains the "new" Haiku logo.)

changes by myself:
* Added Artur to the contributors list in About System.
* Fixed some left overs in the patch, kept tracing turned off.

TODO:
* Remove the need for hard coding the icon positions. (Maybe generate
those from hsbg and put them into images.h? Have user provide icon
spacing/offsets at the command line for hsbg?)
* Rename the stages to something meaningful.
* Use hsbg as a build system tool and generate images.h during build
from PNGs provided in the artwork folder.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24434 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fe8b72bc69e027abd0975ea252706a8d2b92caee 15-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

Applied patch by Vasilis:
* Fixed various warnings with GCC4 due to the double sHaikuRevision line.
* Turned system_info.c to a C++ file.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24404 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4eb3560949b15e7492c8055eb512e5dd68b2da32 11-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added real, effective and saved set- user and group IDs to the team
structure. They are properly inherited and updated on
fork(), load_image(), and exec().
* Implemented the get[e]{u,g}id(), set[[r]e]{u,g}id() family for real.
* getgroups() also calls the kernel now, but only returns the effective
group ID. Supplementary groups support is still missing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24359 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c4d1c5e21dcf7e66414c44691ff0aa92be93842 10-Feb-2008 Michael Lotz <mmlr@mlotz.ch>

Complete rework of the heap implementation. Freelists are now part of the pages
and pages are now kept in lists as well. This allows to return free pages once
a bin does not need them anymore. Partially filled pages are kept in a sorted
linked list so that allocation will always happen on the fullest page - this
favours having full pages and makes it more likely lightly used pages will get
completely empty so they can be returned. Generally this now goes more in the
direction of a slab allocator.
The allocation logic has been extracted, so a heap is now simply attachable to
a region of memory. This allows for multiple heaps and for dynamic growing. In
case the allocator runs out of free pages, an asynchronous growing thread is
notified to create a new area and attach a new heap to it.
By default the kernel heap is now set to 16MB and grows by 8MB each time all
heaps run full.
This should solve quite a few issues, like certain bins just claiming all pages
so that even if there is free space nothing can be allocated. Also it obviously
does aways with filling the heap page by page until it overgrows.
I think this is now a well performing and scalable allocator we can live with
for quite some time. It is well tested under emulation and real hardware and
performs as expected. If problems come up there is an extensive sanity checker
that can be enabled by PARANOID_VALIDATION that covers most aspects of the
allocator. For normal operation this is not necessary though and is therefore
disabled by default.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23939 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0c6f7530ef38de3b1fc3d89253ab3c60a473c6a6 31-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

syscalls.cpp also includes syscall_numbers.h, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23809 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2477bce5046dba76204a8c8b75ea773be4ae9748 19-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for userland symbol lookup in "sc" and "call". Having
used it for an hour or so, I really wonder how we could live without it.
:-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23640 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bbaaf4b7c3e1f9c03e34ea5a0b40d87392d5601b 18-Jan-2008 Jérôme Duval <korli@users.berlios.de>

gcc4 requires a cast, so we prepend (void *) to cast every syscall function
fixed syscall.cpp inclusions due to renaming


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23611 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 548dcc600e2c1823ae0318215197db9725c52b21 17-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* syscalls.c -> syscalls.cpp
* With post syscall debugging enabled, the x86 syscall handling didn't
remove all parameters from the stack after calling the respective user
debugger hook. Should have been harmless though, since the following
code didn't rely on the stack being in order.
* Added syscall pre/post (kernel) tracing functions
trace_{pre,post}_syscall(). They are generic, but need to be invoked
by the architecture specific syscall code. Currently only done for
x86.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23600 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 224aee3ffc83a306629696fe4cf45cad9efa4349 17-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

sem.c -> sem.cpp, port.c -> port.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23585 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 34b3b26b3b8c46ba46ddde037b10dd173f4936d6 10-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged branch haiku/branches/developer/bonefish/optimization revision
23139 into trunk, with roughly the following changes (for details svn
log the branch):
* The int 99 syscall handler is now fully in assembly.
* Added a sysenter/sysexit handler and use it on Pentiums that support
it (via commpage).
* Got rid of i386_handle_trap(). A bit of functionality was moved into
the assembly handler which now uses a jump table to call C functions
handling the respective interrupt.
* Some optimizations to get user debugger support code out of the
interrupt handling path.
* Introduced a thread::flags fields which allows to skip handling of
rare events (signals, user debug enabling/disabling) on the
common interrupt handling path.
* Got rid of the explicit iframe stack. The iframes can still be
retrieved by iterating through the stack frames.
* Made the commpage an architecture independent feature. It's used for
the real time data stuff (instead of creating a separate area).
* The x86 CPU modules can now provide processor optimized versions for
common functions (currently memcpy() only). They are used in the
kernel and are provided to the userland via commpage entries.
* Introduced build system feature allowing easy use of C structure
member offsets in assembly code.

Changes after merging:
* Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp
(caused by refactoring and introduction of "call" debugger command).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23370 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 636bfc08aeaaa7f1bab813c5aa2e8e666b40ec64 02-Oct-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed fs/vfs_select.cpp to wait_for_objects.cpp and got rid of
vfs_select.h, respectively moved most of it into the new kernel
private header wait_for_objects.h.
* Added new experimental API functions wait_for_objects[_etc](). They
work pretty much like poll(), but also for semaphores, ports, and
threads.
* Removed the "ref" parameter from notify_select_events() and the
select_sync_pool functions as well as from fd_ops::fd_[de]select(). It
is no longer needed. The FS interface select() hook still has it,
though -- the VFS will always pass 0.
* de]select_fd() take a select_info* instead of a select_sync* + ref
pair, now. Added respective functions for semaphores, ports, and
threads.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22416 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ebe6d106843e4280c58c87eaa1eab9b71ece8c2a 26-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Turned the files I intend to devastate to C++.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22074 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 227402f2bfd4187053a07abd674464cf88885a3d 09-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Added simple condition variables to the kernel. They are a relatively
cheap means to block threads until notified explicitely.
threads


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21874 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a898ee19d65a967761f20ede7516077414fc6a18 31-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

Ahem... build fix. Forgot that there were some last minute changes that shouldn't have been part of the commit...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21773 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a970df44af54bbb4be84f2d9839eda842536c81a 29-Jun-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Include HaikuImage after the Jamfiles, so they can provide/adjust info
relevant for the image creation.
* The CopySetHaikuRevision propagates the value of the
HAIKU_INCLUDE_IN_IMAGE variable from the source to the target.
* Propagate the value of HAIKU_INCLUDE_IN_IMAGE from "kernel" to
"kernel_$(TARGET_ARCH)".

Now "jam update-install kernel" should work as expected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21527 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bdf8a2e1e7967ddad93f3d25292029172a40ec06 19-May-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Added Haiku revision number to the kernel (same mechanism as used for
libroot). It's available in the kernel through the private
get_haiku_revision() and added to the kernel syslog output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21173 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 81423c91c784578220954adf9ed003575f8db8a0 25-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

added initial slab code to the kernel. It is still unused, and there is still no VM interaction.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20832 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 831486a2d3ba8eb2a012bc59083f383811fff5a3 16-Apr-2007 Travis Geiselbrecht <geist@foobox.com>

Turn the assembly optimized memcpy (simple rep movsd) back on for x86. Had to hack around the make system a bit, and the result is pretty nasty, specifically due to the amount of places in the system where various targets poke their fingers into the libroot directory.
The solution is less than optimal, but should work for now.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20722 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9bf1f552d98d2f0550f2db30597e70865b7fc529 01-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Enabled setjmp()/longjmp() support in the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20499 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 89ae57ba7748457a8f90a05c500e39c49b18fc28 29-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

Removed sysctl(), there is no need for this BSD-ish call.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17954 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cce6f8d05f8d5c24974e10e785a191eed32e69c6 13-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

* Changed the kernel build rules, so that the executables can have resources
files, too.
* Added a temporary icon for the kernel until Stephan comes up with a better
one (hint hint!) :-))
* This even fixes bug #648.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17825 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c14a34a65f69bbccfca75a0c9cd44bab21ab25d5 26-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* Improved kernel ELF loader (and made it more similar to the one from the boot
loader): it now supports holes between segments, and accepts any segment order.
* Renamed elf.c to elf.cpp and fixed warnings.
* Renamed elf_image_info::dynamic_ptr and eheader to dynamic_section and elf_header.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16878 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d3fbce573cc1aa78eb04a0d214e94ef19ccb8d06 06-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* Added a debugger command "info" that dumps some basic system usage info.
* Renamed OBOS_ARCH macro to HAIKU_ARCH.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16608 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5d13c758d1d6976ad181b4f545f705048a5b01e4 05-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* Reduced stack usage for iterator_get_next_module() quite a bit by no
longer pushing a whole path on the stack.
* open_module_list() now adds the prefix to the paths it puts on the
stack to reduce the amount of searching to do (this probably wasn't
done before because of the earlier boot method via bootfs which
didn't allow for deep path names).
* module.c is now module.cpp (for KPath usage).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16584 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d14aab0dcabc0de98bd380cefd6929599fbe53cb 01-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

Changed the way how CPU activity is monitored: instead of taking the active
time of the idle thread as a measure, we now compute the CPU activity on
each thread switch - the time the CPU worked is the total of user and kernel
time a thread spent during its quantum.
Unlike before, this mechanism works correctly on SMP machines. I hope this
works as expected :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16193 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f602da2b72be9c948e694de0d89b1bc823b0f106 26-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

* Turned the kernel platform support from a library into an object.
* Moved the Open Firmware function platform_get_next_device() from
the boot loader into the kernel (renamed to of_get_next_device()).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16101 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 957a1b17eb9d13d6dbf164145e82997e16742549 30-Dec-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced new build system variables
{HAIKU,HOST,TARGET}_KERNEL_PIC_{CC,LINK}FLAGS which define the
compiler/linker flags specifying the kind of position independence
the kernel shall have. For x86 we had and still have -fno-pic, but the
PPC kernel has -fPIE (position independent executable) now, as we
need to relocate it.
* The boot loader relocates the kernel now. Mostly copied the relocation
code from the kernel ELF loader. Almost completely rewrote the PPC
specific relocation code, though. It's more correct and more complete now
(some things are still missing though).
* Added boot platform awareness to the kernel. Moved the generic
Open Firmware code (openfirmware.c/h) from the boot loader to the kernel.
* The kernel PPC serial debug output is sent to the console for the time
being.
* The PPC boot loader counts the CPUs now and allocates the kernel stacks
(made OF device iteration a bit more flexible on the way -- the search
can be restricted to subtree). Furthermore we really enter the kernel...
(Yay! :-) ... and crash in the first dprintf() (in the atomic_set()
called by acquire_spinlock()). kprintf() works, though.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15756 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 38f62644541aaa3c1f4f363a3e3ab11b086b16d4 26-Nov-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Reorganized building of kernel, boot loader, and libroot.
Each component is built in the respective subdirectory now
and no longer in src/system/Jamfile.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15184 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 338b8dc301721b1f472e8297a898d4eaa2f2ee3a 29-Oct-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged changes from branch build_system_redesign at revision 14573.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14574 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d08379a80b88b66365ff7779be6b8fa44c3b7874 21-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* Now we deal with all x86 exceptions, i.e. we no longer panic() when a
user application performs a division by zero or causes a general
protection fault. For some exceptions (e.g. machine check) I wasn't
quite sure whether they can be caused by user apps at all, so we panic()
in those cases. Wouldn't harm, if someone more knowledgable would check
this, though.
* Removed the unused fault handling stuff, respectively moved the little
that was used into x86/arch_int.c.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13795 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 718b5114e0613a5602d5d6296afeaa7f3ee4b576 13-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

This should fix the build after all the kernel/system renaming.
If anything is still broken (and was not before :)), please shout.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12361 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2d690920ac4d0cd27eb3c118fb2b0862615869e0 13-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed system/core to system/kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12360 a95241bf-73f2-0310-859d-f6bbb57e9c96