Blame crt/nt64/crtvrfs.c

6f8ae4
#include <unistd.h>
6f8ae4
#include <stdint.h>
dd0615
#include "psxglue.h"
234f06
#include "peldso.h"
dd0615
dd0615
const int __crtopt_vrfs = __PSXOPT_VRFS;
234f06
234f06
/* framework (rtdata) abi */
234f06
static const struct __guid  __ldsoabi  = NT_PROCESS_GUID_RTDATA;
234f06
d1c888
/* loader standalone (single directory) name */
234f06
static const unsigned short __sdldso[] = {'l','i','b','p','s','x','s','c','l',
234f06
				          '.','s','o',0};
234f06
d1c888
/* libc standalone (single directory) name */
234f06
static const unsigned short __sdlibc[] = {'l','i','b','c',
234f06
				          '.','s','o',0};
234f06
554d2c
/* pty server root-relative name */
554d2c
static const unsigned short __sdctty[] = {'n','t','c','t','t','y',
554d2c
				          '.','e','x','e',0};
554d2c
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;
554d2c
	int  		(*__psx_init)(
554d2c
				int *,char ***,char ***,
554d2c
				void *);
554d2c
	void		(*__libc_entry_routine)(
554d2c
				void *,void *,
554d2c
				const unsigned short *,
554d2c
				int);
234f06
234f06
	if ((status = __ldso_load_framework_loader_ex(
234f06
			&ldsobase,&hroot,&hdsodir,
234f06
			&__ldsoabi,
234f06
			__sdldso,0,__main,
234f06
			__dsodata,sizeof(__dsodata),
234f06
			PE_LDSO_STANDALONE_EXECUTABLE,
234f06
			&(unsigned int){0})))
234f06
		__ldso_terminate_current_process(status);
234f06
234f06
	if ((status = __ldso_load_framework_library(
234f06
			&libcbase,hdsodir,__sdlibc,
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
554d2c
	__libc_entry_routine(__main,__psx_init,__sdctty,flags);
234f06
}