[Mplayer-cvslog] CVS: main/loader/qtx/debug wrapper.S,NONE,1.1 wrapper.h,NONE,1.1

Arpi of Ize arpi at mplayer.dev.hu
Mon Jan 21 01:41:20 CET 2002


Update of /cvsroot/mplayer/main/loader/qtx/debug
In directory mplayer:/var/tmp.root/cvs-serv32721

Added Files:
	wrapper.S wrapper.h 
Log Message:
lowlevel function call wrapper by Dylan Perry <dylanp at tekniche.com.au>

--- NEW FILE ---
.section .data
.globl caller_return
caller_return:
	.long 0
.globl report_entry
report_entry:
	.long null_call
.globl report_ret
report_ret:	
	.long null_call
.global wrapper_target
wrapper_target:	
	.long null_call

.section .text
.globl null_call
	.type null_call, @function
	.align 16,0x90
null_call:
	ret
.globl wrapper
	.type wrapper, @function
	.align 16,0x90
wrapper:
	pusha			# store registers (EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI) 
	pushf			# store flags
	
	push %ebp		# set up a stack frame 
	movl %esp, %ebp

	leal 4(%ebp), %eax	# push flags addr
	push %eax
	leal 8(%ebp), %eax	# push registers addr
	push %eax
	
	leal 40(%ebp), %edx	
	movl (%ebp), %eax
	subl %edx, %eax
	push %eax
	push %edx
	
	call *report_entry	# report entry

	leave			# restore %esp, %ebp
	popf			# restore flags
	popa			# restore registers
	
	popl caller_return	# switch return addresses
	pushl $.Lwrapper_return 
	
	jmp *wrapper_target	# wrapper_target should return at .Lwrapper_return

	.align 16, 0x90
.Lwrapper_return:	
	pushl caller_return	# restore the original return address
	pusha			# more for reference sake here
	pushf
	
	push %ebp		# set up a stack frame
	movl %esp, %ebp

	leal 4(%ebp), %eax	# push flags addr
	push %eax
	leal 8(%ebp), %eax	# push registers addr
	push %eax

	leal 40(%ebp), %edx	# push stack top address (relative to our entry)
	movl (%ebp), %eax
	subl %edx, %eax		# calculate difference between entry and previous frame
	push %eax
	push %edx

	call *report_ret	# report the return information (same args)

	leave
	popf
	popa
	ret
	
--- NEW FILE ---
#ifndef _WRAPPER_H
#define _WRAPPER_H

#include <sys/types.h>

typedef struct {
  u_int32_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
} reg386_t;

typedef void (*wrapper_func_t)(void *stack_base, int stack_size, reg386_t *reg,  u_int32_t *flags);

extern wrapper_func_t report_entry, report_ret;

extern void (*wrapper_target)(void);

extern int wrapper(void);

#endif /* _WRAPPER_H */





More information about the MPlayer-cvslog mailing list