xref: /haiku/src/system/boot/platform/openfirmware/arch/sparc/start.cpp (revision cdbda49e8857ec6958c91a500cbc322304bd487f)
1*cdbda49eSPulkoMandy /*
2*cdbda49eSPulkoMandy  * Copyright 2003-2010, Axel Dörfler, axeld@pinc-software.de.
3*cdbda49eSPulkoMandy  * Copyright 2011, Alexander von Gluck, kallisti5@unixzen.com
4*cdbda49eSPulkoMandy  * Copyright 2019, Adrien Destugues, pulkomandy@pulkomandy.tk
5*cdbda49eSPulkoMandy  * Distributed under the terms of the MIT License.
6*cdbda49eSPulkoMandy  */
7*cdbda49eSPulkoMandy 
8*cdbda49eSPulkoMandy 
9*cdbda49eSPulkoMandy #include "start.h"
10*cdbda49eSPulkoMandy 
11*cdbda49eSPulkoMandy #include "machine.h"
12*cdbda49eSPulkoMandy 
13*cdbda49eSPulkoMandy 
14*cdbda49eSPulkoMandy void
determine_machine(void)15*cdbda49eSPulkoMandy determine_machine(void)
16*cdbda49eSPulkoMandy {
17*cdbda49eSPulkoMandy 	gMachine = MACHINE_UNKNOWN;
18*cdbda49eSPulkoMandy }
19*cdbda49eSPulkoMandy 
20*cdbda49eSPulkoMandy 
21*cdbda49eSPulkoMandy extern "C" void __attribute__((section(".text.start")))
_start(int _reserved,int _argstr,int _arglen,int _unknown,void * openFirmwareEntry)22*cdbda49eSPulkoMandy _start(int _reserved, int _argstr, int _arglen, int _unknown,
23*cdbda49eSPulkoMandy 	void *openFirmwareEntry)
24*cdbda49eSPulkoMandy {
25*cdbda49eSPulkoMandy 	// According to the sparc bindings, OpenFirmware should have created
26*cdbda49eSPulkoMandy 	// a stack of 8kB or higher for us at this point, and window traps are
27*cdbda49eSPulkoMandy 	// operational so it's possible to call the openFirmwareEntry safely.
28*cdbda49eSPulkoMandy 	// The bss segment is already cleared by the firmware as well.
29*cdbda49eSPulkoMandy 
30*cdbda49eSPulkoMandy 	call_ctors();
31*cdbda49eSPulkoMandy 		// call C++ constructors before doing anything else
32*cdbda49eSPulkoMandy 
33*cdbda49eSPulkoMandy 	start(openFirmwareEntry);
34*cdbda49eSPulkoMandy }
35*cdbda49eSPulkoMandy 
36