History log of /haiku/headers/private/kernel/arch/x86/arch_thread.h
Revision Date Author Comments
# 4f7b9506 14-Jun-2018 Augustin Cavalier <waddlesplash@gmail.com>

Revert the rest of the COMPAT_MODE changes (back to hrev52003.)

This reverts commit 458e758f3792ef11ca26d6ff7e24600c88326e83.
This reverts commit ce5eb94a82b1b377ef5909e65411e031f54ceb15.
This reverts commit aac8d4c317ca11a9a6e194e2c668e8183ec23dd6.
This reverts commit c70cba914aa79c01bbc2da38085936f589899c8c.
This reverts commit 2ffbe7aaca8668c5a68ac7488459bace7a0700f2
This reverts commit c6e120e2d2f909d95f95839fa99fccf811fdb3c5.


# c6e120e2 15-May-2018 Jérôme Duval <jerome.duval@gmail.com>

kernel/x86_64: add setup_compat_signal_frame.

* add compatibility signal types.

Change-Id: I665020234be0ba2ccbb33bdbc338c11a214ab6e8


# 735f6748 16-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86: Debugger can now use dr3


# a5b070f1 16-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86: Store pointer to the current thread in gs:0

Apparently, reading from dr3 is slower than reading from memory
with cache hit.

Also, depending on hypervisor configuration, accessing dr3 may cause
a VM exit (and, at least on kvm, it does), what makes it much slower
than a memory access even when there is a cache miss.


# c0d28c01 30-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented signals for x86_64.


# b5c9d24a 09-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented threading for x86_64.

* Thread creation and switching is working fine, however threads do not yet
get interrupted because I've not implemented hardware interrupt handling
yet (I'll do that next).
* I've made some changes to struct iframe: I've removed the e/r prefixes
from the member names for both 32/64, so now they're just named ip, ax,
bp, etc. This makes it easier to write code that works with both 32/64
without having to deal with different iframe member names.


# 5e9bb17d 08-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Renamed remaining i386_* functions to x86_* for consistency.


# 4304bb98 04-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Added arch_cpu.cpp to the x86_64 build.

* Some things are currently ifndef'd out completely for x86_64 because
they aren't implemented, there's a few other ifdef's to handle x86_64
differences but most of the code works unchanged.
* Renamed some i386_* functions to x86_*.
* Added a temporary method for setting the current thread on x86_64
(a global variable, not SMP safe). This will be changed to be done
via the GS segment but I've not implemented that yet.


# 4e8fbfb2 03-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

x86_{read,write}_cr{0,4} can just be implemented as macros, put an x86_ prefix on the other read/write macros for consistency.


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

Merged x86_64 headers into x86 headers.

Not many changes seeing as there's not much x86_64 stuff done yet. Small
differences are handled with ifdefs, large differences (descriptors.h,
struct iframe) have separate headers under arch/x86/32 and arch/x86/64.


# 79f00560 25-Nov-2011 Michael Lotz <mmlr@mlotz.ch>

Fix virtual 8086 mode to properly account for TLS.

* The vm86 code or the code running in virtual 8086 mode may clobber the
%fs register that we use for the CPU dependent thread local storage
(TLS). Previously the vm86 code would simply restore %fs on exit, but
this doesn't always work. If the thread got unscheduled while running
in virtual 8086 mode and was then rescheduled on a different CPU, the
vm86 exit code would restore the %fs register with the TLS value of
the old CPU, causing anything using TLS in userland to crash later on.
Instead we skip the %fs register restore on exit (as do the other
interrupt return functions) and explicitly update the potentially
clobbered %fs by calling x86_set_tls_context(). This will repopulate
the %fs register with the TLS value for the right CPU. Fixes #8068.

* Made the static set_tls_context() into x86_set_tls_context() and made
it available to others to faciliate the above.

* Sync the vm86 specific interrupt code with the changes from hrev23370,
using the iframe pop macro to properly return. Previously what was
pushed in int_bottom wasn't poped on return.

* Account for the time update macro resetting the in_kernel flag and
reset it to 1, as we aren't actually returning to userland. This
didn't cause any harm though as only the time tracking is using that
flag so far.

* Some minor cleanup.


# 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


# 4535495d 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


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


# 78dde7ab 04-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Consequently use uint32 for the physical page directory address.


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


# 568ade58 13-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# ec16be93 22-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added i386_get_current_iframe(), returning the innermost iframe, if any.


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


# 4048494c 17-Feb-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

axeld + bonefish:
* Implemented automatic syscall restarts:
- A syscall can indicate that it has been interrupted and can be
restarted by setting a respective bit in thread::flags. It can
store parameters it wants to be preserved for the restart in
thread::syscall_restart::parameters. Another thread::flags bit
indicates whether it has been restarted.
- handle_signals() clears the restart flag, if the handled signal
has a handler function installed and SA_RESTART is not set. Another
thread flag (THREAD_FLAGS_DONT_RESTART_SYSCALL) can prevent syscalls
from being restarted, even if they could be (not used yet, but we
might want to use it in resume_thread(), so that we stay
behaviorally compatible with BeOS).
- The architecture specific syscall handler restarts the syscall, if
the restart flag is set. Implemented for x86 only.
- Added some support functions in the private <syscall_restart.h> to
simplify the syscall restart code in the syscalls.
- Adjusted all syscalls that can potentially be restarted accordingly.
- _user_ioctl() sets new thread flag THREAD_FLAGS_IOCTL_SYSCALL while
calling the underlying FS's/driver's hook, so that syscall restarts
can also be supported there.
* thread_at_kernel_exit() invokes handle_signals() in a loop now, as
long as the latter indicates that the thread shall be suspended, so
that after waking up signals received in the meantime will be handled
before the thread returns to userland. Adjusted handle_signals()
accordingly -- when encountering a suspending signal we don't check
for further signals.
* Fixed sigsuspend(): Suspending the thread and rescheduling doesn't
result in the correct behavior. Instead we employ a temporary
condition variable and interruptably wait on it. The POSIX test
suite test passes, now.
* Made the switch_sem[_etc]() behavior on interruption consistent.
Depending on when the signal arrived (before the call or when already
waiting) the first semaphore would or wouldn't be released. Now we
consistently release it.
* Refactored _user_{read,write}[v]() syscalls. Use a common function for
either pair. The iovec version doesn't fail anymore, if anything could
be read/written at all. It also checks whether a complete vector
could be read/written, so that we won't skip data, if the underlying
FS/driver couldn't read/write more ATM.
* Some refactoring in the x86 syscall handler: The int 99 and sysenter
handlers use a common subroutine to avoid code duplication.



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


# 8164606d 19-Jan-2008 Jérôme Duval <korli@users.berlios.de>

fix a warning


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23632 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


# 7b7c38a2 04-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

The "where" or "sc" command now switches the page directory to the specified thread
to be able to follow the stack trace into userland.
No symbols there, yet, though.


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


# 9d06770c 04-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

The iframe stack is now in a special structure iframe_stack.
Introduced a gBootFrameStack that is used until the first thread structure
is available - this allows stack crawls and useful register dumps during
early startup. Could also be solved differently by making sure there is
always a thread structure installed in %dr3 (ie. the boot thread would
get a static thread structure instead of a static iframe stack only).
This might be a better solution as i386_handle_trap() would no longer
need to check for an existing thread structure.


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


# 98b14f8a 01-Mar-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* Made i386_get_current_iframe() static again, since it wasn't what was
needed to get the topmost user iframe. Added i386_get_user_iframe() for
exactly that purpose.
* Added reinitialization of user debugging for the new thread when
switching the context.


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


# 05916979 24-Feb-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Export i386_get_current_iframe() so it can be used in arch_user_debugger.cpp.


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


# afad65de 19-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Replaced all remaining PAGE_SIZE with B_PAGE_SIZE, addr with addr_t.
Removed the definition of PAGE_SIZE and addr.


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


# f510e6ce 23-Oct-2002 lillo <lillo@nowhere.fake>

posix signals support, 1st pass


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


# 11fe0cb8 07-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Added prototypes for the sys_/user_ attribute calls.
Changed the file_descriptor structure (more status_t, name removed).
Changed "extern inline" to "static inline" in thread.h/arch_thread.h as those
also work with -O0 -g.
Added prototypes for [arch_cpu_]user_strlcpy().


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


# 5ca8da7a 13-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Backported the new stack crawl command ("sc", not "bt" like in NewOS) from
NewOS. Untested yet, though.


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


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


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


# 735f67481fa904ae6bb5d0763f515fd7b93d5529 16-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86: Debugger can now use dr3


# a5b070f1fac87567bd1837c53bdd7d44f3a5d3c4 16-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86: Store pointer to the current thread in gs:0

Apparently, reading from dr3 is slower than reading from memory
with cache hit.

Also, depending on hypervisor configuration, accessing dr3 may cause
a VM exit (and, at least on kvm, it does), what makes it much slower
than a memory access even when there is a cache miss.


# c0d28c01990d8815dddc645177f44b9ce361d186 30-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented signals for x86_64.


# b5c9d24abcc3599375153ed310b495ea944d46a0 09-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented threading for x86_64.

* Thread creation and switching is working fine, however threads do not yet
get interrupted because I've not implemented hardware interrupt handling
yet (I'll do that next).
* I've made some changes to struct iframe: I've removed the e/r prefixes
from the member names for both 32/64, so now they're just named ip, ax,
bp, etc. This makes it easier to write code that works with both 32/64
without having to deal with different iframe member names.


# 5e9bb17da7b9cdd76ff9072486fab90688cf8c36 08-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Renamed remaining i386_* functions to x86_* for consistency.


# 4304bb9894335fe5e5bd667a1f27dc7605c2e5b9 04-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Added arch_cpu.cpp to the x86_64 build.

* Some things are currently ifndef'd out completely for x86_64 because
they aren't implemented, there's a few other ifdef's to handle x86_64
differences but most of the code works unchanged.
* Renamed some i386_* functions to x86_*.
* Added a temporary method for setting the current thread on x86_64
(a global variable, not SMP safe). This will be changed to be done
via the GS segment but I've not implemented that yet.


# 4e8fbfb2d158de7b1cadd1c060acee51a7d67309 03-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

x86_{read,write}_cr{0,4} can just be implemented as macros, put an x86_ prefix on the other read/write macros for consistency.


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

Merged x86_64 headers into x86 headers.

Not many changes seeing as there's not much x86_64 stuff done yet. Small
differences are handled with ifdefs, large differences (descriptors.h,
struct iframe) have separate headers under arch/x86/32 and arch/x86/64.


# 79f005600225dcd5d1cdb4539a2f0d31dff8ee73 25-Nov-2011 Michael Lotz <mmlr@mlotz.ch>

Fix virtual 8086 mode to properly account for TLS.

* The vm86 code or the code running in virtual 8086 mode may clobber the
%fs register that we use for the CPU dependent thread local storage
(TLS). Previously the vm86 code would simply restore %fs on exit, but
this doesn't always work. If the thread got unscheduled while running
in virtual 8086 mode and was then rescheduled on a different CPU, the
vm86 exit code would restore the %fs register with the TLS value of
the old CPU, causing anything using TLS in userland to crash later on.
Instead we skip the %fs register restore on exit (as do the other
interrupt return functions) and explicitly update the potentially
clobbered %fs by calling x86_set_tls_context(). This will repopulate
the %fs register with the TLS value for the right CPU. Fixes #8068.

* Made the static set_tls_context() into x86_set_tls_context() and made
it available to others to faciliate the above.

* Sync the vm86 specific interrupt code with the changes from hrev23370,
using the iframe pop macro to properly return. Previously what was
pushed in int_bottom wasn't poped on return.

* Account for the time update macro resetting the in_kernel flag and
reset it to 1, as we aren't actually returning to userland. This
didn't cause any harm though as only the time tracking is using that
flag so far.

* Some minor cleanup.


# 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


# 4535495d80c86e19e2610e7444a4fcefe3e0f8e6 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


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


# 78dde7abd76bad760d8d8e94908a19a0e583eb6a 04-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Consequently use uint32 for the physical page directory address.


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


# 568ade58d054e27ce4cd9da0d4e73ecb79563b96 13-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# ec16be9366485749c8c9a9c153b01ebc81c19deb 22-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added i386_get_current_iframe(), returning the innermost iframe, if any.


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


# 4048494ce44a925d3d1e40e4ffb9abe670b4b827 17-Feb-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

axeld + bonefish:
* Implemented automatic syscall restarts:
- A syscall can indicate that it has been interrupted and can be
restarted by setting a respective bit in thread::flags. It can
store parameters it wants to be preserved for the restart in
thread::syscall_restart::parameters. Another thread::flags bit
indicates whether it has been restarted.
- handle_signals() clears the restart flag, if the handled signal
has a handler function installed and SA_RESTART is not set. Another
thread flag (THREAD_FLAGS_DONT_RESTART_SYSCALL) can prevent syscalls
from being restarted, even if they could be (not used yet, but we
might want to use it in resume_thread(), so that we stay
behaviorally compatible with BeOS).
- The architecture specific syscall handler restarts the syscall, if
the restart flag is set. Implemented for x86 only.
- Added some support functions in the private <syscall_restart.h> to
simplify the syscall restart code in the syscalls.
- Adjusted all syscalls that can potentially be restarted accordingly.
- _user_ioctl() sets new thread flag THREAD_FLAGS_IOCTL_SYSCALL while
calling the underlying FS's/driver's hook, so that syscall restarts
can also be supported there.
* thread_at_kernel_exit() invokes handle_signals() in a loop now, as
long as the latter indicates that the thread shall be suspended, so
that after waking up signals received in the meantime will be handled
before the thread returns to userland. Adjusted handle_signals()
accordingly -- when encountering a suspending signal we don't check
for further signals.
* Fixed sigsuspend(): Suspending the thread and rescheduling doesn't
result in the correct behavior. Instead we employ a temporary
condition variable and interruptably wait on it. The POSIX test
suite test passes, now.
* Made the switch_sem[_etc]() behavior on interruption consistent.
Depending on when the signal arrived (before the call or when already
waiting) the first semaphore would or wouldn't be released. Now we
consistently release it.
* Refactored _user_{read,write}[v]() syscalls. Use a common function for
either pair. The iovec version doesn't fail anymore, if anything could
be read/written at all. It also checks whether a complete vector
could be read/written, so that we won't skip data, if the underlying
FS/driver couldn't read/write more ATM.
* Some refactoring in the x86 syscall handler: The int 99 and sysenter
handlers use a common subroutine to avoid code duplication.



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


# 8164606d77c35e0eb9b011426f2d0e5136648317 19-Jan-2008 Jérôme Duval <korli@users.berlios.de>

fix a warning


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23632 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


# 7b7c38a2a77b408d1bbb252a003911fa5383e861 04-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

The "where" or "sc" command now switches the page directory to the specified thread
to be able to follow the stack trace into userland.
No symbols there, yet, though.


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


# 9d06770cdc85682b5c21c926be730fedccca9f6d 04-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

The iframe stack is now in a special structure iframe_stack.
Introduced a gBootFrameStack that is used until the first thread structure
is available - this allows stack crawls and useful register dumps during
early startup. Could also be solved differently by making sure there is
always a thread structure installed in %dr3 (ie. the boot thread would
get a static thread structure instead of a static iframe stack only).
This might be a better solution as i386_handle_trap() would no longer
need to check for an existing thread structure.


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


# 98b14f8a6a92e75a9a6958543e93d7b4fcdf64bb 01-Mar-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* Made i386_get_current_iframe() static again, since it wasn't what was
needed to get the topmost user iframe. Added i386_get_user_iframe() for
exactly that purpose.
* Added reinitialization of user debugging for the new thread when
switching the context.


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


# 05916979f9a44fe8afba8c5fe9c3d94a0bb95b08 24-Feb-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Export i386_get_current_iframe() so it can be used in arch_user_debugger.cpp.


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


# afad65ded7a1258fc91659fb456f1a90d08e0598 19-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Replaced all remaining PAGE_SIZE with B_PAGE_SIZE, addr with addr_t.
Removed the definition of PAGE_SIZE and addr.


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


# f510e6ce601d2e7f3f88df110749a5bf02e79268 23-Oct-2002 lillo <lillo@nowhere.fake>

posix signals support, 1st pass


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


# 11fe0cb8de932243324b119e4567e7d5d69c4540 07-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Added prototypes for the sys_/user_ attribute calls.
Changed the file_descriptor structure (more status_t, name removed).
Changed "extern inline" to "static inline" in thread.h/arch_thread.h as those
also work with -O0 -g.
Added prototypes for [arch_cpu_]user_strlcpy().


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


# 5ca8da7a4b46342b22fa985c7813b558f831484f 13-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Backported the new stack crawl command ("sc", not "bt" like in NewOS) from
NewOS. Untested yet, though.


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


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


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