Пример #1
0
/*******************************************************************
 *         BuildRelays16
 *
 * Build all the 16-bit relay callbacks
 */
void BuildRelays16(void)
{
    if (target_cpu != CPU_x86)
    {
        output( "/* File not used with this architecture. Do not edit! */\n\n" );
        return;
    }

    /* File header */

    output( "/* File generated automatically. Do not edit! */\n\n" );
    output( "\t.text\n" );

    output( "%s:\n\n", asm_name("__wine_spec_thunk_text_16") );

    output( "%s\n", asm_globl("__wine_call16_start") );

    /* Standard CallFrom16 routine */
    BuildCallFrom16Core( FALSE, FALSE );

    /* Register CallFrom16 routine */
    BuildCallFrom16Core( TRUE, FALSE );

    /* C16ThkSL CallFrom16 routine */
    BuildCallFrom16Core( FALSE, TRUE );

    /* Standard CallTo16 routine */
    BuildCallTo16Core( 0 );

    /* Register CallTo16 routine */
    BuildCallTo16Core( 1 );

    /* Standard CallTo16 return stub */
    BuildRet16Func();

    /* CBClientThunkSL routine */
    BuildCallTo32CBClient( FALSE );

    /* CBClientThunkSLEx routine */
    BuildCallTo32CBClient( TRUE  );

    /* Pending DPMI events check stub */
    BuildPendingEventCheck();

    output( "%s\n", asm_globl("__wine_call16_end") );
    output_function_size( "__wine_spec_thunk_text_16" );

    /* Declare the return address and data selector variables */
    output( "\n\t.data\n\t.align %d\n", get_alignment(4) );
    output( "%s\n\t.long 0\n", asm_globl("CallTo16_DataSelector") );
    output( "%s\n\t.long 0\n", asm_globl("CallTo16_TebSelector") );
    if (UsePIC) output( "wine_ldt_copy_ptr:\t.long %s\n", asm_name("wine_ldt_copy") );
    output_gnu_stack_note();
}
Пример #2
0
/*******************************************************************
 *         output_asm_relays16
 *
 * Build all the 16-bit relay callbacks
 */
void output_asm_relays16(void)
{
    /* File header */

    output( "\t.text\n" );
    output( "%s:\n\n", asm_name("__wine_spec_thunk_text_16") );

    output( "%s\n", asm_globl("__wine_call16_start") );

    /* Standard CallFrom16 routine */
    BuildCallFrom16Core( 0, 0 );

    /* Register CallFrom16 routine */
    BuildCallFrom16Core( 1, 0 );

    /* C16ThkSL CallFrom16 routine */
    BuildCallFrom16Core( 0, 1 );

    /* Standard CallTo16 routine */
    BuildCallTo16Core( 0 );

    /* Register CallTo16 routine */
    BuildCallTo16Core( 1 );

    /* Standard CallTo16 return stub */
    BuildRet16Func();

    /* CBClientThunkSL routine */
    BuildCallTo32CBClient( 0 );

    /* CBClientThunkSLEx routine */
    BuildCallTo32CBClient( 1  );

    output( "%s\n", asm_globl("__wine_call16_end") );
    output_function_size( "__wine_spec_thunk_text_16" );

    /* Declare the return address and data selector variables */
    output( "\n\t.data\n\t.align %d\n", get_alignment(4) );
    output( "%s\n\t.long 0\n", asm_globl("CallTo16_DataSelector") );
    output( "%s\n\t.long 0\n", asm_globl("CallTo16_TebSelector") );
}
Пример #3
0
/*******************************************************************
 *         BuildRelays16
 *
 * Build all the 16-bit relay callbacks
 */
void BuildRelays16( FILE *outfile )
{
#ifdef USE_STABS
    char buffer[1024];
#endif

    /* File header */

    fprintf( outfile, "/* File generated automatically. Do not edit! */\n\n" );

#ifdef NEED_RELOCS_IN_DATA
    fprintf( outfile, "\t.data\n" );
#else
    fprintf( outfile, "\t.text\n" );
#endif

#ifdef USE_STABS
    if (output_file_name)
    {
        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
    fprintf( outfile, PREFIX"Call16_Start:\n" );
    fprintf( outfile, "\t.globl "PREFIX"Call16_Start\n" );
    fprintf( outfile, "\t.byte 0\n\n" );

    /* Standard CallFrom16 routine (WORD return) */
    BuildCallFrom16Core( outfile, FALSE, FALSE, TRUE );

    /* Standard CallFrom16 routine (DWORD return) */
    BuildCallFrom16Core( outfile, FALSE, FALSE, FALSE );

    /* Register CallFrom16 routine */
    BuildCallFrom16Core( outfile, TRUE, FALSE, FALSE );

    /* C16ThkSL CallFrom16 routine */
    BuildCallFrom16Core( outfile, FALSE, TRUE, FALSE );

    /* Standard CallTo16 routine (WORD return) */
    BuildCallTo16Core( outfile, TRUE, FALSE );

    /* Standard CallTo16 routine (DWORD return) */
    BuildCallTo16Core( outfile, FALSE, FALSE );

    /* Register CallTo16 routine (16:16 retf) */
    BuildCallTo16Core( outfile, FALSE, 1 );

    /* Register CallTo16 routine (16:32 retf) */
    BuildCallTo16Core( outfile, FALSE, 2 );

    /* CBClientThunkSL routine */
    BuildCallTo32CBClient( outfile, FALSE );

    /* CBClientThunkSLEx routine */
    BuildCallTo32CBClient( outfile, TRUE  );

    fprintf( outfile, PREFIX"Call16_End:\n" );
    fprintf( outfile, "\t.globl "PREFIX"Call16_End\n" );

#ifndef __APPLE__
    /* Leopard linker complains about this */
#ifdef USE_STABS
    fprintf( outfile, "\t.stabs \"\",100,0,0,.Letext\n");
    fprintf( outfile, ".Letext:\n");

    /* Some versions of gdb need to have the filename data for
       each section, so output it again for the data section. */
    if (output_file_name)
    {
        fprintf( outfile, ".stabs \"%s/\",100,0,0,Data_Start\n", buffer);
        fprintf( outfile, ".stabs \"%s\",100,0,0,Data_Start\n", output_file_name );
        fprintf( outfile, "Data_Start:\n\n" );
    }
#endif
#endif

    /* The whole Call16_Ret segment must lie within the .data section */
    fprintf( outfile, "\n\t.data\n" );
    fprintf( outfile, "\t.globl " PREFIX "Call16_Ret_Start\n" );
    fprintf( outfile, PREFIX "Call16_Ret_Start:\n" );

    /* Standard CallTo16 return stub */
    BuildRet16Func( outfile );

    /* CBClientThunkSL return stub */
    BuildCallTo32CBClientRet( outfile, FALSE );

    /* CBClientThunkSLEx return stub */
    BuildCallTo32CBClientRet( outfile, TRUE  );

    /* End of Call16_Ret segment */
    fprintf( outfile, "\n\t.globl " PREFIX "Call16_Ret_End\n" );
    fprintf( outfile, PREFIX "Call16_Ret_End:\n" );

    if (UsePIC)
        fprintf( outfile, "wine_ldt_copy_ptr:\t.long %s\n", PREFIX "wine_ldt_copy" );
}