Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2007 Semihalf |
| 3 | * |
| 4 | * Written by: Rafal Jaworowski <raj@semihalf.com> |
| 5 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #if defined(CONFIG_PPC) |
| 10 | |
| 11 | .text |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 12 | .globl _start |
| 13 | _start: |
Rafal Jaworowski | 3d25ba5 | 2009-01-23 13:27:15 +0100 | [diff] [blame] | 14 | lis %r11, search_hint@ha |
| 15 | addi %r11, %r11, search_hint@l |
| 16 | stw %r1, 0(%r11) |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 17 | b main |
| 18 | |
| 19 | |
| 20 | .globl syscall |
| 21 | syscall: |
| 22 | lis %r11, syscall_ptr@ha |
| 23 | addi %r11, %r11, syscall_ptr@l |
| 24 | lwz %r11, 0(%r11) |
| 25 | mtctr %r11 |
| 26 | bctr |
Rafal Jaworowski | 9d9689f | 2009-01-23 13:27:16 +0100 | [diff] [blame] | 27 | |
| 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 |
| 39 | syscall: |
| 40 | ldr ip, =syscall_ptr |
| 41 | ldr pc, [ip] |
| 42 | |
Stanislav Galabov | 35d35e8 | 2016-02-04 12:13:44 +0200 | [diff] [blame] | 43 | #elif defined(CONFIG_MIPS) |
Stanislav Galabov | 10c7a57 | 2016-02-17 15:23:31 +0200 | [diff] [blame^] | 44 | #include <asm/asm.h> |
Stanislav Galabov | 35d35e8 | 2016-02-04 12:13:44 +0200 | [diff] [blame] | 45 | .text |
| 46 | .globl __start |
| 47 | .ent __start |
| 48 | __start: |
Stanislav Galabov | 10c7a57 | 2016-02-17 15:23:31 +0200 | [diff] [blame^] | 49 | PTR_S $sp, search_hint |
Stanislav Galabov | 35d35e8 | 2016-02-04 12:13:44 +0200 | [diff] [blame] | 50 | b main |
| 51 | .end __start |
| 52 | |
| 53 | .globl syscall |
| 54 | .ent syscall |
| 55 | syscall: |
Stanislav Galabov | 10c7a57 | 2016-02-17 15:23:31 +0200 | [diff] [blame^] | 56 | PTR_S $ra, return_addr |
| 57 | PTR_L $t9, syscall_ptr |
Stanislav Galabov | 35d35e8 | 2016-02-04 12:13:44 +0200 | [diff] [blame] | 58 | jalr $t9 |
| 59 | nop |
Stanislav Galabov | 10c7a57 | 2016-02-17 15:23:31 +0200 | [diff] [blame^] | 60 | PTR_L $ra, return_addr |
Stanislav Galabov | 35d35e8 | 2016-02-04 12:13:44 +0200 | [diff] [blame] | 61 | jr $ra |
| 62 | nop |
| 63 | .end syscall |
| 64 | |
| 65 | return_addr: |
Stanislav Galabov | 10c7a57 | 2016-02-17 15:23:31 +0200 | [diff] [blame^] | 66 | .align 8 |
Stanislav Galabov | 35d35e8 | 2016-02-04 12:13:44 +0200 | [diff] [blame] | 67 | .long 0 |
Rafal Jaworowski | 3d25ba5 | 2009-01-23 13:27:15 +0100 | [diff] [blame] | 68 | #else |
| 69 | #error No support for this arch! |
| 70 | #endif |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 71 | |
| 72 | .globl syscall_ptr |
| 73 | syscall_ptr: |
Stanislav Galabov | 10c7a57 | 2016-02-17 15:23:31 +0200 | [diff] [blame^] | 74 | .align 8 |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 75 | .long 0 |
Rafal Jaworowski | 3d25ba5 | 2009-01-23 13:27:15 +0100 | [diff] [blame] | 76 | |
| 77 | .globl search_hint |
| 78 | search_hint: |
| 79 | .long 0 |