Re: [PATCH v1 1/1] arch: microblaze: allocate stack space for register params
From: Michal Simek
Date: Tue Apr 21 2026 - 04:48:14 EST
On 3/27/26 09:54, Neal Frager wrote:
C functions are invoked with arguments without allocating stack space for
register params (for potential register spills). As a result kernel built
with gcc v15 boot hangs at the point of starting init -.
Remove -.
This patch adds necessary stack space for few C function calls from entry.S
Add necessary.
(not all). After this patch, the kernel boots all the way to login prompt and
root login works. Simple commands like ps work and show normal output.
Signed-off-by: Gopi Kumar Bulusu <gopi@xxxxxxxxxxx>
Tested-by: Neal Frager <neal.frager@xxxxxxx>
If you are sending it you should have sob line here.
---
arch/microblaze/kernel/entry.S | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
index 582d7256d815..2f9604640486 100644
--- a/arch/microblaze/kernel/entry.S
+++ b/arch/microblaze/kernel/entry.S
@@ -339,6 +339,9 @@ C_ENTRY(mb_invalidate_icache):
* Trap entered via brki instruction, so BIP bit is set, and interrupts
* are masked. This is nice, means we don't have to CLI before state save
*/
+
+#define SYSCALL_ARGS_SIZE 36
+
C_ENTRY(_user_exception):
swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */
addi r14, r14, 4 /* return address is 4 byte after call */
@@ -422,16 +425,19 @@ C_ENTRY(_user_exception):
lwi r12, r12, sys_call_table
/* where the trap should return need -8 to adjust for rtsd r15, 8 */
addi r15, r0, ret_from_trap-8
+ addik r1, r1, -SYSCALL_ARGS_SIZE
Please check coding style here.
I will test it on real HW and will talk to you directly about results.
Thanks,
Michal