blob: 6899ebf8ac2fae63bb0e89aeb743e2e6340e61d7 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Rafal Jaworowskia19be782008-01-09 19:39:36 +01002/*
3 * (C) Copyright 2007 Semihalf
4 *
5 * Written by: Rafal Jaworowski <raj@semihalf.com>
Rafal Jaworowskia19be782008-01-09 19:39:36 +01006 */
7
8#if defined(CONFIG_PPC)
9
10 .text
Rafal Jaworowskia19be782008-01-09 19:39:36 +010011 .globl _start
12_start:
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +010013 lis %r11, search_hint@ha
14 addi %r11, %r11, search_hint@l
15 stw %r1, 0(%r11)
Rafal Jaworowskia19be782008-01-09 19:39:36 +010016 b main
17
18
19 .globl syscall
20syscall:
21 lis %r11, syscall_ptr@ha
22 addi %r11, %r11, syscall_ptr@l
23 lwz %r11, 0(%r11)
24 mtctr %r11
25 bctr
Rafal Jaworowski9d9689f2009-01-23 13:27:16 +010026
Heinrich Schuchardt3d2e2f82024-11-03 06:35:49 +010027#elif defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
Rafal Jaworowski9d9689f2009-01-23 13:27:16 +010028
29 .text
30 .globl _start
31_start:
Liya Huang9ed7dec2025-01-28 09:13:16 +080032 ldr r4, =search_hint
33 mov r5, sp
34 str r5, [r4]
Rafal Jaworowski9d9689f2009-01-23 13:27:16 +010035 b main
36
Brunham, Kalenba4dc552024-05-17 19:13:48 +000037
Heinrich Schuchardt3d2e2f82024-11-03 06:35:49 +010038 .globl syscall
Brunham, Kalenba4dc552024-05-17 19:13:48 +000039syscall:
Liya Huang9ed7dec2025-01-28 09:13:16 +080040 ldr r4, =syscall_ptr
41 ldr r4, [r4]
42 bx r4
Brunham, Kalenba4dc552024-05-17 19:13:48 +000043
Heinrich Schuchardt3d2e2f82024-11-03 06:35:49 +010044#elif defined(CONFIG_ARM64)
45
46 .text
47 .globl _start
48_start:
49 ldr x17, =search_hint
50 mov x16, sp
51 str x16, [x17]
52 b main
Rafal Jaworowski9d9689f2009-01-23 13:27:16 +010053
54 .globl syscall
55syscall:
Heinrich Schuchardt3d2e2f82024-11-03 06:35:49 +010056 ldr x16, =syscall_ptr
57 ldr x16, [x16]
58 br x16
Rafal Jaworowski9d9689f2009-01-23 13:27:16 +010059
Stanislav Galabov35d35e82016-02-04 12:13:44 +020060#elif defined(CONFIG_MIPS)
Stanislav Galabov10c7a572016-02-17 15:23:31 +020061#include <asm/asm.h>
Stanislav Galabov35d35e82016-02-04 12:13:44 +020062 .text
63 .globl __start
64 .ent __start
65__start:
Stanislav Galabov10c7a572016-02-17 15:23:31 +020066 PTR_S $sp, search_hint
Stanislav Galabov35d35e82016-02-04 12:13:44 +020067 b main
68 .end __start
69
70 .globl syscall
71 .ent syscall
72syscall:
Stanislav Galabov10c7a572016-02-17 15:23:31 +020073 PTR_S $ra, return_addr
74 PTR_L $t9, syscall_ptr
Stanislav Galabov35d35e82016-02-04 12:13:44 +020075 jalr $t9
76 nop
Stanislav Galabov10c7a572016-02-17 15:23:31 +020077 PTR_L $ra, return_addr
Stanislav Galabov35d35e82016-02-04 12:13:44 +020078 jr $ra
79 nop
80 .end syscall
81
82return_addr:
Stanislav Galabov10c7a572016-02-17 15:23:31 +020083 .align 8
Stanislav Galabov35d35e82016-02-04 12:13:44 +020084 .long 0
Heinrich Schuchardt974cad52024-11-23 09:47:52 +010085#elif defined(CONFIG_ARCH_RV32I)
86
87 .text
88 .globl _start
89_start:
90 la t0, search_hint
91 sw sp, 0(t0)
92 la t0, main
93 jalr x0, t0
94
95 .globl syscall
96syscall:
97 la t0, syscall_ptr
98 lw t0, 0(t0)
99 jalr x0, t0
100
101#elif defined(CONFIG_ARCH_RV64I)
102
103 .text
104 .globl _start
105_start:
106 la t0, search_hint
107 sd sp, 0(t0)
108 la t0, main
109 jalr x0, t0
110
111 .globl syscall
112syscall:
113 la t0, syscall_ptr
114 ld t0, 0(t0)
115 jalr x0, t0
116
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +0100117#else
118#error No support for this arch!
119#endif
Rafal Jaworowskia19be782008-01-09 19:39:36 +0100120
Heinrich Schuchardt3d2e2f82024-11-03 06:35:49 +0100121.section .data
122
Rafal Jaworowskia19be782008-01-09 19:39:36 +0100123 .globl syscall_ptr
124syscall_ptr:
Stanislav Galabov10c7a572016-02-17 15:23:31 +0200125 .align 8
Rafal Jaworowskia19be782008-01-09 19:39:36 +0100126 .long 0
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +0100127
128 .globl search_hint
129search_hint:
Heinrich Schuchardt3d2e2f82024-11-03 06:35:49 +0100130 .long 0