summaryrefslogtreecommitdiff
path: root/hw/xfree86/os-support/misc/SlowBcopy.S
blob: e62738b00dd6d27e54ee591862391ba8bc9517e9 (plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* $XFree86$ */
/*******************************************************************************
                        Copyright 1994 by Glenn G. Lai

                        All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyr notice appear in all copies and that
both that copyr notice and this permission notice appear in
supporting documentation, and that the name of Glenn G. Lai not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.

Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

Glenn G. Lai
P.O. Box 4314
Austin, Tx 78765
glenn@cs.utexas.edu)
7/21/94
*******************************************************************************/
/* $XConsortium: SlowBcopy.s /main/4 1996/02/21 17:40:52 kaleb $ */
 
/* 
 *   Modified from the output generated by GCC
 *
 *   Create a dependency that should be immune from the effect of register
 *   renaming as is commonly seen in superscalar processors.  This should
 *   insert a minimum of 100-ns delays between reads/writes at clock rates
 *   up to 100 MHz---GGL
 *   
 *   Slowbcopy(char *src, char *dst, int count)   
 *   
 */ 

#include "assyntax.h"

	FILE("SlowBcopy.s")

	AS_BEGIN

gcc2_compiled.:
___gnu_compiled_c:

	GLOBL	GLNAME(xf86SlowBcopy)

	SEG_TEXT
	ALIGNTEXT4
GLNAME(xf86SlowBcopy):
	PUSH_L	(EBP)
	MOV_L	(ESP,EBP)
	PUSH_L	(ESI)
	PUSH_L	(EBX)
	MOV_L	(REGOFF(8,EBP),ECX)
	MOV_L	(REGOFF(12,EBP),EDX)
	MOV_L	(REGOFF(16,EBP),ESI)
	XOR_L	(EAX,EAX)
	CMP_L	(ESI,EAX)
	JGE	(L3)

	ALIGNTEXT4
L5:
	MOV_B	(REGIND(ECX),BL)

	MOV_B	(BL, BH)
	MOV_B	(BH, BL)
	MOV_B	(BL, BH)
	MOV_B	(BH, BL)
	MOV_B	(BL, BH)
	MOV_B	(BH, BL)
	MOV_B	(BL, BH)
	MOV_B	(BH, BL)
	MOV_B	(BL, BH)
	MOV_B	(BH, BL)

	MOV_B	(BL,REGIND(EDX))

	INC_L	(ECX)
	DEC_L	(ECX)
	INC_L	(ECX)
	DEC_L	(ECX)
	INC_L	(ECX)
	DEC_L	(ECX)
	INC_L	(ECX)
	DEC_L	(ECX)
	INC_L	(ECX)
	DEC_L	(ECX)

	INC_L	(ECX)
	INC_L	(EDX)
	INC_L	(EAX)
	CMP_L	(ESI,EAX)
	JL	(L5)
L3:
	LEA_L	(REGOFF(-8,EBP),ESP)
	POP_L	(EBX)
	POP_L	(ESI)
	MOV_L	(EBP,ESP)
	POP_L	(EBP)
	RET