Commit eb9a8631 authored by Alexandre Julliard's avatar Alexandre Julliard

Exported CALL32_Regs from ntdll, renamed to __wine_call_from_32_regs

to follow the naming convention for this type of functions. Split 16 and 32-bit relay functions into separate files, and moved the 32-bit ones to dlls/ntdll.
parent 7cd2dd79
Makefile
ntdll.spec.c
relay32.s
......@@ -3,7 +3,6 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = ntdll
SOVERSION = 1.0
EXTRALIBS = $(LIBUNICODE)
C_SRCS = \
......@@ -27,6 +26,9 @@ C_SRCS = \
time.c \
wcstring.c
GEN_ASM_SRCS = \
relay32.s
EXTRA_OBJS = \
$(TOPOBJDIR)/files/files.o \
$(TOPOBJDIR)/if1632/if1632.o \
......@@ -59,4 +61,7 @@ SUBDIRS = \
$(EXTRA_OBJS): dummy
@cd `dirname $@` && $(MAKE) `basename $@`
relay32.s: $(WINEBUILD)
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -relay32
### Dependencies:
......@@ -1021,6 +1021,9 @@ debug_channels (atom cdrom console debug delayhlp dll dosfs dosmem file fixup
@ cdecl -norelay __wine_exception_handler(ptr ptr ptr ptr) __wine_exception_handler
@ cdecl -norelay __wine_finally_handler(ptr ptr ptr ptr) __wine_finally_handler
# Relays
@ cdecl -norelay -i386 __wine_call_from_32_regs() __wine_call_from_32_regs
# Debugging interface
@ cdecl -norelay wine_dbgstr_an(str long) wine_dbgstr_an
@ cdecl -norelay wine_dbgstr_wn(str long) wine_dbgstr_wn
......
Makefile
asmrelay.s
relay16.s
thunk.glue.c
......@@ -12,7 +12,7 @@ C_SRCS = \
thunk.c
GEN_ASM_SRCS = \
asmrelay.s
relay16.s
GLUE = thunk.c
......@@ -23,7 +23,7 @@ all: $(MODULE).o
$(MODULE).o: $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
$(LDCOMBINE) $(OBJS) -o $@
asmrelay.s: $(WINEBUILD)
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -relay
relay16.s: $(WINEBUILD)
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -relay16
### Dependencies:
......@@ -1106,7 +1106,7 @@ typedef CONTEXT *PCONTEXT;
#define _DEFINE_REGS_ENTRYPOINT( name, fn, args ) \
__ASM_GLOBAL_FUNC( name, \
"call " __ASM_NAME("CALL32_Regs") "\n\t" \
"call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \
".long " __ASM_NAME(#fn) "\n\t" \
".byte " #args ", " #args )
#define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
......
......@@ -381,7 +381,7 @@ void WINAPI RELAY_DoCallFrom32Regs( CONTEXT86 *context )
void WINAPI RELAY_CallFrom32Regs(void);
__ASM_GLOBAL_FUNC( RELAY_CallFrom32Regs,
"call " __ASM_NAME("CALL32_Regs") "\n\t"
"call " __ASM_NAME("__wine_call_from_32_regs") "\n\t"
".long " __ASM_NAME("RELAY_DoCallFrom32Regs") ",0" );
/***********************************************************************
......
......@@ -381,10 +381,10 @@ void WINAPI SNOOP_DoReturn( CONTEXT86 *context )
/* assembly wrappers that save the context */
__ASM_GLOBAL_FUNC( SNOOP_Entry,
"call " __ASM_NAME("CALL32_Regs") "\n\t"
"call " __ASM_NAME("__wine_call_from_32_regs") "\n\t"
".long " __ASM_NAME("SNOOP_DoEntry") ",0" );
__ASM_GLOBAL_FUNC( SNOOP_Return,
"call " __ASM_NAME("CALL32_Regs") "\n\t"
"call " __ASM_NAME("__wine_call_from_32_regs") "\n\t"
".long " __ASM_NAME("SNOOP_DoReturn") ",0" );
#else /* !__i386__ */
......
......@@ -149,7 +149,8 @@ extern int output_res16_data( FILE *outfile );
extern int output_res16_directory( unsigned char *buffer );
extern void BuildGlue( FILE *outfile, FILE *infile );
extern void BuildRelays( FILE *outfile );
extern void BuildRelays16( FILE *outfile );
extern void BuildRelays32( FILE *outfile );
extern void BuildSpec16File( FILE *outfile );
extern void BuildSpec32File( FILE *outfile );
extern SPEC_TYPE ParseTopLevel( FILE *file );
......
......@@ -207,7 +207,7 @@ static int remove_symbol_holes(void)
/* add the extra undefined symbols that will be contained in the generated spec file itself */
static void add_extra_undef_symbols(void)
{
const char *extras[8];
const char *extras[10];
int i, count = 0;
#define ADD_SYM(name) \
......@@ -247,6 +247,13 @@ static void add_extra_undef_symbols(void)
ADD_SYM( "GetProcAddress" );
}
for (i = 0; i < nb_entry_points; i++)
{
ORDDEF *odp = EntryPoints[i];
if (odp->type != TYPE_REGISTER) continue;
ADD_SYM( "__wine_call_from_32_regs" );
}
if (count)
{
for (i = 0; i < count; i++) add_undef_symbol( extras[i] );
......
......@@ -55,7 +55,7 @@ static FILE *input_file;
static FILE *output_file;
/* execution mode */
static enum { MODE_NONE, MODE_SPEC, MODE_GLUE, MODE_RELAY } exec_mode = MODE_NONE;
static enum { MODE_NONE, MODE_SPEC, MODE_GLUE, MODE_RELAY16, MODE_RELAY32 } exec_mode = MODE_NONE;
/* open the input file */
static void open_input( const char *name )
......@@ -92,21 +92,23 @@ static void do_output( const char *arg );
static void do_usage(void);
static void do_spec( const char *arg );
static void do_glue( const char *arg );
static void do_relay(void);
static void do_relay16(void);
static void do_relay32(void);
static void do_sym( const char *arg );
static void do_lib( const char *arg );
static const struct option_descr option_table[] =
{
{ "-fPIC", 0, do_pic, "-fPIC Generate PIC code" },
{ "-h", 0, do_usage, "-h Display this help message" },
{ "-L", 1, do_lib, "-L directory Look for imports libraries in 'directory'" },
{ "-o", 1, do_output, "-o name Set the output file name (default: stdout)" },
{ "-sym", 1, do_sym, "-sym file.o Read the list of undefined symbols from 'file.o'" },
{ "-spec", 1, do_spec, "-spec file.spec Build a .c file from a spec file" },
{ "-glue", 1, do_glue, "-glue file.c Build the 16-bit glue for a .c file" },
{ "-relay", 0, do_relay, "-relay Build the relay assembly routines" },
{ NULL, 0, NULL, NULL }
{ "-fPIC", 0, do_pic, "-fPIC Generate PIC code" },
{ "-h", 0, do_usage, "-h Display this help message" },
{ "-L", 1, do_lib, "-L directory Look for imports libraries in 'directory'" },
{ "-o", 1, do_output, "-o name Set the output file name (default: stdout)" },
{ "-sym", 1, do_sym, "-sym file.o Read the list of undefined symbols from 'file.o'" },
{ "-spec", 1, do_spec, "-spec file.spec Build a .c file from a spec file" },
{ "-glue", 1, do_glue, "-glue file.c Build the 16-bit glue for a .c file" },
{ "-relay16", 0, do_relay16, "-relay16 Build the 16-bit relay assembly routines" },
{ "-relay32", 0, do_relay32, "-relay32 Build the 32-bit relay assembly routines" },
{ NULL, 0, NULL, NULL }
};
static void do_pic(void)
......@@ -154,10 +156,16 @@ static void do_glue( const char *arg )
open_input( arg );
}
static void do_relay(void)
static void do_relay16(void)
{
if (exec_mode != MODE_NONE) do_usage();
exec_mode = MODE_RELAY;
exec_mode = MODE_RELAY16;
}
static void do_relay32(void)
{
if (exec_mode != MODE_NONE) do_usage();
exec_mode = MODE_RELAY32;
}
static void do_sym( const char *arg )
......@@ -239,8 +247,11 @@ int main(int argc, char **argv)
case MODE_GLUE:
BuildGlue( output_file, input_file );
break;
case MODE_RELAY:
BuildRelays( output_file );
case MODE_RELAY16:
BuildRelays16( output_file );
break;
case MODE_RELAY32:
BuildRelays32( output_file );
break;
default:
do_usage();
......
......@@ -1027,7 +1027,7 @@ static void BuildCallFrom32Regs( FILE *outfile )
/* Function header */
function_header( outfile, "CALL32_Regs" );
function_header( outfile, "__wine_call_from_32_regs" );
/* Allocate some buffer space on the stack */
......@@ -1130,11 +1130,11 @@ static void BuildCallFrom32Regs( FILE *outfile )
/*******************************************************************
* BuildRelays
* BuildRelays16
*
* Build all the relay callbacks
* Build all the 16-bit relay callbacks
*/
void BuildRelays( FILE *outfile )
void BuildRelays16( FILE *outfile )
{
/* File header */
......@@ -1191,9 +1191,6 @@ void BuildRelays( FILE *outfile )
/* CBClientThunkSLEx routine */
BuildCallTo32CBClient( outfile, TRUE );
/* 32-bit register entry point */
BuildCallFrom32Regs( outfile );
fprintf( outfile, PREFIX"Call16_End:\n" );
fprintf( outfile, "\t.globl "PREFIX"Call16_End\n" );
......@@ -1221,9 +1218,51 @@ void BuildRelays( FILE *outfile )
fprintf( outfile, PREFIX "Call16_Ret_End:\n" );
}
/*******************************************************************
* BuildRelays32
*
* Build all the 32-bit relay callbacks
*/
void BuildRelays32( FILE *outfile )
{
/* File header */
fprintf( outfile, "/* File generated automatically. Do not edit! */\n\n" );
fprintf( outfile, "\t.text\n" );
#ifdef USE_STABS
if (output_file_name)
{
char buffer[1024];
getcwd(buffer, sizeof(buffer));
fprintf( outfile, "\t.file\t\"%s\"\n", output_file_name );
/*
* The stabs help the internal debugger as they are an indication that it
* is sensible to step into a thunk/trampoline.
*/
fprintf( outfile, ".stabs \"%s/\",100,0,0,Code_Start\n", buffer);
fprintf( outfile, ".stabs \"%s\",100,0,0,Code_Start\n", output_file_name );
fprintf( outfile, "Code_Start:\n\n" );
}
#endif
/* 32-bit register entry point */
BuildCallFrom32Regs( outfile );
#ifdef USE_STABS
fprintf( outfile, "\t.stabs \"\",100,0,0,.Letext\n");
fprintf( outfile, ".Letext:\n");
#endif
}
#else /* __i386__ */
void BuildRelays( FILE *outfile )
void BuildRelays16( FILE *outfile )
{
fprintf( outfile, "/* File not used with this architecture. Do not edit! */\n\n" );
}
void BuildRelays32( FILE *outfile )
{
fprintf( outfile, "/* File not used with this architecture. Do not edit! */\n\n" );
}
......
......@@ -407,7 +407,7 @@ static void output_register_funcs( FILE *outfile )
"asm(\".align %d\\n\\t\"\n"
" \"" __ASM_FUNC("%s") "\\n\\t\"\n"
" \"" PREFIX "%s:\\n\\t\"\n"
" \"call " PREFIX "CALL32_Regs\\n\\t\"\n"
" \"call " PREFIX "__wine_call_from_32_regs\\n\\t\"\n"
" \".long " PREFIX "%s\\n\\t\"\n"
" \".byte %d,%d\");\n",
get_alignment(4),
......
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