Subversion Repositories Kolibri OS

Rev

Rev 7136 | Rev 8089 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2288 clevermous 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
7132 dunkaist 3
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
2288 clevermous 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
8
$Revision: 7522 $
9
 
10
 
7136 dunkaist 11
dpl0    =  10010000b      ; data read       dpl0
12
drw0    =  10010010b      ; data read/write dpl0
13
drw3    =  11110010b      ; data read/write dpl3
14
cpl0    =  10011010b      ; code read dpl0
15
cpl3    =  11111010b      ; code read dpl3
2288 clevermous 16
 
7136 dunkaist 17
D32     =  01000000b      ; 32bit segment
18
G32     =  10000000b      ; page gran
2288 clevermous 19
 
20
 
21
;;;;;;;;;;;;cpu_caps flags;;;;;;;;;;;;;;;;
22
 
7136 dunkaist 23
CPU_386        = 3
24
CPU_486        = 4
25
CPU_PENTIUM    = 5
26
CPU_P6         = 6
27
CPU_PENTIUM4   = 0x0F
2288 clevermous 28
 
7136 dunkaist 29
CAPS_FPU       =    00 ;on-chip x87 floating point unit
30
CAPS_VME       =    01 ;virtual-mode enhancements
31
CAPS_DE        =    02 ;debugging extensions
32
CAPS_PSE       =    03 ;page-size extensions
33
CAPS_TSC       =    04 ;time stamp counter
34
CAPS_MSR       =    05 ;model-specific registers
35
CAPS_PAE       =    06 ;physical-address extensions
36
CAPS_MCE       =    07 ;machine check exception
37
CAPS_CX8       =    08 ;CMPXCHG8B instruction
38
CAPS_APIC      =    09 ;on-chip advanced programmable
39
                       ;interrupt controller
40
;                   10 ;unused
41
CAPS_SEP       =    11 ;SYSENTER and SYSEXIT instructions
42
CAPS_MTRR      =    12 ;memory-type range registers
43
CAPS_PGE       =    13 ;page global extension
44
CAPS_MCA       =    14 ;machine check architecture
45
CAPS_CMOV      =    15 ;conditional move instructions
46
CAPS_PAT       =    16 ;page attribute table
2288 clevermous 47
 
7136 dunkaist 48
CAPS_PSE36     =    17 ;page-size extensions
49
CAPS_PSN       =    18 ;processor serial number
50
CAPS_CLFLUSH   =    19 ;CLFUSH instruction
2288 clevermous 51
 
7136 dunkaist 52
CAPS_DS        =    21 ;debug store
53
CAPS_ACPI      =    22 ;thermal monitor and software
54
                       ;controlled clock supported
55
CAPS_MMX       =    23 ;MMX instructions
56
CAPS_FXSR      =    24 ;FXSAVE and FXRSTOR instructions
57
CAPS_SSE       =    25 ;SSE instructions
58
CAPS_SSE2      =    26 ;SSE2 instructions
59
CAPS_SS        =    27 ;self-snoop
60
CAPS_HTT       =    28 ;hyper-threading technology
61
CAPS_TM        =    29 ;thermal monitor supported
62
CAPS_IA64      =    30 ;IA64 capabilities
63
CAPS_PBE       =    31 ;pending break enable
2288 clevermous 64
 
65
;ecx
7136 dunkaist 66
CAPS_SSE3      =    32 ;SSE3 instructions
67
;                   33
68
;                   34
69
CAPS_MONITOR   =    35 ;MONITOR/MWAIT instructions
70
CAPS_DS_CPL    =    36 ;
71
CAPS_VMX       =    37 ;virtual mode extensions
72
;                   38 ;
73
CAPS_EST       =    39 ;enhansed speed step
74
CAPS_TM2       =    40 ;thermal monitor2 supported
75
;                   41
76
CAPS_CID       =    42 ;
77
;                   43
78
;                   44
79
CAPS_CX16      =    45 ;CMPXCHG16B instruction
80
CAPS_xTPR      =    46 ;
81
CAPS_XSAVE     =    32 + 26 ; XSAVE and XRSTOR instructions
82
CAPS_OSXSAVE   =    32 + 27
7124 dunkaist 83
; A value of 1 indicates that the OS has set CR4.OSXSAVE[bit 18] to enable
84
; XSETBV/XGETBV instructions to access XCR0 and to support processor extended
85
; state management using XSAVE/XRSTOR.
7136 dunkaist 86
CAPS_AVX       =    32 + 28 ; not AVX2
2288 clevermous 87
;
88
;reserved
89
;
90
;ext edx /ecx
7136 dunkaist 91
CAPS_SYSCAL    =    64 ;
92
CAPS_XD        =    65 ;execution disable
93
CAPS_FFXSR     =    66 ;
94
CAPS_RDTSCP    =    67 ;
95
CAPS_X64       =    68 ;
96
CAPS_3DNOW     =    69 ;
97
CAPS_3DNOWEXT  =    70 ;
98
CAPS_LAHF      =    71 ;
99
CAPS_CMP_LEG   =    72 ;
100
CAPS_SVM       =    73 ;secure virual machine
101
CAPS_ALTMOVCR8 =    74 ;
2288 clevermous 102
 
103
; CPU MSR names
7136 dunkaist 104
MSR_SYSENTER_CS         =     0x174
105
MSR_SYSENTER_ESP        =     0x175
106
MSR_SYSENTER_EIP        =     0x176
107
MSR_CR_PAT              =     0x277
108
MSR_MTRR_DEF_TYPE       =     0x2FF
5360 serge 109
 
7136 dunkaist 110
MSR_AMD_EFER            =     0xC0000080      ; Extended Feature Enable Register
111
MSR_AMD_STAR            =     0xC0000081      ; SYSCALL/SYSRET Target Address Register
2288 clevermous 112
 
7136 dunkaist 113
CR0_PE         =    0x00000001   ;protected mode
114
CR0_MP         =    0x00000002   ;monitor fpu
115
CR0_EM         =    0x00000004   ;fpu emulation
116
CR0_TS         =    0x00000008   ;task switch
117
CR0_ET         =    0x00000010   ;extension type hardcoded to 1
118
CR0_NE         =    0x00000020   ;numeric error
119
CR0_WP         =    0x00010000   ;write protect
120
CR0_AM         =    0x00040000   ;alignment check
121
CR0_NW         =    0x20000000   ;not write-through
122
CR0_CD         =    0x40000000   ;cache disable
123
CR0_PG         =    0x80000000   ;paging
2288 clevermous 124
 
125
 
7136 dunkaist 126
CR4_VME        =    0x000001
127
CR4_PVI        =    0x000002
128
CR4_TSD        =    0x000004
129
CR4_DE         =    0x000008
130
CR4_PSE        =    0x000010
131
CR4_PAE        =    0x000020
132
CR4_MCE        =    0x000040
133
CR4_PGE        =    0x000080
134
CR4_PCE        =    0x000100
135
CR4_OSFXSR     =    0x000200
136
CR4_OSXMMEXPT  =    0x000400
137
CR4_OSXSAVE    =    0x040000
2288 clevermous 138
 
7136 dunkaist 139
XCR0_FPU_MMX   =    0x0001
140
XCR0_SSE       =    0x0002
141
XCR0_AVX       =    0x0004
142
XCR0_MPX       =    0x0018
143
XCR0_AVX512    =    0x00e0
2288 clevermous 144
 
7136 dunkaist 145
MXCSR_IE       =    0x0001
146
MXCSR_DE       =    0x0002
147
MXCSR_ZE       =    0x0004
148
MXCSR_OE       =    0x0008
149
MXCSR_UE       =    0x0010
150
MXCSR_PE       =    0x0020
151
MXCSR_DAZ      =    0x0040
152
MXCSR_IM       =    0x0080
153
MXCSR_DM       =    0x0100
154
MXCSR_ZM       =    0x0200
155
MXCSR_OM       =    0x0400
156
MXCSR_UM       =    0x0800
157
MXCSR_PM       =    0x1000
158
MXCSR_FZ       =    0x8000
2288 clevermous 159
 
7136 dunkaist 160
MXCSR_INIT     = MXCSR_IM + MXCSR_DM + MXCSR_ZM + MXCSR_OM + MXCSR_UM + MXCSR_PM
7124 dunkaist 161
 
7136 dunkaist 162
EFLAGS_CF      =    0x000001  ; carry flag
163
EFLAGS_PF      =    0x000004  ; parity flag
164
EFLAGS_AF      =    0x000010  ; auxiliary flag
165
EFLAGS_ZF      =    0x000040  ; zero flag
166
EFLAGS_SF      =    0x000080  ; sign flag
167
EFLAGS_TF      =    0x000100  ; trap flag
168
EFLAGS_IF      =    0x000200  ; interrupt flag
169
EFLAGS_DF      =    0x000400  ; direction flag
170
EFLAGS_OF      =    0x000800  ; overflow flag
171
EFLAGS_IOPL    =    0x003000  ; i/o priviledge level
172
EFLAGS_NT      =    0x004000  ; nested task flag
173
EFLAGS_RF      =    0x010000  ; resume flag
174
EFLAGS_VM      =    0x020000  ; virtual 8086 mode flag
175
EFLAGS_AC      =    0x040000  ; alignment check flag
176
EFLAGS_VIF     =    0x080000  ; virtual interrupt flag
177
EFLAGS_VIP     =    0x100000  ; virtual interrupt pending
178
EFLAGS_ID      =    0x200000  ; id flag
7126 dunkaist 179
 
7136 dunkaist 180
IRQ_PIC        =    0
181
IRQ_APIC       =    1
2288 clevermous 182
 
2381 hidnplayr 183
struct  TSS
184
        _back       rw 2
185
        _esp0       rd 1
186
        _ss0        rw 2
187
        _esp1       rd 1
188
        _ss1        rw 2
189
        _esp2       rd 1
190
        _ss2        rw 2
191
        _cr3        rd 1
192
        _eip        rd 1
193
        _eflags     rd 1
194
        _eax        rd 1
195
        _ecx        rd 1
196
        _edx        rd 1
197
        _ebx        rd 1
198
        _esp        rd 1
199
        _ebp        rd 1
200
        _esi        rd 1
201
        _edi        rd 1
202
        _es         rw 2
203
        _cs         rw 2
204
        _ss         rw 2
205
        _ds         rw 2
206
        _fs         rw 2
207
        _gs         rw 2
208
        _ldt        rw 2
209
        _trap       rw 1
210
        _io         rw 1
211
                    rb 24
212
        _io_map_0   rb 4096
213
        _io_map_1   rb 4096
214
ends
2288 clevermous 215
 
7136 dunkaist 216
DRIVE_DATA_SIZE     = 16
3627 Serge 217
 
7136 dunkaist 218
OS_BASE             = 0x80000000
2288 clevermous 219
 
7136 dunkaist 220
window_data         = OS_BASE + 0x0001000
2288 clevermous 221
 
7136 dunkaist 222
CURRENT_TASK        = OS_BASE + 0x0003000
223
TASK_COUNT          = OS_BASE + 0x0003004
224
TASK_BASE           = OS_BASE + 0x0003010
225
TASK_DATA           = OS_BASE + 0x0003020
226
TASK_EVENT          = OS_BASE + 0x0003020
2288 clevermous 227
 
7136 dunkaist 228
CDDataBuf           = OS_BASE + 0x0005000
3732 Serge 229