History log of /haiku/src/system/kernel/arch/x86/Jamfile
Revision Date Author Comments
# 81a892ed 04-Jan-2023 Alexander von Gluck IV <kallisti5@unixzen.com>

efi/serial: Refactor EFI bios serial services

* Convert x86 direct port I/O to our standard gUART.
* sSerial is plainly EFI Serial or EFI Stdout
* gUART is plainly hardware serial now

Change-Id: I5730fbc0ce3427851e4e2d1d0aa8c55f7765e444
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5982
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# fe2bcea7 10-Apr-2022 milek7 <me@milek7.pl>

Move irq_routing_table from x86 to generic.

There is nothing really x86-specific there, other platforms use
ACPI interrupt routing for PCI too.

Change-Id: Ib02e2917902a161c3d79a1049bcd16ba40bb7814
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5277
Reviewed-by: David Karoly <karolyd577@gmail.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>


# 24eb3d5a 13-Apr-2022 X512 <danger_mail@list.ru>

kernel: do not use assembly code for commpage signal handler

Unify with x86 and riscv64 implementation.

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


# b19f5c83 30-Dec-2021 X512 <danger_mail@list.ru>

kernel/x86: add ability to set GS segment base from userland

Needed for Wine.

Co-authored-by: Jérôme Duval <jerome.duval@gmail.com>

Change-Id: I13f6a5802fce04fd2ebb4cc01ecd2f12c90830db
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4839
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 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>


# c4eec9f1 01-Oct-2021 Augustin Cavalier <waddlesplash@gmail.com>

Distinguish KERNEL_ARCH_DIR from KERNEL_ARCH.

On x86_64, the KERNEL_ARCH should really be "x86_64", but it was "x86"
as the architecture sources/headers directory is shared between 32 and 64 bit.

Should not be a functional change on any platform outside x86_64.


# 26e0b0c8 24-Aug-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/x86_64: Add errata patching.

The patched errata are only the AMD ones FreeBSD patches
(it seems there are no Intel errata that can be patched
this way, they are all in microcode updates ... or can't
be patched in the CPU at all.)

This also seems to be roughly the point in the boot that
FreeBSD patches these, too, despite how "critical" some
of them seem.

Change-Id: I9065f8d025332418a21c2cdf39afd7d29405edcc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1740
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>


# 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


# a2021292 12-Jan-2018 Jérôme Duval <jerome.duval@gmail.com>

kernel: Binary code patches on x86.

This will be used to support SMAP.

Sponsored-by: https://liberapay.com/korli


# 1eba4077 25-Aug-2014 Paweł Dziepak <pdziepak@quarnos.org>

kernel/x86_64: rewrite cpuid.S -> cpuid.cpp

Just getting rid of some assembly, no functional change.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>


# 91e7f347 29-May-2014 Paweł Dziepak <pdziepak@quarnos.org>

kernel/x86_64: try to inline physical page mapper functions

The way we handle paging is very wasteful and relies heavily on virtual
funcions even if there is absolutely no reason to do so. The proper
solution would be to do a major rework of paging code (including
arch-independent parts).

On x86_64 physical page mapper is very simple what makes the overhead
resulting from the desing of paging interface very expensive. This
patch attempts to make things a bit better by helping GCC with
devirtualization and allowing inlining physical page mapper impementation
(well, only when it is devirtualized).


# 2c001246 07-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

build: when using gcc4 build kernel with c++11


# c1dc1049 05-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

kernel/x86_64: enable c++11 in x86_64 specific code


# 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).


# d2a1be1c 18-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Cleaner separation of 32-/64-bit specific CPU/interrupt code.

Renamed {32,64}/int.cpp to {32,64}/descriptors.cpp, which now contain
functions for GDT and TSS setup that were previously in arch_cpu.cpp,
as well as the IDT setup code. These get called from the init functions
in arch_cpu.cpp, rather than having a bunch of ifdef'd chunks of code
for 32/64.


# fa6327c9 09-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Compile remaining x86 bits for x86_64.

The IOAPIC and IRQ routing code now gets compiled for x86_64, though
they won't be used yet as there is no ACPI support currently.


# 8a190335 07-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented user debugging support for x86_64.

Reused x86 arch_user_debugger.cpp, with a few minor changes to make
the code work for both 32 and 64 bit. Something isn't quite working
right, if a breakpoint is hit the kernel will hang. Other than that
everything appears to work correctly.


# 74bda98c 03-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Killed off vm86 code, no longer being used.


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

Implemented signals for x86_64.


# 370ab57d 23-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Initial userland support for x86_64.

Userland switch is implemented, as is basic system call support (using
SYSCALL/SYSRET). The system call handler is not yet complete: it doesn't
handle more than 6 arguments, and does not perform all the necessary kernel
entry/exit work (neither does the interrupt handler). However, this is
sufficient for runtime_loader to start and print some debug output.


# 2865db34 20-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compile msi.cpp for x86_64.

Needed to link the PCI module, not enabling it yet though, I'm not
sure whether everything needed for it is in place yet.


# bcb07a31 13-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented the rest of the kernel debugger functions for x86_64.

Merged with the x86 implementations, mostly the same except for a
few differences. GDB stub is currently broken, will investigate
later.


# e6418c88 12-Jul-2012 Ingo Weinhold <ingo_weinhold@gmx.de>

Declare syscall_numbers.h include for x86_signals_asm.S

Fixes #8718 (again).


# 4ebc6dfa 12-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Moved some 32-bit specific stuff to the 32 subdirectory.


# 8c51cca2 12-Jul-2012 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix accidental partial revert of 0174267


# b1700b2c 12-Jul-2012 Ingo Weinhold <ingo_weinhold@gmx.de>

Declare syscall_numbers.h include for x86_signals.cpp

Fixes #8718.


# e2d2662b 12-Jul-2012 Ingo Weinhold <ingo_weinhold@gmx.de>

Automatic whitespace cleanup


# 76a1175d 11-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Support for SMP on x86_64.

No major changes to the kernel: just compiled in arch_smp.cpp and fixed the
IDT load in arch_cpu_init_percpu to use the correct limit for x86_64 (uses
sizeof(interrupt_descriptor)). In the boot loader, changed smp_boot_other_cpus
to construct a temporary GDT and get the page directory address from CR3, as
what's in kernel_args will be 64-bit stuff and will not work to switch the
CPUs into 32-bit mode in the trampoline code. Refactored 64-bit kernel entry
code to not use the stack after disabling paging, as the secondary CPUs are
given a 32-bit virtual stack address by the SMP trampoline code which will
no longer work.


# 0174267a 11-Jul-2012 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Move ACPICA files into acpica subdir and use acpica subdir layout.

This matches layout in ACPICA and keeps a cleaner boundry between
Haiku and ACPICA code. The only haiku specific file in ACPICA is
achaiku.h and it will hopefully be included upstream soon.

Merging will be simpler as we can just replace acpica contents and
fix Jamfile and build errors in our code.


# 659bacac 11-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compile arch_real_time_clock.cpp and arch_system_info.cpp 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.


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

Support ELF64 in the kernel.

This has been done by adding typedefs in elf_common.h to the correct ELF
structures for the architecture, and changing all Elf32_* uses to those
types. I don't know whether image loading works as I cannot test it yet,
there may be some 64-bit safety issues around. However, symbol lookup for
the kernel is working correctly.


# c1517626 06-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compile APIC and timer code for x86_64, and create an area for the IDT.


# 84bf29f9 06-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compile in arch_platform.cpp for x86_64. The apm_init call is disabled for x86_64, APM is 32-bit only.


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

Implementation of VMPhysicalPageMapper for x86_64 using the permanent physical memory mapping.


# 950b24e3 04-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Begun work on VMTranslationMap implementation for x86_64.

* Added empty source files for all the 64-bit paging method code, and a
stub implementation of X86PagingMethod64Bit.
* arch_vm_translation_map.cpp has been modified to use X86PagingMethod64Bit
on x86_64.


# 4988ca58 04-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Build arch_vm.cpp for x86_64. No changes required except for temporarily disabling bios_init call.


# 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.


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

Removed redundant x86 sources/headers.


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

Merged in the x86_64 exception handling.

I've split the 32-bit dependent IDT setup code and ASM interrupt handlers to
the 32 subdirectory, arch_int.cpp now contains only the generic hardware
interrupt handling code.


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

Fixed x86_64 kernel compilation.

For now I've just put all the stub functions that are needed to link the
kernel into a file called stubs.cpp. I've not yet moved across the interrupt
handling code or the ELF64 relocation code to the x86 directory. Once those
have been moved I can get rid of the x86_64 headers/source directories.


# 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


# dc14d97b 10-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Move the legacy PIC and the IO-APIC code into their own source file. No
functional change intended.
* Use an appropriately sized sLevelTriggeredInterrupts for each controller type.
This also fixes an out of bound access for IO-APICs with more than 32 entries
and also returns the right mode in such cases.


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


# c2507ed4 08-May-2011 Michael Lotz <mmlr@mlotz.ch>

Actually use the ACPICA headers to get at the correct types instead of
duplicating the structs on our side. IRQ assignment didn't work with extended
IRQ resources because the alignment of the structs were different in our local
duplicates...
Brings in the ACPICA naming sheme and isn't really clean either. So all of the
reconfiguration should probably just be moved into the ACPI bus_manager.
On the plus side we can now use the proper descriptive macros instead of the
hardcoded numbers which fixes a few of the TODOs.


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


# 5b4d62a2 08-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Skeleton classes for PAE support.


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


# 1c7fda89 08-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved X86VMTranslationMap32Bit to its own source file.
* Made all helper function operating on paging structures static methods of
X86PagingMethod32Bit.


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


# f0675bf7 08-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved X86PagingStructures32Bit into its own source/header pair.


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


# 1b3e83ad 08-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved paging related files to new subdirectories paging and paging/32bit.


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


# 5aa0503c 07-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed i386_translation_map_get_pgdir() and adjusted the one place where it
was used.
* Renamed X86VMTranslationMap to X86VMTranslationMap32Bit and pulled the paging
method agnostic part into new base class X86VMTranslationMap.
* Moved X86PagingStructures into its own header/source pair.
* Moved pgdir_virt from X86PagingStructures to X86PagingStructures32Bit where
it is actually used.


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


# c6caf520 07-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added a level of indirection for the arch_vm_translation_map functions.
Introduced the interface X86PagingMethod which is used by those. ATM
there's one implementing class, X86PagingMethod32Bit.
* Made X86PagingStructures a base class, with one derived class,
X86PagingStructures32Bit.


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


# 33fbe254 13-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

* Add code to allocate and free interrupt vectors for message signaled
interrupts (MSI).
* Add the remaining IDT entries and redirection functions in the interrupt code.
* Make the PIC end_of_interrupt() return a result to indicate whether the vector
was handled by this PIC. If it isn't we now issue a apic_end_of_interrupt()
in the assumption of apic local interrupt, MSI or IPI. This also removes
the need for the gUsingIOAPIC global and doing manual apic_end_of_interrupt()
calls in the SMP and timer code.


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


# 655f3b41 11-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Seperate the generic (local) APIC stuff into it's own file and use it from the
other places where previously the same functionality was duplicated. Also
seperated the header which was originally arch_smp.h into apic.h and arch_smp.h
again as some of it is MP and not actually APIC.


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


# cb58e3f7 06-Apr-2010 Clemens Zeidler <clemens.zeidler@googlemail.com>

Rescue acpi irq stuff from my defect laptop. Code is disabled and should't to any harm.

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


# 2cf60f90 24-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the syscall stuff from arch_commpage.cpp to x86_syscalls.{cpp,h}.
* On context switches we do now set the IA32_MSR_SYSENTER_ESP. This saves us
setting esp at the beginning of x86_sysenter(). More importantly when
entering it in single-step mode, this no longer causes a double fault
(cf. #3487). We still don't handle the resulting debug exception correctly,
so that we still get a (continuable) panic().


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


# 4687d95b 25-Sep-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Renamed x86_hpet.c to x86_hpet.cpp and fixed the compile errors.


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


# 671a2442 31-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

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

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


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


# 47c40a10 19-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Prefixed memset_physical() and memcpy_to_physical() with "vm_",
added vm_memcpy_from_physical() and vm_memcpy_physical_page(), and
added respective functions to the vm_translation_map operations. The
architecture specific implementation can now decide how to implement
them most efficiently. Added generic implementations that can be used,
though.
* Changed vm_{get,put}_physical_page(). The former no longer accepts
flags (the only flag PHYSICAL_PAGE_DONT_WAIT wasn't needed anymore).
Instead it returns an implementation-specific handle that has to be
passed to the latter. Added vm_{get,put}_physical_page_current_cpu()
and *_debug() variants, that work only for the current CPU,
respectively when in the kernel debugger. Also adjusted the
vm_translation_map operations accordingly.
* Made consequent use of the physical memory operations in the source
tree.
* Also adjusted the m68k and ppc implementations with respect to the
vm_translation_map operation changes, but they are probably broken,
nevertheless.
* For x86 the generic physical page mapper isn't used anymore. It is
suboptimal in any case. For systems with small memory it is too much
overhead, since one can just map the complete physical memory (that's
not done yet, though). For systems with large memory it counteracts
the VM strategy to reuse the least recently used pages. Since those
pages will most likely not be mapped by the page mapper anymore, it
will keep remapping chunks. This was also the reason why building
Haiku in Haiku was significantly faster with only 256 MB RAM (since
that much could be kept mapped all the time).
Now we're using a different strategy: We have small pools of virtual
page slots per CPU that are used for the physical page operations
(memset_physical(), memcpy_*_physical()) with CPU-pinned thread.
Furthermore we have four slots per translation map, which are used to
map page tables.

These changes speed up the Haiku image build in Haiku significantly. On
my Core2 Duo 2.2 GHz 2 GB machine about 40% to 20 min 40 s (KDEBUG
disabled, block cache debug disabled). Still more than factor 3 slower
than FreeBSD and Linux, though.


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


# 379ad6d0 09-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the arch specific stuff in src/system/kernel/lib into arch/...
subdirectories. Also moved the x86 kernel arch_string.S there.
* Moved memcpy.c from src/system/libroot/posix/string into the
arch/generic subdirectory.
* Dealt with the consequences of moving things around. Affected are also
the boot loader and runtime loader builds.

Adjust the m68k and ppc parts, too, but only the x86 build is tested.


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


# cb387cfb 10-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Added acpi_shutdown() method. If the ACPI bus manager is installed, this will
be used now. Tested only with VMware so far.
* apm_shutdown() is now called with interrupts turned on.
* Renamed arch_cpu.c to arch_cpu.cpp.
* Minor cleanup.


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


# 6e29a04d 05-Jul-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Patch by Dustin Howett which 'modularizes' timers. The best timer is
automatically selected at boot time. Pit and Apic timers are implemented
for now. Thanks Dustin!



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


# a8f9741c 04-Jul-2008 Michael Lotz <mmlr@mlotz.ch>

* Removed -Wno-unused from all KernelMergeObjects in kernel Jamfiles.
* Fixed most of the warnings resulting from that by removing actually not used
variables or moving declaration into the #IF. Left unused functions there
though, as I wouldn't know if they are supposed to be used again.
* Fixed two statements with no effect (clamping to MAX_ANCILLARY_DATA_LEN in
socket.cpp and unsetting fCounterSem in MessagingService.cpp).
* Some style cleanups.

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


# fa827b37 02-Jun-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

took the liberty to add this to the buiild and fix compilation :)


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


# 54d9d37f 02-Jun-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added patch by Dustin Howett: header with HPET definitions and (empty)
file for hpet implementation. Not yet added to the build.


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


# 15173df4 22-May-2008 Axel Dörfler <axeld@pinc-software.de>

Last patch of the vm86 patch series from Jan Klötzke - thanks!:
* The new function vm86_do_int(struct vm86_state *state, uint8 vec) provides a
facility to call BIOS interupt handlers. The function must only be called from
a user thread context because the lower 1MB of the address space is used.


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


# 6b202f4e 13-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced new header directory headers/private/system which is supposed
to contain headers shared by kernel and userland (mainly libroot).
* Moved quite a few private kernel headers to the new location. Split
several kernel headers into a shared part and one that is still kernel
private. Adjusted all affected Jamfiles and source in the standard x86
build accordingly. The build for other architectures and for test code
may be broken.
* Quite a bit of userland code still includes private kernel headers.
Mostly those are <util/*> headers. The ones that aren't strictly
kernel-only should be moved to some other place (maybe
headers/private/shared/util).


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


# 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


# 393fceb5 27-Sep-2007 Axel Dörfler <axeld@pinc-software.de>

* Cleaned up vm_types.h a bit, and made vm_page, vm_cache, and vm_area
opaque types for C.
* As a result, I've renamed some more source files to .cpp, and fixed
all warnings caused by that.


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


# 1cbf8f4b 18-Feb-2007 Travis Geiselbrecht <geist@foobox.com>

initial support for a commpage, which is a chunk of memory in high kernel space with user readonly permissions.
The first use is to let the kernel decide what the preferred syscall mechanism is at boot time and copy the
appropriate user space code there. Can be used for routines the kernel can decide best how to use (memcpy, some
timing routines, etc).


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


# 44d56753 16-Aug-2006 Jérôme Duval <korli@users.berlios.de>

KernelAddon and KernelStaticLibrary don't include kernel, kernel arch, boot platform headers anymore.
Fixed the build of most of targets using these rules. Though the build can be still broken, feel free to fix.


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


# 036b999b 28-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Unbroke the build (ps2.h was suddenly missing.

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


# afd6dfc8 28-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented first basic APM driver. Only tested with QEMU so far, that's why
it's currently disabled.


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


# a71974c1 06-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

Pulled the algorithm for dynamically mapping physical pages into an
"IO space" out of the x86 specific source into arch/generic. We'll use
it for PPC as well.


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


# 7afa713a 03-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

Reorganized the boot platform dependencies in the kernel a bit.
Basically the architecture specific code is now responsible to
init and make use of the platform specific code, now. The reason
being that we have only one kernel per platform and thus cannot
decide at compile time, which platform to use (if any).
The PPC implementation features an abstract base class PPCPlatform
(implemented for all supported platforms) through which platform
support is provided.


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


# 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


# 0a51327f 02-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed on-screen KDL keyboard input routine: it now works much more reliable
and ignores keyboard input. Also, it now uses the definitions from the PS/2
HID driver (from ps2.h).


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


# 2b8d8585 29-May-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed arch_dbg_console.c to arch_debug_console.c, dbg_console.h to debug_console.h.


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


# 1eba40776dad1af70c3e04ede9cb543c6aa04195 25-Aug-2014 Paweł Dziepak <pdziepak@quarnos.org>

kernel/x86_64: rewrite cpuid.S -> cpuid.cpp

Just getting rid of some assembly, no functional change.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>


# 91e7f347f9320c9f186f0b3af876778b9c56fb5b 29-May-2014 Paweł Dziepak <pdziepak@quarnos.org>

kernel/x86_64: try to inline physical page mapper functions

The way we handle paging is very wasteful and relies heavily on virtual
funcions even if there is absolutely no reason to do so. The proper
solution would be to do a major rework of paging code (including
arch-independent parts).

On x86_64 physical page mapper is very simple what makes the overhead
resulting from the desing of paging interface very expensive. This
patch attempts to make things a bit better by helping GCC with
devirtualization and allowing inlining physical page mapper impementation
(well, only when it is devirtualized).


# 2c001246a0d7c42ecee24642a814c4f6b4fe7451 07-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

build: when using gcc4 build kernel with c++11


# c1dc10496054f49cf6af475cce53bf076bbf4d19 05-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

kernel/x86_64: enable c++11 in x86_64 specific code


# 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).


# d2a1be1c4e4a8ae3879d7f59b07a6924c62b4b14 18-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Cleaner separation of 32-/64-bit specific CPU/interrupt code.

Renamed {32,64}/int.cpp to {32,64}/descriptors.cpp, which now contain
functions for GDT and TSS setup that were previously in arch_cpu.cpp,
as well as the IDT setup code. These get called from the init functions
in arch_cpu.cpp, rather than having a bunch of ifdef'd chunks of code
for 32/64.


# fa6327c9f48f89f3be1f229d5aca749241b55bf0 09-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Compile remaining x86 bits for x86_64.

The IOAPIC and IRQ routing code now gets compiled for x86_64, though
they won't be used yet as there is no ACPI support currently.


# 8a1903353eedd95266c7241aada3a314c5d35a55 07-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented user debugging support for x86_64.

Reused x86 arch_user_debugger.cpp, with a few minor changes to make
the code work for both 32 and 64 bit. Something isn't quite working
right, if a breakpoint is hit the kernel will hang. Other than that
everything appears to work correctly.


# 74bda98cb236130b1d4f84795f7fafd5c8e540a9 03-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Killed off vm86 code, no longer being used.


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

Implemented signals for x86_64.


# 370ab57d49a208f79ce3c5e9f92be13b58c48f18 23-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Initial userland support for x86_64.

Userland switch is implemented, as is basic system call support (using
SYSCALL/SYSRET). The system call handler is not yet complete: it doesn't
handle more than 6 arguments, and does not perform all the necessary kernel
entry/exit work (neither does the interrupt handler). However, this is
sufficient for runtime_loader to start and print some debug output.


# 2865db34c861fc7e72d1076885e671b5b2d0e7dc 20-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compile msi.cpp for x86_64.

Needed to link the PCI module, not enabling it yet though, I'm not
sure whether everything needed for it is in place yet.


# bcb07a319b647eb0af60398e972525cc0a686aa9 13-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented the rest of the kernel debugger functions for x86_64.

Merged with the x86 implementations, mostly the same except for a
few differences. GDB stub is currently broken, will investigate
later.


# e6418c88b54b139e813a919f22042916a26d1c65 12-Jul-2012 Ingo Weinhold <ingo_weinhold@gmx.de>

Declare syscall_numbers.h include for x86_signals_asm.S

Fixes #8718 (again).


# 4ebc6dfa682fa199a88ec06f0930df04369f34ac 12-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Moved some 32-bit specific stuff to the 32 subdirectory.


# 8c51cca27ef0f61a7b0b99c2179ca77e0b5c25a2 12-Jul-2012 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix accidental partial revert of 0174267


# b1700b2cd1068f4717402c66d5cd6e6b5db0315b 12-Jul-2012 Ingo Weinhold <ingo_weinhold@gmx.de>

Declare syscall_numbers.h include for x86_signals.cpp

Fixes #8718.


# e2d2662bc41044357c127b233e121c5b89a539c8 12-Jul-2012 Ingo Weinhold <ingo_weinhold@gmx.de>

Automatic whitespace cleanup


# 76a1175dbe1a314563ca18c0b7fb82695a9730cd 11-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Support for SMP on x86_64.

No major changes to the kernel: just compiled in arch_smp.cpp and fixed the
IDT load in arch_cpu_init_percpu to use the correct limit for x86_64 (uses
sizeof(interrupt_descriptor)). In the boot loader, changed smp_boot_other_cpus
to construct a temporary GDT and get the page directory address from CR3, as
what's in kernel_args will be 64-bit stuff and will not work to switch the
CPUs into 32-bit mode in the trampoline code. Refactored 64-bit kernel entry
code to not use the stack after disabling paging, as the secondary CPUs are
given a 32-bit virtual stack address by the SMP trampoline code which will
no longer work.


# 0174267ad4e56f4eea5d108dfd6daf1be4037782 11-Jul-2012 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Move ACPICA files into acpica subdir and use acpica subdir layout.

This matches layout in ACPICA and keeps a cleaner boundry between
Haiku and ACPICA code. The only haiku specific file in ACPICA is
achaiku.h and it will hopefully be included upstream soon.

Merging will be simpler as we can just replace acpica contents and
fix Jamfile and build errors in our code.


# 659bacac269ec0992603008ef436ee20505bd67f 11-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compile arch_real_time_clock.cpp and arch_system_info.cpp 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.


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

Support ELF64 in the kernel.

This has been done by adding typedefs in elf_common.h to the correct ELF
structures for the architecture, and changing all Elf32_* uses to those
types. I don't know whether image loading works as I cannot test it yet,
there may be some 64-bit safety issues around. However, symbol lookup for
the kernel is working correctly.


# c15176264b7fa5b4e20b4692d30ed9403fd9c71b 06-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compile APIC and timer code for x86_64, and create an area for the IDT.


# 84bf29f97b5ff5f1ace8dfee48d035cba0b4fb75 06-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compile in arch_platform.cpp for x86_64. The apm_init call is disabled for x86_64, APM is 32-bit only.


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

Implementation of VMPhysicalPageMapper for x86_64 using the permanent physical memory mapping.


# 950b24e32d8ddbc0d2a4e46de77c0fb4cc18b128 04-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Begun work on VMTranslationMap implementation for x86_64.

* Added empty source files for all the 64-bit paging method code, and a
stub implementation of X86PagingMethod64Bit.
* arch_vm_translation_map.cpp has been modified to use X86PagingMethod64Bit
on x86_64.


# 4988ca58a0b6f12e48286fe17ee651be490e0f24 04-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Build arch_vm.cpp for x86_64. No changes required except for temporarily disabling bios_init call.


# 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.


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

Removed redundant x86 sources/headers.


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

Merged in the x86_64 exception handling.

I've split the 32-bit dependent IDT setup code and ASM interrupt handlers to
the 32 subdirectory, arch_int.cpp now contains only the generic hardware
interrupt handling code.


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

Fixed x86_64 kernel compilation.

For now I've just put all the stub functions that are needed to link the
kernel into a file called stubs.cpp. I've not yet moved across the interrupt
handling code or the ELF64 relocation code to the x86 directory. Once those
have been moved I can get rid of the x86_64 headers/source directories.


# 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


# dc14d97b7f70aa318483d53e007913b26a12f5d0 10-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Move the legacy PIC and the IO-APIC code into their own source file. No
functional change intended.
* Use an appropriately sized sLevelTriggeredInterrupts for each controller type.
This also fixes an out of bound access for IO-APICs with more than 32 entries
and also returns the right mode in such cases.


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


# c2507ed4aecb4e84364c0934a9ca95598d484465 08-May-2011 Michael Lotz <mmlr@mlotz.ch>

Actually use the ACPICA headers to get at the correct types instead of
duplicating the structs on our side. IRQ assignment didn't work with extended
IRQ resources because the alignment of the structs were different in our local
duplicates...
Brings in the ACPICA naming sheme and isn't really clean either. So all of the
reconfiguration should probably just be moved into the ACPI bus_manager.
On the plus side we can now use the proper descriptive macros instead of the
hardcoded numbers which fixes a few of the TODOs.


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


# 5b4d62a2618dd2ae37b975e4ca283b410f39f9c7 08-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Skeleton classes for PAE support.


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


# 1c7fda897e52591c6f2ada9a2a16f33e6e127b32 08-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved X86VMTranslationMap32Bit to its own source file.
* Made all helper function operating on paging structures static methods of
X86PagingMethod32Bit.


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


# f0675bf7571235ecdedb5cf4fda90ade6b4598f6 08-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved X86PagingStructures32Bit into its own source/header pair.


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


# 1b3e83addefd97925b84cebaf4003d14c9062781 08-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved paging related files to new subdirectories paging and paging/32bit.


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


# 5aa0503c7c1ce7ea4c0595d9a402e612bb290ec8 07-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed i386_translation_map_get_pgdir() and adjusted the one place where it
was used.
* Renamed X86VMTranslationMap to X86VMTranslationMap32Bit and pulled the paging
method agnostic part into new base class X86VMTranslationMap.
* Moved X86PagingStructures into its own header/source pair.
* Moved pgdir_virt from X86PagingStructures to X86PagingStructures32Bit where
it is actually used.


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


# c6caf520ca20ba155cbcf24ab28209c9cf028961 07-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added a level of indirection for the arch_vm_translation_map functions.
Introduced the interface X86PagingMethod which is used by those. ATM
there's one implementing class, X86PagingMethod32Bit.
* Made X86PagingStructures a base class, with one derived class,
X86PagingStructures32Bit.


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


# 33fbe254964dff2c8b8a3e1522bbefff14d51ea1 13-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

* Add code to allocate and free interrupt vectors for message signaled
interrupts (MSI).
* Add the remaining IDT entries and redirection functions in the interrupt code.
* Make the PIC end_of_interrupt() return a result to indicate whether the vector
was handled by this PIC. If it isn't we now issue a apic_end_of_interrupt()
in the assumption of apic local interrupt, MSI or IPI. This also removes
the need for the gUsingIOAPIC global and doing manual apic_end_of_interrupt()
calls in the SMP and timer code.


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


# 655f3b4161bbc8874ffae4afa337317c9a1d26f1 11-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Seperate the generic (local) APIC stuff into it's own file and use it from the
other places where previously the same functionality was duplicated. Also
seperated the header which was originally arch_smp.h into apic.h and arch_smp.h
again as some of it is MP and not actually APIC.


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


# cb58e3f7843976f2f0da38e67b6ad0849837a3dd 06-Apr-2010 Clemens Zeidler <clemens.zeidler@googlemail.com>

Rescue acpi irq stuff from my defect laptop. Code is disabled and should't to any harm.

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


# 2cf60f9070b06681ff0c4cf04d3ffbda2ca7805f 24-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the syscall stuff from arch_commpage.cpp to x86_syscalls.{cpp,h}.
* On context switches we do now set the IA32_MSR_SYSENTER_ESP. This saves us
setting esp at the beginning of x86_sysenter(). More importantly when
entering it in single-step mode, this no longer causes a double fault
(cf. #3487). We still don't handle the resulting debug exception correctly,
so that we still get a (continuable) panic().


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


# 4687d95b681d988c5a2a9da7c53f400daa76dc18 25-Sep-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Renamed x86_hpet.c to x86_hpet.cpp and fixed the compile errors.


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


# 671a2442d93f46c5343ef34e01306befa760c16a 31-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

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

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


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


# 47c40a10a10dc615e078754503f2c19b9f98c38d 19-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Prefixed memset_physical() and memcpy_to_physical() with "vm_",
added vm_memcpy_from_physical() and vm_memcpy_physical_page(), and
added respective functions to the vm_translation_map operations. The
architecture specific implementation can now decide how to implement
them most efficiently. Added generic implementations that can be used,
though.
* Changed vm_{get,put}_physical_page(). The former no longer accepts
flags (the only flag PHYSICAL_PAGE_DONT_WAIT wasn't needed anymore).
Instead it returns an implementation-specific handle that has to be
passed to the latter. Added vm_{get,put}_physical_page_current_cpu()
and *_debug() variants, that work only for the current CPU,
respectively when in the kernel debugger. Also adjusted the
vm_translation_map operations accordingly.
* Made consequent use of the physical memory operations in the source
tree.
* Also adjusted the m68k and ppc implementations with respect to the
vm_translation_map operation changes, but they are probably broken,
nevertheless.
* For x86 the generic physical page mapper isn't used anymore. It is
suboptimal in any case. For systems with small memory it is too much
overhead, since one can just map the complete physical memory (that's
not done yet, though). For systems with large memory it counteracts
the VM strategy to reuse the least recently used pages. Since those
pages will most likely not be mapped by the page mapper anymore, it
will keep remapping chunks. This was also the reason why building
Haiku in Haiku was significantly faster with only 256 MB RAM (since
that much could be kept mapped all the time).
Now we're using a different strategy: We have small pools of virtual
page slots per CPU that are used for the physical page operations
(memset_physical(), memcpy_*_physical()) with CPU-pinned thread.
Furthermore we have four slots per translation map, which are used to
map page tables.

These changes speed up the Haiku image build in Haiku significantly. On
my Core2 Duo 2.2 GHz 2 GB machine about 40% to 20 min 40 s (KDEBUG
disabled, block cache debug disabled). Still more than factor 3 slower
than FreeBSD and Linux, though.


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


# 379ad6d0372d6b3242b4a56925f5b8512d63500f 09-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the arch specific stuff in src/system/kernel/lib into arch/...
subdirectories. Also moved the x86 kernel arch_string.S there.
* Moved memcpy.c from src/system/libroot/posix/string into the
arch/generic subdirectory.
* Dealt with the consequences of moving things around. Affected are also
the boot loader and runtime loader builds.

Adjust the m68k and ppc parts, too, but only the x86 build is tested.


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


# cb387cfb2f88cf171120d5c8a93f4c2a9680db9f 10-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Added acpi_shutdown() method. If the ACPI bus manager is installed, this will
be used now. Tested only with VMware so far.
* apm_shutdown() is now called with interrupts turned on.
* Renamed arch_cpu.c to arch_cpu.cpp.
* Minor cleanup.


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


# 6e29a04d3685e696625920fdeefb0df63ae22276 05-Jul-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Patch by Dustin Howett which 'modularizes' timers. The best timer is
automatically selected at boot time. Pit and Apic timers are implemented
for now. Thanks Dustin!



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


# a8f9741c8c2815234e87b78167738057b976b537 04-Jul-2008 Michael Lotz <mmlr@mlotz.ch>

* Removed -Wno-unused from all KernelMergeObjects in kernel Jamfiles.
* Fixed most of the warnings resulting from that by removing actually not used
variables or moving declaration into the #IF. Left unused functions there
though, as I wouldn't know if they are supposed to be used again.
* Fixed two statements with no effect (clamping to MAX_ANCILLARY_DATA_LEN in
socket.cpp and unsetting fCounterSem in MessagingService.cpp).
* Some style cleanups.

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


# fa827b37fc5d6ecda89b879d5ee5933975c0de2e 02-Jun-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

took the liberty to add this to the buiild and fix compilation :)


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


# 54d9d37f9dec9e7a8129706c42389886cd4a02e5 02-Jun-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added patch by Dustin Howett: header with HPET definitions and (empty)
file for hpet implementation. Not yet added to the build.


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


# 15173df4e9123a4dd082e11f26dba14411b819bf 22-May-2008 Axel Dörfler <axeld@pinc-software.de>

Last patch of the vm86 patch series from Jan Klötzke - thanks!:
* The new function vm86_do_int(struct vm86_state *state, uint8 vec) provides a
facility to call BIOS interupt handlers. The function must only be called from
a user thread context because the lower 1MB of the address space is used.


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


# 6b202f4e3da73d4c131355fcd82b792d153f84f6 13-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced new header directory headers/private/system which is supposed
to contain headers shared by kernel and userland (mainly libroot).
* Moved quite a few private kernel headers to the new location. Split
several kernel headers into a shared part and one that is still kernel
private. Adjusted all affected Jamfiles and source in the standard x86
build accordingly. The build for other architectures and for test code
may be broken.
* Quite a bit of userland code still includes private kernel headers.
Mostly those are <util/*> headers. The ones that aren't strictly
kernel-only should be moved to some other place (maybe
headers/private/shared/util).


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


# 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


# 393fceb5a0d8bd8b73059481ca0f20d285ac7a89 27-Sep-2007 Axel Dörfler <axeld@pinc-software.de>

* Cleaned up vm_types.h a bit, and made vm_page, vm_cache, and vm_area
opaque types for C.
* As a result, I've renamed some more source files to .cpp, and fixed
all warnings caused by that.


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


# 1cbf8f4b3c6c44446420f14d7b75ef8a1fbc2798 18-Feb-2007 Travis Geiselbrecht <geist@foobox.com>

initial support for a commpage, which is a chunk of memory in high kernel space with user readonly permissions.
The first use is to let the kernel decide what the preferred syscall mechanism is at boot time and copy the
appropriate user space code there. Can be used for routines the kernel can decide best how to use (memcpy, some
timing routines, etc).


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


# 44d5675324128d940518aaf7f2096efe9965db3a 16-Aug-2006 Jérôme Duval <korli@users.berlios.de>

KernelAddon and KernelStaticLibrary don't include kernel, kernel arch, boot platform headers anymore.
Fixed the build of most of targets using these rules. Though the build can be still broken, feel free to fix.


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


# 036b999b5435fd2121db01e2122cea2e86e96e5b 28-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Unbroke the build (ps2.h was suddenly missing.

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


# afd6dfc8b400a598ff4b610951548c5a7d2007cb 28-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented first basic APM driver. Only tested with QEMU so far, that's why
it's currently disabled.


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


# a71974c1f8098070e66beb3830666c6fa487f1fa 06-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

Pulled the algorithm for dynamically mapping physical pages into an
"IO space" out of the x86 specific source into arch/generic. We'll use
it for PPC as well.


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


# 7afa713acb69df4a1cd3a53a950af9f409d84514 03-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

Reorganized the boot platform dependencies in the kernel a bit.
Basically the architecture specific code is now responsible to
init and make use of the platform specific code, now. The reason
being that we have only one kernel per platform and thus cannot
decide at compile time, which platform to use (if any).
The PPC implementation features an abstract base class PPCPlatform
(implemented for all supported platforms) through which platform
support is provided.


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


# 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


# 0a51327f985b2b336d7d2c073cd72c8e6d6a1fa4 02-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed on-screen KDL keyboard input routine: it now works much more reliable
and ignores keyboard input. Also, it now uses the definitions from the PS/2
HID driver (from ps2.h).


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


# 2b8d85854db9ea4192c8dd43488ad2cd0c9c802b 29-May-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed arch_dbg_console.c to arch_debug_console.c, dbg_console.h to debug_console.h.


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