wine/if1632/call.S
Alexandre Julliard f41aeca9ff Release 0.4.0
Mon Sep 13 05:00:11 1993  Eric Youngdale

	* [Makefile] [if1632/relay.c] [include/dlls.h] [selector.c]
	  [loader/wine.c] [tools/build.c]
	Added ability to generate missing functions statistics.

Mon Sep 13 12:09:47 1993  Scott A. Laird  (scott@curly)

	* [WIN31-APPLETS]
	Added new file.

	* [if1632/kernel.spec]
	Added definitions for GetProfile{Int,String} and SetHandleCount.

	* [if1632/keyboard.spec]
	Created interface specification for Keyboard driver DLL.

	* [if1632/relay.c]
	Added keyboard.dll to list of included DLLs.

	* [if1632/user.spec]
	Added LoadAccelerators definition.

	* [loader/resource.c]
	Added LoadAccelerators stub.

	* [misc/file.c]
	Changed OpenFile, and added SetHandleCount (for winfile.exe)

	* [misc/keyboard.c]
	Added keyboard code.

	* [misc/profile.c] [misc/xt.c]
	Moved GetPrivateProfile* commands here, and added GetProfile*
	commands.

Mon Sep 13 10:24:37 1993  Andrew Bulhak

	* [windows/utility.c]
	Implemented MulDiv(), OutputDebugString() and wvsprintf()

Fri Sep 10 09:13:30 1993  John Brezak

	* [*/Makefile]
	Created patch to allow BSD make to build wine.

	* [windows/win.c]
	Fixed NULL pointer reference.

	* [windows/message.c] [misc/xt.c]
	Defined HZ to handle system specific timing.

	* [windows/graphics.c]
	Use M_PI is PI

	* [objects/pallete.c]
	NetBSD does not have /usr/include/values.h and MAXINT is INT_MAX.

	* [dump.c] [ldt.c] [wine.c]
	ifdef'ed linux headers for linux compile.

	* [loader/ldtlib.c]
	Add NetBSD system calls when compiled on that system.

	* [loader/selector.c]
	Use mmap(MAP_ANON, ...) for NetBSD.

	* [if1632/call.S]
	Fixed selector assumptions.

Thu Sep 9 20:01:37 1993  David Metcalfe

	* [controls/WinButton*] [controls/button.c] [controls/widget.c]
  	  [windows/win.c] [windows/class.c]
	Added 3D button control and tied into CreateWindow()

Thu Sep  9 07:35:24 1993  Scott Laird

	* [if1632/sound.spec]
	Created interface specification for SOUND DLL.

	* [if1632/win87em.spec]
	Added more functions to the WIN87EM DLL interface specification

	* [misc/emulate.c]
	Created stubs for the new math emulation functions.

	* [misc/sound.c]
	Created stubs for the SOUND DLL.

Sun Sep  5 21:02:10 1993  John Burton

	* [if1632/kernel.spec]
	Added interface specifications for OpenFile, _lclose, _lread, _lopen,
	and _lwrite.

	* [include/windows.h]
	Added OF_ macros

	* [misc/file.c]
	Implemented OpenFile, _lclose, _lread, _lopen and _lwrite.

Fri Sep  3 18:47:03 1993  Alexandre Julliard

        * [windows/dc.c]
	Bug fix

	* [objects/text.c]
	Bug fix

Fri Sep  3 18:47:03 1993  Bob Amstadt

        * [objects/linedda.c]
        Finished LineDDA().
1993-09-14 16:47:10 +00:00

380 lines
6.9 KiB
ArmAsm
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Copyright Robert J. Amstadt, 1993
*/
#ifdef linux
#define UDATASEL 0x2b
#endif
#ifdef __NetBSD__
#define UDATASEL 0x27
#endif
.data
jump_target:
return_value:
.long 0
/**********************************************************************
* Places to keep info about the current 32-bit stack frame.
*/
saved_esp:
.long 0
saved_ebp:
.long 0
saved_ss:
.word 0
/**********************************************************************
* Places to keep info about the current 16-bit stack frame.
*/
.globl _IF1632_Saved16_esp,_IF1632_Saved16_ebp,_IF1632_Saved16_ss
_IF1632_Saved16_esp:
.long 0
_IF1632_Saved16_ebp:
.long 0
_IF1632_Saved16_ss:
.word 0
nbytes:
.word 0
selector:
.word 0
offset:
.word 0
.text
/**********************************************************************
* int CallToInit16(unsigned long csip, unsigned long sssp,
* unsigned short ds)
*
* Stack: 0 ebp
* 4 eip
* 8 target ip
* 10 target cs
* 12 target sp
* 14 target ss
* 16 target ds
*/
.align 4
.globl _CallToInit16
_CallToInit16:
pushl %ebp
movl %esp,%ebp
/*
* Save our registers
*/
pushal
pushl saved_esp
pushl saved_ebp
pushw saved_ss
/*
* Get target address.
*/
movl 8(%ebp),%eax
movl %eax,jump_target
lea jump_target,%edx
/*
* Put stack registers where we can get them after stack switch.
*/
movw %ss,saved_ss
movl %esp,saved_esp
movl %ebp,saved_ebp
/*
* Load initial registers
*/
movw _WIN_StackSize,%bx
movw _WIN_HeapSize,%cx
movl $0,%esi
xorl %eax,%eax
movw _PSPSelector,%ax
movw %ax,%es
movw 16(%ebp),%ax
movw %ax,%ds
movl %eax,%edi
xorl %eax,%eax
movw 12(%ebp),%ax
movl %eax,%esp
movw 14(%ebp),%ax
movw %ax,%ss
movl %esp,%eax
movl %eax,%ebp
#if 1
movw $ UDATASEL,%ax
movw %ax,%fs
movw %ax,%gs
#endif
/*
* Call entry point
*/
.byte 0x66
lcall %fs:(%edx)
/*
* Restore old stack and segment registers.
*
* Two choices here:
* 1. Trust that fs or gs hasn't changed.
* 2. Rely on knowledge of Linux use of segments.
*
* I'll opt for choice 2 because who knows what programs we
* going to run. Linux should be fairly stable in terms of
* GDT usage.
*/
pushl %eax
movw $ UDATASEL,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%fs
movw %ax,%gs
popl %eax
movw saved_ss,%ss
movl saved_esp,%esp
movl saved_ebp,%ebp
/*
* Restore registers, but do not destroy return value.
*/
popw saved_ss
popl saved_ebp
popl saved_esp
movl %eax,return_value
popal
movl return_value,%eax
.align 2,0x90
leave
ret
/**********************************************************************
* int CallTo16(unsigned long csip, unsigned short ds)
*
* Stack: 0 ebp
* 4 eip
* 8 target ip
* 10 target cs
* 12 target ds
*/
.align 4
.globl _CallTo16
_CallTo16:
pushl %ebp
movl %esp,%ebp
/*
* Get target address and new ds
*/
movl 8(%ebp),%eax
movl %eax,jump_target
lea jump_target,%edx
movw 12(%ebp),%ax
/*
* Switch to 16-bit stack
*/
pushl saved_esp
pushl saved_ebp
pushw saved_ss
movw %ss,saved_ss
movl %esp,saved_esp
movl %ebp,saved_ebp
movw _IF1632_Saved16_ss,%ss
movl _IF1632_Saved16_esp,%esp
movl _IF1632_Saved16_ebp,%ebp
/*
* Call entry point
*/
movw %ax,%ds
.byte 0x66
lcall %fs:(%edx)
/*
* Restore old stack and segment registers.
*
* Two choices here:
* 1. Trust that fs or gs hasn't changed.
* 2. Rely on knowledge of Linux use of segments.
*
* I'll opt for choice 2 because who knows what programs we
* going to run. Linux should be fairly stable in terms of
* GDT usage.
*/
pushl %eax
movw $ UDATASEL,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%fs
movw %ax,%gs
popl %eax
movw %ss,_IF1632_Saved16_ss
movl %esp,_IF1632_Saved16_esp
movl %ebp,_IF1632_Saved16_ebp
movw saved_ss,%ss
movl saved_esp,%esp
movl saved_ebp,%ebp
popw saved_ss
popl saved_ebp
popl saved_esp
movl %eax,return_value
movw return_value+2,%dx
.align 2,0x90
leave
ret
/**********************************************************************
* CallTo32()
*
* This function is called as a relay point to the built function
* handler. KERNEL, USER and GDI calls are dealt with by this
* handler. Calls to these DLLs will be mapped to a call handler
* which will set EAX to a number indicating which DLL and which
* function within that DLL.
*
* This function will pass to the function handler two arguments.
* The first argument will be the contents of EAX, the second
* argument will be a segment:offset pair that points to the
* 16-bit stack.
*/
.align 4
.globl _CallTo32
_CallTo32:
pushl %ebp
movl %esp,%ebp
/*
* Save registers. 286 mode does not have fs or gs.
*/
pushw %ds
pushw %es
/*
* Restore segment registers.
*/
pushl %eax
movw $ UDATASEL,%ax
movw %ax,%ds
movw %ax,%es
popl %eax
/*
* Save old stack save variables, save stack registers, reload
* stack registers.
*/
pushl _IF1632_Saved16_esp
pushl _IF1632_Saved16_ebp
pushw _IF1632_Saved16_ss
movw %ss,_IF1632_Saved16_ss
movl %esp,_IF1632_Saved16_esp
movl %ebp,_IF1632_Saved16_ebp
movw saved_ss,%ss
movl saved_esp,%esp
movl saved_ebp,%ebp
/*
* Call entry point
*/
pushw _IF1632_Saved16_ss
pushw _IF1632_Saved16_esp
pushl %eax
call _DLLRelay
/*
* Restore registers, but do not destroy return value.
*/
movw _IF1632_Saved16_ss,%ss
movl _IF1632_Saved16_esp,%esp
movl _IF1632_Saved16_ebp,%ebp
popw _IF1632_Saved16_ss
popl _IF1632_Saved16_ebp
popl _IF1632_Saved16_esp
popw %es
popw %ds
.align 2,0x90
leave
/*
* Now we need to ditch the parameter bytes that were left on the
* stack. We do this by effectively popping the number of bytes,
* and the return address, removing the parameters and then putting
* the return address back on the stack.
* Normally this field is filled in by the relevant function in
* the emulation library, since it should know how many bytes to
* expect.
*/
popw %gs:nbytes
cmpw $0,%gs:nbytes
je noargs
popw %gs:offset
popw %gs:selector
addw %gs:nbytes,%esp
pushw %gs:selector
pushw %gs:offset
noargs:
/*
* Last, but not least we need to move the high word from eax to dx
*/
pushl %eax
popw %dx
popw %dx
.byte 0x66
lret
/**********************************************************************
* ReturnFromRegisterFunc()
*/
.globl _ReturnFromRegisterFunc
_ReturnFromRegisterFunc:
/*
* Restore 16-bit stack
*/
movw _IF1632_Saved16_ss,%ss
movl _IF1632_Saved16_esp,%esp
movl _IF1632_Saved16_ebp,%ebp
popw _IF1632_Saved16_ss
popl _IF1632_Saved16_ebp
popl _IF1632_Saved16_esp
popw %es
popw %ds
.align 2,0x90
leave
/*
* This leaves us with a stack that has number of arguments,
* the return address, the saved registers, and the return
* address again.
*/
popw %ax /* Throw away the number of arguments */
popl %eax /* Throw away first copy of return address */
popw %es
popw %ds
popw %di
popw %si
popw %bp
popw %ax /* Throw away pushed stack pointer */
popw %bx
popw %dx
popw %cx
popw %ax
/*
* Return to original caller.
*/
.byte 0x66
lret