xref: /freebsd/stand/kboot/libkboot/arch/powerpc64/start_arch.h (revision a03411e84728e9b267056fd31c7d1d9d1dc1b01e)
1*a03411e8SWarner Losh /*
2*a03411e8SWarner Losh  * Copyright (c) 2022 Netflix, Inc
3*a03411e8SWarner Losh  *
4*a03411e8SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
5*a03411e8SWarner Losh  */
6*a03411e8SWarner Losh 
7*a03411e8SWarner Losh /*
8*a03411e8SWarner Losh  * Due to the PowerPC ABI, We can call main directly from here, so do so.
9*a03411e8SWarner Losh  *
10*a03411e8SWarner Losh  * Note: there may be some static initializers that aren't called, but we don't
11*a03411e8SWarner Losh  * worry about that elsewhere. This is a stripped down environment.
12*a03411e8SWarner Losh  *
13*a03411e8SWarner Losh  * I think we could also do something like
14*a03411e8SWarner Losh  *
15*a03411e8SWarner Losh  * mflr		r0
16*a03411e8SWarner Losh  * stw		r0,4(r1)
17*a03411e8SWarner Losh  * stwu		r1,-16(r1)
18*a03411e8SWarner Losh  * b		_start_c
19*a03411e8SWarner Losh  *
20*a03411e8SWarner Losh  * But my powerpc assembler fu is quite lacking...
21*a03411e8SWarner Losh  */
22*a03411e8SWarner Losh 
23*a03411e8SWarner Losh #define __unused __attribute__((__unused__))
24*a03411e8SWarner Losh 
25*a03411e8SWarner Losh void
_start(int argc,const char ** argv,char ** env,void * obj __unused,void (* cleanup)(void)__unused)26*a03411e8SWarner Losh _start(int argc, const char **argv, char **env, void *obj __unused,
27*a03411e8SWarner Losh     void (*cleanup)(void) __unused)
28*a03411e8SWarner Losh {
29*a03411e8SWarner Losh 	main(argc, argv, env);
30*a03411e8SWarner Losh }
31