blob: 57bba9d851dbdb243a8f2480db17aab062932d3c [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Rafal Jaworowski500856e2008-01-09 19:39:36 +01002/*
3 * (C) Copyright 2007 Semihalf
4 *
5 * Written by: Rafal Jaworowski <raj@semihalf.com>
Rafal Jaworowski500856e2008-01-09 19:39:36 +01006 */
7
8#if defined(CONFIG_PPC)
9
10 .text
Rafal Jaworowski500856e2008-01-09 19:39:36 +010011 .globl _start
12_start:
Rafal Jaworowskib84d7d82009-01-23 13:27:15 +010013 lis %r11, search_hint@ha
14 addi %r11, %r11, search_hint@l
15 stw %r1, 0(%r11)
Rafal Jaworowski500856e2008-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 Jaworowski7fb6c4f2009-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
36
37 .globl syscall
38syscall:
39 ldr ip, =syscall_ptr
40 ldr pc, [ip]
41
Stanislav Galabov7c604232016-02-04 12:13:44 +020042#elif defined(CONFIG_MIPS)
Stanislav Galabov78757d52016-02-17 15:23:31 +020043#include <asm/asm.h>
Stanislav Galabov7c604232016-02-04 12:13:44 +020044 .text
45 .globl __start
46 .ent __start
47__start:
Stanislav Galabov78757d52016-02-17 15:23:31 +020048 PTR_S $sp, search_hint
Stanislav Galabov7c604232016-02-04 12:13:44 +020049 b main
50 .end __start
51
52 .globl syscall
53 .ent syscall
54syscall:
Stanislav Galabov78757d52016-02-17 15:23:31 +020055 PTR_S $ra, return_addr
56 PTR_L $t9, syscall_ptr
Stanislav Galabov7c604232016-02-04 12:13:44 +020057 jalr $t9
58 nop
Stanislav Galabov78757d52016-02-17 15:23:31 +020059 PTR_L $ra, return_addr
Stanislav Galabov7c604232016-02-04 12:13:44 +020060 jr $ra
61 nop
62 .end syscall
63
64return_addr:
Stanislav Galabov78757d52016-02-17 15:23:31 +020065 .align 8
Stanislav Galabov7c604232016-02-04 12:13:44 +020066 .long 0
Rafal Jaworowskib84d7d82009-01-23 13:27:15 +010067#else
68#error No support for this arch!
69#endif
Rafal Jaworowski500856e2008-01-09 19:39:36 +010070
71 .globl syscall_ptr
72syscall_ptr:
Stanislav Galabov78757d52016-02-17 15:23:31 +020073 .align 8
Rafal Jaworowski500856e2008-01-09 19:39:36 +010074 .long 0
Rafal Jaworowskib84d7d82009-01-23 13:27:15 +010075
76 .globl search_hint
77search_hint:
78 .long 0