Commit a255dd1f authored by Alexandre Julliard's avatar Alexandre Julliard

winebuild: Stop generating syscall entry points.

parent 2dda6a28
......@@ -151,7 +151,6 @@ typedef struct
int subsystem; /* subsystem id */
int subsystem_major; /* subsystem version major number */
int subsystem_minor; /* subsystem version minor number */
int syscall_table; /* syscall table id */
int unicode_app; /* default to unicode entry point */
ORDDEF *entry_points; /* dll entry points */
ORDDEF **names; /* array of entry point names (points into entry_points) */
......@@ -313,7 +312,6 @@ extern int has_delay_imports(void);
extern void output_get_pc_thunk(void);
extern void output_module( DLLSPEC *spec );
extern void output_stubs( DLLSPEC *spec );
extern void output_syscalls( DLLSPEC *spec );
extern void output_imports( DLLSPEC *spec );
extern void output_import_lib( DLLSPEC *spec, struct strarray files );
extern void output_static_lib( const char *output_name, struct strarray files, int create );
......
......@@ -576,7 +576,6 @@ static void check_undefined_exports( DLLSPEC *spec )
ORDDEF *odp = &spec->entry_points[i];
if (odp->type == TYPE_STUB || odp->type == TYPE_ABS || odp->type == TYPE_VARIABLE) continue;
if (odp->flags & FLAG_FORWARD) continue;
if (odp->flags & FLAG_SYSCALL) continue;
if (find_name( odp->link_name, undef_symbols ))
{
switch(odp->type)
......@@ -594,7 +593,6 @@ static void check_undefined_exports( DLLSPEC *spec )
spec->src_name, odp->lineno, odp->link_name );
break;
default:
if (!strcmp( odp->link_name, "__wine_syscall_dispatcher" )) break;
error( "%s:%d: external symbol '%s' is not a function\n",
spec->src_name, odp->lineno, odp->link_name );
break;
......@@ -618,7 +616,6 @@ static char *create_undef_symbols_file( DLLSPEC *spec )
ORDDEF *odp = &spec->entry_points[i];
if (odp->type == TYPE_STUB || odp->type == TYPE_ABS || odp->type == TYPE_VARIABLE) continue;
if (odp->flags & FLAG_FORWARD) continue;
if (odp->flags & FLAG_SYSCALL) continue;
output( "\t%s %s\n", get_asm_ptr_keyword(), asm_name( get_link_name( odp )));
}
for (j = 0; j < extra_ld_symbols.count; j++)
......@@ -1384,146 +1381,6 @@ void output_stubs( DLLSPEC *spec )
}
}
static int cmp_link_name( const void *e1, const void *e2 )
{
const ORDDEF *odp1 = *(const ORDDEF * const *)e1;
const ORDDEF *odp2 = *(const ORDDEF * const *)e2;
return strcmp( odp1->link_name, odp2->link_name );
}
/* output the functions for system calls */
void output_syscalls( DLLSPEC *spec )
{
int i, count;
ORDDEF **syscalls = NULL;
if (!spec->syscall_table) return;
for (i = count = 0; i < spec->nb_entry_points; i++)
{
ORDDEF *odp = &spec->entry_points[i];
if (!(odp->flags & FLAG_SYSCALL)) continue;
if (strcmp( odp->name, odp->link_name )) continue; /* ignore syscall aliases */
if (!syscalls) syscalls = xmalloc( (spec->nb_entry_points - i) * sizeof(*syscalls) );
syscalls[count++] = odp;
}
if (!count) return;
count = sort_func_list( syscalls, count, cmp_link_name );
output( "\n/* system calls */\n\n" );
for (i = 0; i < count; i++)
{
ORDDEF *odp = syscalls[i];
const char *name = get_link_name(odp);
unsigned int id = (spec->syscall_table << 12) + i;
output_function_header( name, 1 );
switch (target.cpu)
{
case CPU_i386:
if (UsePIC)
{
output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") );
output( "1:\tmovl %s-1b(%%eax),%%edx\n", asm_name("__wine_syscall_dispatcher") );
output( "\tmovl $%u,%%eax\n", id );
needs_get_pc_thunk = 1;
}
else
{
output( "\tmovl $%u,%%eax\n", id );
output( "\tmovl $%s,%%edx\n", asm_name("__wine_syscall") );
}
output( "\tcall *%%edx\n" );
output( "\tret $%u\n", get_args_size( odp ));
break;
case CPU_x86_64:
output_seh( ".seh_proc %s", asm_name(name) );
output_seh( ".seh_endprologue" );
/* Chromium depends on syscall thunks having the same form as on
* Windows. For 64-bit systems the only viable form we can emulate is
* having an int $0x2e fallback. Since actually using an interrupt is
* expensive, and since for some reason Chromium doesn't actually
* validate that instruction, we can just put a jmp there instead. */
output( "\t.byte 0x4c,0x8b,0xd1\n" ); /* movq %rcx,%r10 */
output( "\t.byte 0xb8\n" ); /* movl $i,%eax */
output( "\t.long %u\n", id );
output( "\t.byte 0xf6,0x04,0x25,0x08,0x03,0xfe,0x7f,0x01\n" ); /* testb $1,0x7ffe0308 */
output( "\t.byte 0x75,0x03\n" ); /* jne 1f */
output( "\t.byte 0x0f,0x05\n" ); /* syscall */
output( "\t.byte 0xc3\n" ); /* ret */
output( "\tjmp 1f\n" );
output( "\t.byte 0xc3\n" ); /* ret */
if (is_pe())
{
output( "1:\t.byte 0xff,0x14,0x25\n" ); /* 1: callq *(0x7ffe1000) */
output( "\t.long 0x7ffe1000\n" );
}
else
{
output( "\tnop\n" );
output( "1:\tcallq *%s(%%rip)\n", asm_name("__wine_syscall_dispatcher") );
}
output( "\tret\n" );
output_seh( ".seh_endproc" );
break;
case CPU_ARM:
output( "\tpush {r0-r3}\n" );
output( "\tmovw ip, #%u\n", id );
output( "\tmov r3, lr\n" );
output( "\tbl %s\n", asm_name("__wine_syscall") );
output( "\tbx lr\n" );
break;
case CPU_ARM64:
case CPU_ARM64EC:
output_seh( ".seh_proc %s", arm64_name(name) );
output_seh( ".seh_endprologue" );
output( "\tmov x8, #%u\n", id );
output( "\tmov x9, x30\n" );
output( "\tldr x16, 1f\n" );
output( "\tldr x16, [x16]\n" );
output( "\tblr x16\n" );
output( "\tret\n" );
output( "1:\t.quad %s\n", asm_name("__wine_syscall_dispatcher") );
output_seh( ".seh_endproc" );
break;
}
output_function_size( name );
}
switch (target.cpu)
{
case CPU_i386:
if (UsePIC) break;
output_function_header( "__wine_syscall", 0 );
output( "\tjmp *(%s)\n", asm_name("__wine_syscall_dispatcher") );
output_function_size( "__wine_syscall" );
break;
case CPU_ARM:
output_function_header( "__wine_syscall", 0 );
if (UsePIC)
{
output( "\tldr r0, 2f\n");
output( "1:\tadd r0, pc\n" );
}
else
{
output( "\tmovw r0, :lower16:%s\n", asm_name("__wine_syscall_dispatcher") );
output( "\tmovt r0, :upper16:%s\n", asm_name("__wine_syscall_dispatcher") );
}
output( "\tldr r0, [r0]\n");
output( "\tbx r0\n");
if (UsePIC) output( "2:\t.long %s-1b-%u\n", asm_name("__wine_syscall_dispatcher"), thumb_mode ? 4 : 8 );
output_function_size( "__wine_syscall" );
break;
default:
break;
}
}
/* output the import and delayed import tables of a Win32 module */
void output_imports( DLLSPEC *spec )
{
......
......@@ -158,15 +158,6 @@ static void set_subsystem( const char *subsystem, DLLSPEC *spec )
free( str );
}
/* set the syscall table id */
static void set_syscall_table( const char *id, DLLSPEC *spec )
{
int val = atoi( id );
if (val < 0 || val > 3) fatal_error( "Invalid syscall table id '%s', must be 0-3\n", id );
spec->syscall_table = val;
}
/* set the target CPU and platform */
static void set_target( const char *name )
{
......@@ -229,7 +220,6 @@ static const char usage_str[] =
" --safeseh Mark object files as SEH compatible\n"
" --save-temps Do not delete the generated intermediate files\n"
" --subsystem=SUBSYS Set the subsystem (one of native, windows, console, wince)\n"
" --syscall-table=ID Set the syscall table id (between 0 and 3)\n"
" -u, --undefined=SYMBOL Add an undefined reference to SYMBOL when linking\n"
" -v, --verbose Display the programs invoked\n"
" --version Print the version and exit\n"
......@@ -269,7 +259,6 @@ enum long_options_values
LONG_OPT_SAVE_TEMPS,
LONG_OPT_STATICLIB,
LONG_OPT_SUBSYSTEM,
LONG_OPT_SYSCALL_TABLE,
LONG_OPT_VERSION,
LONG_OPT_WITHOUT_DLLTOOL,
};
......@@ -301,7 +290,6 @@ static const struct long_option long_options[] =
{ "safeseh", 0, LONG_OPT_SAFE_SEH },
{ "save-temps", 0, LONG_OPT_SAVE_TEMPS },
{ "subsystem", 1, LONG_OPT_SUBSYSTEM },
{ "syscall-table", 1, LONG_OPT_SYSCALL_TABLE },
{ "version", 0, LONG_OPT_VERSION },
{ "without-dlltool", 0, LONG_OPT_WITHOUT_DLLTOOL },
/* aliases for short options */
......@@ -532,9 +520,6 @@ static void option_callback( int optc, char *optarg )
case LONG_OPT_SUBSYSTEM:
set_subsystem( optarg, main_spec );
break;
case LONG_OPT_SYSCALL_TABLE:
set_syscall_table( optarg, main_spec );
break;
case LONG_OPT_VERSION:
printf( "winebuild version " PACKAGE_VERSION "\n" );
exit(0);
......
......@@ -763,7 +763,6 @@ void output_spec32_file( DLLSPEC *spec )
output_stubs( spec );
output_exports( spec );
output_imports( spec );
output_syscalls( spec );
if (needs_get_pc_thunk) output_get_pc_thunk();
output_resources( spec );
output_gnu_stack_note();
......
......@@ -628,7 +628,6 @@ DLLSPEC *alloc_dll_spec(void)
spec->subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI;
spec->subsystem_major = 4;
spec->subsystem_minor = 0;
spec->syscall_table = 0;
spec->dll_characteristics = IMAGE_DLLCHARACTERISTICS_NX_COMPAT | IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE;
return spec;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment