1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * crt0_s.S: Entry function for SPU-side context save.
5 * Copyright (C) 2005 IBM
7 * Entry function for SPU-side of the context save sequence.
8 * Saves all 128 GPRs, sets up an initial stack frame, then
12 #include <asm/spu_csa.h>
18 .space SIZEOF_SPU_SPILL_REGS, 0x0
23 /* SPU Context Save Step 1: Save the first 16 GPRs. */
24 stqa $0, regs_spill + 0
25 stqa $1, regs_spill + 16
26 stqa $2, regs_spill + 32
27 stqa $3, regs_spill + 48
28 stqa $4, regs_spill + 64
29 stqa $5, regs_spill + 80
30 stqa $6, regs_spill + 96
31 stqa $7, regs_spill + 112
32 stqa $8, regs_spill + 128
33 stqa $9, regs_spill + 144
34 stqa $10, regs_spill + 160
35 stqa $11, regs_spill + 176
36 stqa $12, regs_spill + 192
37 stqa $13, regs_spill + 208
38 stqa $14, regs_spill + 224
39 stqa $15, regs_spill + 240
41 /* SPU Context Save, Step 8: Save the remaining 112 GPRs. */
42 ila $3, regs_spill + 256
44 lqr $4, save_reg_insts
47 .balignl 16, 0x40200000
48 save_reg_insts: /* must be quad-word aligned. */
54 stqr $4, save_reg_insts
56 brnz $5, save_reg_loop
58 /* Initialize the stack pointer to point to 16368
59 * (16kb-16). The back chain pointer is initialized
66 /* Allocate a minimum stack frame for the called main.
67 * This is needed so that main has a place to save the
68 * link register when it calls another function.
73 /* Call the program's main function. */
76 /* In this case main should not return; if it does
77 * there has been an error in the sequence. Execute
78 * stop-and-signal with code=0.
86 /* Pad the size of this crt0.o to be multiple of 16 bytes. */