summaryrefslogtreecommitdiffstats
path: root/private/ntos/dll/i386/emfmisc.asm
blob: 6adc08dc3f461a51d29a60652501e2fb59a56c3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
        subttl  emfmisc.asm - FABS, FCHS, FFREE, FXCH
        page
;*******************************************************************************
;emfmisc.asm - FABS, FCHS, FFREE, FXCH
;
;        Microsoft Confidential
;
;	 Copyright (c) Microsoft Corporation 1991
;        All Rights Reserved
;
;Purpose:
;       FABS, FCHS, FFREE, FXCH instructions
;Inputs:
;	edi = [CURstk]
;	esi = pointer to st(i) from instruction field
;
;Revision History:
;
; []	09/05/91  TP	Initial 32-bit version.
;
;*******************************************************************************


;******
EM_ENTRY eFABS
eFABS:
;******
	cmp	EMSEG:[edi].bTag,bTAG_EMPTY
	jz	StackError		;in emarith.asm
	mov	EMSEG:[edi].bSgn,0		;Turn sign bit off
	ret

;******
EM_ENTRY eFCHS
eFCHS:
;******
	cmp	EMSEG:[edi].bTag,bTAG_EMPTY
	jz	StackError		;in emarith.asm
	not	EMSEG:[edi].bSgn		;Flip the sign
	ret

;******
EM_ENTRY eFFREE
eFFREE:
;******
	mov	EMSEG:[esi].bTag,bTAG_EMPTY
	ret

;******
EM_ENTRY eFXCH
eFXCH:
;******
	cmp	EMSEG:[esi].bTag,bTAG_EMPTY
	jz	XchDestEmpty
XchgChkSrc:
	cmp	EMSEG:[edi].bTag,bTAG_EMPTY
	jz	XchSrcEmpty
DoSwap:
;Swap [esi] with [edi]
	mov	eax,EMSEG:[edi]
	xchg	eax,EMSEG:[esi]
	mov	EMSEG:[edi],eax
	mov	eax,EMSEG:[edi+4]
	xchg	eax,EMSEG:[esi+4]
	mov	EMSEG:[edi+4],eax
	mov	eax,EMSEG:[edi+8]
	xchg	eax,EMSEG:[esi+8]
	mov	EMSEG:[edi+8],eax
	ret

XchDestEmpty:
	call	ReturnIndefinite	;in emarith.asm - ZF set if unmasked
	jnz	XchgChkSrc		;Continue if masked
	ret

XchSrcEmpty:
	xchg	edi,esi			;pass pointer in esi
	call	ReturnIndefinite	;in emarith.asm - ZF set if unmasked
	xchg	edi,esi
	jnz	DoSwap			;Continue if masked
	ret