From 293cc2c20b85b8168f257568ecacb9a947802a14 Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Fri, 19 Oct 2007 07:22:01 +0000 Subject: [PATCH] Debug DbgBreakPoint and drop to GDB on program trap. svn path=/trunk/; revision=29672 --- .../boot/freeldr/freeldr/arch/powerpc/mach.c | 4 +- reactos/lib/ppcmmu/gdblib.c | 53 ++++++------------- reactos/lib/ppcmmu/mmuobject.c | 3 ++ 3 files changed, 22 insertions(+), 38 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c b/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c index 443269869a6..6ace3b11a78 100644 --- a/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c +++ b/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c @@ -514,7 +514,7 @@ BOOLEAN PpcDiskNormalizeSystemPath(char *SystemPath, unsigned Size) { } extern int _bss; -typedef unsigned int uint32_t; +//typedef unsigned int uint32_t; void PpcDefaultMachVtbl() { @@ -661,5 +661,5 @@ void ChainLoadBiosBootSectorCode() { } void DbgBreakPoint() { - ofw_exit(); + __asm__("twi 31,0,0"); } diff --git a/reactos/lib/ppcmmu/gdblib.c b/reactos/lib/ppcmmu/gdblib.c index 5a423db6ceb..5cb92c3a20a 100644 --- a/reactos/lib/ppcmmu/gdblib.c +++ b/reactos/lib/ppcmmu/gdblib.c @@ -249,43 +249,25 @@ void PacketFinish() PacketSent = 0; - do { - if (!count) - { - SerialWrite('$'); - for (i = 0; i < DataOutAddr; i++) - { - SerialWrite(DataOutBuffer[i]); - } - SerialWrite('#'); - SerialWrite(hex[(DataOutCsum >> 4) & 15]); - SerialWrite(hex[DataOutCsum & 15]); - } - while(count-- != 0) - { - if (chr(serport)) - { - ch = SerialRead(); - break; - } - } - - switch (ch) - { - default: - break; + SerialWrite('$'); + for (i = 0; i < DataOutAddr; i++) + { + SerialWrite(DataOutBuffer[i]); + } + SerialWrite('#'); + SerialWrite(hex[(DataOutCsum >> 4) & 15]); + SerialWrite(hex[DataOutCsum & 15]); - case '-': - count = 0; - break; - - case '+': - PacketSent = 1; - break; - } - } while(PacketSent != 1); + while(!chr(serport) && ((ch = SerialRead()) != '+') && (ch != '$')); + if (ch == '$') + { + ParseState = 0; + DataInAddr = 0; + ComputedCsum = 0; + } } + void PacketWriteString(char *str) { while(*str) PacketWriteChar(*str++); @@ -481,8 +463,7 @@ int TakeException(int n, ppc_trap_frame_t *tf) { Signal = n; RegisterSaveArea = tf; - if (SendSignal) - PacketWriteSignal(Signal); + PacketWriteSignal(Signal); SendSignal = 0; Continue = 0; while(!Continue) SerialInterrupt(n, tf); diff --git a/reactos/lib/ppcmmu/mmuobject.c b/reactos/lib/ppcmmu/mmuobject.c index cc8ab4c4535..e01fc80edee 100644 --- a/reactos/lib/ppcmmu/mmuobject.c +++ b/reactos/lib/ppcmmu/mmuobject.c @@ -304,6 +304,9 @@ void initme() /* Serial Interrupt */ callback[5] = SerialInterrupt; + /* Program Exception */ + callback[6] = TakeException; + /* Floating point exception */ callback[8] = fpenable;