Rev 5597 | Rev 6240 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5597 | Rev 5984 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | 7 | ||
8 | $Revision: 5597 $ |
8 | $Revision: 5984 $ |
9 | 9 | ||
10 | 10 | ||
11 | dpl0 equ 10010000b ; data read dpl0 |
11 | dpl0 equ 10010000b ; data read dpl0 |
12 | drw0 equ 10010010b ; data read/write dpl0 |
12 | drw0 equ 10010010b ; data read/write dpl0 |
13 | drw3 equ 11110010b ; data read/write dpl3 |
13 | drw3 equ 11110010b ; data read/write dpl3 |
14 | cpl0 equ 10011010b ; code read dpl0 |
14 | cpl0 equ 10011010b ; code read dpl0 |
15 | cpl3 equ 11111010b ; code read dpl3 |
15 | cpl3 equ 11111010b ; code read dpl3 |
16 | 16 | ||
17 | D32 equ 01000000b ; 32bit segment |
17 | D32 equ 01000000b ; 32bit segment |
18 | G32 equ 10000000b ; page gran |
18 | G32 equ 10000000b ; page gran |
19 | 19 | ||
20 | 20 | ||
21 | ;;;;;;;;;;;;cpu_caps flags;;;;;;;;;;;;;;;; |
21 | ;;;;;;;;;;;;cpu_caps flags;;;;;;;;;;;;;;;; |
22 | 22 | ||
23 | CPU_386 equ 3 |
23 | CPU_386 equ 3 |
24 | CPU_486 equ 4 |
24 | CPU_486 equ 4 |
25 | CPU_PENTIUM equ 5 |
25 | CPU_PENTIUM equ 5 |
26 | CPU_P6 equ 6 |
26 | CPU_P6 equ 6 |
27 | CPU_PENTIUM4 equ 0x0F |
27 | CPU_PENTIUM4 equ 0x0F |
28 | 28 | ||
29 | CAPS_FPU equ 00 ;on-chip x87 floating point unit |
29 | CAPS_FPU equ 00 ;on-chip x87 floating point unit |
30 | CAPS_VME equ 01 ;virtual-mode enhancements |
30 | CAPS_VME equ 01 ;virtual-mode enhancements |
31 | CAPS_DE equ 02 ;debugging extensions |
31 | CAPS_DE equ 02 ;debugging extensions |
32 | CAPS_PSE equ 03 ;page-size extensions |
32 | CAPS_PSE equ 03 ;page-size extensions |
33 | CAPS_TSC equ 04 ;time stamp counter |
33 | CAPS_TSC equ 04 ;time stamp counter |
34 | CAPS_MSR equ 05 ;model-specific registers |
34 | CAPS_MSR equ 05 ;model-specific registers |
35 | CAPS_PAE equ 06 ;physical-address extensions |
35 | CAPS_PAE equ 06 ;physical-address extensions |
36 | CAPS_MCE equ 07 ;machine check exception |
36 | CAPS_MCE equ 07 ;machine check exception |
37 | CAPS_CX8 equ 08 ;CMPXCHG8B instruction |
37 | CAPS_CX8 equ 08 ;CMPXCHG8B instruction |
38 | CAPS_APIC equ 09 ;on-chip advanced programmable |
38 | CAPS_APIC equ 09 ;on-chip advanced programmable |
39 | ; interrupt controller |
39 | ; interrupt controller |
40 | ; 10 ;unused |
40 | ; 10 ;unused |
41 | CAPS_SEP equ 11 ;SYSENTER and SYSEXIT instructions |
41 | CAPS_SEP equ 11 ;SYSENTER and SYSEXIT instructions |
42 | CAPS_MTRR equ 12 ;memory-type range registers |
42 | CAPS_MTRR equ 12 ;memory-type range registers |
43 | CAPS_PGE equ 13 ;page global extension |
43 | CAPS_PGE equ 13 ;page global extension |
44 | CAPS_MCA equ 14 ;machine check architecture |
44 | CAPS_MCA equ 14 ;machine check architecture |
45 | CAPS_CMOV equ 15 ;conditional move instructions |
45 | CAPS_CMOV equ 15 ;conditional move instructions |
46 | CAPS_PAT equ 16 ;page attribute table |
46 | CAPS_PAT equ 16 ;page attribute table |
47 | 47 | ||
48 | CAPS_PSE36 equ 17 ;page-size extensions |
48 | CAPS_PSE36 equ 17 ;page-size extensions |
49 | CAPS_PSN equ 18 ;processor serial number |
49 | CAPS_PSN equ 18 ;processor serial number |
50 | CAPS_CLFLUSH equ 19 ;CLFUSH instruction |
50 | CAPS_CLFLUSH equ 19 ;CLFUSH instruction |
51 | 51 | ||
52 | CAPS_DS equ 21 ;debug store |
52 | CAPS_DS equ 21 ;debug store |
53 | CAPS_ACPI equ 22 ;thermal monitor and software |
53 | CAPS_ACPI equ 22 ;thermal monitor and software |
54 | ;controlled clock supported |
54 | ;controlled clock supported |
55 | CAPS_MMX equ 23 ;MMX instructions |
55 | CAPS_MMX equ 23 ;MMX instructions |
56 | CAPS_FXSR equ 24 ;FXSAVE and FXRSTOR instructions |
56 | CAPS_FXSR equ 24 ;FXSAVE and FXRSTOR instructions |
57 | CAPS_SSE equ 25 ;SSE instructions |
57 | CAPS_SSE equ 25 ;SSE instructions |
58 | CAPS_SSE2 equ 26 ;SSE2 instructions |
58 | CAPS_SSE2 equ 26 ;SSE2 instructions |
59 | CAPS_SS equ 27 ;self-snoop |
59 | CAPS_SS equ 27 ;self-snoop |
60 | CAPS_HTT equ 28 ;hyper-threading technology |
60 | CAPS_HTT equ 28 ;hyper-threading technology |
61 | CAPS_TM equ 29 ;thermal monitor supported |
61 | CAPS_TM equ 29 ;thermal monitor supported |
62 | CAPS_IA64 equ 30 ;IA64 capabilities |
62 | CAPS_IA64 equ 30 ;IA64 capabilities |
63 | CAPS_PBE equ 31 ;pending break enable |
63 | CAPS_PBE equ 31 ;pending break enable |
64 | 64 | ||
65 | ;ecx |
65 | ;ecx |
66 | CAPS_SSE3 equ 32 ;SSE3 instructions |
66 | CAPS_SSE3 equ 32 ;SSE3 instructions |
67 | ; 33 |
67 | ; 33 |
68 | ; 34 |
68 | ; 34 |
69 | CAPS_MONITOR equ 35 ;MONITOR/MWAIT instructions |
69 | CAPS_MONITOR equ 35 ;MONITOR/MWAIT instructions |
70 | CAPS_DS_CPL equ 36 ; |
70 | CAPS_DS_CPL equ 36 ; |
71 | CAPS_VMX equ 37 ;virtual mode extensions |
71 | CAPS_VMX equ 37 ;virtual mode extensions |
72 | ; 38 ; |
72 | ; 38 ; |
73 | CAPS_EST equ 39 ;enhansed speed step |
73 | CAPS_EST equ 39 ;enhansed speed step |
74 | CAPS_TM2 equ 40 ;thermal monitor2 supported |
74 | CAPS_TM2 equ 40 ;thermal monitor2 supported |
75 | ; 41 |
75 | ; 41 |
76 | CAPS_CID equ 42 ; |
76 | CAPS_CID equ 42 ; |
77 | ; 43 |
77 | ; 43 |
78 | ; 44 |
78 | ; 44 |
79 | CAPS_CX16 equ 45 ;CMPXCHG16B instruction |
79 | CAPS_CX16 equ 45 ;CMPXCHG16B instruction |
80 | CAPS_xTPR equ 46 ; |
80 | CAPS_xTPR equ 46 ; |
81 | ; |
81 | ; |
82 | ;reserved |
82 | ;reserved |
83 | ; |
83 | ; |
84 | ;ext edx /ecx |
84 | ;ext edx /ecx |
85 | CAPS_SYSCAL equ 64 ; |
85 | CAPS_SYSCAL equ 64 ; |
86 | CAPS_XD equ 65 ;execution disable |
86 | CAPS_XD equ 65 ;execution disable |
87 | CAPS_FFXSR equ 66 ; |
87 | CAPS_FFXSR equ 66 ; |
88 | CAPS_RDTSCP equ 67 ; |
88 | CAPS_RDTSCP equ 67 ; |
89 | CAPS_X64 equ 68 ; |
89 | CAPS_X64 equ 68 ; |
90 | CAPS_3DNOW equ 69 ; |
90 | CAPS_3DNOW equ 69 ; |
91 | CAPS_3DNOWEXT equ 70 ; |
91 | CAPS_3DNOWEXT equ 70 ; |
92 | CAPS_LAHF equ 71 ; |
92 | CAPS_LAHF equ 71 ; |
93 | CAPS_CMP_LEG equ 72 ; |
93 | CAPS_CMP_LEG equ 72 ; |
94 | CAPS_SVM equ 73 ;secure virual machine |
94 | CAPS_SVM equ 73 ;secure virual machine |
95 | CAPS_ALTMOVCR8 equ 74 ; |
95 | CAPS_ALTMOVCR8 equ 74 ; |
96 | 96 | ||
97 | ; CPU MSR names |
97 | ; CPU MSR names |
98 | MSR_SYSENTER_CS equ 0x174 |
98 | MSR_SYSENTER_CS equ 0x174 |
99 | MSR_SYSENTER_ESP equ 0x175 |
99 | MSR_SYSENTER_ESP equ 0x175 |
100 | MSR_SYSENTER_EIP equ 0x176 |
100 | MSR_SYSENTER_EIP equ 0x176 |
101 | MSR_CR_PAT equ 0x277 |
101 | MSR_CR_PAT equ 0x277 |
102 | MSR_MTRR_DEF_TYPE equ 0x2FF |
102 | MSR_MTRR_DEF_TYPE equ 0x2FF |
103 | 103 | ||
104 | MSR_AMD_EFER equ 0xC0000080 ; Extended Feature Enable Register |
104 | MSR_AMD_EFER equ 0xC0000080 ; Extended Feature Enable Register |
105 | MSR_AMD_STAR equ 0xC0000081 ; SYSCALL/SYSRET Target Address Register |
105 | MSR_AMD_STAR equ 0xC0000081 ; SYSCALL/SYSRET Target Address Register |
106 | 106 | ||
107 | CR0_PE equ 0x00000001 ;protected mode |
107 | CR0_PE equ 0x00000001 ;protected mode |
108 | CR0_MP equ 0x00000002 ;monitor fpu |
108 | CR0_MP equ 0x00000002 ;monitor fpu |
109 | CR0_EM equ 0x00000004 ;fpu emulation |
109 | CR0_EM equ 0x00000004 ;fpu emulation |
110 | CR0_TS equ 0x00000008 ;task switch |
110 | CR0_TS equ 0x00000008 ;task switch |
111 | CR0_ET equ 0x00000010 ;extension type hardcoded to 1 |
111 | CR0_ET equ 0x00000010 ;extension type hardcoded to 1 |
112 | CR0_NE equ 0x00000020 ;numeric error |
112 | CR0_NE equ 0x00000020 ;numeric error |
113 | CR0_WP equ 0x00010000 ;write protect |
113 | CR0_WP equ 0x00010000 ;write protect |
114 | CR0_AM equ 0x00040000 ;alignment check |
114 | CR0_AM equ 0x00040000 ;alignment check |
115 | CR0_NW equ 0x20000000 ;not write-through |
115 | CR0_NW equ 0x20000000 ;not write-through |
116 | CR0_CD equ 0x40000000 ;cache disable |
116 | CR0_CD equ 0x40000000 ;cache disable |
117 | CR0_PG equ 0x80000000 ;paging |
117 | CR0_PG equ 0x80000000 ;paging |
118 | 118 | ||
119 | 119 | ||
120 | CR4_VME equ 0x0001 |
120 | CR4_VME equ 0x0001 |
121 | CR4_PVI equ 0x0002 |
121 | CR4_PVI equ 0x0002 |
122 | CR4_TSD equ 0x0004 |
122 | CR4_TSD equ 0x0004 |
123 | CR4_DE equ 0x0008 |
123 | CR4_DE equ 0x0008 |
124 | CR4_PSE equ 0x0010 |
124 | CR4_PSE equ 0x0010 |
125 | CR4_PAE equ 0x0020 |
125 | CR4_PAE equ 0x0020 |
126 | CR4_MCE equ 0x0040 |
126 | CR4_MCE equ 0x0040 |
127 | CR4_PGE equ 0x0080 |
127 | CR4_PGE equ 0x0080 |
128 | CR4_PCE equ 0x0100 |
128 | CR4_PCE equ 0x0100 |
129 | CR4_OSFXSR equ 0x0200 |
129 | CR4_OSFXSR equ 0x0200 |
130 | CR4_OSXMMEXPT equ 0x0400 |
130 | CR4_OSXMMEXPT equ 0x0400 |
131 | 131 | ||
132 | SSE_IE equ 0x0001 |
132 | SSE_IE equ 0x0001 |
133 | SSE_DE equ 0x0002 |
133 | SSE_DE equ 0x0002 |
134 | SSE_ZE equ 0x0004 |
134 | SSE_ZE equ 0x0004 |
135 | SSE_OE equ 0x0008 |
135 | SSE_OE equ 0x0008 |
136 | SSE_UE equ 0x0010 |
136 | SSE_UE equ 0x0010 |
137 | SSE_PE equ 0x0020 |
137 | SSE_PE equ 0x0020 |
138 | SSE_DAZ equ 0x0040 |
138 | SSE_DAZ equ 0x0040 |
139 | SSE_IM equ 0x0080 |
139 | SSE_IM equ 0x0080 |
140 | SSE_DM equ 0x0100 |
140 | SSE_DM equ 0x0100 |
141 | SSE_ZM equ 0x0200 |
141 | SSE_ZM equ 0x0200 |
142 | SSE_OM equ 0x0400 |
142 | SSE_OM equ 0x0400 |
143 | SSE_UM equ 0x0800 |
143 | SSE_UM equ 0x0800 |
144 | SSE_PM equ 0x1000 |
144 | SSE_PM equ 0x1000 |
145 | SSE_FZ equ 0x8000 |
145 | SSE_FZ equ 0x8000 |
146 | 146 | ||
147 | SSE_INIT equ (SSE_IM+SSE_DM+SSE_ZM+SSE_OM+SSE_UM+SSE_PM) |
147 | SSE_INIT equ (SSE_IM+SSE_DM+SSE_ZM+SSE_OM+SSE_UM+SSE_PM) |
148 | 148 | ||
149 | IRQ_PIC equ 0 |
149 | IRQ_PIC equ 0 |
150 | IRQ_APIC equ 1 |
150 | IRQ_APIC equ 1 |
151 | 151 | ||
152 | struct TSS |
152 | struct TSS |
153 | _back rw 2 |
153 | _back rw 2 |
154 | _esp0 rd 1 |
154 | _esp0 rd 1 |
155 | _ss0 rw 2 |
155 | _ss0 rw 2 |
156 | _esp1 rd 1 |
156 | _esp1 rd 1 |
157 | _ss1 rw 2 |
157 | _ss1 rw 2 |
158 | _esp2 rd 1 |
158 | _esp2 rd 1 |
159 | _ss2 rw 2 |
159 | _ss2 rw 2 |
160 | _cr3 rd 1 |
160 | _cr3 rd 1 |
161 | _eip rd 1 |
161 | _eip rd 1 |
162 | _eflags rd 1 |
162 | _eflags rd 1 |
163 | _eax rd 1 |
163 | _eax rd 1 |
164 | _ecx rd 1 |
164 | _ecx rd 1 |
165 | _edx rd 1 |
165 | _edx rd 1 |
166 | _ebx rd 1 |
166 | _ebx rd 1 |
167 | _esp rd 1 |
167 | _esp rd 1 |
168 | _ebp rd 1 |
168 | _ebp rd 1 |
169 | _esi rd 1 |
169 | _esi rd 1 |
170 | _edi rd 1 |
170 | _edi rd 1 |
171 | _es rw 2 |
171 | _es rw 2 |
172 | _cs rw 2 |
172 | _cs rw 2 |
173 | _ss rw 2 |
173 | _ss rw 2 |
174 | _ds rw 2 |
174 | _ds rw 2 |
175 | _fs rw 2 |
175 | _fs rw 2 |
176 | _gs rw 2 |
176 | _gs rw 2 |
177 | _ldt rw 2 |
177 | _ldt rw 2 |
178 | _trap rw 1 |
178 | _trap rw 1 |
179 | _io rw 1 |
179 | _io rw 1 |
180 | rb 24 |
180 | rb 24 |
181 | _io_map_0 rb 4096 |
181 | _io_map_0 rb 4096 |
182 | _io_map_1 rb 4096 |
182 | _io_map_1 rb 4096 |
183 | ends |
183 | ends |
184 | 184 | ||
185 | DRIVE_DATA_SIZE equ 16 |
185 | DRIVE_DATA_SIZE equ 16 |
186 | 186 | ||
187 | OS_BASE equ 0x80000000 |
187 | OS_BASE equ 0x80000000 |
188 | 188 | ||
189 | window_data equ (OS_BASE+0x0001000) |
189 | window_data equ (OS_BASE+0x0001000) |
190 | 190 | ||
191 | CURRENT_TASK equ (OS_BASE+0x0003000) |
191 | CURRENT_TASK equ (OS_BASE+0x0003000) |
192 | TASK_COUNT equ (OS_BASE+0x0003004) |
192 | TASK_COUNT equ (OS_BASE+0x0003004) |
193 | TASK_BASE equ (OS_BASE+0x0003010) |
193 | TASK_BASE equ (OS_BASE+0x0003010) |
194 | TASK_DATA equ (OS_BASE+0x0003020) |
194 | TASK_DATA equ (OS_BASE+0x0003020) |
195 | TASK_EVENT equ (OS_BASE+0x0003020) |
195 | TASK_EVENT equ (OS_BASE+0x0003020) |
196 | 196 | ||
197 | CDDataBuf equ (OS_BASE+0x0005000) |
197 | CDDataBuf equ (OS_BASE+0x0005000) |
198 | 198 | ||
199 | ;unused 0x6000 - 0x8fff |
199 | ;unused 0x6000 - 0x8fff |
200 | 200 | ||
201 | BOOT_VARS equ (OS_BASE) ;0x9000 |
201 | BOOT_VARS equ (OS_BASE) ;0x9000 |
202 | 202 | ||
203 | idts equ (OS_BASE+0x000B100) |
203 | idts equ (OS_BASE+0x000B100) |
204 | WIN_STACK equ (OS_BASE+0x000C000) |
204 | WIN_STACK equ (OS_BASE+0x000C000) |
205 | WIN_POS equ (OS_BASE+0x000C400) |
205 | WIN_POS equ (OS_BASE+0x000C400) |
206 | FDD_BUFF equ (OS_BASE+0x000D000) ;512 |
206 | FDD_BUFF equ (OS_BASE+0x000D000) ;512 |
207 | 207 | ||
208 | WIN_TEMP_XY equ (OS_BASE+0x000F300) |
208 | WIN_TEMP_XY equ (OS_BASE+0x000F300) |
209 | KEY_COUNT equ (OS_BASE+0x000F400) |
209 | KEY_COUNT equ (OS_BASE+0x000F400) |
210 | KEY_BUFF equ (OS_BASE+0x000F401) ; 120*2 + 2*2 = 244 bytes, actually 255 bytes |
210 | KEY_BUFF equ (OS_BASE+0x000F401) ; 120*2 + 2*2 = 244 bytes, actually 255 bytes |
211 | 211 | ||
212 | BTN_COUNT equ (OS_BASE+0x000F500) |
212 | BTN_COUNT equ (OS_BASE+0x000F500) |
213 | BTN_BUFF equ (OS_BASE+0x000F501) |
213 | BTN_BUFF equ (OS_BASE+0x000F501) |
214 | 214 | ||
215 | 215 | ||
216 | BTN_ADDR equ (OS_BASE+0x000FE88) |
216 | BTN_ADDR equ (OS_BASE+0x000FE88) |
217 | MEM_AMOUNT equ (OS_BASE+0x000FE8C) |
217 | MEM_AMOUNT equ (OS_BASE+0x000FE8C) |
218 | 218 | ||
219 | SYS_SHUTDOWN equ (OS_BASE+0x000FF00) |
219 | SYS_SHUTDOWN equ (OS_BASE+0x000FF00) |
220 | TASK_ACTIVATE equ (OS_BASE+0x000FF01) |
220 | TASK_ACTIVATE equ (OS_BASE+0x000FF01) |
221 | 221 | ||
222 | 222 | ||
223 | TMP_STACK_TOP equ 0x006CC00 |
223 | TMP_STACK_TOP equ 0x006CC00 |
224 | 224 | ||
225 | sys_proc equ (OS_BASE+0x006F000) |
225 | sys_proc equ (OS_BASE+0x006F000) |
226 | 226 | ||
227 | SLOT_BASE equ (OS_BASE+0x0080000) |
227 | SLOT_BASE equ (OS_BASE+0x0080000) |
228 | 228 | ||
229 | VGABasePtr equ (OS_BASE+0x00A0000) |
229 | VGABasePtr equ (OS_BASE+0x00A0000) |
230 | 230 | ||
231 | CLEAN_ZONE equ (_CLEAN_ZONE-OS_BASE) |
231 | CLEAN_ZONE equ (_CLEAN_ZONE-OS_BASE) |
232 | 232 | ||
233 | UPPER_KERNEL_PAGES equ (OS_BASE+0x0400000) |
233 | UPPER_KERNEL_PAGES equ (OS_BASE+0x0400000) |
234 | 234 | ||
235 | virtual at (OS_BASE+0x05FFF80) |
235 | virtual at (OS_BASE+0x05FFF80) |
236 | tss TSS |
236 | tss TSS |
237 | end virtual |
237 | end virtual |
238 | 238 | ||
239 | HEAP_BASE equ (OS_BASE+0x0800000) |
239 | HEAP_BASE equ (OS_BASE+0x0800000) |
240 | HEAP_MIN_SIZE equ 0x01000000 |
240 | HEAP_MIN_SIZE equ 0x01000000 |
241 | 241 | ||
242 | page_tabs equ 0xFDC00000 |
242 | page_tabs equ 0xFDC00000 |
243 | app_page_tabs equ 0xFDC00000 |
243 | app_page_tabs equ 0xFDC00000 |
244 | kernel_tabs equ (page_tabs+ (OS_BASE shr 10)) ;0xFDE00000 |
244 | kernel_tabs equ (page_tabs+ (OS_BASE shr 10)) ;0xFDE00000 |
245 | master_tab equ (page_tabs+ (page_tabs shr 10)) ;0xFDFF70000 |
245 | master_tab equ (page_tabs+ (page_tabs shr 10)) ;0xFDFF70000 |
246 | 246 | ||
247 | LFB_BASE equ 0xFE000000 |
247 | LFB_BASE equ 0xFE000000 |
248 | 248 | ||
249 | 249 | ||
250 | new_app_base equ 0; |
250 | new_app_base equ 0; |
251 | 251 | ||
252 | twdw equ 0x2000 ;(CURRENT_TASK-window_data) |
252 | twdw equ 0x2000 ;(CURRENT_TASK-window_data) |
253 | 253 | ||
254 | std_application_base_address equ new_app_base |
254 | std_application_base_address equ new_app_base |
255 | RING0_STACK_SIZE equ (0x2000 - 512) ;512 байт для контекста FPU |
255 | RING0_STACK_SIZE equ (0x2000 - 512) ;512 байт для контекста FPU |
256 | 256 | ||
257 | REG_SS equ (RING0_STACK_SIZE-4) |
257 | REG_SS equ (RING0_STACK_SIZE-4) |
258 | REG_APP_ESP equ (RING0_STACK_SIZE-8) |
258 | REG_APP_ESP equ (RING0_STACK_SIZE-8) |
259 | REG_EFLAGS equ (RING0_STACK_SIZE-12) |
259 | REG_EFLAGS equ (RING0_STACK_SIZE-12) |
260 | REG_CS equ (RING0_STACK_SIZE-16) |
260 | REG_CS equ (RING0_STACK_SIZE-16) |
261 | REG_EIP equ (RING0_STACK_SIZE-20) |
261 | REG_EIP equ (RING0_STACK_SIZE-20) |
262 | REG_EAX equ (RING0_STACK_SIZE-24) |
262 | REG_EAX equ (RING0_STACK_SIZE-24) |
263 | REG_ECX equ (RING0_STACK_SIZE-28) |
263 | REG_ECX equ (RING0_STACK_SIZE-28) |
264 | REG_EDX equ (RING0_STACK_SIZE-32) |
264 | REG_EDX equ (RING0_STACK_SIZE-32) |
265 | REG_EBX equ (RING0_STACK_SIZE-36) |
265 | REG_EBX equ (RING0_STACK_SIZE-36) |
266 | REG_ESP equ (RING0_STACK_SIZE-40) ;RING0_STACK_SIZE-20 |
266 | REG_ESP equ (RING0_STACK_SIZE-40) ;RING0_STACK_SIZE-20 |
267 | REG_EBP equ (RING0_STACK_SIZE-44) |
267 | REG_EBP equ (RING0_STACK_SIZE-44) |
268 | REG_ESI equ (RING0_STACK_SIZE-48) |
268 | REG_ESI equ (RING0_STACK_SIZE-48) |
269 | REG_EDI equ (RING0_STACK_SIZE-52) |
269 | REG_EDI equ (RING0_STACK_SIZE-52) |
270 | REG_RET equ (RING0_STACK_SIZE-56) ;irq0.return |
270 | REG_RET equ (RING0_STACK_SIZE-56) ;irq0.return |
271 | 271 | ||
272 | 272 | ||
273 | PAGE_SIZE equ 4096 |
273 | PAGE_SIZE equ 4096 |
274 | 274 | ||
275 | PG_UNMAP equ 0x000 |
275 | PG_UNMAP equ 0x000 |
276 | PG_READ equ 0x001 |
276 | PG_READ equ 0x001 |
277 | PG_WRITE equ 0x002 |
277 | PG_WRITE equ 0x002 |
278 | PG_USER equ 0x004 |
278 | PG_USER equ 0x004 |
279 | PG_PCD equ 0x008 |
279 | PG_PCD equ 0x008 |
280 | PG_PWT equ 0x010 |
280 | PG_PWT equ 0x010 |
281 | PG_ACCESSED equ 0x020 |
281 | PG_ACCESSED equ 0x020 |
282 | PG_DIRTY equ 0x040 |
282 | PG_DIRTY equ 0x040 |
283 | PG_PAT equ 0x080 |
283 | PG_PAT equ 0x080 |
284 | PG_GLOBAL equ 0x100 |
284 | PG_GLOBAL equ 0x100 |
285 | PG_SHARED equ 0x200 |
285 | PG_SHARED equ 0x200 |
286 | 286 | ||
287 | PG_SWR equ 0x003 ; (PG_WRITE+PG_READ) |
287 | PG_SWR equ 0x003 ; (PG_WRITE+PG_READ) |
288 | PG_UR equ 0x005 ; (PG_USER+PG_READ) |
288 | PG_UR equ 0x005 ; (PG_USER+PG_READ) |
289 | PG_UWR equ 0x007 ; (PG_USER+PG_WRITE+PG_READ) |
289 | PG_UWR equ 0x007 ; (PG_USER+PG_WRITE+PG_READ) |
290 | PG_NOCACHE equ 0x018 ; (PG_PCD+PG_PWT) |
290 | PG_NOCACHE equ 0x018 ; (PG_PCD+PG_PWT) |
291 | 291 | ||
292 | PDE_LARGE equ 0x080 |
292 | PDE_LARGE equ 0x080 |
293 | 293 | ||
294 | PAT_WB equ 0x000 |
294 | PAT_WB equ 0x000 |
295 | PAT_WC equ 0x008 |
295 | PAT_WC equ 0x008 |
296 | PAT_UCM equ 0x010 |
296 | PAT_UCM equ 0x010 |
297 | PAT_UC equ 0x018 |
297 | PAT_UC equ 0x018 |
298 | 298 | ||
299 | PAT_TYPE_UC equ 0 |
299 | PAT_TYPE_UC equ 0 |
300 | PAT_TYPE_WC equ 1 |
300 | PAT_TYPE_WC equ 1 |
301 | PAT_TYPE_WB equ 6 |
301 | PAT_TYPE_WB equ 6 |
302 | PAT_TYPE_UCM equ 7 |
302 | PAT_TYPE_UCM equ 7 |
303 | 303 | ||
304 | PAT_VALUE equ 0x00070106; (UC<<24)|(UCM<<16)|(WC<<8)|WB |
304 | PAT_VALUE equ 0x00070106; (UC<<24)|(UCM<<16)|(WC<<8)|WB |
305 | 305 | ||
306 | ;;;;;;;;;;;boot time variables |
306 | ;;;;;;;;;;;boot time variables |
307 | 307 | ||
308 | BOOT_BPP equ 0x9000 ;byte bits per pixel |
308 | BOOT_BPP equ 0x9000 ;byte bits per pixel |
309 | BOOT_PITCH equ 0x9001 ;word scanline length |
309 | BOOT_PITCH equ 0x9001 ;word scanline length |
310 | BOOT_VESA_MODE equ 0x9008 ;word vesa video mode |
310 | BOOT_VESA_MODE equ 0x9008 ;word vesa video mode |
311 | BOOT_X_RES equ 0x900A ;word X res |
311 | BOOT_X_RES equ 0x900A ;word X res |
312 | BOOT_Y_RES equ 0x900C ;word Y res |
312 | BOOT_Y_RES equ 0x900C ;word Y res |
313 | BOOT_BANK_SW equ 0x9014 ;dword Vesa 1.2 pm bank switch |
313 | BOOT_BANK_SW equ 0x9014 ;dword Vesa 1.2 pm bank switch |
314 | BOOT_LFB equ 0x9018 ;dword Vesa 2.0 LFB address |
314 | BOOT_LFB equ 0x9018 ;dword Vesa 2.0 LFB address |
315 | BOOT_MTRR equ 0x901C ;byte 0 or 1 : enable MTRR graphics acceleration |
315 | BOOT_MTRR equ 0x901C ;byte 0 or 1 : enable MTRR graphics acceleration |
316 | ;BOOT_LOG equ 0x901D ;byte not used anymore (0 or 1 : enable system log display) |
316 | ;BOOT_LOG equ 0x901D ;byte not used anymore (0 or 1 : enable system log display) |
317 | BOOT_LAUNCHER_START equ 0x901D ;byte (0 or 1) start the first app (right now it's LAUNCHER) after kernel is loaded? |
317 | BOOT_LAUNCHER_START equ 0x901D ;byte (0 or 1) start the first app (right now it's LAUNCHER) after kernel is loaded? |
318 | ;BOOT_DIRECT_LFB equ 0x901E ;byte 0 or 1 : enable direct lfb write, paging disabled |
318 | ;BOOT_DIRECT_LFB equ 0x901E ;byte 0 or 1 : enable direct lfb write, paging disabled |
319 | BOOT_DEBUG_PRINT equ 0x901E ;byte If nonzero, duplicates debug output to the screen. |
319 | BOOT_DEBUG_PRINT equ 0x901E ;byte If nonzero, duplicates debug output to the screen. |
320 | BOOT_DMA equ 0x901F ; |
320 | BOOT_DMA equ 0x901F ; |
321 | BOOT_PCI_DATA equ 0x9020 ;8bytes pci data |
321 | BOOT_PCI_DATA equ 0x9020 ;8bytes pci data |
322 | BOOT_VRR equ 0x9030 ;byte VRR start enabled 1, 2-no |
322 | BOOT_VRR equ 0x9030 ;byte VRR start enabled 1, 2-no |
323 | ;BOOT_IDE_BASE_ADDR equ 0x9031 ;word IDEContrRegsBaseAddr ; now free and is not used |
323 | ;BOOT_IDE_BASE_ADDR equ 0x9031 ;word IDEContrRegsBaseAddr ; now free and is not used |
324 | BOOT_MEM_AMOUNT equ 0x9034 ;dword memory amount |
324 | BOOT_MEM_AMOUNT equ 0x9034 ;dword memory amount |
325 | 325 | ||
326 | BOOT_APM_ENTRY equ 0x9040 |
326 | BOOT_APM_ENTRY equ 0x9040 |
327 | BOOT_APM_VERSION equ 0x9044 |
327 | BOOT_APM_VERSION equ 0x9044 |
328 | BOOT_APM_FLAGS equ 0x9046 ;unused |
328 | BOOT_APM_FLAGS equ 0x9046 ;unused |
329 | BOOT_APM_CODE_32 equ 0x9050 |
329 | BOOT_APM_CODE_32 equ 0x9050 |
330 | BOOT_APM_CODE_16 equ 0x9052 |
330 | BOOT_APM_CODE_16 equ 0x9052 |
331 | BOOT_APM_DATA_16 equ 0x9054 |
331 | BOOT_APM_DATA_16 equ 0x9054 |
332 | ;BOOT_IDE_BAR0_16 equ 0x9056 ; now free and is not used |
332 | ;BOOT_IDE_BAR0_16 equ 0x9056 ; now free and is not used |
333 | ;BOOT_IDE_BAR1_16 equ 0x9058 ; now free and is not used |
333 | ;BOOT_IDE_BAR1_16 equ 0x9058 ; now free and is not used |
334 | ;BOOT_IDE_BAR2_16 equ 0x905A ; now free and is not used |
334 | ;BOOT_IDE_BAR2_16 equ 0x905A ; now free and is not used |
335 | ;BOOT_IDE_BAR3_16 equ 0x905C ; now free and is not used |
335 | ;BOOT_IDE_BAR3_16 equ 0x905C ; now free and is not used |
336 | ;BOOT_IDE_PI_16 equ 0x905E ; now free and is not used |
336 | ;BOOT_IDE_PI_16 equ 0x905E ; now free and is not used |
337 | ;BOOT_IDE_INTERR_16 equ 0x9060 ; now free and is not used |
337 | ;BOOT_IDE_INTERR_16 equ 0x9060 ; now free and is not used |
338 | 338 | ||
339 | TMP_FILE_NAME equ 0 |
339 | TMP_FILE_NAME equ 0 |
340 | TMP_CMD_LINE equ 1024 |
340 | TMP_CMD_LINE equ 1024 |
341 | TMP_ICON_OFFS equ 1280 |
341 | TMP_ICON_OFFS equ 1280 |
342 | 342 | ||
343 | 343 | ||
344 | EVENT_REDRAW equ 0x00000001 |
344 | EVENT_REDRAW equ 0x00000001 |
345 | EVENT_KEY equ 0x00000002 |
345 | EVENT_KEY equ 0x00000002 |
346 | EVENT_BUTTON equ 0x00000004 |
346 | EVENT_BUTTON equ 0x00000004 |
347 | EVENT_BACKGROUND equ 0x00000010 |
347 | EVENT_BACKGROUND equ 0x00000010 |
348 | EVENT_MOUSE equ 0x00000020 |
348 | EVENT_MOUSE equ 0x00000020 |
349 | EVENT_IPC equ 0x00000040 |
349 | EVENT_IPC equ 0x00000040 |
350 | EVENT_NETWORK equ 0x00000080 |
350 | EVENT_NETWORK equ 0x00000080 |
351 | EVENT_DEBUG equ 0x00000100 |
351 | EVENT_DEBUG equ 0x00000100 |
352 | EVENT_NETWORK2 equ 0x00000200 |
352 | EVENT_NETWORK2 equ 0x00000200 |
353 | EVENT_EXTENDED equ 0x00000400 |
353 | EVENT_EXTENDED equ 0x00000400 |
354 | 354 | ||
355 | EV_INTR equ 1 |
355 | EV_INTR equ 1 |
356 | 356 | ||
357 | STDIN_FILENO equ 0 |
357 | STDIN_FILENO equ 0 |
358 | STDOUT_FILENO equ 1 |
358 | STDOUT_FILENO equ 1 |
359 | STDERR_FILENO equ 2 |
359 | STDERR_FILENO equ 2 |
360 | 360 | ||
361 | struct SYSCALL_STACK |
361 | struct SYSCALL_STACK |
362 | _eip dd ? |
362 | _eip dd ? |
363 | _edi dd ? ; +4 |
363 | _edi dd ? ; +4 |
364 | _esi dd ? ; +8 |
364 | _esi dd ? ; +8 |
365 | _ebp dd ? ; +12 |
365 | _ebp dd ? ; +12 |
366 | _esp dd ? ; +16 |
366 | _esp dd ? ; +16 |
367 | _ebx dd ? ; +20 |
367 | _ebx dd ? ; +20 |
368 | _edx dd ? ; +24 |
368 | _edx dd ? ; +24 |
369 | _ecx dd ? ; +28 |
369 | _ecx dd ? ; +28 |
370 | _eax dd ? ; +32 |
370 | _eax dd ? ; +32 |
371 | ends |
371 | ends |
372 | 372 | ||
373 | struct LHEAD |
373 | struct LHEAD |
374 | next dd ? ;next object in list |
374 | next dd ? ;next object in list |
375 | prev dd ? ;prev object in list |
375 | prev dd ? ;prev object in list |
376 | ends |
376 | ends |
377 | 377 | ||
378 | struct MUTEX_WAITER |
378 | struct MUTEX_WAITER |
379 | list LHEAD |
379 | list LHEAD |
380 | task dd ? |
380 | task dd ? |
381 | type dd ? |
381 | type dd ? |
382 | ends |
382 | ends |
383 | 383 | ||
384 | struct MUTEX |
384 | struct MUTEX |
385 | wait_list LHEAD |
385 | wait_list LHEAD |
386 | count dd ? |
386 | count dd ? |
387 | ends |
387 | ends |
388 | 388 | ||
389 | struct RWSEM |
389 | struct RWSEM |
390 | wait_list LHEAD |
390 | wait_list LHEAD |
391 | count dd ? |
391 | count dd ? |
392 | ends |
392 | ends |
393 | 393 | ||
394 | struct FUTEX |
394 | struct FUTEX |
395 | list LHEAD |
395 | list LHEAD |
396 | magic dd ? |
396 | magic dd ? |
397 | handle dd ? |
397 | handle dd ? |
398 | destroy dd ? |
398 | destroy dd ? |
399 | 399 | ||
400 | wait_list LHEAD |
400 | wait_list LHEAD |
401 | pointer dd ? |
401 | pointer dd ? |
402 | flags dd ? |
402 | flags dd ? |
403 | ends |
403 | ends |
404 | 404 | ||
405 | FUTEX_INIT equ 0 |
405 | FUTEX_INIT equ 0 |
406 | FUTEX_DESTROY equ 1 |
406 | FUTEX_DESTROY equ 1 |
407 | FUTEX_WAIT equ 2 |
407 | FUTEX_WAIT equ 2 |
408 | FUTEX_WAKE equ 3 |
408 | FUTEX_WAKE equ 3 |
409 | 409 | ||
410 | struct PROC |
410 | struct PROC |
411 | list LHEAD |
411 | list LHEAD |
412 | thr_list LHEAD |
412 | thr_list LHEAD |
413 | heap_lock MUTEX |
413 | heap_lock MUTEX |
414 | heap_base rd 1 |
414 | heap_base rd 1 |
415 | heap_top rd 1 |
415 | heap_top rd 1 |
416 | mem_used rd 1 |
416 | mem_used rd 1 |
417 | dlls_list_ptr rd 1 |
417 | dlls_list_ptr rd 1 |
418 | pdt_0_phys rd 1 |
418 | pdt_0_phys rd 1 |
419 | pdt_1_phys rd 1 |
419 | pdt_1_phys rd 1 |
420 | io_map_0 rd 1 |
420 | io_map_0 rd 1 |
421 | io_map_1 rd 1 |
421 | io_map_1 rd 1 |
422 | 422 | ||
423 | ht_lock rd 1 |
423 | ht_lock rd 1 |
424 | ht_free rd 1 ;htab[0] stdin |
424 | ht_free rd 1 ;htab[0] stdin |
425 | ht_next rd 1 ;htab[1] stdout |
425 | ht_next rd 1 ;htab[1] stdout |
426 | htab rd (4096-$)/4 ;htab[2] stderr |
426 | htab rd (4096-$)/4 ;htab[2] stderr |
427 | pdt_0 rd 1024 |
427 | pdt_0 rd 1024 |
428 | ends |
428 | ends |
429 | 429 | ||
430 | struct DBG_REGS |
430 | struct DBG_REGS |
431 | dr0 dd ? |
431 | dr0 dd ? |
432 | dr1 dd ? |
432 | dr1 dd ? |
433 | dr2 dd ? |
433 | dr2 dd ? |
434 | dr3 dd ? |
434 | dr3 dd ? |
435 | dr7 dd ? |
435 | dr7 dd ? |
436 | ends |
436 | ends |
437 | 437 | ||
438 | struct POINT |
438 | struct POINT |
439 | x dd ? |
439 | x dd ? |
440 | y dd ? |
440 | y dd ? |
441 | ends |
441 | ends |
442 | 442 | ||
443 | struct RECT |
443 | struct RECT |
444 | left dd ? |
444 | left dd ? |
445 | top dd ? |
445 | top dd ? |
446 | right dd ? |
446 | right dd ? |
447 | bottom dd ? |
447 | bottom dd ? |
448 | ends |
448 | ends |
449 | 449 | ||
450 | struct BOX |
450 | struct BOX |
451 | left dd ? |
451 | left dd ? |
452 | top dd ? |
452 | top dd ? |
453 | width dd ? |
453 | width dd ? |
454 | height dd ? |
454 | height dd ? |
455 | ends |
455 | ends |
456 | 456 | ||
457 | struct APPDATA |
457 | struct APPDATA |
458 | app_name rb 11 |
458 | app_name rb 11 |
459 | rb 5 |
459 | rb 5 |
460 | 460 | ||
461 | list LHEAD ;+16 |
461 | list LHEAD ;+16 |
462 | process dd ? ;+24 |
462 | process dd ? ;+24 |
463 | fpu_state dd ? ;+28 |
463 | fpu_state dd ? ;+28 |
464 | exc_handler dd ? ;+32 |
464 | exc_handler dd ? ;+32 |
465 | except_mask dd ? ;+36 |
465 | except_mask dd ? ;+36 |
466 | pl0_stack dd ? ;+40 |
466 | pl0_stack dd ? ;+40 |
467 | cursor dd ? ;+44 |
467 | cursor dd ? ;+44 |
468 | fd_ev dd ? ;+48 |
468 | fd_ev dd ? ;+48 |
469 | bk_ev dd ? ;+52 |
469 | bk_ev dd ? ;+52 |
470 | fd_obj dd ? ;+56 |
470 | fd_obj dd ? ;+56 |
471 | bk_obj dd ? ;+60 |
471 | bk_obj dd ? ;+60 |
472 | saved_esp dd ? ;+64 |
472 | saved_esp dd ? ;+64 |
473 | io_map rd 2 ;+68 |
473 | io_map rd 2 ;+68 |
474 | dbg_state dd ? ;+76 |
474 | dbg_state dd ? ;+76 |
475 | cur_dir dd ? ;+80 |
475 | cur_dir dd ? ;+80 |
476 | wait_timeout dd ? ;+84 |
476 | wait_timeout dd ? ;+84 |
477 | saved_esp0 dd ? ;+88 |
477 | saved_esp0 dd ? ;+88 |
478 | wait_begin dd ? ;+92 +++ |
478 | wait_begin dd ? ;+92 +++ |
479 | wait_test dd ? ;+96 +++ |
479 | wait_test dd ? ;+96 +++ |
480 | wait_param dd ? ;+100 +++ |
480 | wait_param dd ? ;+100 +++ |
481 | tls_base dd ? ;+104 |
481 | tls_base dd ? ;+104 |
482 | dd ? ;+108 |
482 | dd ? ;+108 |
483 | event_filter dd ? ;+112 |
483 | event_filter dd ? ;+112 |
484 | draw_bgr_x dd ? ;+116 |
484 | draw_bgr_x dd ? ;+116 |
485 | draw_bgr_y dd ? ;+120 |
485 | draw_bgr_y dd ? ;+120 |
486 | dd ? ;+124 |
486 | dd ? ;+124 |
487 | 487 | ||
488 | wnd_shape dd ? ;+128 |
488 | wnd_shape dd ? ;+128 |
489 | wnd_shape_scale dd ? ;+132 |
489 | wnd_shape_scale dd ? ;+132 |
490 | dd ? ;+136 |
490 | dd ? ;+136 |
491 | dd ? ;+140 |
491 | dd ? ;+140 |
492 | saved_box BOX ;+144 |
492 | saved_box BOX ;+144 |
493 | ipc_start dd ? ;+160 |
493 | ipc_start dd ? ;+160 |
494 | ipc_size dd ? ;+164 |
494 | ipc_size dd ? ;+164 |
495 | event_mask dd ? ;+168 |
495 | event_mask dd ? ;+168 |
496 | debugger_slot dd ? ;+172 |
496 | debugger_slot dd ? ;+172 |
497 | terminate_protection dd ? ;+176 |
497 | terminate_protection dd ? ;+176 |
498 | keyboard_mode db ? ;+180 |
498 | keyboard_mode db ? ;+180 |
499 | rb 3 |
499 | rb 3 |
500 | dd ? ;+184 |
500 | dd ? ;+184 |
501 | dbg_event_mem dd ? ;+188 |
501 | dbg_event_mem dd ? ;+188 |
502 | dbg_regs DBG_REGS ;+192 |
502 | dbg_regs DBG_REGS ;+192 |
503 | wnd_caption dd ? ;+212 |
503 | wnd_caption dd ? ;+212 |
504 | wnd_clientbox BOX ;+216 |
504 | wnd_clientbox BOX ;+216 |
505 | priority dd ? ;+232 |
505 | priority dd ? ;+232 |
506 | in_schedule LHEAD ;+236 |
506 | in_schedule LHEAD ;+236 |
507 | ends |
507 | ends |
508 | 508 | ||
509 | APP_OBJ_OFFSET equ 48 |
509 | APP_OBJ_OFFSET equ 48 |
510 | APP_EV_OFFSET equ 40 |
510 | APP_EV_OFFSET equ 40 |
511 | 511 | ||
512 | struct TASKDATA |
512 | struct TASKDATA |
513 | event_mask dd ? |
513 | event_mask dd ? |
514 | pid dd ? |
514 | pid dd ? |
515 | dw ? |
515 | dw ? |
516 | state db ? |
516 | state db ? |
517 | db ? |
517 | db ? |
518 | dw ? |
518 | dw ? |
519 | wnd_number db ? |
519 | wnd_number db ? |
520 | db ? |
520 | db ? |
521 | mem_start dd ? |
521 | mem_start dd ? |
522 | counter_sum dd ? |
522 | counter_sum dd ? |
523 | counter_add dd ? |
523 | counter_add dd ? |
524 | cpu_usage dd ? |
524 | cpu_usage dd ? |
525 | ends |
525 | ends |
526 | 526 | ||
527 | TSTATE_RUNNING = 0 |
527 | TSTATE_RUNNING = 0 |
528 | TSTATE_RUN_SUSPENDED = 1 |
528 | TSTATE_RUN_SUSPENDED = 1 |
529 | TSTATE_WAIT_SUSPENDED = 2 |
529 | TSTATE_WAIT_SUSPENDED = 2 |
530 | TSTATE_ZOMBIE = 3 |
530 | TSTATE_ZOMBIE = 3 |
531 | TSTATE_TERMINATING = 4 |
531 | TSTATE_TERMINATING = 4 |
532 | TSTATE_WAITING = 5 |
532 | TSTATE_WAITING = 5 |
533 | TSTATE_FREE = 9 |
533 | TSTATE_FREE = 9 |
534 | 534 | ||
535 | ; constants definition |
535 | ; constants definition |
536 | WSTATE_NORMAL = 00000000b |
536 | WSTATE_NORMAL = 00000000b |
537 | WSTATE_MAXIMIZED = 00000001b |
537 | WSTATE_MAXIMIZED = 00000001b |
538 | WSTATE_MINIMIZED = 00000010b |
538 | WSTATE_MINIMIZED = 00000010b |
539 | WSTATE_ROLLEDUP = 00000100b |
539 | WSTATE_ROLLEDUP = 00000100b |
540 | 540 | ||
541 | WSTATE_REDRAW = 00000001b |
541 | WSTATE_REDRAW = 00000001b |
542 | WSTATE_WNDDRAWN = 00000010b |
542 | WSTATE_WNDDRAWN = 00000010b |
543 | 543 | ||
544 | WSTYLE_HASCAPTION = 00010000b |
544 | WSTYLE_HASCAPTION = 00010000b |
545 | WSTYLE_CLIENTRELATIVE = 00100000b |
545 | WSTYLE_CLIENTRELATIVE = 00100000b |
- | 546 | ||
- | 547 | ZPOS_DESKTOP = -2 |
|
- | 548 | ZPOS_ALWAYS_BACK = -1 |
|
- | 549 | ZPOS_NORMAL = 0 |
|
546 | 550 | ZPOS_ALWAYS_TOP = 1 ;ZPOS_ALWAYS_TOP is always last and has max number! |
|
547 | ; structures definition |
551 | ; structures definition |
548 | struct WDATA |
552 | struct WDATA |
549 | box BOX |
553 | box BOX |
550 | cl_workarea dd ? |
554 | cl_workarea dd ? |
551 | cl_titlebar dd ? |
555 | cl_titlebar dd ? |
552 | cl_frames dd ? |
556 | cl_frames dd ? |
553 | reserved db ? |
557 | z_modif db ? |
554 | fl_wstate db ? |
558 | fl_wstate db ? |
555 | fl_wdrawn db ? |
559 | fl_wdrawn db ? |
556 | fl_redraw db ? |
560 | fl_redraw db ? |
557 | ends |
561 | ends |
558 | 562 | ||
559 | label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3 |
563 | label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3 |
560 | 564 | ||
561 | 565 | ||
562 | struct SYS_VARS |
566 | struct SYS_VARS |
563 | bpp dd ? |
567 | bpp dd ? |
564 | scanline dd ? |
568 | scanline dd ? |
565 | vesa_mode dd ? |
569 | vesa_mode dd ? |
566 | x_res dd ? |
570 | x_res dd ? |
567 | y_res dd ? |
571 | y_res dd ? |
568 | ends |
572 | ends |
569 | 573 | ||
570 | struct APPOBJ ; common object header |
574 | struct APPOBJ ; common object header |
571 | magic dd ? ; |
575 | magic dd ? ; |
572 | destroy dd ? ; internal destructor |
576 | destroy dd ? ; internal destructor |
573 | fd dd ? ; next object in list |
577 | fd dd ? ; next object in list |
574 | bk dd ? ; prev object in list |
578 | bk dd ? ; prev object in list |
575 | pid dd ? ; owner id |
579 | pid dd ? ; owner id |
576 | ends |
580 | ends |
577 | 581 | ||
578 | struct CURSOR APPOBJ |
582 | struct CURSOR APPOBJ |
579 | base dd ? ;allocated memory |
583 | base dd ? ;allocated memory |
580 | hot_x dd ? ;hotspot coords |
584 | hot_x dd ? ;hotspot coords |
581 | hot_y dd ? |
585 | hot_y dd ? |
582 | 586 | ||
583 | list_next dd ? ;next cursor in cursor list |
587 | list_next dd ? ;next cursor in cursor list |
584 | list_prev dd ? ;prev cursor in cursor list |
588 | list_prev dd ? ;prev cursor in cursor list |
585 | dev_obj dd ? ;device depended data |
589 | dev_obj dd ? ;device depended data |
586 | ends |
590 | ends |
587 | 591 | ||
588 | 592 | ||
589 | struct EVENT APPOBJ |
593 | struct EVENT APPOBJ |
590 | id dd ? ;event uid |
594 | id dd ? ;event uid |
591 | state dd ? ;internal flags |
595 | state dd ? ;internal flags |
592 | code dd ? |
596 | code dd ? |
593 | rd 5 |
597 | rd 5 |
594 | ends |
598 | ends |
595 | 599 | ||
596 | 600 | ||
597 | struct SMEM |
601 | struct SMEM |
598 | bk dd ? |
602 | bk dd ? |
599 | fd dd ? ;+4 |
603 | fd dd ? ;+4 |
600 | base dd ? ;+8 |
604 | base dd ? ;+8 |
601 | size dd ? ;+12 |
605 | size dd ? ;+12 |
602 | access dd ? ;+16 |
606 | access dd ? ;+16 |
603 | refcount dd ? ;+20 |
607 | refcount dd ? ;+20 |
604 | name rb 32 ;+24 |
608 | name rb 32 ;+24 |
605 | ends |
609 | ends |
606 | 610 | ||
607 | struct SMAP APPOBJ |
611 | struct SMAP APPOBJ |
608 | base dd ? ;mapped base |
612 | base dd ? ;mapped base |
609 | parent dd ? ;SMEM |
613 | parent dd ? ;SMEM |
610 | ends |
614 | ends |
611 | 615 | ||
612 | struct DLLDESCR |
616 | struct DLLDESCR |
613 | bk dd ? |
617 | bk dd ? |
614 | fd dd ? ;+4 |
618 | fd dd ? ;+4 |
615 | data dd ? ;+8 |
619 | data dd ? ;+8 |
616 | size dd ? ;+12 |
620 | size dd ? ;+12 |
617 | timestamp dq ? |
621 | timestamp dq ? |
618 | refcount dd ? |
622 | refcount dd ? |
619 | defaultbase dd ? |
623 | defaultbase dd ? |
620 | coff_hdr dd ? |
624 | coff_hdr dd ? |
621 | symbols_ptr dd ? |
625 | symbols_ptr dd ? |
622 | symbols_num dd ? |
626 | symbols_num dd ? |
623 | symbols_lim dd ? |
627 | symbols_lim dd ? |
624 | exports dd ? ;export table |
628 | exports dd ? ;export table |
625 | name rb 260 |
629 | name rb 260 |
626 | ends |
630 | ends |
627 | 631 | ||
628 | struct HDLL |
632 | struct HDLL |
629 | fd dd ? ;next object in list |
633 | fd dd ? ;next object in list |
630 | bk dd ? ;prev object in list |
634 | bk dd ? ;prev object in list |
631 | pid dd ? ;owner id |
635 | pid dd ? ;owner id |
632 | 636 | ||
633 | base dd ? ;mapped base |
637 | base dd ? ;mapped base |
634 | size dd ? ;mapped size |
638 | size dd ? ;mapped size |
635 | refcount dd ? ;reference counter for this process and this lib |
639 | refcount dd ? ;reference counter for this process and this lib |
636 | parent dd ? ;DLLDESCR |
640 | parent dd ? ;DLLDESCR |
637 | ends |
641 | ends |
638 | 642 | ||
639 | 643 | ||
640 | struct BOOT_DATA |
644 | struct BOOT_DATA |
641 | bpp dd ? |
645 | bpp dd ? |
642 | scanline dd ? |
646 | scanline dd ? |
643 | vesa_mode dd ? |
647 | vesa_mode dd ? |
644 | x_res dd ? |
648 | x_res dd ? |
645 | y_res dd ? |
649 | y_res dd ? |
646 | mouse_port dd ? |
650 | mouse_port dd ? |
647 | bank_switch dd ? |
651 | bank_switch dd ? |
648 | lfb dd ? |
652 | lfb dd ? |
649 | vesa_mem dd ? |
653 | vesa_mem dd ? |
650 | log dd ? |
654 | log dd ? |
651 | direct_lfb dd ? |
655 | direct_lfb dd ? |
652 | pci_data dd ? |
656 | pci_data dd ? |
653 | dd ? |
657 | dd ? |
654 | vrr dd ? |
658 | vrr dd ? |
655 | ide_base dd ? |
659 | ide_base dd ? |
656 | mem_amount dd ? |
660 | mem_amount dd ? |
657 | pages_count dd ? |
661 | pages_count dd ? |
658 | pagemap_size dd ? |
662 | pagemap_size dd ? |
659 | kernel_max dd ? |
663 | kernel_max dd ? |
660 | kernel_pages dd ? |
664 | kernel_pages dd ? |
661 | kernel_tables dd ? |
665 | kernel_tables dd ? |
662 | 666 | ||
663 | cpu_vendor dd ? |
667 | cpu_vendor dd ? |
664 | dd ? |
668 | dd ? |
665 | dd ? |
669 | dd ? |
666 | cpu_sign dd ? |
670 | cpu_sign dd ? |
667 | cpu_info dd ? |
671 | cpu_info dd ? |
668 | cpu_caps dd ? |
672 | cpu_caps dd ? |
669 | dd ? |
673 | dd ? |
670 | dd ? |
674 | dd ? |
671 | ends |
675 | ends |
672 | 676 | ||
673 | struct display_t |
677 | struct display_t |
674 | x dd ? |
678 | x dd ? |
675 | y dd ? |
679 | y dd ? |
676 | width dd ? |
680 | width dd ? |
677 | height dd ? |
681 | height dd ? |
678 | bits_per_pixel dd ? |
682 | bits_per_pixel dd ? |
679 | vrefresh dd ? |
683 | vrefresh dd ? |
680 | lfb dd ? |
684 | lfb dd ? |
681 | lfb_pitch dd ? |
685 | lfb_pitch dd ? |
682 | 686 | ||
683 | win_map_lock RWSEM |
687 | win_map_lock RWSEM |
684 | win_map dd ? |
688 | win_map dd ? |
685 | win_map_pitch dd ? |
689 | win_map_pitch dd ? |
686 | win_map_size dd ? |
690 | win_map_size dd ? |
687 | 691 | ||
688 | modes dd ? |
692 | modes dd ? |
689 | ddev dd ? |
693 | ddev dd ? |
690 | connector dd ? |
694 | connector dd ? |
691 | crtc dd ? |
695 | crtc dd ? |
692 | 696 | ||
693 | cr_list.next dd ? |
697 | cr_list.next dd ? |
694 | cr_list.prev dd ? |
698 | cr_list.prev dd ? |
695 | 699 | ||
696 | cursor dd ? |
700 | cursor dd ? |
697 | 701 | ||
698 | init_cursor dd ? |
702 | init_cursor dd ? |
699 | select_cursor dd ? |
703 | select_cursor dd ? |
700 | show_cursor dd ? |
704 | show_cursor dd ? |
701 | move_cursor dd ? |
705 | move_cursor dd ? |
702 | restore_cursor dd ? |
706 | restore_cursor dd ? |
703 | disable_mouse dd ? |
707 | disable_mouse dd ? |
704 | mask_seqno dd ? |
708 | mask_seqno dd ? |
705 | check_mouse dd ? |
709 | check_mouse dd ? |
706 | check_m_pixel dd ? |
710 | check_m_pixel dd ? |
707 | 711 | ||
708 | bytes_per_pixel dd ? |
712 | bytes_per_pixel dd ? |
709 | ends |
713 | ends |
710 | 714 | ||
711 | struct DISPMODE |
715 | struct DISPMODE |
712 | width dw ? |
716 | width dw ? |
713 | height dw ? |
717 | height dw ? |
714 | bpp dw ? |
718 | bpp dw ? |
715 | freq dw ? |
719 | freq dw ? |
716 | ends |
720 | ends |
717 | 721 | ||
718 | 722 | ||
719 | struct PCIDEV |
723 | struct PCIDEV |
720 | bk dd ? |
724 | bk dd ? |
721 | fd dd ? |
725 | fd dd ? |
722 | vendor_device_id dd ? |
726 | vendor_device_id dd ? |
723 | class dd ? |
727 | class dd ? |
724 | devfn db ? |
728 | devfn db ? |
725 | bus db ? |
729 | bus db ? |
726 | rb 2 |
730 | rb 2 |
727 | owner dd ? ; pointer to SRV or 0 |
731 | owner dd ? ; pointer to SRV or 0 |
728 | ends |
732 | ends |
729 | 733 | ||
730 | struct IDE_DATA |
734 | struct IDE_DATA |
731 | ProgrammingInterface dd ? |
735 | ProgrammingInterface dd ? |
732 | Interrupt dw ? |
736 | Interrupt dw ? |
733 | RegsBaseAddres dw ? |
737 | RegsBaseAddres dw ? |
734 | BAR0_val dw ? |
738 | BAR0_val dw ? |
735 | BAR1_val dw ? |
739 | BAR1_val dw ? |
736 | BAR2_val dw ? |
740 | BAR2_val dw ? |
737 | BAR3_val dw ? |
741 | BAR3_val dw ? |
738 | dma_hdd_channel_1 db ? |
742 | dma_hdd_channel_1 db ? |
739 | dma_hdd_channel_2 db ? |
743 | dma_hdd_channel_2 db ? |
740 | ends |
744 | ends |
741 | 745 | ||
742 | struct IDE_CACHE |
746 | struct IDE_CACHE |
743 | pointer dd ? |
747 | pointer dd ? |
744 | size dd ? ; not use |
748 | size dd ? ; not use |
745 | data_pointer dd ? |
749 | data_pointer dd ? |
746 | system_data_size dd ? ; not use |
750 | system_data_size dd ? ; not use |
747 | appl_data_size dd ? ; not use |
751 | appl_data_size dd ? ; not use |
748 | system_data dd ? |
752 | system_data dd ? |
749 | appl_data dd ? |
753 | appl_data dd ? |
750 | system_sad_size dd ? |
754 | system_sad_size dd ? |
751 | appl_sad_size dd ? |
755 | appl_sad_size dd ? |
752 | search_start dd ? |
756 | search_start dd ? |
753 | appl_search_start dd ? |
757 | appl_search_start dd ? |
754 | ends |
758 | ends |
755 | 759 | ||
756 | struct IDE_DEVICE |
760 | struct IDE_DEVICE |
757 | UDMA_possible_modes db ? |
761 | UDMA_possible_modes db ? |
758 | UDMA_set_mode db ? |
762 | UDMA_set_mode db ? |
759 | ends |
763 | ends |
760 | 764 | ||
761 | ; The following macro assume that we are on uniprocessor machine. |
765 | ; The following macro assume that we are on uniprocessor machine. |
762 | ; Serious work is needed for multiprocessor machines. |
766 | ; Serious work is needed for multiprocessor machines. |
763 | macro spin_lock_irqsave spinlock |
767 | macro spin_lock_irqsave spinlock |
764 | { |
768 | { |
765 | pushf |
769 | pushf |
766 | cli |
770 | cli |
767 | } |
771 | } |
768 | macro spin_unlock_irqrestore spinlock |
772 | macro spin_unlock_irqrestore spinlock |
769 | { |
773 | { |
770 | popf |
774 | popf |
771 | } |
775 | } |
772 | macro spin_lock_irq spinlock |
776 | macro spin_lock_irq spinlock |
773 | { |
777 | { |
774 | cli |
778 | cli |
775 | } |
779 | } |
776 | macro spin_unlock_irq spinlock |
780 | macro spin_unlock_irq spinlock |
777 | { |
781 | { |
778 | sti |
782 | sti |
779 | } |
783 | } |
780 | 784 | ||
781 | struct MEM_STATE |
785 | struct MEM_STATE |
782 | mutex MUTEX |
786 | mutex MUTEX |
783 | smallmap dd ? |
787 | smallmap dd ? |
784 | treemap dd ? |
788 | treemap dd ? |
785 | topsize dd ? |
789 | topsize dd ? |
786 | top dd ? |
790 | top dd ? |
787 | smallbins rd 4*32 |
791 | smallbins rd 4*32 |
788 | treebins rd 32 |
792 | treebins rd 32 |
789 | ends |
793 | ends |
790 | 794 | ||
791 | struct PG_DATA |
795 | struct PG_DATA |
792 | mem_amount dd ? |
796 | mem_amount dd ? |
793 | vesa_mem dd ? |
797 | vesa_mem dd ? |
794 | pages_count dd ? |
798 | pages_count dd ? |
795 | pages_free dd ? |
799 | pages_free dd ? |
796 | pages_faults dd ? |
800 | pages_faults dd ? |
797 | pagemap_size dd ? |
801 | pagemap_size dd ? |
798 | kernel_pages dd ? |
802 | kernel_pages dd ? |
799 | kernel_tables dd ? |
803 | kernel_tables dd ? |
800 | sys_page_dir dd ? |
804 | sys_page_dir dd ? |
801 | mutex MUTEX |
805 | mutex MUTEX |
802 | ends |
806 | ends |
803 | 807 | ||
804 | struct SRV |
808 | struct SRV |
805 | srv_name rb 16 ;ASCIIZ string |
809 | srv_name rb 16 ;ASCIIZ string |
806 | magic dd ? ;+0x10 ;'SRV ' |
810 | magic dd ? ;+0x10 ;'SRV ' |
807 | size dd ? ;+0x14 ;size of structure SRV |
811 | size dd ? ;+0x14 ;size of structure SRV |
808 | fd dd ? ;+0x18 ;next SRV descriptor |
812 | fd dd ? ;+0x18 ;next SRV descriptor |
809 | bk dd ? ;+0x1C ;prev SRV descriptor |
813 | bk dd ? ;+0x1C ;prev SRV descriptor |
810 | base dd ? ;+0x20 ;service base address |
814 | base dd ? ;+0x20 ;service base address |
811 | entry dd ? ;+0x24 ;service START function |
815 | entry dd ? ;+0x24 ;service START function |
812 | srv_proc dd ? ;+0x28 ;user mode service handler |
816 | srv_proc dd ? ;+0x28 ;user mode service handler |
813 | srv_proc_ex dd ? ;+0x2C ;kernel mode service handler |
817 | srv_proc_ex dd ? ;+0x2C ;kernel mode service handler |
814 | ends |
818 | ends |
815 | 819 | ||
816 | struct USBSRV |
820 | struct USBSRV |
817 | srv SRV |
821 | srv SRV |
818 | usb_func dd ? |
822 | usb_func dd ? |
819 | ends |
823 | ends |
820 | 824 | ||
821 | struct USBFUNC |
825 | struct USBFUNC |
822 | strucsize dd ? |
826 | strucsize dd ? |
823 | add_device dd ? |
827 | add_device dd ? |
824 | device_disconnect dd ? |
828 | device_disconnect dd ? |
825 | ends |
829 | ends |
826 | 830 | ||
827 | DRV_ENTRY equ 1 |
831 | DRV_ENTRY equ 1 |
828 | DRV_EXIT equ -1 |
832 | DRV_EXIT equ -1 |
829 | 833 | ||
830 | struct COFF_HEADER |
834 | struct COFF_HEADER |
831 | machine dw ? |
835 | machine dw ? |
832 | nSections dw ? |
836 | nSections dw ? |
833 | DataTime dd ? |
837 | DataTime dd ? |
834 | pSymTable dd ? |
838 | pSymTable dd ? |
835 | nSymbols dd ? |
839 | nSymbols dd ? |
836 | optHeader dw ? |
840 | optHeader dw ? |
837 | flags dw ? |
841 | flags dw ? |
838 | ends |
842 | ends |
839 | 843 | ||
840 | struct COFF_SECTION |
844 | struct COFF_SECTION |
841 | Name rb 8 |
845 | Name rb 8 |
842 | VirtualSize dd ? |
846 | VirtualSize dd ? |
843 | VirtualAddress dd ? |
847 | VirtualAddress dd ? |
844 | SizeOfRawData dd ? |
848 | SizeOfRawData dd ? |
845 | PtrRawData dd ? |
849 | PtrRawData dd ? |
846 | PtrReloc dd ? |
850 | PtrReloc dd ? |
847 | PtrLinenumbers dd ? |
851 | PtrLinenumbers dd ? |
848 | NumReloc dw ? |
852 | NumReloc dw ? |
849 | NumLinenum dw ? |
853 | NumLinenum dw ? |
850 | Characteristics dd ? |
854 | Characteristics dd ? |
851 | ends |
855 | ends |
852 | 856 | ||
853 | struct COFF_RELOC |
857 | struct COFF_RELOC |
854 | VirtualAddress dd ? |
858 | VirtualAddress dd ? |
855 | SymIndex dd ? |
859 | SymIndex dd ? |
856 | Type dw ? |
860 | Type dw ? |
857 | ends |
861 | ends |
858 | 862 | ||
859 | struct COFF_SYM |
863 | struct COFF_SYM |
860 | Name rb 8 |
864 | Name rb 8 |
861 | Value dd ? |
865 | Value dd ? |
862 | SectionNumber dw ? |
866 | SectionNumber dw ? |
863 | Type dw ? |
867 | Type dw ? |
864 | StorageClass db ? |
868 | StorageClass db ? |
865 | NumAuxSymbols db ? |
869 | NumAuxSymbols db ? |
866 | ends |
870 | ends |
867 | 871 | ||
868 | struct STRIPPED_PE_HEADER |
872 | struct STRIPPED_PE_HEADER |
869 | Signature dw ? |
873 | Signature dw ? |
870 | Characteristics dw ? |
874 | Characteristics dw ? |
871 | AddressOfEntryPoint dd ? |
875 | AddressOfEntryPoint dd ? |
872 | ImageBase dd ? |
876 | ImageBase dd ? |
873 | SectionAlignmentLog db ? |
877 | SectionAlignmentLog db ? |
874 | FileAlignmentLog db ? |
878 | FileAlignmentLog db ? |
875 | MajorOSVersion db ? |
879 | MajorOSVersion db ? |
876 | MinorOSVersion db ? |
880 | MinorOSVersion db ? |
877 | SizeOfImage dd ? |
881 | SizeOfImage dd ? |
878 | SizeOfStackReserve dd ? |
882 | SizeOfStackReserve dd ? |
879 | SizeOfHeapReserve dd ? |
883 | SizeOfHeapReserve dd ? |
880 | SizeOfHeaders dd ? |
884 | SizeOfHeaders dd ? |
881 | Subsystem db ? |
885 | Subsystem db ? |
882 | NumberOfRvaAndSizes db ? |
886 | NumberOfRvaAndSizes db ? |
883 | NumberOfSections dw ? |
887 | NumberOfSections dw ? |
884 | ends |
888 | ends |
885 | STRIPPED_PE_SIGNATURE = 0x4503 ; 'PE' xor 'S' |
889 | STRIPPED_PE_SIGNATURE = 0x4503 ; 'PE' xor 'S' |
886 | SPE_DIRECTORY_IMPORT = 0 |
890 | SPE_DIRECTORY_IMPORT = 0 |
887 | SPE_DIRECTORY_EXPORT = 1 |
891 | SPE_DIRECTORY_EXPORT = 1 |
888 | SPE_DIRECTORY_BASERELOC = 2 |
892 | SPE_DIRECTORY_BASERELOC = 2 |
889 | 893 | ||
890 | struct IOCTL |
894 | struct IOCTL |
891 | handle dd ? |
895 | handle dd ? |
892 | io_code dd ? |
896 | io_code dd ? |
893 | input dd ? |
897 | input dd ? |
894 | inp_size dd ? |
898 | inp_size dd ? |
895 | output dd ? |
899 | output dd ? |
896 | out_size dd ? |
900 | out_size dd ? |
897 | ends |
901 | ends |
898 | 902 | ||
899 | struct IRQH |
903 | struct IRQH |
900 | list LHEAD |
904 | list LHEAD |
901 | handler dd ? ;handler roututine |
905 | handler dd ? ;handler roututine |
902 | data dd ? ;user-specific data |
906 | data dd ? ;user-specific data |
903 | num_ints dd ? ;how many times handled |
907 | num_ints dd ? ;how many times handled |
904 | ends8)|WB |
908 | ends8)|WB |
905 | 909 | ||
906 | ;;;;;;;;;;;boot><8)|WB |
910 | ;;;;;;;;;;;boot><8)|WB |
907 | 911 | ||
908 | ;;;;;;;;;;;boot>16)|(WC<<8)|WB |
912 | ;;;;;;;;;;;boot>16)|(WC<<8)|WB |
909 | 913 | ||
910 | ;;;;;;;;;;;boot><16)|(WC<<8)|WB |
914 | ;;;;;;;;;;;boot><16)|(WC<<8)|WB |
911 | 915 | ||
912 | ;;;;;;;;;;;boot>24)|(UCM<<16)|(WC<<8)|WB |
916 | ;;;;;;;;;;;boot>24)|(UCM<<16)|(WC<<8)|WB |
913 | 917 | ||
914 | ;;;;;;;;;;;boot><24)|(UCM<<16)|(WC<<8)|WB |
918 | ;;;;;;;;;;;boot><24)|(UCM<<16)|(WC<<8)|WB |
915 | 919 | ||
916 | ;;;;;;;;;;;boot> |
920 | ;;;;;;;;;;;boot> |