Got rid of 16-bit glue code generation since it is no longer used.

This commit is contained in:
Alexandre Julliard 2003-08-23 00:45:20 +00:00
parent 5fbb446cfc
commit af62e83d1c
8 changed files with 4 additions and 202 deletions

View File

@ -100,7 +100,7 @@ prog_manext = 1
api_manext = 3w api_manext = 3w
conf_manext = 5 conf_manext = 5
CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \ CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
*.flc *.spec.c *.spec.def *.glue.c *.dbg.c y.tab.c y.tab.h @LEX_OUTPUT_ROOT@.c core *.flc *.spec.c *.spec.def *.dbg.c y.tab.c y.tab.h @LEX_OUTPUT_ROOT@.c core
OBJS = $(C_SRCS:.c=.o) $(EXTRA_OBJS) OBJS = $(C_SRCS:.c=.o) $(EXTRA_OBJS)

View File

@ -126,10 +126,10 @@ crosstest:: $(TESTSUBDIRS:%=%/__crosstest__)
# Misc rules # Misc rules
TAGS etags: TAGS etags:
etags `find $(TOPSRCDIR) -name '*.[ch]' -a -not -name '*.spec.c' -a -not -name '*.glue.c' -a -not -name '*.dbg.c' -print` etags `find $(TOPSRCDIR) -name '*.[ch]' -a -not -name '*.spec.c' -a -not -name '*.dbg.c' -print`
tags ctags: tags ctags:
ctags --c-types=+px `find $(TOPSRCDIR) -name '*.[ch]' -a -not -name '*.spec.c' -a -not -name '*.glue.c' -a -not -name '*.dbg.c' -print` ctags --c-types=+px `find $(TOPSRCDIR) -name '*.[ch]' -a -not -name '*.spec.c' -a -not -name '*.dbg.c' -print`
manpages: manpages:
$(MKINSTALLDIRS) $(TOPOBJDIR)/documentation/man3w $(MKINSTALLDIRS) $(TOPOBJDIR)/documentation/man3w

View File

@ -34,11 +34,6 @@ $(MODULE).tmp.o: $(ALL_OBJS) Makefile.in
$(LDCOMBINE) $(ALL_OBJS) -o $@ $(LDCOMBINE) $(ALL_OBJS) -o $@
-$(STRIP) --strip-unneeded $@ -$(STRIP) --strip-unneeded $@
# Rule for 16-bit glue
$(MODULE).glue.c: $(C_SRCS) $(C_SRCS16) $(WINEBUILD)
$(WINEBUILD) $(DEFS) -o $@ --glue -C$(SRCDIR) $(C_SRCS) $(C_SRCS16)
# Rules for .dll files # Rules for .dll files
$(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) $(IMPORTLIBS) Makefile.in $(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) $(IMPORTLIBS) Makefile.in

View File

@ -1,6 +1,5 @@
Makefile Makefile
ntdll.dll.dbg.c ntdll.dll.dbg.c
ntdll.dll.glue.c
ntdll.spec.c ntdll.spec.c
ntdll.spec.def ntdll.spec.def
relay16.s relay16.s

View File

@ -155,7 +155,6 @@ extern int output_res16_directory( unsigned char *buffer );
extern void output_dll_init( FILE *outfile, const char *constructor, const char *destructor ); extern void output_dll_init( FILE *outfile, const char *constructor, const char *destructor );
extern int parse_debug_channels( const char *srcdir, const char *filename ); extern int parse_debug_channels( const char *srcdir, const char *filename );
extern void BuildGlue( FILE *outfile, const char *srcdir, char **argv );
extern void BuildRelays16( FILE *outfile ); extern void BuildRelays16( FILE *outfile );
extern void BuildRelays32( FILE *outfile ); extern void BuildRelays32( FILE *outfile );
extern void BuildSpec16File( FILE *outfile ); extern void BuildSpec16File( FILE *outfile );

View File

@ -85,7 +85,6 @@ enum exec_mode_values
MODE_NONE, MODE_NONE,
MODE_SPEC, MODE_SPEC,
MODE_EXE, MODE_EXE,
MODE_GLUE,
MODE_DEF, MODE_DEF,
MODE_DEBUG, MODE_DEBUG,
MODE_RELAY16, MODE_RELAY16,
@ -148,7 +147,6 @@ static const char usage_str[] =
" --def=FILE.SPEC Build a .def file from a spec file\n" " --def=FILE.SPEC Build a .def file from a spec file\n"
" --exe=NAME Build a .c file for the named executable\n" " --exe=NAME Build a .c file for the named executable\n"
" --debug [FILES] Build a .c file with the debug channels declarations\n" " --debug [FILES] Build a .c file with the debug channels declarations\n"
" --glue [FILES] Build the 16-bit glue for the source files\n"
" --relay16 Build the 16-bit relay assembly routines\n" " --relay16 Build the 16-bit relay assembly routines\n"
" --relay32 Build the 32-bit relay assembly routines\n\n" " --relay32 Build the 32-bit relay assembly routines\n\n"
"The mode options are mutually exclusive; you must specify one and only one.\n\n"; "The mode options are mutually exclusive; you must specify one and only one.\n\n";
@ -159,7 +157,6 @@ enum long_options_values
LONG_OPT_DEF, LONG_OPT_DEF,
LONG_OPT_EXE, LONG_OPT_EXE,
LONG_OPT_DEBUG, LONG_OPT_DEBUG,
LONG_OPT_GLUE,
LONG_OPT_RELAY16, LONG_OPT_RELAY16,
LONG_OPT_RELAY32, LONG_OPT_RELAY32,
LONG_OPT_VERSION LONG_OPT_VERSION
@ -173,7 +170,6 @@ static const struct option long_options[] =
{ "def", 1, 0, LONG_OPT_DEF }, { "def", 1, 0, LONG_OPT_DEF },
{ "exe", 1, 0, LONG_OPT_EXE }, { "exe", 1, 0, LONG_OPT_EXE },
{ "debug", 0, 0, LONG_OPT_DEBUG }, { "debug", 0, 0, LONG_OPT_DEBUG },
{ "glue", 0, 0, LONG_OPT_GLUE },
{ "relay16", 0, 0, LONG_OPT_RELAY16 }, { "relay16", 0, 0, LONG_OPT_RELAY16 },
{ "relay32", 0, 0, LONG_OPT_RELAY32 }, { "relay32", 0, 0, LONG_OPT_RELAY32 },
{ "version", 0, 0, LONG_OPT_VERSION }, { "version", 0, 0, LONG_OPT_VERSION },
@ -328,9 +324,6 @@ static char **parse_options( int argc, char **argv )
case LONG_OPT_DEBUG: case LONG_OPT_DEBUG:
set_exec_mode( MODE_DEBUG ); set_exec_mode( MODE_DEBUG );
break; break;
case LONG_OPT_GLUE:
set_exec_mode( MODE_GLUE );
break;
case LONG_OPT_RELAY16: case LONG_OPT_RELAY16:
set_exec_mode( MODE_RELAY16 ); set_exec_mode( MODE_RELAY16 );
break; break;
@ -421,9 +414,6 @@ int main(int argc, char **argv)
case MODE_DEBUG: case MODE_DEBUG:
BuildDebugFile( output_file, current_src_dir, argv ); BuildDebugFile( output_file, current_src_dir, argv );
break; break;
case MODE_GLUE:
BuildGlue( output_file, current_src_dir, argv );
break;
case MODE_RELAY16: case MODE_RELAY16:
if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] ); if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] );
BuildRelays16( output_file ); BuildRelays16( output_file );

View File

@ -451,91 +451,6 @@ static void BuildCallFrom16Func( FILE *outfile, const char *profile, const char
} }
/*******************************************************************
* BuildCallTo16Func
*
* Build a Wine-to-16-bit callback glue function.
*
* Prototypes for the CallTo16 functions:
* extern WORD CALLBACK PREFIX_CallTo16_word_xxx( FARPROC16 func, args... );
* extern LONG CALLBACK PREFIX_CallTo16_long_xxx( FARPROC16 func, args... );
*
* These routines are provided solely for convenience; they simply
* write the arguments onto the 16-bit stack, and call the appropriate
* wine_call_to_16... core routine.
*
* If you have more sophisticated argument conversion requirements than
* are provided by these routines, you might as well call the core
* routines by yourself.
*
*/
static int BuildCallTo16Func( FILE *outfile, const char *profile, const char *prefix )
{
const char *args = profile + 5;
int i, argsize = 0, short_ret = 0;
if (!strncmp( "word_", profile, 5 )) short_ret = 1;
else if (strncmp( "long_", profile, 5 ))
{
error( "Invalid function name '%s'\n", profile );
return 0;
}
fprintf( outfile, "unsigned %s __stdcall %s_CallTo16_%s( void (*proc)()",
short_ret? "short" : "int", prefix, profile );
args = profile + 5;
for ( i = 0; args[i]; i++ )
{
fprintf( outfile, ", " );
switch (args[i])
{
case 'w': fprintf( outfile, "unsigned short" ); argsize += 2; break;
case 'l': fprintf( outfile, "unsigned int" ); argsize += 4; break;
default:
error( "Invalid letter '%c' in function name '%s'\n", args[i], profile );
return 0;
}
fprintf( outfile, " arg%d", i+1 );
}
fprintf( outfile, " )\n{\n" );
#ifdef __i386__
if ( argsize > 0 )
{
fprintf( outfile, " char *args;\n" );
fprintf( outfile, " unsigned int cur_stack;\n\n" );
fprintf( outfile, "#ifdef __GNUC__\n" );
fprintf( outfile, " __asm__(\".byte 0x64\\n\\tmovl (0x%x),%%0\" : \"=r\" (cur_stack));\n",
STACKOFFSET );
fprintf( outfile, "#else\n" );
fprintf( outfile, " extern char *NtCurrentTeb(void);\n" );
fprintf( outfile, " cur_stack = *(unsigned int *)(NtCurrentTeb() + 0x%x);\n",
STACKOFFSET );
fprintf( outfile, "#endif\n" );
fprintf( outfile, " args = (char *)wine_ldt_copy.base[cur_stack >> 19] + (cur_stack & 0xffff);\n" );
}
args = profile + 5;
for ( i = 0; args[i]; i++ )
{
switch (args[i])
{
case 'w': fprintf( outfile, " args -= sizeof(unsigned short); *(unsigned short" ); break;
case 'l': fprintf( outfile, " args -= sizeof(unsigned int); *(unsigned int" ); break;
default: fprintf( stderr, "Unexpected case '%c' in BuildCallTo16Func\n",
args[i] );
}
fprintf( outfile, " *)args = arg%d;\n", i+1 );
}
fprintf( outfile, " return wine_call_to_16( proc, %d );\n}\n\n", argsize );
#else /* __i386__ */
fprintf( outfile, " assert(0);\n}\n\n" );
#endif /* __i386__ */
return 1;
}
/******************************************************************* /*******************************************************************
* get_function_name * get_function_name
*/ */
@ -921,56 +836,3 @@ void BuildSpec16File( FILE *outfile )
" __wine_unregister_dll_16( &descriptor );\n" " __wine_unregister_dll_16( &descriptor );\n"
"}\n", destructor ); "}\n", destructor );
} }
/*******************************************************************
* BuildGlue
*
* Build the 16-bit-to-Wine/Wine-to-16-bit callback glue code
*/
void BuildGlue( FILE *outfile, const char *srcdir, char **argv )
{
char buffer[1024];
/* File header */
output_file_header( outfile );
#ifdef __i386__
fprintf( outfile, "extern unsigned int __stdcall wine_call_to_16( void (*target)(), int args );\n\n" );
#else
fprintf( outfile, "#include <assert.h>\n\n" );
#endif
/* Build the callback glue functions */
while (*argv)
{
FILE *infile = open_input_file( srcdir, *argv );
while (fgets( buffer, sizeof(buffer), infile ))
{
current_line++;
if (strstr( buffer, "### start build ###" )) break;
}
while (fgets( buffer, sizeof(buffer), infile ))
{
char *p;
if ( (p = strstr( buffer, "CallTo16_" )) != NULL )
{
char *q, *profile = p + strlen( "CallTo16_" );
for (q = profile; (*q == '_') || isalpha(*q); q++ )
;
*q = '\0';
for (q = p-1; q > buffer && ((*q == '_') || isalnum(*q)); q-- )
;
if ( ++q < p ) p[-1] = '\0'; else q = "";
BuildCallTo16Func( outfile, profile, q );
}
current_line++;
if (strstr( buffer, "### stop build ###" )) break;
}
close_input_file( infile );
argv++;
}
}

View File

@ -53,13 +53,6 @@ should be a list of C files to search for debug channel
definitions. The resulting C file must be compiled and linked with the definitions. The resulting C file must be compiled and linked with the
dll. dll.
.TP .TP
.B \--glue
Build a C file containing the glue code for the 16-bit calls contained
in the
.I input files.
These calls must be specified in the source files using special
markers, as described in the \fBGLUE FUNCTIONS\fR section.
.TP
.B \--relay16 .B \--relay16
Generate the assembly code for the 16-bit relay routines. This is for Generate the assembly code for the 16-bit relay routines. This is for
Wine internal usage only, you should never need to use this option. Wine internal usage only, you should never need to use this option.
@ -72,7 +65,7 @@ Wine internal usage only, you should never need to use this option.
.BI \-C,\ --source-dir= directory .BI \-C,\ --source-dir= directory
Change to the specified directory before reading source files. Only Change to the specified directory before reading source files. Only
meaningful in meaningful in
.BR \--debug\ and\ --glue\ modes. .BR \--debug\ mode.
.TP .TP
.BI \-D\ symbol .BI \-D\ symbol
Ignored for compatibility with the C compiler. Ignored for compatibility with the C compiler.
@ -406,42 +399,6 @@ This declaration defines an ordinal as an absolute value.
will be the name available for dynamic linking. will be the name available for dynamic linking.
.I data .I data
can be a decimal number or a hex number preceeded by "0x". can be a decimal number or a hex number preceeded by "0x".
.SH "GLUE FUNCTIONS"
Glue functions are used to call down to 16-bit code from a 32-bit
function. This is done by declaring a special type of function
prototype in the source file that needs to call to 16-bit code, and
processing the source file through
.I winebuild --glue.
.PP
These prototypes must be of one of the following forms:
.PP
.B extern WORD CALLBACK \fIprefix\fB_CallTo16_word_\fIxxx\fB( FARPROC16 func, \fIargs\fB );
.br
.B extern LONG CALLBACK \fIprefix\fB_CallTo16_long_\fIxxx\fB( FARPROC16 func, \fIargs\fB );
.PP
The
.I prefix
can be anything you need to make the function names unique inside a
given dll. The
.I xxx
characters specify the type of the arguments, with one letter for each
argument. A \fBw\fR indicates a WORD argument, a \fBl\fR indicates a
LONG argument.
.PP
All the CallTo16 prototypes must be located between the special
markers
.B ### start build ###
and
.B ### stop build ###
(which have to be inside C comments of course).
.PP
Here's what a real life example looks like:
.PP
.B /* ### start build ### */
.br
.B extern WORD CALLBACK PRTDRV_CallTo16_word_ww(FARPROC16,WORD,WORD);
.br
.B /* ### stop build ### */
.SH AUTHORS .SH AUTHORS
.B winebuild .B winebuild
has been worked on by many people over the years. The main authors are has been worked on by many people over the years. The main authors are