From f0ba3800a45f8479052ae1de212e3db12cbbe1df Mon Sep 17 00:00:00 2001 From: ReactOS Portable Systems Group Date: Sun, 13 Jul 2008 22:40:36 +0000 Subject: [PATCH] - Write a DebugService routine for ARM in the RTL library and get rid of the hack in ntoskrnl. - Just like on x86, this routine generates a breakpoint -- on ARM this is done with BKPT followed by an index. - We use the BREAKPOINT_PRINT index just like on x86. - This generates a prefetch abort -- so now we implement the prefetch abort handler. Thanks to the trap macros, this was 10 lines of code. - This calls into the real C handler, which is now unimplemented and hangs the whole system, so we've regressed way back (on purpose). svn path=/trunk/; revision=34474 --- reactos/lib/rtl/arm/debug_asm.S | 12 +++++++++++- reactos/ntoskrnl/include/internal/arm/ksarm.h | 10 ++++++++++ reactos/ntoskrnl/ke/arm/kiinit.c | 18 ------------------ reactos/ntoskrnl/ke/arm/trap.s | 17 +++++++++++++++-- reactos/ntoskrnl/ke/arm/trapc.c | 8 ++++++++ 5 files changed, 44 insertions(+), 21 deletions(-) diff --git a/reactos/lib/rtl/arm/debug_asm.S b/reactos/lib/rtl/arm/debug_asm.S index 8a5813d4f55..8b15966d3bf 100644 --- a/reactos/lib/rtl/arm/debug_asm.S +++ b/reactos/lib/rtl/arm/debug_asm.S @@ -17,9 +17,19 @@ // // Do a breakpoint and return // - bkpt 3 + bkpt BREAKPOINT_BREAK bx lr ENTRY_END DbgBreakPoint + + NESTED_ENTRY DebugService + PROLOG_END DebugService + + // + // Do a breakpoint and return + // + bkpt BREAKPOINT_PRINT // Could also be PROMPT -- we check later in a1 + bx lr + ENTRY_END DebugService NESTED_ENTRY RtlCaptureContext PROLOG_END RtlCaptureContext diff --git a/reactos/ntoskrnl/include/internal/arm/ksarm.h b/reactos/ntoskrnl/include/internal/arm/ksarm.h index d7847fb6a39..96d50c95a81 100644 --- a/reactos/ntoskrnl/include/internal/arm/ksarm.h +++ b/reactos/ntoskrnl/include/internal/arm/ksarm.h @@ -102,6 +102,16 @@ .equ CsPc, 0x40 .equ CsPsr, 0x44 +/* + * DebugService Control Types + */ +.equ BREAKPOINT_BREAK, 0 +.equ BREAKPOINT_PRINT, 1 +.equ BREAKPOINT_PROMPT, 2 +.equ BREAKPOINT_LOAD_SYMBOLS, 3 +.equ BREAKPOINT_UNLOAD_SYMBOLS, 4 +.equ BREAKPOINT_COMMAND_STRING, 5 + #else /* diff --git a/reactos/ntoskrnl/ke/arm/kiinit.c b/reactos/ntoskrnl/ke/arm/kiinit.c index 20e375788e3..445de65f0a5 100644 --- a/reactos/ntoskrnl/ke/arm/kiinit.c +++ b/reactos/ntoskrnl/ke/arm/kiinit.c @@ -31,24 +31,6 @@ KiIdleLoop( VOID ); -VOID -STDCALL -KdpSerialDebugPrint(LPSTR Message, - ULONG Length); - -VOID -DebugService(IN ULONG ServiceType, - IN PCHAR Buffer, - IN ULONG Length, - IN ULONG Component, - IN ULONG Level) -{ - // - // FIXME: ARM Bring-up Hack - // - KdpSerialDebugPrint(Buffer, Length); -} - VOID DebugService2(IN ULONG Arg1, IN ULONG Arg2, diff --git a/reactos/ntoskrnl/ke/arm/trap.s b/reactos/ntoskrnl/ke/arm/trap.s index feb1db08c75..e3a564931d0 100644 --- a/reactos/ntoskrnl/ke/arm/trap.s +++ b/reactos/ntoskrnl/ke/arm/trap.s @@ -67,9 +67,22 @@ PROLOG_END KiPrefetchAbortException // - // FIXME: TODO + // Handle trap entry // - b . + TRAP_PROLOG 1 // FromAbort + + // + // Call the C handler + // + adr lr, 1f + mov r0, sp + ldr pc, =KiPrefetchAbortHandler + +1: + // + // Handle trap exit + // + TRAP_EPILOG 0 // NotFromSystemCall ENTRY_END KiPrefetchAbortException diff --git a/reactos/ntoskrnl/ke/arm/trapc.c b/reactos/ntoskrnl/ke/arm/trapc.c index a61ba93a626..a8d62040a90 100644 --- a/reactos/ntoskrnl/ke/arm/trapc.c +++ b/reactos/ntoskrnl/ke/arm/trapc.c @@ -431,6 +431,14 @@ KiInterruptHandler(IN PKTRAP_FRAME TrapFrame, _enable(); } +NTSTATUS +KiPrefetchAbortHandler(IN PKTRAP_FRAME TrapFrame) +{ + ASSERT(TrapFrame->DbgArgMark == 0xBADB0D00); + while (TRUE); + return STATUS_SUCCESS; +} + NTSTATUS KiDataAbortHandler(IN PKTRAP_FRAME TrapFrame) {