commit b6889f687659a9c5cf1df7829c242478948a02f8
parent e434f9a14cfd695066a7f6bdc65c3196e780ffd8
Author: Dimitris Papastamos <dimitris.papastamos@arm.com>
Date: Wed, 7 Nov 2018 11:29:10 +0000
[debuglang] Add in_debug/dbgrecover fields in bssmap
When in_debug is set, a longjmp will be performed to return back to
the debug interpreter. If this is not done, doing an RMC in the bare
metal environment will go through switch and exit the interpreter.
Change-Id: I764eccebef1f42577a07dae0fd68cc325194ee2d
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
Diffstat:
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/rcode.h b/include/rcode.h
@@ -1,3 +1,4 @@
+#include <setjmp.h>
#include <stddef.h>
#include <stdint.h>
@@ -78,11 +79,13 @@ enum ecvals {
struct bssmap {
unsigned char in_panic;
+ unsigned char in_debug;
unsigned char dumpstack;
unsigned char backtrace;
void *text;
void *uartbase;
const char *errstr;
+ jmp_buf dbgrecover;
Rmucmd *cmd;
unsigned char enable; /* System realm enablement */
diff --git a/src/debuglang/debuglang.c b/src/debuglang/debuglang.c
@@ -29,8 +29,6 @@ struct named_reg {
size_t offset;
};
-extern jmp_buf recover;
-
static const struct named_reg named_regs[];
static const struct cmd cmds[];
@@ -43,7 +41,7 @@ error(char *fmt, ...)
fputs(PREFIX "ERR ", stdout);
vprintf(fmt, va);
fputc('\n', stdout);
- longjmp(recover, 1);
+ longjmp(bss->dbgrecover, 1);
}
static void
@@ -304,11 +302,13 @@ run(struct trapframe *tf)
void
debug(struct trapframe *fp)
{
+ bss->in_debug = 1;
+
setvbuf(stdin, NULL, _IOLBF, 0);
setvbuf(stdout, NULL, _IOLBF, 0);
printf("begin debug language interface\n");
- setjmp(recover);
+ setjmp(bss->dbgrecover);
for (ready(); run(fp); ready())
;