blob: d2a97557817af26316d80edb89dec129530b7b08 [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:
32 ldr ip, =search_hint
33 str sp, [ip]
34 b main
35
Brunham, Kalenba4dc552024-05-17 19:13:48 +000036
Heinrich Schuchardt3d2e2f82024-11-03 06:35:49 +010037 .globl syscall
Brunham, Kalenba4dc552024-05-17 19:13:48 +000038syscall:
Heinrich Schuchardt3d2e2f82024-11-03 06:35:49 +010039 ldr ip, =syscall_ptr
40 ldr pc, [ip]
Brunham, Kalenba4dc552024-05-17 19:13:48 +000041
Heinrich Schuchardt3d2e2f82024-11-03 06:35:49 +010042#elif defined(CONFIG_ARM64)
43
44 .text
45 .globl _start
46_start:
47 ldr x17, =search_hint
48 mov x16, sp
49 str x16, [x17]
50 b main
Rafal Jaworowski9d9689f2009-01-23 13:27:16 +010051
52 .globl syscall
53syscall:
Heinrich Schuchardt3d2e2f82024-11-03 06:35:49 +010054 ldr x16, =syscall_ptr
55 ldr x16, [x16]
56 br x16
Rafal Jaworowski9d9689f2009-01-23 13:27:16 +010057
Stanislav Galabov35d35e82016-02-04 12:13:44 +020058#elif defined(CONFIG_MIPS)
Stanislav Galabov10c7a572016-02-17 15:23:31 +020059#include <asm/asm.h>
Stanislav Galabov35d35e82016-02-04 12:13:44 +020060 .text
61 .globl __start
62 .ent __start
63__start:
Stanislav Galabov10c7a572016-02-17 15:23:31 +020064 PTR_S $sp, search_hint
Stanislav Galabov35d35e82016-02-04 12:13:44 +020065 b main
66 .end __start
67
68 .globl syscall
69 .ent syscall
70syscall:
Stanislav Galabov10c7a572016-02-17 15:23:31 +020071 PTR_S $ra, return_addr
72 PTR_L $t9, syscall_ptr
Stanislav Galabov35d35e82016-02-04 12:13:44 +020073 jalr $t9
74 nop
Stanislav Galabov10c7a572016-02-17 15:23:31 +020075 PTR_L $ra, return_addr
Stanislav Galabov35d35e82016-02-04 12:13:44 +020076 jr $ra
77 nop
78 .end syscall
79
80return_addr:
Stanislav Galabov10c7a572016-02-17 15:23:31 +020081 .align 8
Stanislav Galabov35d35e82016-02-04 12:13:44 +020082 .long 0
Heinrich Schuchardt974cad52024-11-23 09:47:52 +010083#elif defined(CONFIG_ARCH_RV32I)
84
85 .text
86 .globl _start
87_start:
88 la t0, search_hint
89 sw sp, 0(t0)
90 la t0, main
91 jalr x0, t0
92
93 .globl syscall
94syscall:
95 la t0, syscall_ptr
96 lw t0, 0(t0)
97 jalr x0, t0
98
99#elif defined(CONFIG_ARCH_RV64I)
100
101 .text
102 .globl _start
103_start:
104 la t0, search_hint
105 sd sp, 0(t0)
106 la t0, main
107 jalr x0, t0
108
109 .globl syscall
110syscall:
111 la t0, syscall_ptr
112 ld t0, 0(t0)
113 jalr x0, t0
114
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +0100115#else
116#error No support for this arch!
117#endif
Rafal Jaworowskia19be782008-01-09 19:39:36 +0100118
Heinrich Schuchardt3d2e2f82024-11-03 06:35:49 +0100119.section .data
120
Rafal Jaworowskia19be782008-01-09 19:39:36 +0100121 .globl syscall_ptr
122syscall_ptr:
Stanislav Galabov10c7a572016-02-17 15:23:31 +0200123 .align 8
Rafal Jaworowskia19be782008-01-09 19:39:36 +0100124 .long 0
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +0100125
126 .globl search_hint
127search_hint:
Heinrich Schuchardt3d2e2f82024-11-03 06:35:49 +0100128 .long 0