Skip to content

Commit 7bfba2c

Browse files
sravnborgandreas-gaisler
authored andcommitted
sparc32: Fix build with trapbase
Fix the following build errors: irq_32.c:258:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1] irq_32.c:271:14: error: assignment to 'struct tt_entry *' from incompatible pointer type 'struct tt_entry (*)[] trapbase is a pointer to an array of tt_entry, but the code declared it as a pointer so the compiler see a single entry and not an array. Fix this by modifyinf the declaration to be an array, and modify all users to take the address of the first member. Signed-off-by: Sam Ravnborg <[email protected]> Acked-by: Randy Dunlap <[email protected]> Tested-by: Randy Dunlap <[email protected]> # build-tested Cc: Andreas Larsson <[email protected]> Cc: "David S. Miller" <[email protected]> Reviewed-by: Andreas Larsson <[email protected]> Tested-by: Andreas Larsson <[email protected]> Signed-off-by: Andreas Larsson <[email protected]> Link: https://lore.kernel.org/r/20240224-sam-fix-sparc32-all-builds-v2-2-1f186603c5c4@ravnborg.org
1 parent 802a887 commit 7bfba2c

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

arch/sparc/kernel/irq_32.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,11 @@ int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler)
268268
if (sparc_cpu_model != sparc_leon) {
269269
struct tt_entry *trap_table;
270270

271-
trap_table = &trapbase_cpu1;
271+
trap_table = &trapbase_cpu1[0];
272272
INSTANTIATE(trap_table)
273-
trap_table = &trapbase_cpu2;
273+
trap_table = &trapbase_cpu2[0];
274274
INSTANTIATE(trap_table)
275-
trap_table = &trapbase_cpu3;
275+
trap_table = &trapbase_cpu3[0];
276276
INSTANTIATE(trap_table)
277277
}
278278
#endif

arch/sparc/kernel/kernel.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ extern unsigned int t_nmi[];
138138
extern unsigned int linux_trap_ipi15_sun4d[];
139139
extern unsigned int linux_trap_ipi15_sun4m[];
140140

141-
extern struct tt_entry trapbase;
142-
extern struct tt_entry trapbase_cpu1;
143-
extern struct tt_entry trapbase_cpu2;
144-
extern struct tt_entry trapbase_cpu3;
141+
extern struct tt_entry trapbase[];
142+
extern struct tt_entry trapbase_cpu1[];
143+
extern struct tt_entry trapbase_cpu2[];
144+
extern struct tt_entry trapbase_cpu3[];
145145

146146
extern char cputypval[];
147147

arch/sparc/kernel/kgdb_32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
3737
gdb_regs[GDB_Y] = regs->y;
3838
gdb_regs[GDB_PSR] = regs->psr;
3939
gdb_regs[GDB_WIM] = 0;
40-
gdb_regs[GDB_TBR] = (unsigned long) &trapbase;
40+
gdb_regs[GDB_TBR] = (unsigned long) &trapbase[0];
4141
gdb_regs[GDB_PC] = regs->pc;
4242
gdb_regs[GDB_NPC] = regs->npc;
4343
gdb_regs[GDB_FSR] = 0;
@@ -72,7 +72,7 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
7272

7373
gdb_regs[GDB_PSR] = t->kpsr;
7474
gdb_regs[GDB_WIM] = t->kwim;
75-
gdb_regs[GDB_TBR] = (unsigned long) &trapbase;
75+
gdb_regs[GDB_TBR] = (unsigned long) &trapbase[0];
7676
gdb_regs[GDB_PC] = t->kpc;
7777
gdb_regs[GDB_NPC] = t->kpc + 4;
7878
gdb_regs[GDB_FSR] = 0;

arch/sparc/kernel/leon_smp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,13 @@ void __init leon_smp_done(void)
245245

246246
/* Free unneeded trap tables */
247247
if (!cpu_present(1)) {
248-
free_reserved_page(virt_to_page(&trapbase_cpu1));
248+
free_reserved_page(virt_to_page(&trapbase_cpu1[0]));
249249
}
250250
if (!cpu_present(2)) {
251-
free_reserved_page(virt_to_page(&trapbase_cpu2));
251+
free_reserved_page(virt_to_page(&trapbase_cpu2[0]));
252252
}
253253
if (!cpu_present(3)) {
254-
free_reserved_page(virt_to_page(&trapbase_cpu3));
254+
free_reserved_page(virt_to_page(&trapbase_cpu3[0]));
255255
}
256256
/* Ok, they are spinning and ready to go. */
257257
smp_processors_ready = 1;

arch/sparc/kernel/setup_32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static void prom_sync_me(void)
6767
__asm__ __volatile__("wr %0, 0x0, %%tbr\n\t"
6868
"nop\n\t"
6969
"nop\n\t"
70-
"nop\n\t" : : "r" (&trapbase));
70+
"nop\n\t" : : "r" (&trapbase[0]));
7171

7272
prom_printf("PROM SYNC COMMAND...\n");
7373
show_mem();
@@ -285,7 +285,7 @@ void __init setup_arch(char **cmdline_p)
285285
int i;
286286
unsigned long highest_paddr;
287287

288-
sparc_ttable = &trapbase;
288+
sparc_ttable = &trapbase[0];
289289

290290
/* Initialize PROM console and command line. */
291291
*cmdline_p = prom_getbootargs();

0 commit comments

Comments
 (0)