Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 435102
Collapse All | Expand All

(-)vlc/modules/codec/loader/module.c (-8 / +4 lines)
Lines 63-70 Link Here
63
63
64
#ifdef EMU_QTX_API
64
#ifdef EMU_QTX_API
65
#include "wrapper.h"
65
#include "wrapper.h"
66
static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t *flags);
66
int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t *flags);
67
static int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, uint32_t *flags);
67
int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, uint32_t *flags);
68
#endif
68
#endif
69
69
70
//#undef TRACE
70
//#undef TRACE
Lines 572-579 HMODULE WINAPI LoadLibraryExA(LPCSTR lib Link Here
572
	    fprintf(stderr,"QuickTime.qts patched!!! old entry=%p\n",ptr[0]);
572
	    fprintf(stderr,"QuickTime.qts patched!!! old entry=%p\n",ptr[0]);
573
573
574
#ifdef EMU_QTX_API
574
#ifdef EMU_QTX_API
575
	    report_entry = report_func;
576
	    report_ret   = report_func_ret;
577
	    wrapper_target=ptr[0];
575
	    wrapper_target=ptr[0];
578
	    ptr[0]=wrapper;
576
	    ptr[0]=wrapper;
579
#endif
577
#endif
Lines 754-760 static int dump_component(char* name,int Link Here
754
static uint32_t ret_array[4096];
752
static uint32_t ret_array[4096];
755
static int ret_i=0;
753
static int ret_i=0;
756
754
757
static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t *flags)
755
int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t *flags)
758
{
756
{
759
#ifdef DEBUG_QTX_API
757
#ifdef DEBUG_QTX_API
760
  int i;
758
  int i;
Lines 953-959 static int report_func(void *stack_base, Link Here
953
    return 0;
951
    return 0;
954
}
952
}
955
953
956
static int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, uint32_t *flags)
954
int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, uint32_t *flags)
957
{
955
{
958
  int i;
956
  int i;
959
  short err;
957
  short err;
Lines 1066-1073 FARPROC MODULE_GetProcAddress( Link Here
1066
//      || !strcmp(function,"_CallComponent")
1064
//      || !strcmp(function,"_CallComponent")
1067
      ){
1065
      ){
1068
	fprintf(stderr,"theQuickTimeDispatcher catched -> %p\n",retproc);
1066
	fprintf(stderr,"theQuickTimeDispatcher catched -> %p\n",retproc);
1069
      report_entry = report_func;
1070
      report_ret   = report_func_ret;
1071
      wrapper_target=(void(*)(void))retproc;
1067
      wrapper_target=(void(*)(void))retproc;
1072
      retproc=(FARPROC)wrapper;
1068
      retproc=(FARPROC)wrapper;
1073
    }
1069
    }
(-)vlc/modules/codec/loader/stubs.s (+3 lines)
Lines 33-35 exp_EH_prolog: Link Here
33
	leal  12(%esp), %ebp
33
	leal  12(%esp), %ebp
34
	pushl %eax
34
	pushl %eax
35
	ret
35
	ret
36
37
.section .note.GNU-stack,"",@progbits
38
(-)vlc/modules/codec/loader/wrapper.S (-20 / +38 lines)
Lines 1-17 Link Here
1
.section .data
1
.section .data
2
.globl caller_return
3
caller_return:
2
caller_return:
4
	.long 0
3
	.long 0
5
.globl report_entry
6
report_entry:
7
	.long null_call
8
.globl report_ret
9
report_ret:	
10
	.long null_call
11
.global wrapper_target
4
.global wrapper_target
12
wrapper_target:	
5
wrapper_target:	
13
	.long null_call
6
	.long null_call
14
7
8
#undef __i686 /* gcc define gets in our way */
9
	.section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
10
.globl __i686.get_pc_thunk.bx
11
	.hidden	__i686.get_pc_thunk.bx
12
	.type	__i686.get_pc_thunk.bx,@function
13
__i686.get_pc_thunk.bx:
14
	movl (%esp), %ebx
15
	ret
16
15
.section .text
17
.section .text
16
.globl null_call
18
.globl null_call
17
	.type null_call, @function
19
	.type null_call, @function
Lines 22-67 null_call: Link Here
22
	.type wrapper, @function
24
	.type wrapper, @function
23
	.balign 16,0x90
25
	.balign 16,0x90
24
wrapper:
26
wrapper:
27
	pushl $0
25
	pusha			# store registers (EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI) 
28
	pusha			# store registers (EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI) 
26
	pushf			# store flags
29
	pushf			# store flags
27
	
30
	
28
	push %ebp		# set up a stack frame 
31
	push %ebp		# set up a stack frame 
29
	movl %esp, %ebp
32
	movl %esp, %ebp
30
33
34
	call __i686.get_pc_thunk.bx
35
	addl $_GLOBAL_OFFSET_TABLE_, %ebx
36
31
	leal 4(%ebp), %eax	# push flags addr
37
	leal 4(%ebp), %eax	# push flags addr
32
	push %eax
38
	push %eax
33
	leal 8(%ebp), %eax	# push registers addr
39
	leal 8(%ebp), %eax	# push registers addr
34
	push %eax
40
	push %eax
35
	
41
36
	leal 40(%ebp), %edx	
42
	leal 44(%ebp), %edx	
37
	movl (%ebp), %eax
43
	movl (%ebp), %eax
38
	subl %edx, %eax
44
	subl %edx, %eax
39
	push %eax
45
	push %eax
40
	push %edx
46
	push %edx
41
	
47
42
	call *report_entry	# report entry
48
	call report_func@PLT	# report entry
43
	
49
44
	test %eax, %eax
50
	test %eax, %eax
45
	jnz .Ldone
51
	jnz .Ldone
46
52
53
	movl 44(%ebp), %eax	# switch return addresses
54
	movl %eax, caller_return@GOTOFF(%ebx)
55
	leal .Lwrapper_return@GOTOFF(%ebx), %eax
56
	movl %eax, 40(%ebp)
57
58
	movl wrapper_target@GOTOFF(%ebx), %eax
59
	mov %eax, 40(%ebp)	# wrapper_target should return at .Lwrapper_return
60
47
	leave			# restore %esp, %ebp
61
	leave			# restore %esp, %ebp
48
	popf			# restore flags
62
	popf			# restore flags
49
	popa			# restore registers
63
	popa			# restore registers
50
	
64
51
	popl caller_return	# switch return addresses
65
	ret
52
	pushl $.Lwrapper_return 
53
	
54
	jmp *wrapper_target	# wrapper_target should return at .Lwrapper_return
55
66
56
	.balign 16, 0x90
67
	.balign 16, 0x90
57
.Lwrapper_return:	
68
.Lwrapper_return:	
58
	pushl caller_return	# restore the original return address
69
	pushl $0		# restore the original return address
59
	pusha			# more for reference sake here
70
	pusha			# more for reference sake here
60
	pushf
71
	pushf
61
	
72
	
62
	push %ebp		# set up a stack frame
73
	push %ebp		# set up a stack frame
63
	movl %esp, %ebp
74
	movl %esp, %ebp
64
75
76
	call __i686.get_pc_thunk.bx
77
	addl $_GLOBAL_OFFSET_TABLE_, %ebx
78
	movl caller_return@GOTOFF(%ebx), %eax
79
	movl %eax, 40(%ebp)	# restore the original return address
80
65
	leal 4(%ebp), %eax	# push flags addr
81
	leal 4(%ebp), %eax	# push flags addr
66
	push %eax
82
	push %eax
67
	leal 8(%ebp), %eax	# push registers addr
83
	leal 8(%ebp), %eax	# push registers addr
Lines 73-83 wrapper: Link Here
73
	push %eax
89
	push %eax
74
	push %edx
90
	push %edx
75
91
76
	call *report_ret	# report the return information (same args)
92
	call report_func_ret@PLT# report the return information (same args)
77
.Ldone:	
93
.Ldone:	
78
94
79
	leave
95
	leave
80
	popf
96
	popf
81
	popa
97
	popa
82
	ret
98
	ret
83
	
99
100
.section .note.GNU-stack,"",@progbits
101
(-)vlc/modules/codec/loader/wrapper.h (-4 lines)
Lines 7-16 typedef struct { Link Here
7
  uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
7
  uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
8
} reg386_t;
8
} reg386_t;
9
9
10
typedef int (*wrapper_func_t)(void *stack_base, int stack_size, reg386_t *reg,  uint32_t *flags);
11
12
extern wrapper_func_t report_entry, report_ret;
13
14
extern void (*wrapper_target)(void);
10
extern void (*wrapper_target)(void);
15
11
16
extern int wrapper(void);
12
extern int wrapper(void);
(-)vlc.orig/modules/common.am (-1 / +1 lines)
Lines 23-29 Link Here
23
if HAVE_DYNAMIC_PLUGINS
23
if HAVE_DYNAMIC_PLUGINS
24
AM_CPPFLAGS += -D__PLUGIN__
24
AM_CPPFLAGS += -D__PLUGIN__
25
endif
25
endif
26
AM_CFLAGS =
26
AM_CFLAGS = -fPIC
27
AM_CXXFLAGS =
27
AM_CXXFLAGS =
28
AM_OBJCFLAGS =
28
AM_OBJCFLAGS =
29
AM_LIBADD = $(LIBPTHREAD)
29
AM_LIBADD = $(LIBPTHREAD)

Return to bug 435102