summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/i386ex/start/macros.inc
blob: 53016ad62a1ad00fbba4a96c7584348bc50b0db8 (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
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
/* macros.inc
 *
 * This file assists the board independent startup code
 * by initializing the chip-select channels to 
 * reflect the proper memory configuration.
 *
 * NOTE: No stack has been established when this routine	
 *       is invoked.  It returns to start.s through ldsegs
 *
 *  Submitted by:
 *
 *    Erik Ivanenko
 *    University of Toronto
 *    erik.ivanenko@utoronto.ca
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.OARcorp.com/rtems/license.html.
 *
 *  $Id$
 */

.set GDT_CODE_PTR	, 0x10
.set GDT_DATA_PTR	, 0x18	

.set BOARD_SELECT  , 0x301
.set BOARD_DATA	   , 0x302
.set BOARD_LATCH   , 0x303


#define SetExRegByte(_register,_value) \
        movb       $ ## _value, al; \
	movw	  $ ## _register, dx; \
        outb       al, dx

#define SetExRegWord(_register,_value) \
        movw      $ ## _value, ax; \
	movw      $ ## _register, dx ; \
        outw      ax, dx


#define DESC2(lim_0_15, bas_0_15, bas_16_23, access, gran, bas_24_31) \
 .word lim_0_15 ; \
 .word bas_0_15 ; \
 .byte bas_16_23 ; \
 .byte access ; \
 .byte gran ; \
 .byte bas_24_31

#define DESC3( _base, _limit) \
.word _limit ; \
.long _base

/* THE GET_ACCESS IS CHANGED FROM 8E TO 9E */

#define INTERRUPT_GATE( _vector ) \
	.word   _vector ; \
	.word	GDT_CODE_PTR ; \
	.byte   0x0 ; \
	.byte	0x8E ; \
	.word	0x0

#define rLOAD_INDEX( _selector, _segment_register) \
        movl     _selector , _segment_register ; \
        addb	al, ( eax )

#define rLOAD_SEGMENT( _reg, _segment_register) \
        mov     _reg , _segment_register ; \

/* #define rLOAD_SEGMENT( _reg, _segment_register) \
	.code16 ; \
        mov     _reg , _segment_register ; \
        .code32 
*/
#define pLOAD_SEGMENT( _selector, _segment_register) \
        movl     $ ##  _selector , eax ; .code16 ; \
        mov      ax, _segment_register ; .code32 

/* #define MOVE_WORD( _immed32, _reg ) \
	data16 ; \
	movl    _immed32, _reg
*/

#define MOVE_WORD( _immed32, _reg ) \
	movw    _immed32, _reg

/* #define MOVE_IMMED_WORD( _immed32, _reg ) \
	data16 ; \
	mov    $ ## _immed32, _reg

#define CS_OFF( _cs_symbol, _reg ) \
	data16 ; \
	mov	_cs_symbol, _reg ; \
	data16 ;\
	andl	$0x000ffff, _reg

#define _16_NOPS \
	nop ; \
	nop ; \
	nop ; \
	nop ; \
	nop ; \
	nop ; \
	nop ; \
	nop ; \
	nop ; \
	nop ; \
	nop ; \
	nop ; \
	nop ; \
	nop ; \
	nop ; \
	nop ; 
*/