blob: 06f6d1f9ad4dcac05d16eeedb3044a03c9c14075 [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
27#elif defined(CONFIG_ARM)
28
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#elif defined(CONFIG_ARM64)
37
38 .text
39 .globl _start
40_start:
41 ldr ip0, =search_hint
42 str sp_el2, [ip0]
43 b main
44
45
46 .globl syscall
47syscall:
48 ldr ip0, =syscall_ptr
49 ldr pc_el2, [ip0]
50
Rafal Jaworowski9d9689f2009-01-23 13:27:16 +010051
52 .globl syscall
53syscall:
54 ldr ip, =syscall_ptr
55 ldr pc, [ip]
56
Stanislav Galabov35d35e82016-02-04 12:13:44 +020057#elif defined(CONFIG_MIPS)
Stanislav Galabov10c7a572016-02-17 15:23:31 +020058#include <asm/asm.h>
Stanislav Galabov35d35e82016-02-04 12:13:44 +020059 .text
60 .globl __start
61 .ent __start
62__start:
Stanislav Galabov10c7a572016-02-17 15:23:31 +020063 PTR_S $sp, search_hint
Stanislav Galabov35d35e82016-02-04 12:13:44 +020064 b main
65 .end __start
66
67 .globl syscall
68 .ent syscall
69syscall:
Stanislav Galabov10c7a572016-02-17 15:23:31 +020070 PTR_S $ra, return_addr
71 PTR_L $t9, syscall_ptr
Stanislav Galabov35d35e82016-02-04 12:13:44 +020072 jalr $t9
73 nop
Stanislav Galabov10c7a572016-02-17 15:23:31 +020074 PTR_L $ra, return_addr
Stanislav Galabov35d35e82016-02-04 12:13:44 +020075 jr $ra
76 nop
77 .end syscall
78
79return_addr:
Stanislav Galabov10c7a572016-02-17 15:23:31 +020080 .align 8
Stanislav Galabov35d35e82016-02-04 12:13:44 +020081 .long 0
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +010082#else
83#error No support for this arch!
84#endif
Rafal Jaworowskia19be782008-01-09 19:39:36 +010085
86 .globl syscall_ptr
87syscall_ptr:
Stanislav Galabov10c7a572016-02-17 15:23:31 +020088 .align 8
Rafal Jaworowskia19be782008-01-09 19:39:36 +010089 .long 0
Rafal Jaworowski3d25ba52009-01-23 13:27:15 +010090
91 .globl search_hint
92search_hint:
93 .long 0