blob: 5a7049d6b4b721f71a85948364d24217e93030ec [file] [log] [blame]
Rafal Jaworowski500856e2008-01-09 19:39:36 +01001/*
2 * (C) Copyright 2007 Semihalf
3 *
4 * Written by: Rafal Jaworowski <raj@semihalf.com>
5 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Rafal Jaworowski500856e2008-01-09 19:39:36 +01007 */
8
9#if defined(CONFIG_PPC)
10
11 .text
Rafal Jaworowski500856e2008-01-09 19:39:36 +010012 .globl _start
13_start:
Rafal Jaworowskib84d7d82009-01-23 13:27:15 +010014 lis %r11, search_hint@ha
15 addi %r11, %r11, search_hint@l
16 stw %r1, 0(%r11)
Rafal Jaworowski500856e2008-01-09 19:39:36 +010017 b main
18
19
20 .globl syscall
21syscall:
22 lis %r11, syscall_ptr@ha
23 addi %r11, %r11, syscall_ptr@l
24 lwz %r11, 0(%r11)
25 mtctr %r11
26 bctr
Rafal Jaworowski7fb6c4f2009-01-23 13:27:16 +010027
28#elif defined(CONFIG_ARM)
29
30 .text
31 .globl _start
32_start:
33 ldr ip, =search_hint
34 str sp, [ip]
35 b main
36
37
38 .globl syscall
39syscall:
40 ldr ip, =syscall_ptr
41 ldr pc, [ip]
42
Stanislav Galabov7c604232016-02-04 12:13:44 +020043#elif defined(CONFIG_MIPS)
Stanislav Galabov78757d52016-02-17 15:23:31 +020044#include <asm/asm.h>
Stanislav Galabov7c604232016-02-04 12:13:44 +020045 .text
46 .globl __start
47 .ent __start
48__start:
Stanislav Galabov78757d52016-02-17 15:23:31 +020049 PTR_S $sp, search_hint
Stanislav Galabov7c604232016-02-04 12:13:44 +020050 b main
51 .end __start
52
53 .globl syscall
54 .ent syscall
55syscall:
Stanislav Galabov78757d52016-02-17 15:23:31 +020056 PTR_S $ra, return_addr
57 PTR_L $t9, syscall_ptr
Stanislav Galabov7c604232016-02-04 12:13:44 +020058 jalr $t9
59 nop
Stanislav Galabov78757d52016-02-17 15:23:31 +020060 PTR_L $ra, return_addr
Stanislav Galabov7c604232016-02-04 12:13:44 +020061 jr $ra
62 nop
63 .end syscall
64
65return_addr:
Stanislav Galabov78757d52016-02-17 15:23:31 +020066 .align 8
Stanislav Galabov7c604232016-02-04 12:13:44 +020067 .long 0
Rafal Jaworowskib84d7d82009-01-23 13:27:15 +010068#else
69#error No support for this arch!
70#endif
Rafal Jaworowski500856e2008-01-09 19:39:36 +010071
72 .globl syscall_ptr
73syscall_ptr:
Stanislav Galabov78757d52016-02-17 15:23:31 +020074 .align 8
Rafal Jaworowski500856e2008-01-09 19:39:36 +010075 .long 0
Rafal Jaworowskib84d7d82009-01-23 13:27:15 +010076
77 .globl search_hint
78search_hint:
79 .long 0