Sweden-Number/loader/main.c

83 lines
2.5 KiB
C

/*
* Emulator initialisation code
*
* Copyright 2000 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#include "wine/library.h"
#include "main.h"
#ifdef __APPLE__
asm(".zerofill WINE_DOS, WINE_DOS, ___wine_dos, 0x60000000");
asm(".zerofill WINE_SHARED_HEAP, WINE_SHARED_HEAP, ___wine_shared_heap, 0x02000000");
extern char __wine_dos[0x60000000], __wine_shared_heap[0x02000000];
static const struct wine_preload_info wine_main_preload_info[] =
{
{ __wine_dos, sizeof(__wine_dos) }, /* DOS area + PE exe */
{ __wine_shared_heap, sizeof(__wine_shared_heap) }, /* shared user data + shared heap */
{ 0, 0 } /* end of list */
};
static inline void reserve_area( void *addr, size_t size )
{
wine_anon_mmap( addr, size, PROT_NONE, MAP_FIXED | MAP_NORESERVE );
wine_mmap_add_reserved_area( addr, size );
}
#else /* __APPLE__ */
/* the preloader will set this variable */
const struct wine_preload_info *wine_main_preload_info = NULL;
static inline void reserve_area( void *addr, size_t size )
{
wine_mmap_add_reserved_area( addr, size );
}
#endif /* __APPLE__ */
/**********************************************************************
* main
*/
int main( int argc, char *argv[] )
{
char error[1024];
int i;
if (wine_main_preload_info)
{
for (i = 0; wine_main_preload_info[i].size; i++)
reserve_area( wine_main_preload_info[i].addr, wine_main_preload_info[i].size );
}
wine_pthread_set_functions( &pthread_functions, sizeof(pthread_functions) );
wine_init( argc, argv, error, sizeof(error) );
fprintf( stderr, "wine: failed to initialize: %s\n", error );
exit(1);
}