* Introduced x86_get_double_fault_stack(), which returns the address

and size of the double fault stack.
* is_kernel_stack_address() does now also check whether the given
  address is on the double fault stack. This fixes stack traces on
  double faults, which were broken (i.e. went only to the double fault
  iframe) since we started checking whether the addresses are on the
  kernel stack at all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26775 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-08-04 02:51:38 +00:00
parent 39ec9b48bd
commit bca3215f8a
3 changed files with 21 additions and 1 deletions

View File

@ -268,6 +268,7 @@ uint32 x86_count_mtrrs(void);
void x86_set_mtrr(uint32 index, uint64 base, uint64 length, uint8 type);
status_t x86_get_mtrr(uint32 index, uint64 *_base, uint64 *_length, uint8 *_type);
bool x86_check_feature(uint32 feature, enum x86_feature_type type);
void* x86_get_double_fault_stack(int32 cpu, size_t* _size);
#define read_cr3(value) \

View File

@ -452,6 +452,14 @@ x86_check_feature(uint32 feature, enum x86_feature_type type)
}
void*
x86_get_double_fault_stack(int32 cpu, size_t* _size)
{
*_size = sizeof(sDoubleFaultStack);
return sDoubleFaultStack;
}
// #pragma mark -

View File

@ -12,6 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <cpu.h>
#include <debug.h>
#include <elf.h>
#include <kernel.h>
@ -208,6 +209,14 @@ setup_for_thread(char *arg, struct thread **_thread, uint32 *_ebp,
*_thread = thread;
}
static bool
is_double_fault_stack_address(int32 cpu, addr_t address)
{
size_t size;
addr_t bottom = (addr_t)x86_get_double_fault_stack(cpu, &size);
return address >= bottom && address < bottom + size;
}
static bool
is_kernel_stack_address(struct thread* thread, addr_t address)
@ -218,7 +227,9 @@ is_kernel_stack_address(struct thread* thread, addr_t address)
return IS_KERNEL_ADDRESS(address);
return address >= thread->kernel_stack_base
&& address < thread->kernel_stack_top;
&& address < thread->kernel_stack_top
|| thread->cpu != NULL
&& is_double_fault_stack_address(thread->cpu->cpu_num, address);
}