Blame crt/nt64/crtldso.c

dd0615
#include "psxglue.h"
234f06
#include "peldso.h"
dd0615
dd0615
const int __crtopt_ldso = __PSXOPT_LDSO;
234f06
234f06
/* framework (rtdata) abi */
234f06
static const struct __guid  __ldsoabi  = NT_PROCESS_GUID_RTDATA;
234f06
234f06
/* loader root-relative name */
234f06
static const unsigned short __rrldso[] = {'l','i','b','\\',
234f06
				          'l','i','b','p','s','x','s','c','l',
234f06
				          '.','s','o',0};
234f06
234f06
/* loader root-relative name */
234f06
static const unsigned short __rrlibc[] = {'l','i','b','\\',
234f06
				          'l','i','b','c',
234f06
				          '.','s','o',0};
234f06
234f06
234f06
static unsigned long	__attribute__((section(".dsodata")))
234f06
			__dsodata[65536/sizeof(unsigned long)];
234f06
234f06
void __libc_loader_init(void * __main, int flags)
234f06
{
234f06
	int		status;
234f06
	void *		hroot;
234f06
	void *		hdsodir;
234f06
	void *		ldsobase;
234f06
	void *		libcbase;
234f06
	int  		(*__psx_init)(int *,char ***,char ***,void *);
234f06
	void		(*__libc_entry_routine)(void *,void *,int);
234f06
234f06
	if ((status = __ldso_load_framework_loader_ex(
234f06
			&ldsobase,&hroot,&hdsodir,
234f06
			&__ldsoabi,
234f06
			0,__rrldso,__main,
234f06
			__dsodata,sizeof(__dsodata),
234f06
			PE_LDSO_DEFAULT_EXECUTABLE,
234f06
			&(unsigned int){0})))
234f06
		__ldso_terminate_current_process(status);
234f06
234f06
	if ((status = __ldso_load_framework_library(
234f06
			&libcbase,hroot,__rrlibc,
234f06
			__dsodata,sizeof(__dsodata),
234f06
			&(unsigned int){0})))
234f06
		__ldso_terminate_current_process(status);
234f06
234f06
	if (!(__psx_init = __ldso_get_procedure_address(
234f06
			ldsobase,"__psx_init")))
234f06
		__ldso_terminate_current_process(NT_STATUS_NOINTERFACE);
234f06
234f06
	if (!(__libc_entry_routine = __ldso_get_procedure_address(
234f06
			libcbase,"__libc_entry_routine")))
234f06
		__ldso_terminate_current_process(NT_STATUS_NOINTERFACE);
234f06
234f06
	__libc_entry_routine(__main,__psx_init,flags);
234f06
}