/contrib/sdk/sources/newlib/libc/include/kos32sys.h |
---|
470,14 → 470,6 |
::"a"(73),"b"(0),"c"(&bc.dstx)); |
}; |
void* load_library(const char *name); |
void* get_proc_address(void *handle, const char *proc_name); |
void enumerate_libraries(int (*callback)(void *handle, const char* name, |
uint32_t base, uint32_t size, void *user_data), |
void *user_data); |
#ifdef __cplusplus |
} |
#endif |
/contrib/sdk/sources/newlib/libc/pe/loader.c |
---|
53,8 → 53,8 |
uint32_t refcount; |
char *start; |
char *end; |
void *start; |
uint32_t end; |
void *entry; |
70,6 → 70,7 |
int path_len; |
}dll_path_t; |
module_t* load_library(const char *name); |
LIST_HEAD(path_list); |
230,7 → 231,7 |
nt->OptionalHeader.DataDirectory[0].VirtualAddress); |
libc_dll.start = libc_image; |
libc_dll.end = MakePtr(char*,libc_image, nt->OptionalHeader.SizeOfImage); |
libc_dll.end = MakePtr(uint32_t,libc_image, nt->OptionalHeader.SizeOfImage); |
libc_dll.img_hdr = nt; |
libc_dll.img_sec = MakePtr(PIMAGE_SECTION_HEADER,nt, sizeof(IMAGE_NT_HEADERS32)); |
341,6 → 342,8 |
return img_base; |
}; |
//static jmp_buf loader_env; |
//static loader_recursion; |
int link_image(void *img_base, PIMAGE_IMPORT_DESCRIPTOR imp) |
{ |
454,6 → 457,7 |
}; |
}; |
minn = 0; |
maxn = exp->NumberOfNames - 1; |
while (minn <= maxn) |
577,10 → 581,9 |
}; |
void *get_proc_address(void *handle, const char *proc_name) |
void *get_proc_address(module_t *module, char *proc_name) |
{ |
module_t *module = handle; |
PIMAGE_DOS_HEADER expdos; |
PIMAGE_NT_HEADERS32 expnt; |
PIMAGE_EXPORT_DIRECTORY exp; |
679,7 → 682,7 |
return img_base; |
} |
void* load_library(const char *name) |
module_t* load_library(const char *name) |
{ |
PIMAGE_DOS_HEADER dos; |
PIMAGE_NT_HEADERS32 nt; |
735,10 → 738,10 |
if( unlikely(img_base == NULL) ) |
{ |
printf("unable to load %s\n", name); |
return 0; |
return NULL; |
}; |
module = malloc(sizeof(module_t)); |
module = (module_t*)malloc(sizeof(module_t)); |
if(unlikely(module == NULL)) |
{ |
759,7 → 762,7 |
exp = MakePtr(PIMAGE_EXPORT_DIRECTORY, img_base, |
nt->OptionalHeader.DataDirectory[0].VirtualAddress); |
module->end = MakePtr(char*,img_base, nt->OptionalHeader.SizeOfImage); |
module->end = MakePtr(uint32_t,img_base, nt->OptionalHeader.SizeOfImage); |
module->img_hdr = nt; |
module->img_sec = MakePtr(PIMAGE_SECTION_HEADER,nt, sizeof(IMAGE_NT_HEADERS32)); |
799,19 → 802,7 |
err1: |
user_free(img_base); |
return NULL; |
}; |
void enumerate_libraries(int (*callback)(void *handle, const char* name, |
uint32_t base, uint32_t size, void *user_data), |
void *user_data) |
{ |
module_t *mod = &libc_dll; |
do |
{ |
if(0 == callback(mod, mod->img_name, (uint32_t)mod->start, |
mod->end - mod->start, user_data)) |
break; |
mod = (module_t*)mod->list.next; |
}while(mod != &libc_dll); |
} |
/contrib/sdk/sources/newlib/libc/crt/crtdll.c |
---|
25,21 → 25,20 |
int (*main)(int argc, char **argv, char **envp); |
}; |
void _pei386_runtime_relocator (void); |
void init_loader(void *libc_image); |
void init_reent(); |
int _argc; |
char **_argv; |
int link_app(); |
void* get_entry_point(void *raw); |
int (*entry)(int, char **, char **); |
char __appcwd[1024]; |
int __appcwdlen; |
char* __appenv; |
int __appenv_size; |
void init_loader(void *libc_image); |
extern char _tls_map[128]; |
void init_reent(); |
jmp_buf loader_env; |
void __attribute__((noreturn)) |
__thread_startup (int (*entry)(void*), void *param, |
void *stacklow, void *stackhigh) |
46,7 → 45,7 |
{ |
int retval; |
// asm volatile ( "xchgw %bx, %bx"); |
asm volatile ( "xchgw %bx, %bx"); |
__asm__ __volatile__( // save stack limits |
"movl %0, %%fs:8 \n\t" // use TLS |
65,129 → 64,29 |
return NULL; |
} |
static int split_cmdline(char *cmdline, char **argv) |
{ |
enum quote_state |
{ |
QUOTE_NONE, /* no " active in current parm */ |
QUOTE_DELIMITER, /* " was first char and must be last */ |
QUOTE_STARTED /* " was seen, look for a match */ |
}; |
void _pei386_runtime_relocator (void); |
int link_app(); |
enum quote_state state; |
unsigned int argc; |
char *p = cmdline; |
char *new_arg, *start; |
char __appcwd[1024]; |
int __appcwdlen; |
char* __appenv; |
int __appenv_size; |
argc = 0; |
static char *arg[2]; |
for(;;) |
{ |
/* skip over spaces and tabs */ |
if ( *p ) |
{ |
while (*p == ' ' || *p == '\t') |
++p; |
} |
extern char _tls_map[128]; |
if (*p == '\0') |
break; |
state = QUOTE_NONE; |
if( *p == '\"' ) |
{ |
p++; |
state = QUOTE_DELIMITER; |
} |
new_arg = start = p; |
for (;;) |
{ |
if( *p == '\"' ) |
{ |
p++; |
if( state == QUOTE_NONE ) |
{ |
state = QUOTE_STARTED; |
} |
else |
{ |
state = QUOTE_NONE; |
} |
continue; |
} |
if( *p == ' ' || *p == '\t' ) |
{ |
if( state == QUOTE_NONE ) |
{ |
break; |
} |
} |
if( *p == '\0' ) |
break; |
if( *p == '\\' ) |
{ |
if( p[1] == '\"' ) |
{ |
++p; |
if( p[-2] == '\\' ) |
{ |
continue; |
} |
} |
} |
if( argv ) |
{ |
*(new_arg++) = *p; |
} |
++p; |
}; |
if( argv ) |
{ |
argv[ argc ] = start; |
++argc; |
/* |
The *new = '\0' is req'd in case there was a \" to " |
translation. It must be after the *p check against |
'\0' because new and p could point to the same char |
in which case the scan would be terminated too soon. |
*/ |
if( *p == '\0' ) |
{ |
*new_arg = '\0'; |
break; |
} |
*new_arg = '\0'; |
++p; |
} |
else |
{ |
++argc; |
if( *p == '\0' ) |
{ |
break; |
} |
++p; |
} |
} |
return argc; |
}; |
void __attribute__((noreturn)) |
libc_crt_startup (void *libc_base) |
{ |
struct app_hdr *header = NULL; |
int len; |
char *p; |
void *my_app; |
int retval = 0; |
char **argv; |
int argc; |
_pei386_runtime_relocator(); |
memset(_tls_map, 0xFF, 32*4); |
207,23 → 106,18 |
memcpy(__appcwd, header->path, __appcwdlen); |
set_cwd(__appcwd); |
arg[0] = header->path; |
if( header->cmdline[0] != 0) |
{ |
argc = split_cmdline(header->cmdline, NULL) + 1; |
argv = alloca((argc+1)*sizeof(char*)); |
argv[0] = header->path; |
split_cmdline(header->cmdline, argv + 1); |
_argc = 2; |
arg[1] = header->cmdline; |
} |
else |
{ |
argc = 1; |
argv = alloca((argc+1)*sizeof(char*)); |
argv[0] = header->path; |
} |
argv[argc] = NULL; |
else _argc = 1; |
retval = header->main(argc, argv, NULL); |
_argv = arg; |
retval = header->main(_argc, _argv, NULL); |
done: |
exit (retval); |
} |
/contrib/sdk/sources/libstdc++-v3/config.h |
---|
868,7 → 868,7 |
/* #undef _GLIBCXX_USE_SYSCTL_HW_NCPU */ |
/* Define if code specialized for wchar_t should be used. */ |
//#define _GLIBCXX_USE_WCHAR_T 1 |
#define _GLIBCXX_USE_WCHAR_T 1 |
/* Define to 1 if a verbose library is built, or 0 otherwise. */ |
#define _GLIBCXX_VERBOSE 1 |
/contrib/sdk/sources/libstdc++-v3/include/mingw32/bits/c++config.h |
---|
1332,7 → 1332,7 |
/* #undef _GLIBCXX_USE_SYSCTL_HW_NCPU */ |
/* Define if code specialized for wchar_t should be used. */ |
//#define _GLIBCXX_USE_WCHAR_T 1 |
#define _GLIBCXX_USE_WCHAR_T 1 |
/* Define to 1 if a verbose library is built, or 0 otherwise. */ |
#define _GLIBCXX_VERBOSE 1 |
/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/platform_drm.c |
---|
43,6 → 43,9 |
#include "egl_dri2.h" |
void* load_library(const char *name); |
void *get_proc_address(void *module, char *proc_name); |
int (*blit_bitmap_from_handle)(bitmap_t *bitmap, uint32_t handle); |
void (*blit_set_bo_handle)(bitmap_t *bitmap, int handle); |
int (*blit_blit_tex)(bitmap_t *bitmap, int scale, int vsync, int dst_x, int dst_y, |