@@ -427,13 +427,13 @@ static void copy_to_ctx(struct gdb_ctx *ctx, const struct arch_esf *stack)
427
427
struct xtensa_register * reg ;
428
428
int idx , num_laddr_regs ;
429
429
430
- uint32_t * bsa = * (int * * )stack ;
430
+ uint32_t * bsa = * (const int * * )stack ;
431
431
432
- if (( int * ) bsa - stack > 4 ) {
432
+ if (bsa - ( const uint32_t * ) stack > 4 ) {
433
433
num_laddr_regs = 8 ;
434
- } else if (( int * ) bsa - stack > 8 ) {
434
+ } else if (bsa - ( const uint32_t * ) stack > 8 ) {
435
435
num_laddr_regs = 12 ;
436
- } else if (( int * ) bsa - stack > 12 ) {
436
+ } else if (bsa - ( const uint32_t * ) stack > 12 ) {
437
437
num_laddr_regs = 16 ;
438
438
} else {
439
439
num_laddr_regs = 4 ;
@@ -445,8 +445,7 @@ static void copy_to_ctx(struct gdb_ctx *ctx, const struct arch_esf *stack)
445
445
446
446
if (reg -> regno == SOC_GDB_REGNO_A1 ) {
447
447
/* A1 is calculated */
448
- reg -> val = POINTER_TO_UINT (
449
- ((char * )bsa ) + BASE_SAVE_AREA_SIZE );
448
+ reg -> val = POINTER_TO_UINT (((char * )bsa ) + sizeof (_xtensa_irq_bsa_t ));
450
449
reg -> seqno = ctx -> seqno ;
451
450
} else {
452
451
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)
518
517
struct xtensa_register * reg ;
519
518
int idx , num_laddr_regs ;
520
519
521
- _xtensa_irq_bsa_t * bsa = (void * )* (int * * )stack ;
520
+ _xtensa_irq_bsa_t * bsa = (void * )* (const int * * )stack ;
522
521
523
- if ((int * )bsa - stack > 4 ) {
522
+ if ((uint32_t * )bsa - ( const uint32_t * ) stack > 4 ) {
524
523
num_laddr_regs = 8 ;
525
- } else if ((int * )bsa - stack > 8 ) {
524
+ } else if ((uint32_t * )bsa - ( const uint32_t * ) stack > 8 ) {
526
525
num_laddr_regs = 12 ;
527
- } else if ((int * )bsa - stack > 12 ) {
526
+ } else if ((uint32_t * )bsa - ( const uint32_t * ) stack > 12 ) {
528
527
num_laddr_regs = 16 ;
529
528
} else {
530
529
num_laddr_regs = 4 ;
@@ -547,7 +546,7 @@ static void restore_from_ctx(struct gdb_ctx *ctx, const struct arch_esf *stack)
547
546
/* Shouldn't be changing stack pointer */
548
547
continue ;
549
548
} else {
550
- bsa [reg -> stack_offset / 4 ] = reg -> val ;
549
+ (( uint32_t * ) bsa ) [reg -> stack_offset / 4 ] = reg -> val ;
551
550
}
552
551
}
553
552
@@ -559,7 +558,7 @@ static void restore_from_ctx(struct gdb_ctx *ctx, const struct arch_esf *stack)
559
558
continue ;
560
559
} else if (reg -> stack_offset != 0 ) {
561
560
/* For those registers stashed in stack */
562
- bsa [reg -> stack_offset / 4 ] = reg -> val ;
561
+ (( uint32_t * ) bsa ) [reg -> stack_offset / 4 ] = reg -> val ;
563
562
} else if (gdb_xtensa_is_special_reg (reg )) {
564
563
/*
565
564
* Currently not writing back any special
0 commit comments