Subversion Repositories Kolibri OS

Rev

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

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