xtensa: gdbstub: fix compilation
Building gdbstub for xtensa is failing currently with multiple failures like arch/xtensa/core/gdbstub.c:432:24: error: invalid operands to \ binary - (have 'int *' and 'const struct arch_esf *') 432 | if ((int *)bsa - stack > 4) { Fix them by using appropriate pointer types. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
92a32a903d
commit
5769c4d565
1 changed files with 11 additions and 12 deletions
|
@ -427,13 +427,13 @@ static void copy_to_ctx(struct gdb_ctx *ctx, const struct arch_esf *stack)
|
||||||
struct xtensa_register *reg;
|
struct xtensa_register *reg;
|
||||||
int idx, num_laddr_regs;
|
int idx, num_laddr_regs;
|
||||||
|
|
||||||
uint32_t *bsa = *(int **)stack;
|
uint32_t *bsa = *(const int **)stack;
|
||||||
|
|
||||||
if ((int *)bsa - stack > 4) {
|
if (bsa - (const uint32_t *)stack > 4) {
|
||||||
num_laddr_regs = 8;
|
num_laddr_regs = 8;
|
||||||
} else if ((int *)bsa - stack > 8) {
|
} else if (bsa - (const uint32_t *)stack > 8) {
|
||||||
num_laddr_regs = 12;
|
num_laddr_regs = 12;
|
||||||
} else if ((int *)bsa - stack > 12) {
|
} else if (bsa - (const uint32_t *)stack > 12) {
|
||||||
num_laddr_regs = 16;
|
num_laddr_regs = 16;
|
||||||
} else {
|
} else {
|
||||||
num_laddr_regs = 4;
|
num_laddr_regs = 4;
|
||||||
|
@ -445,8 +445,7 @@ static void copy_to_ctx(struct gdb_ctx *ctx, const struct arch_esf *stack)
|
||||||
|
|
||||||
if (reg->regno == SOC_GDB_REGNO_A1) {
|
if (reg->regno == SOC_GDB_REGNO_A1) {
|
||||||
/* A1 is calculated */
|
/* A1 is calculated */
|
||||||
reg->val = POINTER_TO_UINT(
|
reg->val = POINTER_TO_UINT(((char *)bsa) + sizeof(_xtensa_irq_bsa_t));
|
||||||
((char *)bsa) + BASE_SAVE_AREA_SIZE);
|
|
||||||
reg->seqno = ctx->seqno;
|
reg->seqno = ctx->seqno;
|
||||||
} else {
|
} else {
|
||||||
reg->val = bsa[reg->stack_offset / 4];
|
reg->val = bsa[reg->stack_offset / 4];
|
||||||
|
@ -518,13 +517,13 @@ static void restore_from_ctx(struct gdb_ctx *ctx, const struct arch_esf *stack)
|
||||||
struct xtensa_register *reg;
|
struct xtensa_register *reg;
|
||||||
int idx, num_laddr_regs;
|
int idx, num_laddr_regs;
|
||||||
|
|
||||||
_xtensa_irq_bsa_t *bsa = (void *)*(int **)stack;
|
_xtensa_irq_bsa_t *bsa = (void *)*(const int **)stack;
|
||||||
|
|
||||||
if ((int *)bsa - stack > 4) {
|
if ((uint32_t *)bsa - (const uint32_t *)stack > 4) {
|
||||||
num_laddr_regs = 8;
|
num_laddr_regs = 8;
|
||||||
} else if ((int *)bsa - stack > 8) {
|
} else if ((uint32_t *)bsa - (const uint32_t *)stack > 8) {
|
||||||
num_laddr_regs = 12;
|
num_laddr_regs = 12;
|
||||||
} else if ((int *)bsa - stack > 12) {
|
} else if ((uint32_t *)bsa - (const uint32_t *)stack > 12) {
|
||||||
num_laddr_regs = 16;
|
num_laddr_regs = 16;
|
||||||
} else {
|
} else {
|
||||||
num_laddr_regs = 4;
|
num_laddr_regs = 4;
|
||||||
|
@ -547,7 +546,7 @@ static void restore_from_ctx(struct gdb_ctx *ctx, const struct arch_esf *stack)
|
||||||
/* Shouldn't be changing stack pointer */
|
/* Shouldn't be changing stack pointer */
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
bsa[reg->stack_offset / 4] = reg->val;
|
((uint32_t *)bsa)[reg->stack_offset / 4] = reg->val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +558,7 @@ static void restore_from_ctx(struct gdb_ctx *ctx, const struct arch_esf *stack)
|
||||||
continue;
|
continue;
|
||||||
} else if (reg->stack_offset != 0) {
|
} else if (reg->stack_offset != 0) {
|
||||||
/* For those registers stashed in stack */
|
/* For those registers stashed in stack */
|
||||||
bsa[reg->stack_offset / 4] = reg->val;
|
((uint32_t *)bsa)[reg->stack_offset / 4] = reg->val;
|
||||||
} else if (gdb_xtensa_is_special_reg(reg)) {
|
} else if (gdb_xtensa_is_special_reg(reg)) {
|
||||||
/*
|
/*
|
||||||
* Currently not writing back any special
|
* Currently not writing back any special
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue