1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Start assembly for snippets 4 * 5 * Copyright (c) 2021 IBM Corp. 6 * 7 * Authors: 8 * Janosch Frank <frankja@linux.ibm.com> 9 */ 10#include <asm/sigp.h> 11 12.section .init 13 .globl start 14start: 15 /* XOR all registers with themselves to clear them fully. */ 16 .irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 17 xgr \i,\i 18 .endr 19 /* 0x3000 is the stack page for now */ 20 lghi %r15, stackptr 21 sam64 22 brasl %r14, main 23 /* 24 * If main() returns, we stop the CPU with the code below. We also 25 * route some functions that are required by the libc (but not usable 26 * from snippets) to the CPU stop code below, so that snippets can 27 * still be linked against the libc code (to use non-related functions 28 * like memset() etc.) 29 */ 30.global puts 31.global exit 32puts: 33exit: 34 /* For now let's only use cpu 0 in snippets so this will always work. */ 35 xgr %r0, %r0 36 sigp %r2, %r0, SIGP_STOP 37