Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

m68k: sun3: Fix DEBUG_MMU_EMU build

With DEBUG_MMU_EMU enabled:

arch/m68k/sun3/mmu_emu.c: In function ‘mmu_emu_handle_fault’:
arch/m68k/sun3/mmu_emu.c:420:38: error: implicit declaration of function ‘get_fs’; did you mean ‘sget_fc’? [-Werror=implicit-function-declaration]
420 | pr_info("seg:%ld crp:%p ->", get_fs().seg, crp);
| ^~~~~~

[...]

arch/m68k/sun3/mmu_emu.c:420:46: error: request for member ‘seg’ in something not a structure or union
420 | pr_info("seg:%ld crp:%p ->", get_fs().seg, crp);
| ^

Fix this by reintroducing and using a helper to retrieve the current
value of the DFC register.

While at it, replace "%p" by "%px", as there is no point in printing
obfuscated pointers during debugging.

Fixes: 9fde0348640252c7 ("m68k: Remove set_fs()")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/b1d12a1d24b4aea9f98d905383ba932b2dc382e6.1737387419.git.geert@linux-m68k.org

+16 -2
+14
arch/m68k/include/asm/processor.h
··· 95 95 "movec %0,%/dfc\n\t" 96 96 : /* no outputs */ : "r" (val) : "memory"); 97 97 } 98 + 99 + static inline unsigned long get_fc(void) 100 + { 101 + unsigned long val; 102 + 103 + __asm__ ("movec %/dfc,%0" : "=r" (val) : ); 104 + 105 + return val; 106 + } 98 107 #else 99 108 static inline void set_fc(unsigned long val) 100 109 { 110 + } 111 + 112 + static inline unsigned long get_fc(void) 113 + { 114 + return USER_DATA; 101 115 } 102 116 #endif /* CONFIG_CPU_HAS_ADDRESS_SPACES */ 103 117
+2 -2
arch/m68k/sun3/mmu_emu.c
··· 371 371 } 372 372 373 373 #ifdef DEBUG_MMU_EMU 374 - pr_info("%s: vaddr=%lx type=%s crp=%p\n", __func__, vaddr, 374 + pr_info("%s: vaddr=%lx type=%s crp=%px\n", __func__, vaddr, 375 375 str_read_write(read_flag), crp); 376 376 #endif 377 377 ··· 418 418 pte_val (*pte) |= SUN3_PAGE_ACCESSED; 419 419 420 420 #ifdef DEBUG_MMU_EMU 421 - pr_info("seg:%ld crp:%p ->", get_fs().seg, crp); 421 + pr_info("seg:%ld crp:%px ->", get_fc(), crp); 422 422 print_pte_vaddr (vaddr); 423 423 pr_cont("\n"); 424 424 #endif