Added check to ensure KDL does not include frames beyond kernel entry in the backtrace. This prevents KDL from faulting when printing backtrace on ARM.
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
// memory layout
|
// memory layout
|
||||||
#define KERNEL_BASE 0x80000000
|
#define KERNEL_BASE 0x80000000
|
||||||
#define KERNEL_SIZE 0x80000000
|
#define KERNEL_SIZE 0x800000
|
||||||
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
|
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ TODO:
|
|||||||
|
|
||||||
|
|
||||||
// 8 MB for the kernel, kernel args, modules, driver settings, ...
|
// 8 MB for the kernel, kernel args, modules, driver settings, ...
|
||||||
static const size_t kMaxKernelSize = 0x800000;
|
static const size_t kMaxKernelSize = KERNEL_SIZE;
|
||||||
|
|
||||||
// Base address for loader
|
// Base address for loader
|
||||||
static const size_t kLoaderBaseAddress = KERNEL_LOAD_BASE + kMaxKernelSize;
|
static const size_t kLoaderBaseAddress = KERNEL_LOAD_BASE + kMaxKernelSize;
|
||||||
|
|||||||
@@ -56,19 +56,18 @@ already_visited(uint32 *visited, int32 *_last, int32 *_num, uint32 fp)
|
|||||||
static status_t
|
static status_t
|
||||||
get_next_frame(addr_t fp, addr_t *next, addr_t *ip)
|
get_next_frame(addr_t fp, addr_t *next, addr_t *ip)
|
||||||
{
|
{
|
||||||
if (fp != 0) {
|
addr_t _fp = *(((addr_t*)fp) -3);
|
||||||
addr_t _fp = *(((addr_t*)fp) -3);
|
addr_t _sp = *(((addr_t*)fp) -2);
|
||||||
addr_t _sp = *(((addr_t*)fp) -2);
|
addr_t _lr = *(((addr_t*)fp) -1);
|
||||||
addr_t _lr = *(((addr_t*)fp) -1);
|
addr_t _pc = *(((addr_t*)fp) -0);
|
||||||
addr_t _pc = *(((addr_t*)fp) -0);
|
|
||||||
|
|
||||||
*ip = (_fp != 0) ? _lr : _pc;
|
if (_lr > KERNEL_TOP) {
|
||||||
*next = _fp;
|
return B_BAD_ADDRESS;
|
||||||
|
|
||||||
return B_OK;
|
|
||||||
}
|
}
|
||||||
|
*ip = (_fp != 0) ? _lr : _pc;
|
||||||
|
*next = _fp;
|
||||||
|
|
||||||
return B_BAD_VALUE;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user