[haiku-commits] haiku: hrev47832 - src/system/kernel/arch/arm src/system/boot/arch/arm headers/private/kernel/arch/arm

  • From: ithamar@xxxxxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 7 Sep 2014 19:18:33 +0200 (CEST)

hrev47832 adds 2 changesets to branch 'master'
old head: 365f14bfbd71a401f24dcec861068ab150ae9763
new head: 6048591e9dd5c3f461dd3dd6cb5e6f4a17167439
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=6048591+%5E365f14b

----------------------------------------------------------------------------

eb92810: ARM: fix arch_debug_call_with_fault_handler
  
  This fixes the problem with KDL freaking out when doing a stacktrace
  and having its fault handler triggered. Have no clue how this could
  have worked before, but it did :P

6048591: Revert "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 reverts commit 3fbb24680c819d0819f4f876fe6565c336a19139.
  
  As I mentioned in #11131, this fix is not correct, and works around
  the problem. The real reason was that arch_debug_call_with_fault_handler
  was not working properly, so the fault handler went crazy.
  
  With commit eb92810 that is fixed so this can be reverted.

                          [ Ithamar R. Adema <ithamar@xxxxxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 16 insertions(+), 15 deletions(-)
headers/private/kernel/arch/arm/arch_kernel.h |  2 +-
src/system/boot/arch/arm/arch_mmu.cpp         |  2 +-
src/system/kernel/arch/arm/arch_asm.S         |  8 ++++----
src/system/kernel/arch/arm/arch_debug.cpp     | 19 ++++++++++---------

############################################################################

Commit:      eb92810edcbe694596e90aeb4cc5336e3e4f6ae5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=eb92810
Author:      Ithamar R. Adema <ithamar@xxxxxxxxxxxxxxxxxxx>
Date:        Sun Sep  7 17:11:36 2014 UTC

ARM: fix arch_debug_call_with_fault_handler

This fixes the problem with KDL freaking out when doing a stacktrace
and having its fault handler triggered. Have no clue how this could
have worked before, but it did :P

----------------------------------------------------------------------------

diff --git a/src/system/kernel/arch/arm/arch_asm.S 
b/src/system/kernel/arch/arm/arch_asm.S
index 6c04401..b5463f8 100644
--- a/src/system/kernel/arch/arm/arch_asm.S
+++ b/src/system/kernel/arch/arm/arch_asm.S
@@ -231,7 +231,7 @@ FUNCTION_END(arch_cpu_user_strlcpy)
        \param parameter The parameter to be passed to the function to be 
called.
 */
 FUNCTION(arch_debug_call_with_fault_handler):
-       stmfd   sp!, { r4, lr }
+       stmfd   sp!, { r1, r4, lr }
 
        // Set fault handler address, and fault handler stack pointer address. 
We
        // don't need to save the previous values, since that's done by the 
caller.
@@ -245,11 +245,11 @@ FUNCTION(arch_debug_call_with_fault_handler):
        blx     r2
 
        // regular return
-       ldmfd   sp!, { r4, pc }
+       ldmfd   sp!, { r1, r4, pc }
 
        // fault -- return via longjmp(jumpBuffer, 1)
 1:
-       mov     r0, r1
+       ldmfd   sp!, { r0, r4, lr } // restore jumpBuffer in r0 (was r1)
        mov     r1, #1
-       bl      longjmp
+       b       longjmp
 FUNCTION_END(arch_debug_call_with_fault_handler)

############################################################################

Revision:    hrev47832
Commit:      6048591e9dd5c3f461dd3dd6cb5e6f4a17167439
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6048591
Author:      Ithamar R. Adema <ithamar@xxxxxxxxxxxxxxxxxxx>
Date:        Sun Sep  7 17:15:01 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/11131

Revert "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 reverts commit 3fbb24680c819d0819f4f876fe6565c336a19139.

As I mentioned in #11131, this fix is not correct, and works around
the problem. The real reason was that arch_debug_call_with_fault_handler
was not working properly, so the fault handler went crazy.

With commit eb92810 that is fixed so this can be reverted.

----------------------------------------------------------------------------

diff --git a/headers/private/kernel/arch/arm/arch_kernel.h 
b/headers/private/kernel/arch/arm/arch_kernel.h
index 9c8723b..766ab42 100644
--- a/headers/private/kernel/arch/arm/arch_kernel.h
+++ b/headers/private/kernel/arch/arm/arch_kernel.h
@@ -9,7 +9,7 @@
 
 // memory layout
 #define KERNEL_BASE    0x80000000
-#define KERNEL_SIZE    0x800000
+#define KERNEL_SIZE    0x80000000
 #define KERNEL_TOP     (KERNEL_BASE + (KERNEL_SIZE - 1))
 
 /*
diff --git a/src/system/boot/arch/arm/arch_mmu.cpp 
b/src/system/boot/arch/arm/arch_mmu.cpp
index 7e2f44a..758a1f3 100644
--- a/src/system/boot/arch/arm/arch_mmu.cpp
+++ b/src/system/boot/arch/arm/arch_mmu.cpp
@@ -59,7 +59,7 @@ TODO:
 
 
 // 8 MB for the kernel, kernel args, modules, driver settings, ...
-static const size_t kMaxKernelSize = KERNEL_SIZE;
+static const size_t kMaxKernelSize = 0x800000;
 
 // Base address for loader
 static const size_t kLoaderBaseAddress = KERNEL_LOAD_BASE + kMaxKernelSize;
diff --git a/src/system/kernel/arch/arm/arch_debug.cpp 
b/src/system/kernel/arch/arm/arch_debug.cpp
index 985ce7c..1832ca2 100644
--- a/src/system/kernel/arch/arm/arch_debug.cpp
+++ b/src/system/kernel/arch/arm/arch_debug.cpp
@@ -56,18 +56,19 @@ already_visited(uint32 *visited, int32 *_last, int32 *_num, 
uint32 fp)
 static status_t
 get_next_frame(addr_t fp, addr_t *next, addr_t *ip)
 {
-       addr_t _fp = *(((addr_t*)fp) -3);
-       addr_t _sp = *(((addr_t*)fp) -2);
-       addr_t _lr = *(((addr_t*)fp) -1);
-       addr_t _pc = *(((addr_t*)fp) -0);
+       if (fp != 0) {
+               addr_t _fp = *(((addr_t*)fp) -3);
+               addr_t _sp = *(((addr_t*)fp) -2);
+               addr_t _lr = *(((addr_t*)fp) -1);
+               addr_t _pc = *(((addr_t*)fp) -0);
 
-       if (_lr > KERNEL_TOP) {
-               return B_BAD_ADDRESS;
+               *ip = (_fp != 0) ? _lr : _pc;
+               *next = _fp;
+
+               return B_OK;
        }
-       *ip = (_fp != 0) ? _lr : _pc;
-       *next = _fp;
 
-       return B_OK;
+       return B_BAD_VALUE;
 }
 
 


Other related posts:

  • » [haiku-commits] haiku: hrev47832 - src/system/kernel/arch/arm src/system/boot/arch/arm headers/private/kernel/arch/arm - ithamar