9os

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit cccce1659a14d7e69a2a2b3d200557f20f259a98
parent ab54c2e52816118a7fb61460b204bd83bc939b71
Author: Roberto Vargas <roberto.vargas@arm.com>
Date:   Thu, 21 Feb 2019 09:58:24 +0000

[dlang] Remove regstr.c file

It doesn't make sense to have this additional file
because the functionality can be moved to rmc.c

Change-Id: Ib3f91000e22b5e54280aa2f82bc4994a68d28b2b

Diffstat:
Minclude/rcode/rcode.h | 5++++-
Minclude/rcode/romfw.h | 1+
Msrc/romfw/Makefile | 1-
Msrc/romfw/dlang.c | 16++--------------
Dsrc/romfw/regstr.c | 47-----------------------------------------------
Msrc/romfw/rmc.c | 44++++++++++++++++++++++++++++++++++++++++++--
6 files changed, 49 insertions(+), 65 deletions(-)

diff --git a/include/rcode/rcode.h b/include/rcode/rcode.h @@ -93,7 +93,7 @@ extern noreturn void badcmd(int error); extern void rmc(Rmucmd *cmd); extern int debug(void); extern void idev(void); -extern char *regstr(enum regidx r); +extern void dumpregs(struct trapframe *fp); /* driver functions */ extern int create(const char *name, int flags); @@ -122,3 +122,6 @@ extern void unlock(mutex_t *m); /* dlang.c */ extern unsigned in_debug; extern jmp_buf dbgrecover; + +/* rmc.c */ +extern const char *const regnames[]; diff --git a/include/rcode/romfw.h b/include/rcode/romfw.h @@ -6,3 +6,4 @@ struct trapframe; extern struct rmctab romtab; extern struct rmctab *rmctab; extern struct trapframe *framep; +extern const char *const regnames[]; diff --git a/src/romfw/Makefile b/src/romfw/Makefile @@ -4,7 +4,6 @@ include $(PROJECTDIR)/scripts/rules.mk OBJS = rmc.o \ ecstr.o \ - regstr.o \ rmu.o \ dlang.o \ diff --git a/src/romfw/dlang.c b/src/romfw/dlang.c @@ -53,18 +53,6 @@ ready(void) kputs(PREFIX "READY\n"); } -static void -print_tf(struct trapframe *fp) -{ - int i; - - for (i = X0; i < NR_REGS; i++) - kprint("%s=0x%llx%c", regstr(i), fp->r[i], - (i > 0 && i % 4 == 0) ? '\n' : ' '); - if (i % 4 == 0) - kputc('\n'); -} - /* Read a value in a given base between 2 and 16 0 means default base; * 10, unless the string begins with "0x" or "0b" */ @@ -90,7 +78,7 @@ get_named_reg(char *name, struct trapframe *fp) int i; for (i = 0; i < NR_REGS; i++) - if (strcmp(name, regstr(i)) == 0) + if (strcmp(name, regnames[i]) == 0) return &fp->r[i]; return NULL; } @@ -151,7 +139,7 @@ do_get(const struct cmd *cmd, struct args *args) static int do_dump(const struct cmd *cmd, struct args *args) { - print_tf(framep); + dumpregs(framep); return 0; } diff --git a/src/romfw/regstr.c b/src/romfw/regstr.c @@ -1,47 +0,0 @@ -#include <rcode/rcode.h> - -static const char *const regtbl[] = { - [X0] = "x0", - [X1] = "x1", - [X2] = "x2", - [X3] = "x3", - [X4] = "x4", - [X5] = "x5", - [X6] = "x6", - [X7] = "x7", - [X8] = "x8", - [X9] = "x9", - [X10] = "x10", - [X11] = "x11", - [X12] = "x12", - [X13] = "x13", - [X14] = "x14", - [X15] = "x15", - [X16] = "x16", - [X17] = "x17", - [X18] = "x18", - [X19] = "x19", - [X20] = "x20", - [X21] = "x21", - [X22] = "x22", - [X23] = "x23", - [X24] = "x24", - [X25] = "x25", - [X26] = "x26", - [X27] = "x27", - [X28] = "x28", - [X29] = "x29", - [ELR] = "elr", - [X30] = "x30", - [SPSR] = "spsr", - [ESR] = "esr", - [SP] = "sp", - [FAR] = "far", - NULL -}; - -char * -regstr(enum regidx r) -{ - return regtbl[r]; -} diff --git a/src/romfw/rmc.c b/src/romfw/rmc.c @@ -16,13 +16,53 @@ static unsigned in_backtrace; static struct rmucmd *rmucmd; static char *errstr; -static void +const char *const regnames[] = { + [X0] = "x0", + [X1] = "x1", + [X2] = "x2", + [X3] = "x3", + [X4] = "x4", + [X5] = "x5", + [X6] = "x6", + [X7] = "x7", + [X8] = "x8", + [X9] = "x9", + [X10] = "x10", + [X11] = "x11", + [X12] = "x12", + [X13] = "x13", + [X14] = "x14", + [X15] = "x15", + [X16] = "x16", + [X17] = "x17", + [X18] = "x18", + [X19] = "x19", + [X20] = "x20", + [X21] = "x21", + [X22] = "x22", + [X23] = "x23", + [X24] = "x24", + [X25] = "x25", + [X26] = "x26", + [X27] = "x27", + [X28] = "x28", + [X29] = "x29", + [ELR] = "elr", + [X30] = "x30", + [SPSR] = "spsr", + [ESR] = "esr", + [SP] = "sp", + [FAR] = "far", + NULL +}; + +void dumpregs(struct trapframe *fp) { int i; for (i = X0; i < NR_REGS; i++) - kprint("%s=0x%llx%c", regstr(i), fp->r[i], + kprint("%s=0x%llx%c", regnames[i], fp->r[i], (i > 0 && i % 4 == 0) ? '\n' : ' '); if (i % 4 == 0) kputc('\n');