summaryrefslogtreecommitdiff
path: root/Board/EM/Csm/MBIOSMAC.MAC
blob: 63d9b5a1755aa5016a16cfca997f6a1fc77ed6c2 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
;Inclusion guard
ifndef _mbiosmac_mac_
_mbiosmac_mac_	equ	1
.xlist

;*****************************************************************;
;*****************************************************************;
;**                                                             **;
;**      (C)Copyright 1985-2000, American Megatrends, Inc.      **;
;**                                                             **;
;**                     All Rights Reserved.                    **;
;**                                                             **;
;**           6145-F Northbelt Pkwy, Norcross, GA 30071         **;
;**                                                             **;
;**                     Phone (770)-246-8600                    **;
;**                                                             **;
;*****************************************************************;
;*****************************************************************;
;*****************************************************************;
; $Header: /Alaska/SOURCE/Modules/CSM/Generic/OEM Hooks/MBIOSMAC.MAC 1     5/16/06 2:39p Olegi $
;
; $Revision: 1 $
;
; $Date: 5/16/06 2:39p $
;*****************************************************************;
;*****************************************************************;
; Revision History
; ----------------
; $Log: /Alaska/SOURCE/Modules/CSM/Generic/OEM Hooks/MBIOSMAC.MAC $
; 
; 1     5/16/06 2:39p Olegi
; 
; 3     9/27/02 5:49p Anandj
; Added SET_ORG_PLUS macro
; 
; 2     8/06/02 3:46p Dickh
; Surrounded RT_CHECK_POINT and check_point_ini macros with
; indef statements so that they can be overridden.
; 
; 4     7/24/01 9:30a Anandj
; Macro eK_PROC is moved to mbiosmac.mac.
;
; 3     7/24/01 9:01a Anandj
; Macros IO_DELAY and IO_DELAY_BB are moved to mbiosmac.mac.
;
; 2     5/31/01 3:22p Anandj
; Deleted IO_DELAY macro
;
; 1     5/25/01 2:34p Anandj
;
; 1     5/25/01 1:38p Anandj
; First Check in on CORE database
;
; 3     5/10/01 4:51p Sudhakaro
; Updated to use the macro SET_ORG instead of  ORG directive, so that
; MAPGUARD can detect the code overlap problems.
;
; 2     3/28/01 12:42p Sudhakaro
; Updated for TBLv1.1 integration
;
; 1     3/26/01 4:36p Vivekc
;
; 1     3/22/01 1:49p Vivekc
;
; 3     3/01/01 5:01p Juand
; Removed unused macros.
;
; 2     11/21/00 1:50p Juand
; BigBIOS changes.
;
; 1     4/28/00 10:53a Olegi
;
; 2     1/31/00 7:04p Juand
; Added Inclusion guard.
;
; 1     11/29/99 11:48a Debkumar
; Initial CheckIn for Core 7.00.
;
; 2     3/16/99 6:27p Robertj
; Added initial ADM code (beta version)
;
; 1     6/05/97 12:33p Debkumar
;
; 1     1/31/97 11:30a Debkumar
; New files for 62700.
;
; 1     1/02/97 10:50a Debkumar
; Started with 6.26.02 files.
;
; 6     9/03/96 5:18p Mandal
; 6.26 for USA
;
; 1     6/17/96 2:39p Mandal
;
; 5     3/21/96 6:44p Mandal
; AMI address changed.
;
; 4     3/21/96 6:09p Mandal
; (c)1996 and phone no changed.
;
; 3     2/19/96 6:49p Mandal
; IO_DELAY macro modified.
;
;*****************************************************************;
;---------------------------------------;
;		RET_SP			;
;---------------------------------------;
ret_sp	macro	dummy			; call routine without stack
	local	llll, lll		; local label
	even
	mov	sp, offset cs:lll	; return address
	jmp	dummy
lll:
	dw	offset cs:llll		; return address
llll:
endm
;---------------------------------------;
;		JMP_SP			;
;---------------------------------------;
jmp_sp	macro	dummy			; goto routine & back (via SP)
	local	llll			; local label
	mov	sp, offset cs:llll		; return address
	jmp	dummy
llll:
endm
;---------------------------------------;
;		JMP_BP			;
;---------------------------------------;
jmp_bp	macro	dummy			; goto routine & back (via SI)
	local	llll			; local label
	mov	bp, offset cs:llll		; return address
	jmp	dummy
llll:
endm
;---------------------------------------;
;		JMP_CX			;
;---------------------------------------;
jmp_cx	macro	dummy			; goto routine & back (via SI)
	local	llll			; local label
	mov	cx, offset cs:llll		; return address
	jmp	dummy
llll:
endm
;---------------------------------------;
;		JMP_SI			;
;---------------------------------------;
jmp_si	macro	dummy			; goto routine & back (via SI)
	local	llll			; local label
	mov	si, offset cs:llll	; return address
	jmp	dummy
llll:
endm
;---------------------------------------;
;		JMP_DI			;
;---------------------------------------;
jmp_di	macro	dummy			; goto routine & back (via DI)
	local	llll			; local label
	mov	di, offset cs:llll	; return address
	jmp	dummy
llll:
endm
;---------------------------------------;
;		DES_TAB			;
;---------------------------------------;
des_tab	macro	v_mode_seg_size,seg_low_word,seg_high_byte,access_right
	dw	v_mode_seg_size
	dw	seg_low_word		; low word for descriptor
	db	seg_high_byte			; descriptor high byte
	db	access_right			; access right byte
	dw	0000h			; reserved word
endm

;---------------------------------------;
;	CHECK_POINT_INI			;
;---------------------------------------;
ifndef check_point_ini
check_point_ini	macro	xx
	mov	al,xx
	out	80h,al
endm
endif

ifndef RT_CHECK_POINT
RT_CHECK_POINT	MACRO CP
	mov	al, CP
	out	80h, al
ENDM
endif

;<AMI_MHDR_START>
;----------------------------------------------------------------------------
; Name:		IO_DELAY
;
; Description:	This macro can be used to introduced a delay of one IO
;		read operation. Use this macro only when the stack is
;		availabel.
;
; Input:
;----------------------------------------------------------------------------
;<AMI_MHDR_END>
IO_DELAY	MACRO
	push	ax
	in	al, refresh_port
	pop	ax
ENDM

;<AMI_MHDR_START>
;----------------------------------------------------------------------------
; Name:		IO_DELAY_BB
;
; Description:	This macro can be used to introduced a delay two jumps.
;		The idea is, the jump will cause CPU to flush its instruction
;		cache and will introduce some delay. In the newer CPUs this macro
;		will introduce hardly any delay.
;		This macro can be used without stack.
;
; Input:
;----------------------------------------------------------------------------
;<AMI_MHDR_END>
IO_DELAY_bb	MACRO
	jcxz	$+2
	jcxz	$+2

ENDM


;<AMI_MHDR_START>
;----------------------------------------------------------------------------
; Name:		SET_ORG
;
; Description:	This macro can be used as a replacement to "ORG" directive
;		in source files. The advantage in using this macro instead
;		of "ORG" directive is that it generates necessary labels for
;		for mapgaurd utility, so that any possible code overlaps
;		betweens ORGs can be detected during build time itself.
;
; Input:	OrgValue	- Value for ORG.
;		GuardTag	- Tag name for mapgaurd utility.
;----------------------------------------------------------------------------
;<AMI_MHDR_END>

SET_ORG	MACRO	OrgValue, GuardTag

	PUBLIC	orgguard_&GuardTag&_&OrgValue&_start
orgguard_&GuardTag&_&OrgValue&_start	LABEL	BYTE
	ORG	OrgValue
	PUBLIC	orgguard_&GuardTag&_&OrgValue&_end
orgguard_&GuardTag&_&OrgValue&_end	LABEL	BYTE

ENDM

;<AMI_MHDR_START>
;----------------------------------------------------------------------------
; Name:		SET_ORG_PLUS
;
; Description:	This macro can be used as a replacement to "ORG" directive
;		in source files. The advantage in using this macro instead
;		of "ORG" directive is that it generates necessary labels for
;		for mapgaurd utility, so that any possible code overlaps
;		betweens ORGs can be detected during build time itself.
;
; Input:	OrgBase		- Value for ORG base
;		OrgPlus		- Offset from the OrgBase.
;		GuardTag	- Tag name for mapgaurd utility.
;----------------------------------------------------------------------------
;<AMI_MHDR_END>
SET_ORG_Plus	MACRO	OrgBase, OrgPlus, GuardTag
	PUBLIC	orgguard_&GuardTag&_&OrgPlus&_&OrgBase&_start
orgguard_&GuardTag&_&OrgPlus&_&OrgBase&_start	LABEL	BYTE
	ORG	OrgBase + OrgPlus
	PUBLIC	orgguard_&GuardTag&_&OrgPlus&_&OrgBase&_end
orgguard_&GuardTag&_&OrgPlus&_&OrgBase&_end	LABEL	BYTE
ENDM

;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mEXTERN_NEAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mEXTERN_NEAR MACRO LabelName

	EXTERN	LabelName:NEAR		; Define the label as a NEAR EXTERN.

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mEXTERN_FAR
;
; Description:
;
; Input:	
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mEXTERN_FAR MACRO LabelName

	EXTERN	LabelName:FAR		; Define the label as a FAR EXTERN.

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mSTART_PROC_NEAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mSTART_PROC_NEAR MACRO LabelName

LabelName PROC NEAR PUBLIC

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mBODY_CALL_PROC_NEAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mBODY_CALL_PROC_NEAR MACRO LabelID, LabelName

	call	LabelName

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mBODY_JMP_PROC_NEAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mBODY_JMP_PROC_NEAR MACRO LabelID, LabelName

	jmp	LabelName
	PUBLIC	LabelName&End
LabelName&End::

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mEND_PROC_NEAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mEND_PROC_NEAR MACRO LabelName

	ret
LabelName ENDP

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mEND_PROC_WITH_JMP_NEAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mEND_PROC_WITH_JMP_NEAR MACRO LabelName

	EXTERN	LabelName&End:NEAR
	jmp	LabelName&End
LabelName ENDP

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mSTART_PROC_FAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mSTART_PROC_FAR MACRO LabelName

LabelName PROC FAR PUBLIC	

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mBODY_CALL_PROC_FAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mBODY_CALL_PROC_FAR MACRO LabelID, LabelName

	call	LabelName

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mBODY_JMP_PROC_FAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mBODY_JMP_PROC_FAR MACRO LabelID, LabelName

	jmp	LabelName
	PUBLIC	LabelName&End
LabelName&End::

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mEND_PROC_FAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mEND_PROC_FAR MACRO LabelName

	ret
LabelName ENDP

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mEND_PROC_WITH_JMP_FAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mEND_PROC_WITH_JMP_FAR MACRO LabelName

	EXTERN	LabelName&End:FAR
	jmp	LabelName&End
LabelName ENDP

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mSTART_TBL
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mSTART_TBL MACRO LabelName

	PUBLIC	LabelName
LabelName LABEL BYTE

ENDM

;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mBODY_TBL_ENTRY_NEAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mBODY_TBL_ENTRY_NEAR MACRO LabelID, LabelName

	stTblEntryNEAR <LabelName>

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mBODY_ID_AND_TBL_ENTRY_NEAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mBODY_ID_AND_TBL_ENTRY_NEAR MACRO LabelID, LabelName

	stIDAndTblEntryNEAR <LabelID, LabelName>

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mBODY_ID_AND_TBL_CSM_ENTRY_NEAR
;
; Description:	This macro is used to declare a function entry with an ID and
;				a NEAR function. The EXTERN declaration is done WITHIN the 16 bit segment.
;				This is useful if the macro is used to create a binary using EXE2BIN;
;				if EXTRERN is declared outside the segment, then EXE2BIN will not work.
;
; Notes:		EXTERN definition only for functions (Prog. Guide pg 253)
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mBODY_ID_AND_TBL_CSM_ENTRY_NEAR MACRO LabelID, LabelName

	EXTERN LabelName:NEAR
	stIDAndTblEntryNEAR <LabelID, LabelName>

ENDM

mEND_TBL_CSM MACRO LabelName
	stIDAndTblEntryNEAR <0FFFFh, 0>
LabelName&End LABEL BYTE
ENDM

;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mBODY_TBL_ENTRY_FAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mBODY_TBL_ENTRY_FAR MACRO LabelID, LabelName

	stTblEntryFAR <LabelName>

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mBODY_ID_AND_TBL_ENTRY_FAR
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mBODY_ID_AND_TBL_ENTRY_FAR MACRO LabelID, LabelName

	stIDAndTblEntryFAR <LabelID, LabelName>

ENDM


;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Name:		mEND_TBL
;
; Description:	
;
; Input:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>

mEND_TBL MACRO LabelName

	PUBLIC	LabelName&End
LabelName&End LABEL BYTE

ENDM



;*****************************************************************;
;*****************************************************************;
;**                                                             **;
;**      (C)Copyright 1985-2000, American Megatrends, Inc.      **;
;**                                                             **;
;**                     All Rights Reserved.                    **;
;**                                                             **;
;**           6145-F Northbelt Pkwy, Norcross, GA 30071         **;
;**                                                             **;
;**                     Phone (770)-246-8600                    **;
;**                                                             **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------;
.list

;End of Inclusion guard
endif	;_mbiosmac_mac_