OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [oc/] [gdb-5.0/] [utils/] [amd-udi/] [udi/] [dosdfe.asm] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
;******************************************************************************
2
;* Copyright 1991 Advanced Micro Devices, Inc.
3
;*
4
;* This software is the property of Advanced Micro Devices, Inc  (AMD)  which
5
;* specifically  grants the user the right to modify, use and distribute this
6
;* software provided this notice is not removed or altered.  All other rights
7
;* are reserved by AMD.
8
;*
9
;* AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
10
;* SOFTWARE.  IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
11
;* DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
12
;* USE OF THIS SOFTWARE.
13
;*
14
;* Comments about this software should be directed to udi@amd.com. If access
15
;* to electronic mail isn't available, send mail to:
16
;*
17
;* Advanced Micro Devices, Inc.
18
;* 29K Support Products
19
;* Mail Stop 573
20
;* 5900 E. Ben White Blvd.
21
;* Austin, TX 78741
22
;*****************************************************************************
23
;*       $Id: dosdfe.asm,v 1.1.1.1 2001-05-18 11:27:55 markom Exp $
24
;*       $Id: @(#)dosdfe.asm    2.5, AMD
25
;*
26
IFNDEF  DOS386
27
        DOSSEG
28
ENDIF
29
        INCLUDE udidos.ah
30
IFDEF   DOS386
31
 
32
rmcode  segment byte public use16
33
rmcode  ends
34
rmdata  segment dword public use16
35
rmdata  ends
36
pmdata  segment dword public use32
37
pmdata  ends
38
pmcode  segment byte public use32
39
pmcode  ends
40
dgroup  group   rmdata,pmdata
41
 
42
 
43
 
44
rmcode  segment
45
 
46
;
47
; Symbol marking start of real mode code & data,
48
; used at link time to specify the real mode
49
; code & data size
50
;
51
        public  start_real
52
start_real label        byte
53
 
54
rmcode  ends
55
 
56
 
57
 
58
;
59
; Data that needs to be accessed in both real
60
; mode and protected mode
61
;
62
rmdata  segment
63
 
64
 
65
        public code_selector, data_selector, call_prot
66
        ; these get filled in by protected mode startup code
67
 
68
code_selector  DW ?
69
data_selector  DW ?
70
call_prot       DD ?
71
 
72
rmdata  ends
73
 
74
 
75
 
76
 
77
rmdata  segment
78
 
79
        public  TermStruct              ; No auto underscore for Watcom C or HighC386
80
TermStruct      DOSTerm <>              ; Don't initialize, it will get filled at run time.
81
        public  UDITerminate            ; need this so we can set up real addr into TermSTruct
82
 
83
rmdata  ends
84
 
85
rmcode  segment
86
 
87
 
88
ELSE    ; not DOS386
89
 
90
        PUBLIC  _TermStruct
91
        .MODEL  LARGE
92
        .DATA
93
_TermStruct  DOSTerm 
94
        .CODE
95
 
96
ENDIF  ; DOS386
97
 
98
 
99
 
100
 
101
UDITerminate    PROC    FAR
102
;
103
; Retrieve registers from save area
104
IFDEF   DOS386
105
        ASSUME  CS:rmcode
106
        mov     bx, OFFSET TermStruct   ; in 386 mode, the pointer we pass to TIP
107
                                        ; has UDITerminate seg = seg(rmcode)
108
        mov     ax, cs
109
ELSE    ; not DOS386
110
        mov     bx, OFFSET _TermStruct
111
        mov     ax, DGROUP
112
ENDIF   ; DOS386
113
        mov     es, ax
114
        mov     ss, es:[bx].sss
115
        mov     sp, es:[bx].ssp
116
        mov     ds, es:[bx].sds
117
        mov     si, es:[bx].ssi
118
        mov     di, es:[bx].sdi
119
        mov     bp, es:[bx].sbp
120
        mov     ax, es:[bx].retval
121
        ret                             ; far return because of PROC FAR
122
 
123
UDITerminate ENDP
124
 
125
IFDEF   DOS386
126
 
127
rmcode  ends
128
 
129
 
130
 
131
pmcode segment
132
 
133
 
134
        ASSUME CS:pmcode
135
        ASSUME DS:dgroup
136
 
137
        public  GetCS
138
GetCS   PROC NEAR
139
        mov     ax, cs
140
        ret
141
GetCS   ENDP
142
 
143
        public  GetDS
144
GetDS   PROC NEAR
145
        mov     ax, ds
146
        ret
147
GetDS   ENDP
148
 
149
 
150
        public  _exp_call_to
151
_exp_call_to PROC NEAR
152
        push    ebp
153
        mov     ebp, esp
154
        push    es              ; save at least all regs required by hc386
155
        push    gs
156
        push    fs
157
        push    ds
158
        push    ebx
159
        push    esi
160
        push    edi
161
        mov     ebx, [ebp+8]
162
        mov     ax, [ebx+0ah]   ; new ss,ds,etc.
163
        mov     ecx, [ebx+6]    ; new sp
164
        sub     ecx, 256        ; back up past TIPname space
165
        mov     es, ax
166
        mov     gs, ax
167
        mov     fs, ax
168
        mov     ds, ax
169
        mov     edx, esp
170
        mov     si, ss  ; save old ss:sp
171
        mov     ss, ax
172
        mov     esp, ecx
173
        ; now on new stack, save old stack
174
        push    edx
175
        push    si
176
        call    fword ptr cs:[ebx]
177
        ; restore old stack
178
        pop     si
179
        pop     edx
180
        mov     ss,si
181
        mov     esp,edx
182
        ; now we are back on original stack
183
        pop     edi
184
        pop     esi
185
        pop     ebx
186
        pop     ds
187
        pop     fs
188
        pop     gs
189
        pop     es
190
        pop     ebp
191
        ret                     ; eax will be the return
192
 
193
_exp_call_to ENDP
194
 
195
 
196
pmcode ends
197
 
198
 
199
 
200
rmdata   segment
201
;
202
; Symbol marking end of real mode code & data,
203
; used at link time to specify the real mode
204
; code & data size
205
;
206
        public  end_real
207
end_real label  byte
208
rmdata   ends
209
 
210
ENDIF   ; DOS386
211
 
212
        END

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.