#
02463fb4 |
|
05-Mar-2024 |
X512 <danger_mail@list.ru> |
kernel/int: consolidate interrupt vector number to `int32` This is no-op for 32 bit platforms because `int32` is defined as `long` there. Change interrupt vector number from 64 bits to 32 bits for 64 bit platforms. Change-Id: I52d1ad616cab16488804e9733c7afaf772a670ba Reviewed-on: https://review.haiku-os.org/c/haiku/+/7507 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
|
#
c7360f4b |
|
13-Nov-2023 |
Jérôme Duval <jerome.duval@gmail.com> |
kernel/x86_64: on context switch, load defaults in fpu control and mxcsr after a0131eaae2884fdced27158c3d34732d1656aca9 mxcsr was possibly also incorrect. fpu control and mxcsr will be restored with fxrstor/xrstor. no need to clear pending exceptions on #MF fix #18656 (and #18624 after reverting). Change-Id: I7dd5e2e4610747c5b82abd6c67e302d264b4be92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7104 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
53e2dc0f |
|
31-Oct-2023 |
Jérôme Duval <jerome.duval@gmail.com> |
kernel/x86_64: clear any pending exceptions on #MF * also on x86 for simplicity. * fixes #18624 * also makes x87 FPU data registers available for x87 floating instructions. EMMS is cheap. see https://github.com/cloudius-systems/osv/commit/25209d81f7b872111beb02ab9758f0d86898ec6b Change-Id: I5c1b399377102f3eb10bc6d7f7247afbaf6d8483 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7089 Reviewed-by: waddlesplash <waddlesplash@gmail.com> Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
#
e223e8e9 |
|
29-May-2023 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/x86: Initialize IO-APIC only after PCI enumeration is complete. Before the PCI refactor, PCI initialization/enumeration occurred immediately after the PCI module was loaded, and so by the time we got to IOAPIC initialization, it was already complete. After the refactor, PCI enumeration is deferred until slightly later, and so we would try to initialize IO-APICs without knowing PCI information. This would fail, as read_irq_routing_table needs to have that available. Hopefully fixes #18425, #18393, #18398. Change-Id: I1e4b06367da26eeb10085a1c6322ed39885b632b Reviewed-on: https://review.haiku-os.org/c/haiku/+/6476 Reviewed-by: X512 <danger_mail@list.ru> Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
3c259739 |
|
01-Dec-2021 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/int: Allow arch_int_assign_to_cpu to make its own decisions. For now this is used on RISCV64 to indicate that interrupts will always be on CPU 0. However, in the future, some architectures may want or require interrupts to be "steered" in various ways, and this also paves the way for that. Change-Id: Iec79870cf5c4898d102d0e624de19602271ae772 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4721 Reviewed-by: waddlesplash <waddlesplash@gmail.com> Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
|
#
9268c3d7 |
|
27-Sep-2019 |
Kacper Kasper <kacperkasper@gmail.com> |
x86: Reorder ifs in page fault handler * If interrupts were disabled, SMAP and SMEP violation message was shadowed by confusing "page fault but interrupts disabled" panic. Change-Id: I7470329984e55330f35fdca9b7c253fc4684e0c8 Reviewed-on: https://review.haiku-os.org/c/haiku/+/1891 Reviewed-by: waddlesplash <waddlesplash@gmail.com> Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
|
#
13c4bc94 |
|
20-Feb-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel: Undo changes to pinned threads and blocking. This reverts commit 58ed2965d0362707ca043b365ac1f2e89ee8c789. This reverts commit 055d49b1fd44ba7c450ad40051a2f34f38508b5f. I was mistaken, it is perfectly legal to block a pinned thread. It seems we'll need some other way to detect invalid context switches.
|
#
055d49b1 |
|
19-Feb-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/x86: Pin the current thread before calling interrupt handlers. int_io_* functions do not touch the thread state, but we already have it here as we will modify its contents later, so it makes more sense to set this flag here. This is mostly only relevant following the previous commit, i.e. finding interrupt handlers that brokenly try to context-switch.
|
#
99888f6b |
|
13-Sep-2018 |
Michael Lotz <mmlr@mlotz.ch> |
kernel: Apply user iframe determination logic to SMAP/SMEP. Change-Id: I394492a289f01303ac28e6d6670fbfdb326fa4db Reviewed-on: https://review.haiku-os.org/561 Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
|
#
8c005190 |
|
06-Apr-2018 |
Michael Lotz <mmlr@mlotz.ch> |
kernel: Determine kernel vs. user page fault depending on iframe. The action vm_page_fault takes should depend on whether the iframe to be handled is a user iframe or not. The check for the user flag in the error code does however only check if the fault happend in user or kernel space. Use IFRAME_IS_USER() instead which checks the privilege level of the iframe. Under 32 bit x86 this also handles vm86 compatibility mode properly. This is the same logic as used on FreeBSD (TRAPF_USERMODE). Fixes #13930. Change-Id: I9c348b6ab4c60daaaaa2c0fe33bcc3336aa29f7b Reviewed-on: https://review.haiku-os.org/560 Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
|
#
0de5a839 |
|
06-Apr-2018 |
Michael Lotz <mmlr@mlotz.ch> |
Cleanup: Use symbolic names, compare != 0 and whitespace. Change-Id: I34c60b3ab8387fe57dbcd91f9b5d278468455cf6 Reviewed-on: https://review.haiku-os.org/559 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
9dd4d2dd |
|
03-Jan-2018 |
Jérôme Duval <jerome.duval@gmail.com> |
kernel: support for Intel SMAP and SMEP on x86_64. SMAP will generated page faults when the kernel tries to access user pages unless overriden. If SMAP is enabled, the override instructions are written where needed in memory with binary "altcodepatches". Support is enabled by default, might be disabled per safemode setting. Change-Id: Ife26cd765056aeaf65b2ffa3cadd0dcf4e273a96
|
#
17698139 |
|
02-Nov-2017 |
jua <jua@terra.sol> |
x86-64: handle stack fault for non-canonical address access * With the amd64 architecture, the stack fault exception got a new meaning: it is raised when an instruction tries to access a non-canonical address, and the stack is referenced in the instruction (e.g. by its addressing mode). So unlike on x86, this is not a fatal exception and shouldn't trigger a KDL -- instead, it is to be treated like a general protection fault, terminating the team which caused it. * Fixes #13744
|
#
59bdca5d |
|
27-Feb-2017 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/x86/arch_int: Style fixes. Thanks Axel for the review.
|
#
0414166a |
|
25-Feb-2017 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/x86/arch_int: Move cast after NULL check. Spotted by Lioncash (via IRC). No functional change intended.
|
#
95e97463 |
|
14-Sep-2014 |
Paweł Dziepak <pdziepak@quarnos.org> |
kernel: add generic wrapper for accessing user memory This patch adds user_access() which can be used to gracefully handle page faults that may happen when accessing user memory. It is used by arch_cpu_user{memcpy, memset, strlcpy}() to allow using optimized functions from the standard library. Currently only x64 uses this, but nothing really is arch specific here. Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
|
#
b4552fcf |
|
19-Dec-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
x86: Remove debug message
|
#
66395144 |
|
19-Dec-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
x86[_64]: Support assigning MSI IRQs to arbitrary CPU
|
#
2b7ea4cd |
|
29-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Remove Thread::next_state
|
#
d897a478 |
|
17-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Allow reassigning IRQs to logical processors
|
#
03fb2d88 |
|
07-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Remove gSchedulerLock * Thread::scheduler_lock protects thread state, priority, etc. * sThreadCreationLock protects thread creation and removal and list of threads in team. * Team::signal_lock and Team::time_lock protect list of threads in team as well. * Scheduler uses its own internal locking.
|
#
46f7a54d |
|
26-Jul-2013 |
Jérôme Duval <jerome.duval@gmail.com> |
MSI: Use the effective APIC id of the boot CPU for the address destination. * This should only affect systems where the CPU ids aren't sequential (mostly non Intel). * Fixes #9807.
|
#
966f2076 |
|
06-Mar-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
x86: enable data execution prevention Set execute disable bit for any page that belongs to area with neither B_EXECUTE_AREA nor B_KERNEL_EXECUTE_AREA set. In order to take advanage of NX bit in 32 bit protected mode PAE must be enabled. Thus, from now on it is also enabled when the CPU supports NX bit. vm_page_fault() takes additional argument which indicates whether page fault was caused by an illegal instruction fetch.
|
#
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.
|
#
c936a023 |
|
15-Aug-2012 |
Michael Lotz <mmlr@mlotz.ch> |
Move MSI initialization before IO-APIC to fix missing init. Initializing the IO-APIC will initialize the PCI module, which does read the MSI config of the devices only when MSIs are available. Since we initialized them only after that, that condition wasn't met. Later, due to the uninitialized arch info, MSIs were still marked as available (0xcc = 204 MSIs). Due to the also uninitialized configured count, they were always deemed busy however, in effect just breaking MSI support whereever IO-APICs were available.
|
#
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.
|
#
74bda98c |
|
03-Aug-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Killed off vm86 code, no longer being used.
|
#
6497f6b1 |
|
21-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Moved the exception handling functions to arch_int.cpp, shared between x86 and x86_64.
|
#
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.
|
#
5670b0a8 |
|
09-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Moved the 32-bit page fault handler to arch_int.cpp, use it for x86_64. A proper page fault handler was required for areas that were not locked into the kernel address space. This enables the boot process to get up to the point of trying to find the boot volume.
|
#
c8049a88 |
|
09-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Enabled hardware interrupt handler, timers now work and threads are preempted.
|
#
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.
|
#
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.
|
#
e5fc2bfc |
|
26-Jun-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Implemented long mode setup/switch code, the bootloader can now start the 64-bit kernel! The setup procedure is fairly simple: create a 64-bit GDT and 64-bit page tables that include all kernel mappings from the 32-bit address space, but at the correct 64-bit address, then go through kernel_args and changes all virtual addresses to 64-bit addresses, and finally switch to long mode and jump to the kernel.
|
#
fc2d7cb0 |
|
12-Oct-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Introduce {reserve|allocate|free}_io_interrupt_vectors() that can generically be used to mark certain io interrupt vectors as reserved and to allocate from the still free ones. It is a kernel private API for now though. * Make the MSI code use that functionality instead of implementing its own which slims it down considerably and also removes quite a bit of hardcoded knowledge about the interrupt layout that didn't really belong there. * Mark the various in-use interrupts as reserved from the components that actually know about them (PIC, IO-APIC, SMP, APIC timer and interrupt setup). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42832 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
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
|
#
8908aef9 |
|
13-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Don't map the IO-APIC within the bootloader. We don't need it to set up SMP at all and, since there can be multiple IO-APICs, we need to do the enumeration again in the kernel anyway. Also only set ioapic_phys the first time we encounter an IO-APIC object as it looks cleaner when we arrive at the first IO-APIC default address. * Therefore we don't have to worry about already mapped IO-APICs when enumerating them in the kernel. * Also remove the mapping function that is now not used anymore. * We still use the ioapic_phys field of the kernel args to determine whether there is an IO-APIC at all to avoid needlessly doing the enumeration again. This fixes multi IO-APIC configurations, because before we would indeed map the last IO-APIC listed in the MADT, but then in the kernel assumed we mapped the first one. We'd end up with mapping the last listed IO-APIC twice and the first IO-APIC never, always programming the last one when we actually targetted the first one. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41476 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a56cbb2a |
|
11-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* When initializing MSI support, don't assume a single 24 entry IO-APIC. Instead mark the ISA interrupts as unusable and then use ioapic_is_interrupt_available to determine if that vector is possibly taken by an IO-APIC. If IO-APICs are not used, this will simply always return false, leaving all vectors free for MSI use. * The msi_init() now has to be done after a potential IO-APIC init, so it is now done after ioapic_init() instead of inside apic_init(). * Add apic_disable_local_ints() to clear the local ints on the local APIC once we are in APIC mode (i.e. the IO-APIC is set up and we don't need the external routing anymore). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41445 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
|
#
393b3b70 |
|
10-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Fix build with TRACEs on. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41422 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c7e314bb |
|
10-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Use const references instead of pointers for the print functions. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41417 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9173e384 |
|
10-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Choose the desired configuration of the link devices at preparation time already. This allows to detect invalid settings before starting to enable IRQ routing and therefore allows to gracefully fall back to PIC mode on error. * Actually read the number of IO-APIC entries before using that number in routing preparation. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41416 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ad175725 |
|
10-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Check hardwired and chosen IRQs against the maximum we can address. Try to fail gracefully in such cases (resulting in the IO-APIC not being used). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41415 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
414f205a |
|
10-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Remove the IRQ to IO-APIC pin mapping array. It isn't used as we don't redirect vectors at all. It'd also not work for multi IO-APIC setups which we don't support yet (but are relatively rare anyway). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41414 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
80c4e0ce |
|
09-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Balance the IRQs amongst the possible ones. A simple usage counter, filled by hardwired GSIs and updated on configuring the link devices, is used for that. This doesn't guarantee optimal results as some link devices may not be configurable to some IRQs and we might fill up their slots this way. Most of the time this should be good enough though. * Take the BIOS assigned IRQ white list into account when assigning IRQs in the ISA range and avoid assigning to non white listed IRQs. Quite probably it'd be ok to use all of the IRQs present in the possible IRQ list, but let's play it safe... * Also white listed are the IRQs that were set on the link device before reconfiguration. * Some cleanup, use references instead of pointers where applicable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41401 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
35ce8223 |
|
09-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Seperated out reading and enabling IRQ routing. Reading will only read the configuration that doesn't require any link device changes and will only prepare for updating the pci_info. Enabling then does the link device setup and updates the pci_info with the new IRQ values. * Configuring link devices now takes into account that multiple devices may share a single link device, meaning that the sharing PCI devices can't be configured independently. We still only blindly configure the first possible IRQ on the link devices, but now we actually have all the information to change that. Working on that next. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41400 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
348eade4 |
|
07-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Print the routing table unconditionally for now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41373 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
56b5ad07 |
|
07-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Added a temporary opt-in option "enable_ioapic" to the boot menu. This way the IO-APIC can be easily enabled to test it on various configurations. Note that the previous default opt-out didn't work because the safemode options would not be touched at all when not actually entering the boot menu. Once IO-APIC is more broadly tested this can be removed again and the opt-out option reenabled. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41370 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8c804ef2 |
|
07-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Added functionality to resolve the addresses provided in the IRQ routing table to PCI devices partly using the new ACPI interface and by using bridge config information from PCI. * Added lookup of matching device/pin combinations and update of the relevant interrupt line variable via the new PCI module function. This means that the Global System Interrupt (GSI) that is used after switching to the IO-APIC is now stored in the PCI config space and drivers enumerating these devices will now attach their interrupt handlers to the right IRQs. * Resolve all relevant interrupt information directly into the irq_routing_entry so that can be used as the single source for config information. This includes resolving the current setting of any PCI link devices into the irq field that represents a GSI now. * Use that info to configure interrupts in arch_int.cpp and remove the logic there. * Some cleanup and added debug output. This implements the final missing part for using IO-APICs and full APIC mode for interrupt routing. Note that there is no quirk handling of any form, so this may very well not work on some configurations. Note also that I have tested this only on one machine so far. Once proper testing is done the default of disabling the IO-APIC can be removed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41367 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1882d05b |
|
05-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
We need to specify the intended interrupt model with ACPI so that we get the correct PCI IRQ routing table for that mode. With this, we finally get the right PIRQ <-> Global System Interrupt mapping and can therefore program the right IO APIC entries. The only missing part now is to fix up the pci_info of the devices with the then active GSI. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41338 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c0b7f988 |
|
05-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Change some of the structure fields to more sensible types. * The irq values we get from ACPICA are already converted, remove the wrong extra conversion from bitfield to irq number. * Add and handle extended irq structures. * Disable the legacy PIC when done configuring the IOAPIC. Since during that configuration the ACPI module is initialized, the ACPI SCI is still enabled in the PIC instead of the IOAPIC. We'll have to delay that routing in the ACPI module for it to work. * Correctly handle the fixed IRQ case for the PCI interrupt routing (hopefully). * Actually allow for enumeration of possible IRQ settings. Not yet used though. All of this brings us a bit closer, though it still won't work for PCI interrupts. ISA interrupts work fine through the IOAPIC as far as my hardware goes, but PCI interrupts are connected to dedicated IOAPIC pins and I still haven't figured out how to determine their exact routing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41328 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8e52f69e |
|
03-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Cleanup and a minor debug output change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41313 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7fae7797 |
|
19-Mar-2011 |
Fredrik Holmqvist <fredrik.holmqvist@gmail.com> |
Just some cleanup. We won't need pci module for setup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41025 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
|
#
b0c50151 |
|
05-Sep-2010 |
Fredrik Holmqvist <fredrik.holmqvist@gmail.com> |
If source_index is != 0 it is hardwired to a GSI (Global System Interrupt). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38532 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
68876880 |
|
03-Sep-2010 |
Fredrik Holmqvist <fredrik.holmqvist@gmail.com> |
The flag returns true if io_apic is disabled. Use the proper check so that it can be toggled while booting. (io_apic is not working though so no need to try unless you are interested in development). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38525 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b22ea630 |
|
03-Jul-2010 |
Clemens Zeidler <clemens.zeidler@googlemail.com> |
Disable io apic for now. Fix irq argument for ioapic_configure_io_interrupt. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37384 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a8ad734f |
|
14-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced structures {virtual,physical}_address_restrictions, which specify restrictions for virtual/physical addresses. * vm_page_allocate_page_run(): - Fixed conversion of base/limit to array indexes. sPhysicalPageOffset was not taken into account. - Takes a physical_address_restrictions instead of base/limit and also supports alignment and boundary restrictions, now. * map_backing_store(), VM[User,Kernel]AddressSpace::InsertArea()/ ReserveAddressRange() take a virtual_address_restrictions parameter, now. They also support an alignment independent from the range size. * create_area_etc(), vm_create_anonymous_area(): Take {virtual,physical}_address_restrictions parameters, now. * Removed no longer needed B_PHYSICAL_BASE_ADDRESS. * DMAResources: - Fixed potential overflows of uint32 when initializing from device node attributes. - Fixed bounce buffer creation TODOs: By using create_area_etc() with the new restrictions parameters we can directly support physical high address, boundary, and alignment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37131 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7198f765 |
|
05-May-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* During early kernel startup, we must not create areas without the CREATE_AREA_DONT_WAIT flag; waiting at this point is not allowed. * I hope I found all occurences, but there might be some areas left (note, only those that don't use B_ALREADY_WIRED are problematic). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36624 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
fba2ee25 |
|
15-Apr-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* We should check for the I/O APIC before mapping it (since we panic if mapping it failed...). * Moved IRQ table reading much earlier (before starting to program the I/O APIC), though it currently fails, possibly because the device manager isn't up yet, and there is no embedded controller driver. * The kernel now enables I/O APICs by default, but the boot loader disables them - you can now enable them using the safe mode menu, but it currently won't have any (positive) effect. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36293 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9de17be6 |
|
14-Apr-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Moved I/O APIC initialization to a later point, now the APCI and DPC modules can safely be used. * Since using the I/O APIC is disabled by default, I've removed the "return" that prevented its use when enabled. Let's see if it already does anything. * Adapted other arch_int.cpp with a bit of cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36290 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
|
#
ad0b2833 |
|
11-Apr-2010 |
Clemens Zeidler <clemens.zeidler@googlemail.com> |
Fix spelling, pointed out by Stefano and Axel. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36139 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
|
#
08876f2b |
|
03-Mar-2010 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
Move the code which checks for disabled apic earlier (in the boot loader). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35741 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5b15d1ec |
|
28-Feb-2010 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
small cleanup: move variables declaration near where they're used. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35660 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
94632505 |
|
13-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added boolean "alreadyWired" parameter to vm_map_physical_memory(). * ioapic_init(): map_physical_memory() was called for already mapped addresses. This worked fine, but only because the x86 page mapping code didn't mind. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35059 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0338371f |
|
13-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* All scheduler implementations: - enqueue_in_run_queue() no longer returns whether rescheduling is supposed to happen. Instead is sets cpu_ent::invoke_scheduler on the current CPU. - reschedule() does now handle cpu_ent::invoke_scheduler_if_idle(). No need to let all callers do that. * thread_unblock[_locked]() no longer return whether rescheduling is supposed to happen. * Got rid of the B_INVOKE_SCHEDULER handling. The interrupt hooks really can't know, when it makes sense to reschedule or not. * Introduced scheduler_reschedule_if_necessary[_locked]() functions for checking+invoking the scheduler. * Some semaphore functions (e.g. delete_sem()) invoke the scheduler now, if they wake up anything with greater priority. I've also tried to add scheduler invocations in the condition variable and mutex/rw_lock code, but that actually has a negative impact on performance, probably because it causes too much ping-ponging between threads when multiple locking primitives are involved. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34657 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
3533b659 |
|
10-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Reintroduced the SMP_MSG_RESCHEDULE_IF_IDLE ICI message. This time implemented by means of an additional member in cpu_ent. * Removed thread::keep_scheduled and the related functions. The feature wasn't used yet and wouldn't have worked as implemented anyway. * Resurrected an older, SMP aware version of our simple scheduler and made it the default instead of the affine scheduler. The latter is in no state to be used yet. It causes enormous latencies (I've seen up to 0.1s) even when six or seven CPUs were idle at the same time, totally killing parallelism. That's also the reason why a -j8 build was slower than a -j2. This is no longer the case. On my machine the -j2 build takes about 10% less time now and the -j8 build saves another 20%. The latter is not particularly impressive (compared with Linux), but that seems to be due to lock contention. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34615 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e50cf876 |
|
02-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved the VM headers into subdirectory vm/. * Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
01ce3f26 |
|
08-Nov-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Cleanup, no functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33951 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1d502690 |
|
15-Sep-2009 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
Basically reverted previous commit, since at that point we haven't yet checked the existence of the apics. Moved the code to disable the local apic from arch_timer.c to arch_int.cpp, so we also avoid installing the interrupt handler for it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33149 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ea2abd11 |
|
02-Aug-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Renamed the ROUNDOWN macro to ROUNDDOWN. Also changed the implementation of ROUNDUP to use '*' and '/' -- the compiler will optimize that for powers of two anyway and this implementation works for other numbers as well. * The thread::fault_handler use in C[++] code was broken with gcc 4. At least when other functions were invoked. Trying to trick the compiler wasn't a particularly good idea anyway, since the next compiler version could break the trick again. So the general policy is to use the fault handlers only in assembly code where we have full control. Changed that for x86 (save for the vm86 mode, which has a similar mechanism), but not for the other architectures. * Introduced fault_handler, fault_handler_stack_pointer, and fault_jump_buffer fields in the cpu_ent structure, which must be used instead of thread::fault_handler in the kernel debugger. Consequently user_memcpy() must not be used in the kernel debugger either. Introduced a debug_memcpy() instead. * Introduced debug_call_with_fault_handler() function which calls a function in a setjmp() and fault handler context. The architecture specific backend arch_debug_call_with_fault_handler() has only been implemented for x86 yet. * Introduced debug_is_kernel_memory_accessible() for use in the kernel debugger. It determines whether a range of memory can be accessed in the way specified. The architecture specific back end arch_vm_translation_map_is_kernel_page_accessible() has only been implemented for x86 yet. * Added arch_debug_unset_current_thread() (only implemented for x86) to unset the current thread pointer in the kernel debugger. When entering the kernel debugger we do some basic sanity checks of the currently set thread structure and unset it, if they fail. This allows certain commands (most importantly the stack trace command) to avoid accessing the thread structure. * x86: When handling a double fault, we do now install a special handler for page faults. This allows us to gracefully catch faulting commands, even if e.g. the thread structure is toast. We are now in much better shape to deal with double faults. Hopefully avoiding the triple faults that some people have been experiencing on their hardware and ideally even allowing to use the kernel debugger normally. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32073 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
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
|
#
95e97463d265c9f4a6e43265ef0f1f63a0825b21 |
|
14-Sep-2014 |
Paweł Dziepak <pdziepak@quarnos.org> |
kernel: add generic wrapper for accessing user memory This patch adds user_access() which can be used to gracefully handle page faults that may happen when accessing user memory. It is used by arch_cpu_user{memcpy, memset, strlcpy}() to allow using optimized functions from the standard library. Currently only x64 uses this, but nothing really is arch specific here. Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
|
#
b4552fcf9b2700a356c0dc25f49a052adc504650 |
|
19-Dec-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
x86: Remove debug message
|
#
663951443784bb63d60abe742f1d1379fb153e18 |
|
19-Dec-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
x86[_64]: Support assigning MSI IRQs to arbitrary CPU
|
#
2b7ea4cddf362859cd3089e3cb95481cda4adc5f |
|
29-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Remove Thread::next_state
|
#
d897a478d7c01054aad29b23f7f545073c797530 |
|
17-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Allow reassigning IRQs to logical processors
|
#
03fb2d886830e4dd4b344c56725db59f96733216 |
|
07-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Remove gSchedulerLock * Thread::scheduler_lock protects thread state, priority, etc. * sThreadCreationLock protects thread creation and removal and list of threads in team. * Team::signal_lock and Team::time_lock protect list of threads in team as well. * Scheduler uses its own internal locking.
|
#
46f7a54d8c545ff61d59d6b336232d2b65c3b1fd |
|
26-Jul-2013 |
Jérôme Duval <jerome.duval@gmail.com> |
MSI: Use the effective APIC id of the boot CPU for the address destination. * This should only affect systems where the CPU ids aren't sequential (mostly non Intel). * Fixes #9807.
|
#
966f207668d19610dae34d5331150e3742815bcf |
|
06-Mar-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
x86: enable data execution prevention Set execute disable bit for any page that belongs to area with neither B_EXECUTE_AREA nor B_KERNEL_EXECUTE_AREA set. In order to take advanage of NX bit in 32 bit protected mode PAE must be enabled. Thus, from now on it is also enabled when the CPU supports NX bit. vm_page_fault() takes additional argument which indicates whether page fault was caused by an illegal instruction fetch.
|
#
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.
|
#
c936a02360c7a18c49d2da5e8b8e38b6b666ead6 |
|
15-Aug-2012 |
Michael Lotz <mmlr@mlotz.ch> |
Move MSI initialization before IO-APIC to fix missing init. Initializing the IO-APIC will initialize the PCI module, which does read the MSI config of the devices only when MSIs are available. Since we initialized them only after that, that condition wasn't met. Later, due to the uninitialized arch info, MSIs were still marked as available (0xcc = 204 MSIs). Due to the also uninitialized configured count, they were always deemed busy however, in effect just breaking MSI support whereever IO-APICs were available.
|
#
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.
|
#
74bda98cb236130b1d4f84795f7fafd5c8e540a9 |
|
03-Aug-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Killed off vm86 code, no longer being used.
|
#
6497f6b1ec4dd21d85ec01a18098138b03986a98 |
|
21-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Moved the exception handling functions to arch_int.cpp, shared between x86 and x86_64.
|
#
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.
|
#
5670b0a8e4fe8e5504b2e57a958e1590f6024406 |
|
09-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Moved the 32-bit page fault handler to arch_int.cpp, use it for x86_64. A proper page fault handler was required for areas that were not locked into the kernel address space. This enables the boot process to get up to the point of trying to find the boot volume.
|
#
c8049a88a3ea4a5d8b4144f7f053d712815b75ce |
|
09-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Enabled hardware interrupt handler, timers now work and threads are preempted.
|
#
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.
|
#
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.
|
#
e5fc2bfcab8c15a3ff7d33c358f9aa82ed73c823 |
|
26-Jun-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Implemented long mode setup/switch code, the bootloader can now start the 64-bit kernel! The setup procedure is fairly simple: create a 64-bit GDT and 64-bit page tables that include all kernel mappings from the 32-bit address space, but at the correct 64-bit address, then go through kernel_args and changes all virtual addresses to 64-bit addresses, and finally switch to long mode and jump to the kernel.
|
#
fc2d7cb04d7ad78424169fd0df4d236de2bb17d1 |
|
12-Oct-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Introduce {reserve|allocate|free}_io_interrupt_vectors() that can generically be used to mark certain io interrupt vectors as reserved and to allocate from the still free ones. It is a kernel private API for now though. * Make the MSI code use that functionality instead of implementing its own which slims it down considerably and also removes quite a bit of hardcoded knowledge about the interrupt layout that didn't really belong there. * Mark the various in-use interrupts as reserved from the components that actually know about them (PIC, IO-APIC, SMP, APIC timer and interrupt setup). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42832 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
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
|
#
8908aef9c2c62225bce2d8216e81397c872316e8 |
|
13-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Don't map the IO-APIC within the bootloader. We don't need it to set up SMP at all and, since there can be multiple IO-APICs, we need to do the enumeration again in the kernel anyway. Also only set ioapic_phys the first time we encounter an IO-APIC object as it looks cleaner when we arrive at the first IO-APIC default address. * Therefore we don't have to worry about already mapped IO-APICs when enumerating them in the kernel. * Also remove the mapping function that is now not used anymore. * We still use the ioapic_phys field of the kernel args to determine whether there is an IO-APIC at all to avoid needlessly doing the enumeration again. This fixes multi IO-APIC configurations, because before we would indeed map the last IO-APIC listed in the MADT, but then in the kernel assumed we mapped the first one. We'd end up with mapping the last listed IO-APIC twice and the first IO-APIC never, always programming the last one when we actually targetted the first one. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41476 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a56cbb2afbf4dbfb4a07dfdd95f10637a195a053 |
|
11-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* When initializing MSI support, don't assume a single 24 entry IO-APIC. Instead mark the ISA interrupts as unusable and then use ioapic_is_interrupt_available to determine if that vector is possibly taken by an IO-APIC. If IO-APICs are not used, this will simply always return false, leaving all vectors free for MSI use. * The msi_init() now has to be done after a potential IO-APIC init, so it is now done after ioapic_init() instead of inside apic_init(). * Add apic_disable_local_ints() to clear the local ints on the local APIC once we are in APIC mode (i.e. the IO-APIC is set up and we don't need the external routing anymore). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41445 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
|
#
393b3b70a74bf5d3f5db03de79e700704fbc4d6b |
|
10-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Fix build with TRACEs on. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41422 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c7e314bba7367820d2e8f28fd86f9981c0b7fcda |
|
10-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Use const references instead of pointers for the print functions. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41417 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9173e3843e8623782de1890aea764f68426b8a63 |
|
10-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Choose the desired configuration of the link devices at preparation time already. This allows to detect invalid settings before starting to enable IRQ routing and therefore allows to gracefully fall back to PIC mode on error. * Actually read the number of IO-APIC entries before using that number in routing preparation. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41416 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ad1757252e43d6fc2e682df1d95b1d9f3a0f1fbd |
|
10-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Check hardwired and chosen IRQs against the maximum we can address. Try to fail gracefully in such cases (resulting in the IO-APIC not being used). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41415 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
414f205aeeeafb3438b1666660cd364def3522ad |
|
10-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Remove the IRQ to IO-APIC pin mapping array. It isn't used as we don't redirect vectors at all. It'd also not work for multi IO-APIC setups which we don't support yet (but are relatively rare anyway). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41414 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
80c4e0ced06167a20dc11bfeb80f4cb671a86805 |
|
09-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Balance the IRQs amongst the possible ones. A simple usage counter, filled by hardwired GSIs and updated on configuring the link devices, is used for that. This doesn't guarantee optimal results as some link devices may not be configurable to some IRQs and we might fill up their slots this way. Most of the time this should be good enough though. * Take the BIOS assigned IRQ white list into account when assigning IRQs in the ISA range and avoid assigning to non white listed IRQs. Quite probably it'd be ok to use all of the IRQs present in the possible IRQ list, but let's play it safe... * Also white listed are the IRQs that were set on the link device before reconfiguration. * Some cleanup, use references instead of pointers where applicable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41401 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
35ce82238fa244f331ede53401d16cc884472bab |
|
09-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Seperated out reading and enabling IRQ routing. Reading will only read the configuration that doesn't require any link device changes and will only prepare for updating the pci_info. Enabling then does the link device setup and updates the pci_info with the new IRQ values. * Configuring link devices now takes into account that multiple devices may share a single link device, meaning that the sharing PCI devices can't be configured independently. We still only blindly configure the first possible IRQ on the link devices, but now we actually have all the information to change that. Working on that next. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41400 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
348eade4a8442badfb50deff01079463729d94c1 |
|
07-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Print the routing table unconditionally for now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41373 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
56b5ad07811e608372b159831a6151598edefd48 |
|
07-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Added a temporary opt-in option "enable_ioapic" to the boot menu. This way the IO-APIC can be easily enabled to test it on various configurations. Note that the previous default opt-out didn't work because the safemode options would not be touched at all when not actually entering the boot menu. Once IO-APIC is more broadly tested this can be removed again and the opt-out option reenabled. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41370 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8c804ef2d6816a50d59579314451a2f827bb8b95 |
|
07-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Added functionality to resolve the addresses provided in the IRQ routing table to PCI devices partly using the new ACPI interface and by using bridge config information from PCI. * Added lookup of matching device/pin combinations and update of the relevant interrupt line variable via the new PCI module function. This means that the Global System Interrupt (GSI) that is used after switching to the IO-APIC is now stored in the PCI config space and drivers enumerating these devices will now attach their interrupt handlers to the right IRQs. * Resolve all relevant interrupt information directly into the irq_routing_entry so that can be used as the single source for config information. This includes resolving the current setting of any PCI link devices into the irq field that represents a GSI now. * Use that info to configure interrupts in arch_int.cpp and remove the logic there. * Some cleanup and added debug output. This implements the final missing part for using IO-APICs and full APIC mode for interrupt routing. Note that there is no quirk handling of any form, so this may very well not work on some configurations. Note also that I have tested this only on one machine so far. Once proper testing is done the default of disabling the IO-APIC can be removed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41367 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1882d05b95585250e2ddfbcd08786f228c229e74 |
|
05-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
We need to specify the intended interrupt model with ACPI so that we get the correct PCI IRQ routing table for that mode. With this, we finally get the right PIRQ <-> Global System Interrupt mapping and can therefore program the right IO APIC entries. The only missing part now is to fix up the pci_info of the devices with the then active GSI. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41338 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c0b7f988f45f57636059c2648849259acd6b7d32 |
|
05-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Change some of the structure fields to more sensible types. * The irq values we get from ACPICA are already converted, remove the wrong extra conversion from bitfield to irq number. * Add and handle extended irq structures. * Disable the legacy PIC when done configuring the IOAPIC. Since during that configuration the ACPI module is initialized, the ACPI SCI is still enabled in the PIC instead of the IOAPIC. We'll have to delay that routing in the ACPI module for it to work. * Correctly handle the fixed IRQ case for the PCI interrupt routing (hopefully). * Actually allow for enumeration of possible IRQ settings. Not yet used though. All of this brings us a bit closer, though it still won't work for PCI interrupts. ISA interrupts work fine through the IOAPIC as far as my hardware goes, but PCI interrupts are connected to dedicated IOAPIC pins and I still haven't figured out how to determine their exact routing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41328 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8e52f69ef2d51b7b10865c8bd75b13cb477a1101 |
|
03-May-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Cleanup and a minor debug output change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41313 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7fae77976618b676ff17571fff9759402d61d961 |
|
19-Mar-2011 |
Fredrik Holmqvist <fredrik.holmqvist@gmail.com> |
Just some cleanup. We won't need pci module for setup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41025 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
|
#
b0c501514087f12b0b2b62e9e0424a768f6f898a |
|
05-Sep-2010 |
Fredrik Holmqvist <fredrik.holmqvist@gmail.com> |
If source_index is != 0 it is hardwired to a GSI (Global System Interrupt). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38532 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
688768804f424638dd3519c2cb5e1c28f61cfadd |
|
03-Sep-2010 |
Fredrik Holmqvist <fredrik.holmqvist@gmail.com> |
The flag returns true if io_apic is disabled. Use the proper check so that it can be toggled while booting. (io_apic is not working though so no need to try unless you are interested in development). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38525 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b22ea6300c8d25180762372c27587d632826e767 |
|
03-Jul-2010 |
Clemens Zeidler <clemens.zeidler@googlemail.com> |
Disable io apic for now. Fix irq argument for ioapic_configure_io_interrupt. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37384 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a8ad734f1c698917badb15e1641e0f38b3e9a013 |
|
14-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced structures {virtual,physical}_address_restrictions, which specify restrictions for virtual/physical addresses. * vm_page_allocate_page_run(): - Fixed conversion of base/limit to array indexes. sPhysicalPageOffset was not taken into account. - Takes a physical_address_restrictions instead of base/limit and also supports alignment and boundary restrictions, now. * map_backing_store(), VM[User,Kernel]AddressSpace::InsertArea()/ ReserveAddressRange() take a virtual_address_restrictions parameter, now. They also support an alignment independent from the range size. * create_area_etc(), vm_create_anonymous_area(): Take {virtual,physical}_address_restrictions parameters, now. * Removed no longer needed B_PHYSICAL_BASE_ADDRESS. * DMAResources: - Fixed potential overflows of uint32 when initializing from device node attributes. - Fixed bounce buffer creation TODOs: By using create_area_etc() with the new restrictions parameters we can directly support physical high address, boundary, and alignment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37131 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7198f76564e4b062401bb95f6ddf540bbf9e8625 |
|
05-May-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* During early kernel startup, we must not create areas without the CREATE_AREA_DONT_WAIT flag; waiting at this point is not allowed. * I hope I found all occurences, but there might be some areas left (note, only those that don't use B_ALREADY_WIRED are problematic). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36624 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
fba2ee2527563001dbab46b4aa15570bf47c00bc |
|
15-Apr-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* We should check for the I/O APIC before mapping it (since we panic if mapping it failed...). * Moved IRQ table reading much earlier (before starting to program the I/O APIC), though it currently fails, possibly because the device manager isn't up yet, and there is no embedded controller driver. * The kernel now enables I/O APICs by default, but the boot loader disables them - you can now enable them using the safe mode menu, but it currently won't have any (positive) effect. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36293 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9de17be600220db91400c27772b19546284f470f |
|
14-Apr-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Moved I/O APIC initialization to a later point, now the APCI and DPC modules can safely be used. * Since using the I/O APIC is disabled by default, I've removed the "return" that prevented its use when enabled. Let's see if it already does anything. * Adapted other arch_int.cpp with a bit of cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36290 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
|
#
ad0b28334d09ee5ae254a5c2c1837c85187c00a3 |
|
11-Apr-2010 |
Clemens Zeidler <clemens.zeidler@googlemail.com> |
Fix spelling, pointed out by Stefano and Axel. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36139 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
|
#
08876f2b9668da3140c7f868c47a5d599337d6c1 |
|
03-Mar-2010 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
Move the code which checks for disabled apic earlier (in the boot loader). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35741 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5b15d1ec1ef01e665eb12a3d1620f162eead1aff |
|
28-Feb-2010 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
small cleanup: move variables declaration near where they're used. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35660 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
946325051bcbdb05b1bf2466ed03bed13f36bf59 |
|
13-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added boolean "alreadyWired" parameter to vm_map_physical_memory(). * ioapic_init(): map_physical_memory() was called for already mapped addresses. This worked fine, but only because the x86 page mapping code didn't mind. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35059 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0338371f26864c2a248b1ea53b9fe78c884af7f2 |
|
13-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* All scheduler implementations: - enqueue_in_run_queue() no longer returns whether rescheduling is supposed to happen. Instead is sets cpu_ent::invoke_scheduler on the current CPU. - reschedule() does now handle cpu_ent::invoke_scheduler_if_idle(). No need to let all callers do that. * thread_unblock[_locked]() no longer return whether rescheduling is supposed to happen. * Got rid of the B_INVOKE_SCHEDULER handling. The interrupt hooks really can't know, when it makes sense to reschedule or not. * Introduced scheduler_reschedule_if_necessary[_locked]() functions for checking+invoking the scheduler. * Some semaphore functions (e.g. delete_sem()) invoke the scheduler now, if they wake up anything with greater priority. I've also tried to add scheduler invocations in the condition variable and mutex/rw_lock code, but that actually has a negative impact on performance, probably because it causes too much ping-ponging between threads when multiple locking primitives are involved. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34657 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
3533b6597db4ad65493632da8a92c1f6ea3de149 |
|
10-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Reintroduced the SMP_MSG_RESCHEDULE_IF_IDLE ICI message. This time implemented by means of an additional member in cpu_ent. * Removed thread::keep_scheduled and the related functions. The feature wasn't used yet and wouldn't have worked as implemented anyway. * Resurrected an older, SMP aware version of our simple scheduler and made it the default instead of the affine scheduler. The latter is in no state to be used yet. It causes enormous latencies (I've seen up to 0.1s) even when six or seven CPUs were idle at the same time, totally killing parallelism. That's also the reason why a -j8 build was slower than a -j2. This is no longer the case. On my machine the -j2 build takes about 10% less time now and the -j8 build saves another 20%. The latter is not particularly impressive (compared with Linux), but that seems to be due to lock contention. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34615 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e50cf8765be50a7454c9488db38b638cf90805af |
|
02-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved the VM headers into subdirectory vm/. * Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
01ce3f26d2c9eecd02ee03f8e8abc1b297f820cd |
|
08-Nov-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Cleanup, no functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33951 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1d5026909d9bb497082970a453043976f13b580d |
|
15-Sep-2009 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
Basically reverted previous commit, since at that point we haven't yet checked the existence of the apics. Moved the code to disable the local apic from arch_timer.c to arch_int.cpp, so we also avoid installing the interrupt handler for it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33149 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ea2abd110bd6a4518a954477562e2dd94a5fef9d |
|
02-Aug-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Renamed the ROUNDOWN macro to ROUNDDOWN. Also changed the implementation of ROUNDUP to use '*' and '/' -- the compiler will optimize that for powers of two anyway and this implementation works for other numbers as well. * The thread::fault_handler use in C[++] code was broken with gcc 4. At least when other functions were invoked. Trying to trick the compiler wasn't a particularly good idea anyway, since the next compiler version could break the trick again. So the general policy is to use the fault handlers only in assembly code where we have full control. Changed that for x86 (save for the vm86 mode, which has a similar mechanism), but not for the other architectures. * Introduced fault_handler, fault_handler_stack_pointer, and fault_jump_buffer fields in the cpu_ent structure, which must be used instead of thread::fault_handler in the kernel debugger. Consequently user_memcpy() must not be used in the kernel debugger either. Introduced a debug_memcpy() instead. * Introduced debug_call_with_fault_handler() function which calls a function in a setjmp() and fault handler context. The architecture specific backend arch_debug_call_with_fault_handler() has only been implemented for x86 yet. * Introduced debug_is_kernel_memory_accessible() for use in the kernel debugger. It determines whether a range of memory can be accessed in the way specified. The architecture specific back end arch_vm_translation_map_is_kernel_page_accessible() has only been implemented for x86 yet. * Added arch_debug_unset_current_thread() (only implemented for x86) to unset the current thread pointer in the kernel debugger. When entering the kernel debugger we do some basic sanity checks of the currently set thread structure and unset it, if they fail. This allows certain commands (most importantly the stack trace command) to avoid accessing the thread structure. * x86: When handling a double fault, we do now install a special handler for page faults. This allows us to gracefully catch faulting commands, even if e.g. the thread structure is toast. We are now in much better shape to deal with double faults. Hopefully avoiding the triple faults that some people have been experiencing on their hardware and ideally even allowing to use the kernel debugger normally. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32073 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
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
|