Commit Graph

62 Commits

Author SHA1 Message Date
Axel Dörfler 7b7c38a2a7 The "where" or "sc" command now switches the page directory to the specified thread
to be able to follow the stack trace into userland.
No symbols there, yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14697 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-04 15:58:04 +00:00
Axel Dörfler 90ce9e8305 Added calls to read and write the MSR, the machine state register.
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14537 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-26 23:39:38 +00:00
Axel Dörfler 8fcd6b8e61 * renamed smp_boot.c to smp.cpp
* there is now a "Disable Hyper-Threading" safemode in the boot loader
* the SMP & HT menu items are now added in smp.cpp - and are only added
  if the system supports one of them.
* more cleanup to smp_apic.h
* removed cpuid() from the boot loader's support.S - instead, it will now
  use the one from the kernel.
* added a very weak HT detection: if the MP config only listed one CPU,
  and this CPU supports HT, we enable the other logic processor manually -
  as this currently doesn't work, it's disabled, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14536 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-26 22:57:13 +00:00
Axel Dörfler fde12d6407 Some cleanup: renamed the mp_ext_* structures to mp_base_* as they are
part of the base table, not the extended table.
Renamed some structure fields, variables to be clearer and nicer to read.
Removed some unused stuff.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14502 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-24 21:37:40 +00:00
Axel Dörfler 0c67510ae1 Enabled SMP detection again - since it's very likely that it doesn't work on
your system, I've also added a "Disable SMP" safemode option. The NO_SMP
define is still there, and will be removed once SMP works flawlessly.
Prints out infos about the interrupt entries in the MP config.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14499 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-24 19:43:50 +00:00
Axel Dörfler 3d5ecf962c Minor cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14472 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-22 16:53:49 +00:00
Ingo Weinhold d08379a80b * 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
2005-07-21 23:47:08 +00:00
Axel Dörfler eca3ada99b Removed some unused old headers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12890 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-29 13:29:55 +00:00
Axel Dörfler b20667b35b {install|remove}_io_interrupt_handler() now correctly handle the B_NO_ENABLE_COUNTER flag.
Lots of cleanup:
- moved B_NO_ENABLE_COUNTER flag definition out of int.h to KernelExport.h, as it's
  described in the BeBook (although it's probably not really used that often :))
- int.c no longer has any platform dependent code (+ 0x20 on interrupt numbers is gone);
  it's now entirely handled in the arch/x86/ section.
- the io_vectors[] is now statically initialized, instead of allocated from the heap
- removed {install|remove}_interrupt_handler(); they weren't that useful, arch_smp_init()
  is now calling install_io_interrupt_handler() correctly instead
- introduced a new arch_int.h header file that currently contains NUM_IO_VECTORS only
  (though on x86, it also has ARCH_INTERRUPT_BASE == 0x20).
- changed the return type from {install|remove}_io_interrupt_handler() from "long" to
  "status_t"
- rearranged and cleaned the PIC initialization code, made the PIC code more prominent
- changed comments that talk about a non existing 8239 (the PIC chip is actually 8259)
- moved arch/x86/interrupts.h to the source directory, as it's not used outside
- added BeOS compatible interrupts_enabled() function, that should replace our
  equivalent (and private) are_interrupts_enabled()


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12477 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-27 01:08:35 +00:00
Ingo Weinhold 8e26b085e5 Fixed double fault handler. Personally I disclaim all responsiblity
for these changes. I was mostly just staring in amazement at the screen
while Axel and Thomas were discussing IA32 internals. A particularly
fascinating moment was when Thomas produced the cause of a bug we had
been trying to track down for hours off the top of his head (of course
iret behaves specially when the NT bit is set :-). His slowness must be
excused though, since he hadn't slept for more then 30 hours. ;-)

The code doesn't wholeheartedly deal with multi-processor machines yet.
Axel will certainly do some cleanup...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12239 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-04 21:43:47 +00:00
Axel Dörfler e5b0e0b5e3 Changed the set_segment_descriptor()'s usage of the limit/granularity
flag. Now, it will choose how to set the granularity by evaluating the
limit.
This call was actually already used this way in the kernel, so that
the TLS and TSS segments were much too large (harmless but incorrect).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12231 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-04 14:34:18 +00:00
Axel Dörfler 9d06770cdc The iframe stack is now in a special structure iframe_stack.
Introduced a gBootFrameStack that is used until the first thread structure
is available - this allows stack crawls and useful register dumps during
early startup. Could also be solved differently by making sure there is
always a thread structure installed in %dr3 (ie. the boot thread would
get a static thread structure instead of a static iframe stack only).
This might be a better solution as i386_handle_trap() would no longer
need to check for an existing thread structure.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12230 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-04 14:13:25 +00:00
Axel Dörfler edb5566393 Fixed struct tss; there is no ss3/sp3.
Moved ptentry/pdentry to arch_vm_translation_map.c and renamed them to
page_table_entry and page_directory_entry.
Fixed a race condition that happened when memory was remapped (which
can currently happen because lock_memory() does not work correctly, and
there might be other conditions as well, like certain vm_store fault
handlers). Now, page table and directory entries are updated atomically.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12229 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-04 14:07:24 +00:00
Ingo Weinhold 85001a7cc6 * Fixed checking for DR6 bits after a debug exception (we were and'ing
with the bit number, not the respective mask).
* Added a small hack to allow single stepping to work in qemu.
  Apparently the BS bit in DR6 is not set when the debug exception
  is handled. So we always assume that a single step event occurred,
  when we couldn't recognize any other event, if the hack is enabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11998 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-25 18:48:51 +00:00
Axel Dörfler 74b043d98d Removed execute property that was set accidently (since CVS days).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11896 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-18 01:50:45 +00:00
Ingo Weinhold 935486a09f Added some more EFLAGS bits.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11533 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-02 14:51:48 +00:00
Ingo Weinhold 86cc722477 * DR3 is used for holding the pointer to the current struct thread*, so
we only have 3 debug registers available for break-/watchpoints.
* Added definitions for debug status register DR6. Reordered DR7 defs to
  ascending order. Added definitions for the EFLAGS flags we need.
* Added arch_thread_debug_info structure and related definitions.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11525 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-02 00:05:02 +00:00
Ingo Weinhold 98b14f8a6a * Made i386_get_current_iframe() static again, since it wasn't what was
needed to get the topmost user iframe. Added i386_get_user_iframe() for
  exactly that purpose.
* Added reinitialization of user debugging for the new thread when
  switching the context.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11523 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-01 23:56:52 +00:00
Ingo Weinhold c8d7534e5d * Made C++ save.
* Made the parameter for restoring the FPU state const.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11522 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-01 23:52:09 +00:00
Ingo Weinhold 8ae64a82eb x86 specific user debugging support definitions.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11508 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-02-28 00:44:41 +00:00
Ingo Weinhold 05916979f9 Export i386_get_current_iframe() so it can be used in arch_user_debugger.cpp.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11472 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-02-24 15:49:41 +00:00
Ingo Weinhold 98dbeb36df Added note to keep struct iframe in sync with the struct cpu_state.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11471 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-02-24 15:47:54 +00:00
Ingo Weinhold f19279abda Danger! The size of empty structures differs between C and C++, so we have to put something in, if we want to use them from both.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11314 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-02-10 02:59:37 +00:00
Axel Dörfler c2c20b7848 Incorporated some code from NewOS to set up a double fault handler.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10444 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-12-14 01:46:46 +00:00
Axel Dörfler c44645aa42 vm.h was not used anywhere.
Introduced new arch_vm.h ("public" arch headers have the arch_ prefix).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10384 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-12-10 18:43:26 +00:00
Axel Dörfler b385f97e3e Added our first x86-only syscall for get_cpuid().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10323 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-12-01 03:54:23 +00:00
Axel Dörfler a3129fbc3b Added cpu_clock_speed field for now - might either be moved to the main
kernel_args; depending on how it'll be done on PPC.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10311 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-30 20:57:36 +00:00
Axel Dörfler 86a48e24ad Got inspired by mmu_man's dmidecode release and added a simple identification
of BIOS32, SMBIOS, and DMI services.
Also implemented a get_bios32_service() function which you can use to get
access to that service (ie. for use by the PCI bus manager).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10286 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-29 20:42:04 +00:00
Axel Dörfler 6a689590ce Removed unneeded includes of ktypes.h.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10036 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-19 19:40:05 +00:00
Axel Dörfler 99daf65959 Added definitions that describe the stack direction.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10007 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-18 14:43:28 +00:00
Axel Dörfler afad65ded7 Replaced all remaining PAGE_SIZE with B_PAGE_SIZE, addr with addr_t.
Removed the definition of PAGE_SIZE and addr.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9433 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-20 00:33:06 +00:00
Axel Dörfler a8673f45bf Added prototypes for arch_{store|restore}_fork_frame().
Removed broken arch_thread::current_iframe field.
Introduced new arch_fork_arg structure.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9295 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-12 03:57:31 +00:00
Axel Dörfler 3490a4becc No longer needs the arch_thread.h header.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9293 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-12 03:54:03 +00:00
Axel Dörfler a78a421de8 Renamed sleep() to spin() as that's what it does, and sleep() also doesn't
like unistd.h.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9040 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-23 13:43:57 +00:00
Ingo Weinhold b07e2ab15f uint32 -> unsigned int. No need to rely on defined types.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8906 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-10 23:12:23 +00:00
Axel Dörfler c2d416e259 Partially covered by arch_config.h and support/ByteOrder.h now/already.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8900 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-10 14:18:46 +00:00
Axel Dörfler 1aaaa3689a Moved some arch dependent config information to this new file (from arch_cpu.h).
There is probably more that could be moved in here.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8899 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-10 13:08:06 +00:00
Ingo Weinhold 75df143732 Introduced a macro specifying the type function parameters are aligned to. Not nice, but seems to help with the automatic generation of syscall code (at least on x86).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8783 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-01 20:15:19 +00:00
Axel Dörfler 3999c1f3ec Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7881 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-09 18:15:25 +00:00
Axel Dörfler a8061da698 Removed system_time() prototype; it's already defined in OS.h.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7711 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-05-31 23:31:15 +00:00
Axel Dörfler bbd8e7fbd9 Removed unneeded prototype.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6981 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-03-15 00:56:02 +00:00
Axel Dörfler 4a2e872cca Applied NewOS change 1914: moved APIC setup into the kernel due to a
problem with the APIC clock speed test.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6980 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-03-14 22:54:00 +00:00
Axel Dörfler db5620838a Moved the vm_translation_map_get_pgdir() function from arch/vm_translation_map.h
into this file (and replaced the prefix with i386_).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5065 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-10-17 13:35:12 +00:00
Axel Dörfler b4d2f3a8e7 Renamed arch_stage2.h to arch_kernel_args.h.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4972 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-10-07 23:34:59 +00:00
beveloper 5fe840b9b5 fixed address checking in ppc atomic functions.
fixed compilation on x86.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4361 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-08-21 23:36:06 +00:00
Axel Dörfler ff6ff33a9d Put spaces between "::" in the asm directive to let it compile in C++ mode.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3262 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-05-20 03:02:19 +00:00
Axel Dörfler f78d32a251 Some header cleanups.
Removed unused keyboard.h header.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3135 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-05-03 13:26:32 +00:00
Axel Dörfler c4bf92f686 Added new arch_elf.h header where the platform dependent relocation definitions
are located.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3134 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-05-03 12:51:56 +00:00
Axel Dörfler a02a5888af Added another argument parameter for the thread creation code. Helps
implementing a more efficient on_exit_thread().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3073 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-04-18 09:21:22 +00:00
Axel Dörfler 9175b5a5e0 Cleanup of the header mess: removed the redundant APIC/mp structure definitions
from smp_priv.h and stage2_priv.h. Created a new file smp_apic.h which now
contains those definitions.
Made the APIC_xxx register offsets only base offsets (without referencing a
particular variable).
Other small cleanups (i.e. "unsigned int" to uint32).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2604 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-30 21:20:33 +00:00