Rev 9930 | Rev 9941 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2288 | clevermous | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
9715 | Doczom | 3 | ;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;; |
2288 | clevermous | 4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
||
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
7 | |||
8 | $Revision: 9932 $ |
||
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 |
9930 | Doczom | 226 | background_window = window_data + sizeof.WDATA |
2288 | clevermous | 227 | |
9930 | Doczom | 228 | ;CDDataBuf = OS_BASE + 0x0005000 |
3732 | Serge | 229 | |
7136 | dunkaist | 230 | BOOT_VARS = 0x9000 |
3732 | Serge | 231 | |
7136 | dunkaist | 232 | idts = OS_BASE + 0x000B100 |
233 | WIN_STACK = OS_BASE + 0x000C000 |
||
234 | WIN_POS = OS_BASE + 0x000C400 |
||
235 | FDD_BUFF = OS_BASE + 0x000D000 ;512 |
||
2288 | clevermous | 236 | |
7136 | dunkaist | 237 | WIN_TEMP_XY = OS_BASE + 0x000F300 |
238 | KEY_COUNT = OS_BASE + 0x000F400 |
||
239 | KEY_BUFF = OS_BASE + 0x000F401 ; 120*2 + 2*2 = 244 bytes, actually 255 bytes |
||
2288 | clevermous | 240 | |
7136 | dunkaist | 241 | BTN_COUNT = OS_BASE + 0x000F500 |
242 | BTN_BUFF = OS_BASE + 0x000F501 |
||
2288 | clevermous | 243 | |
244 | |||
7136 | dunkaist | 245 | BTN_ADDR = OS_BASE + 0x000FE88 |
246 | MEM_AMOUNT = OS_BASE + 0x000FE8C |
||
2288 | clevermous | 247 | |
7136 | dunkaist | 248 | SYS_SHUTDOWN = OS_BASE + 0x000FF00 |
2288 | clevermous | 249 | |
2513 | mario79 | 250 | |
8085 | dunkaist | 251 | TMP_STACK_TOP = 0x007CC00 |
2288 | clevermous | 252 | |
8085 | dunkaist | 253 | sys_proc = OS_BASE + 0x007E000 |
2288 | clevermous | 254 | |
7136 | dunkaist | 255 | SLOT_BASE = OS_BASE + 0x0080000 |
2288 | clevermous | 256 | |
7136 | dunkaist | 257 | VGABasePtr = OS_BASE + 0x00A0000 |
2288 | clevermous | 258 | |
7136 | dunkaist | 259 | virtual at OS_BASE + 0x05FFF80 |
2288 | clevermous | 260 | tss TSS |
261 | end virtual |
||
262 | |||
7136 | dunkaist | 263 | HEAP_BASE = OS_BASE + 0x0800000 |
264 | HEAP_MIN_SIZE = 0x01000000 |
||
2288 | clevermous | 265 | |
7136 | dunkaist | 266 | page_tabs = 0xFDC00000 |
267 | app_page_tabs = 0xFDC00000 |
||
268 | kernel_tabs = page_tabs + (OS_BASE shr 10) ;0xFDE00000 |
||
269 | master_tab = page_tabs + (page_tabs shr 10) ;0xFDFF70000 |
||
2288 | clevermous | 270 | |
7136 | dunkaist | 271 | LFB_BASE = 0xFE000000 |
2288 | clevermous | 272 | |
9917 | Doczom | 273 | std_application_base_address = 0 |
7136 | dunkaist | 274 | RING0_STACK_SIZE = 0x2000 |
2288 | clevermous | 275 | |
7136 | dunkaist | 276 | REG_SS = RING0_STACK_SIZE - 4 |
277 | REG_APP_ESP = RING0_STACK_SIZE - 8 |
||
278 | REG_EFLAGS = RING0_STACK_SIZE - 12 |
||
279 | REG_CS = RING0_STACK_SIZE - 16 |
||
280 | REG_EIP = RING0_STACK_SIZE - 20 |
||
281 | REG_EAX = RING0_STACK_SIZE - 24 |
||
282 | REG_ECX = RING0_STACK_SIZE - 28 |
||
283 | REG_EDX = RING0_STACK_SIZE - 32 |
||
284 | REG_EBX = RING0_STACK_SIZE - 36 |
||
285 | REG_ESP = RING0_STACK_SIZE - 40 ;RING0_STACK_SIZE-20 |
||
286 | REG_EBP = RING0_STACK_SIZE - 44 |
||
287 | REG_ESI = RING0_STACK_SIZE - 48 |
||
288 | REG_EDI = RING0_STACK_SIZE - 52 |
||
289 | REG_RET = RING0_STACK_SIZE - 56 ;irq0.return |
||
2288 | clevermous | 290 | |
291 | |||
7136 | dunkaist | 292 | PAGE_SIZE = 4096 |
5130 | serge | 293 | |
7136 | dunkaist | 294 | PG_UNMAP = 0x000 |
295 | PG_READ = 0x001 |
||
296 | PG_WRITE = 0x002 |
||
297 | PG_USER = 0x004 |
||
298 | PG_PCD = 0x008 |
||
299 | PG_PWT = 0x010 |
||
300 | PG_ACCESSED = 0x020 |
||
301 | PG_DIRTY = 0x040 |
||
302 | PG_PAT = 0x080 |
||
303 | PG_GLOBAL = 0x100 |
||
304 | PG_SHARED = 0x200 |
||
2288 | clevermous | 305 | |
7136 | dunkaist | 306 | PG_SWR = 0x003 ; PG_WRITE + PG_READ |
307 | PG_UR = 0x005 ; PG_USER + PG_READ |
||
308 | PG_UWR = 0x007 ; PG_USER + PG_WRITE + PG_READ |
||
309 | PG_NOCACHE = 0x018 ; PG_PCD + PG_PWT |
||
5356 | serge | 310 | |
7136 | dunkaist | 311 | PDE_LARGE = 0x080 |
5356 | serge | 312 | |
7136 | dunkaist | 313 | MEM_WB = 6 ; write-back memory |
314 | MEM_WC = 1 ; write combined memory |
||
315 | MEM_UC = 0 ; uncached memory |
||
5360 | serge | 316 | |
7136 | dunkaist | 317 | PAT_WB = 0x000 |
318 | PAT_WC = 0x008 |
||
319 | PAT_UCM = 0x010 |
||
320 | PAT_UC = 0x018 |
||
5360 | serge | 321 | |
7136 | dunkaist | 322 | PAT_TYPE_UC = 0 |
323 | PAT_TYPE_WC = 1 |
||
324 | PAT_TYPE_WB = 6 |
||
325 | PAT_TYPE_UCM = 7 |
||
5360 | serge | 326 | |
7136 | dunkaist | 327 | PAT_VALUE = 0x00070106; (UC<<24)|(UCM<<16)|(WC<<8)|WB |
7122 | dunkaist | 328 | |
7136 | dunkaist | 329 | MAX_MEMMAP_BLOCKS = 32 |
2288 | clevermous | 330 | |
7136 | dunkaist | 331 | EVENT_REDRAW = 0x00000001 |
332 | EVENT_KEY = 0x00000002 |
||
333 | EVENT_BUTTON = 0x00000004 |
||
334 | EVENT_BACKGROUND = 0x00000010 |
||
335 | EVENT_MOUSE = 0x00000020 |
||
336 | EVENT_IPC = 0x00000040 |
||
337 | EVENT_NETWORK = 0x00000080 |
||
338 | EVENT_DEBUG = 0x00000100 |
||
339 | EVENT_NETWORK2 = 0x00000200 |
||
340 | EVENT_EXTENDED = 0x00000400 |
||
2288 | clevermous | 341 | |
9917 | Doczom | 342 | EVM_MOUSE_FILTER = 0x80000000 ; see in macros.inc for apps |
343 | EVM_CURSOR_FILTER = 0x40000000 |
||
344 | |||
7136 | dunkaist | 345 | EV_INTR = 1 |
6079 | serge | 346 | |
7136 | dunkaist | 347 | STDIN_FILENO = 0 |
348 | STDOUT_FILENO = 1 |
||
349 | STDERR_FILENO = 2 |
||
6244 | serge | 350 | |
7136 | dunkaist | 351 | SYSTEM_SHUTDOWN = 2 |
352 | SYSTEM_REBOOT = 3 |
||
353 | SYSTEM_RESTART = 4 |
||
6790 | 0CodErr | 354 | |
7136 | dunkaist | 355 | BLIT_CLIENT_RELATIVE = 0x20000000 |
356 | |||
6079 | serge | 357 | struct SYSCALL_STACK |
9831 | dunkaist | 358 | eip dd ? ; +0 |
359 | edi dd ? ; +4 |
||
360 | esi dd ? ; +8 |
||
361 | ebp dd ? ; +12 |
||
362 | esp dd ? ; +16 |
||
363 | ebx dd ? ; +20 |
||
364 | edx dd ? ; +24 |
||
365 | ecx dd ? ; +28 |
||
366 | eax dd ? ; +32 |
||
2384 | hidnplayr | 367 | ends |
2288 | clevermous | 368 | |
6079 | serge | 369 | struct LHEAD |
370 | next dd ? ;next object in list |
||
371 | prev dd ? ;prev object in list |
||
372 | ends |
||
2288 | clevermous | 373 | |
6079 | serge | 374 | struct MUTEX_WAITER |
375 | list LHEAD |
||
376 | task dd ? |
||
377 | type dd ? |
||
378 | ends |
||
379 | |||
380 | struct MUTEX |
||
381 | wait_list LHEAD |
||
382 | count dd ? |
||
383 | ends |
||
384 | |||
385 | struct RWSEM |
||
386 | wait_list LHEAD |
||
387 | count dd ? |
||
388 | ends |
||
389 | |||
390 | struct FUTEX |
||
391 | list LHEAD |
||
392 | magic dd ? |
||
393 | handle dd ? |
||
394 | destroy dd ? |
||
395 | |||
396 | wait_list LHEAD |
||
397 | pointer dd ? |
||
398 | flags dd ? |
||
399 | ends |
||
400 | |||
7136 | dunkaist | 401 | FUTEX_INIT = 0 |
402 | FUTEX_DESTROY = 1 |
||
403 | FUTEX_WAIT = 2 |
||
404 | FUTEX_WAKE = 3 |
||
6079 | serge | 405 | |
6926 | serge | 406 | struct FILED |
407 | list LHEAD |
||
408 | magic rd 1 |
||
409 | handle rd 1 |
||
410 | destroy rd 1 |
||
6929 | serge | 411 | mode rd 1 |
6926 | serge | 412 | file rd 1 |
413 | ends |
||
414 | |||
415 | struct PIPE |
||
416 | pipe_ops rd 1 |
||
417 | buffer rd 1 |
||
418 | readers rd 1 |
||
419 | writers rd 1 |
||
420 | |||
421 | pipe_lock MUTEX |
||
422 | count rd 1 |
||
423 | |||
424 | read_end rd 1 |
||
425 | write_end rd 1 |
||
426 | rlist LHEAD |
||
427 | wlist LHEAD |
||
428 | ends |
||
429 | |||
6079 | serge | 430 | struct PROC |
431 | list LHEAD |
||
432 | thr_list LHEAD |
||
433 | heap_lock MUTEX |
||
434 | heap_base rd 1 |
||
435 | heap_top rd 1 |
||
436 | mem_used rd 1 |
||
437 | dlls_list_ptr rd 1 |
||
438 | pdt_0_phys rd 1 |
||
439 | pdt_1_phys rd 1 |
||
440 | io_map_0 rd 1 |
||
441 | io_map_1 rd 1 |
||
442 | |||
443 | ht_lock rd 1 |
||
6802 | pathoswith | 444 | ht_free rd 1 ;htab[0] stdin |
445 | ht_next rd 1 ;htab[1] stdout |
||
446 | htab rd 1024-PROC.htab/4 ;htab[2] stderr |
||
6079 | serge | 447 | pdt_0 rd 1024 |
448 | ends |
||
449 | |||
450 | struct DBG_REGS |
||
451 | dr0 dd ? |
||
452 | dr1 dd ? |
||
453 | dr2 dd ? |
||
454 | dr3 dd ? |
||
455 | dr7 dd ? |
||
456 | ends |
||
457 | |||
458 | struct POINT |
||
459 | x dd ? |
||
460 | y dd ? |
||
461 | ends |
||
462 | |||
463 | struct RECT |
||
464 | left dd ? |
||
465 | top dd ? |
||
466 | right dd ? |
||
467 | bottom dd ? |
||
468 | ends |
||
469 | |||
470 | struct BOX |
||
471 | left dd ? |
||
472 | top dd ? |
||
473 | width dd ? |
||
474 | height dd ? |
||
475 | ends |
||
476 | |||
477 | struct APPDATA |
||
478 | app_name rb 11 |
||
479 | rb 5 |
||
480 | |||
481 | list LHEAD ;+16 |
||
482 | process dd ? ;+24 |
||
483 | fpu_state dd ? ;+28 |
||
484 | exc_handler dd ? ;+32 |
||
485 | except_mask dd ? ;+36 |
||
486 | pl0_stack dd ? ;+40 |
||
9930 | Doczom | 487 | dd ? ;+44 |
6079 | serge | 488 | fd_ev dd ? ;+48 |
489 | bk_ev dd ? ;+52 |
||
490 | fd_obj dd ? ;+56 |
||
491 | bk_obj dd ? ;+60 |
||
492 | saved_esp dd ? ;+64 |
||
493 | io_map rd 2 ;+68 |
||
494 | dbg_state dd ? ;+76 |
||
9930 | Doczom | 495 | cur_dir dd ? ;+80 ; directory this thread |
6079 | serge | 496 | wait_timeout dd ? ;+84 |
497 | saved_esp0 dd ? ;+88 |
||
498 | wait_begin dd ? ;+92 +++ |
||
499 | wait_test dd ? ;+96 +++ |
||
500 | wait_param dd ? ;+100 +++ |
||
501 | tls_base dd ? ;+104 |
||
9709 | Doczom | 502 | event_mask dd ? ;+108 stores event types allowed for task |
503 | tid dd ? ;+112 thread id |
||
9930 | Doczom | 504 | dd ? ;+116 |
505 | dd ? ;+120 |
||
9709 | Doczom | 506 | state db ? ;+124 thread state |
507 | wnd_number db ? ;+125 |
||
8869 | rgimad | 508 | dw ? ;+126 |
9930 | Doczom | 509 | window dd ? ;+128 ptr WDATA |
9926 | Doczom | 510 | dd ? ;+132 |
9710 | Doczom | 511 | dd ? ;+136 |
9932 | Doczom | 512 | counter_sum dd ? ;+140 |
9930 | Doczom | 513 | rd 4 ;+144 |
6079 | serge | 514 | ipc_start dd ? ;+160 |
515 | ipc_size dd ? ;+164 |
||
8874 | rgimad | 516 | occurred_events dd ? ;+168 ; mask which accumulates occurred events |
9930 | Doczom | 517 | debugger_slot dd ? ;+172 ; index in SLOT_BASE array |
6079 | serge | 518 | terminate_protection dd ? ;+176 |
519 | keyboard_mode db ? ;+180 |
||
9926 | Doczom | 520 | rb 3 |
6318 | serge | 521 | exec_params dd ? ;+184 |
6079 | serge | 522 | dbg_event_mem dd ? ;+188 |
523 | dbg_regs DBG_REGS ;+192 |
||
9926 | Doczom | 524 | dd ? ;+212 |
525 | rd 4 ;+216 |
||
6079 | serge | 526 | priority dd ? ;+232 |
527 | in_schedule LHEAD ;+236 |
||
9932 | Doczom | 528 | counter_add dd ? ;+244 |
529 | cpu_usage dd ? ;+248 |
||
9930 | Doczom | 530 | dd ? ;+252 ; temporary place to save cursor |
6079 | serge | 531 | ends |
532 | |||
8093 | dunkaist | 533 | assert sizeof.APPDATA = 256 |
534 | |||
7136 | dunkaist | 535 | APP_OBJ_OFFSET = 48 |
536 | APP_EV_OFFSET = 40 |
||
6079 | serge | 537 | |
8874 | rgimad | 538 | ; Thread states: |
6079 | serge | 539 | TSTATE_RUNNING = 0 |
540 | TSTATE_RUN_SUSPENDED = 1 |
||
541 | TSTATE_WAIT_SUSPENDED = 2 |
||
542 | TSTATE_ZOMBIE = 3 |
||
543 | TSTATE_TERMINATING = 4 |
||
544 | TSTATE_WAITING = 5 |
||
545 | TSTATE_FREE = 9 |
||
546 | |||
8874 | rgimad | 547 | ; Window constants: |
6079 | serge | 548 | WSTATE_NORMAL = 00000000b |
549 | WSTATE_MAXIMIZED = 00000001b |
||
550 | WSTATE_MINIMIZED = 00000010b |
||
551 | WSTATE_ROLLEDUP = 00000100b |
||
9930 | Doczom | 552 | WSTATE_USED = 10000000b |
6079 | serge | 553 | |
9930 | Doczom | 554 | ; fl_redraw |
6079 | serge | 555 | WSTATE_REDRAW = 00000001b |
556 | WSTATE_WNDDRAWN = 00000010b |
||
557 | |||
558 | WSTYLE_HASCAPTION = 00010000b |
||
559 | WSTYLE_CLIENTRELATIVE = 00100000b |
||
560 | |||
561 | ZPOS_DESKTOP = -2 |
||
562 | ZPOS_ALWAYS_BACK = -1 |
||
563 | ZPOS_NORMAL = 0 |
||
564 | ZPOS_ALWAYS_TOP = 1 ;ZPOS_ALWAYS_TOP is always last and has max number! |
||
8874 | rgimad | 565 | |
566 | ; Window structure: |
||
6079 | serge | 567 | struct WDATA |
568 | box BOX |
||
569 | cl_workarea dd ? |
||
570 | cl_titlebar dd ? |
||
571 | cl_frames dd ? |
||
572 | z_modif db ? |
||
573 | fl_wstate db ? |
||
574 | fl_wdrawn db ? |
||
575 | fl_redraw db ? |
||
9926 | Doczom | 576 | clientbox BOX |
577 | shape dd ? |
||
578 | shape_scale dd ? |
||
579 | caption dd ? |
||
580 | captionEncoding db ? |
||
581 | rb 3 |
||
9930 | Doczom | 582 | saved_box BOX |
583 | cursor dd ? |
||
584 | temp_cursor dd ? |
||
585 | draw_bgr_x dd ? |
||
586 | draw_bgr_y dd ? |
||
587 | draw_data RECT |
||
588 | thread dd ? ; prt APPDATA |
||
9932 | Doczom | 589 | rb 12 |
6079 | serge | 590 | ends |
591 | |||
592 | label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3 |
||
593 | |||
9930 | Doczom | 594 | assert sizeof.WDATA = 128 |
6079 | serge | 595 | |
2384 | hidnplayr | 596 | struct SYS_VARS |
597 | bpp dd ? |
||
598 | scanline dd ? |
||
599 | vesa_mode dd ? |
||
600 | x_res dd ? |
||
601 | y_res dd ? |
||
602 | ends |
||
2288 | clevermous | 603 | |
2384 | hidnplayr | 604 | struct APPOBJ ; common object header |
605 | magic dd ? ; |
||
606 | destroy dd ? ; internal destructor |
||
607 | fd dd ? ; next object in list |
||
608 | bk dd ? ; prev object in list |
||
609 | pid dd ? ; owner id |
||
610 | ends |
||
2288 | clevermous | 611 | |
2384 | hidnplayr | 612 | struct CURSOR APPOBJ |
613 | base dd ? ;allocated memory |
||
614 | hot_x dd ? ;hotspot coords |
||
615 | hot_y dd ? |
||
2288 | clevermous | 616 | |
2384 | hidnplayr | 617 | list_next dd ? ;next cursor in cursor list |
618 | list_prev dd ? ;prev cursor in cursor list |
||
619 | dev_obj dd ? ;device depended data |
||
620 | ends |
||
2288 | clevermous | 621 | |
622 | |||
2384 | hidnplayr | 623 | struct EVENT APPOBJ |
624 | id dd ? ;event uid |
||
625 | state dd ? ;internal flags |
||
626 | code dd ? |
||
627 | rd 5 |
||
628 | ends |
||
2288 | clevermous | 629 | |
630 | |||
2384 | hidnplayr | 631 | struct SMEM |
632 | bk dd ? |
||
633 | fd dd ? ;+4 |
||
634 | base dd ? ;+8 |
||
635 | size dd ? ;+12 |
||
636 | access dd ? ;+16 |
||
637 | refcount dd ? ;+20 |
||
638 | name rb 32 ;+24 |
||
639 | ends |
||
2288 | clevermous | 640 | |
2384 | hidnplayr | 641 | struct SMAP APPOBJ |
642 | base dd ? ;mapped base |
||
643 | parent dd ? ;SMEM |
||
644 | ends |
||
2288 | clevermous | 645 | |
2384 | hidnplayr | 646 | struct DLLDESCR |
647 | bk dd ? |
||
648 | fd dd ? ;+4 |
||
649 | data dd ? ;+8 |
||
650 | size dd ? ;+12 |
||
651 | timestamp dq ? |
||
652 | refcount dd ? |
||
653 | defaultbase dd ? |
||
654 | coff_hdr dd ? |
||
655 | symbols_ptr dd ? |
||
656 | symbols_num dd ? |
||
657 | symbols_lim dd ? |
||
658 | exports dd ? ;export table |
||
659 | name rb 260 |
||
660 | ends |
||
2288 | clevermous | 661 | |
2384 | hidnplayr | 662 | struct HDLL |
663 | fd dd ? ;next object in list |
||
664 | bk dd ? ;prev object in list |
||
665 | pid dd ? ;owner id |
||
2288 | clevermous | 666 | |
2384 | hidnplayr | 667 | base dd ? ;mapped base |
668 | size dd ? ;mapped size |
||
669 | refcount dd ? ;reference counter for this process and this lib |
||
670 | parent dd ? ;DLLDESCR |
||
671 | ends |
||
2288 | clevermous | 672 | |
7132 | dunkaist | 673 | struct DQ |
9888 | dunkaist | 674 | union |
675 | lo dd ? |
||
676 | hi_be dd ? ; big endian |
||
677 | ends |
||
678 | union |
||
679 | hi dd ? |
||
680 | lo_be dd ? |
||
681 | ends |
||
7132 | dunkaist | 682 | ends |
2288 | clevermous | 683 | |
7132 | dunkaist | 684 | struct e820entry |
685 | addr DQ ? |
||
686 | size DQ ? |
||
687 | type dd ? |
||
688 | ends |
||
2288 | clevermous | 689 | |
8091 | dunkaist | 690 | RD_LOAD_FROM_FLOPPY = 1 |
691 | RD_LOAD_FROM_HD = 2 |
||
692 | RD_LOAD_FROM_MEMORY = 3 |
||
693 | RD_LOAD_FROM_FORMAT = 4 |
||
694 | RD_LOAD_FROM_NONE = 5 |
||
8089 | dunkaist | 695 | |
9227 | dunkaist | 696 | struct boot_pci_data |
697 | access_mechanism db ? |
||
698 | last_bus db ? |
||
699 | version dw ? ; bcd minor, then major |
||
700 | pm_entry dd ? ; physical address of protected-mode entry point |
||
701 | ends |
||
702 | |||
7132 | dunkaist | 703 | struct boot_data |
704 | bpp db ? ; bits per pixel |
||
705 | pitch dw ? ; scanline length |
||
706 | db ? |
||
2384 | hidnplayr | 707 | dd ? |
7132 | dunkaist | 708 | vesa_mode dw ? |
709 | x_res dw ? |
||
710 | y_res dw ? |
||
711 | dw ? |
||
2384 | hidnplayr | 712 | dd ? |
7132 | dunkaist | 713 | bank_switch dd ? ; Vesa 1.2 pm bank switch |
714 | lfb dd ? ; Vesa 2.0 LFB address |
||
715 | mtrr db ? ; 0 or 1: enable MTRR graphics acceleration |
||
8217 | dunkaist | 716 | launcher_start db ? ; 0 or 1: start the first app (right now it's |
717 | ; LAUNCHER) after kernel is loaded |
||
7132 | dunkaist | 718 | debug_print db ? ; if nonzero, duplicates debug output to the screen |
719 | dma db ? ; DMA write: 1=yes, 2=no |
||
9227 | dunkaist | 720 | pci_data boot_pci_data |
7132 | dunkaist | 721 | rb 8 |
722 | shutdown_type db ? ; see sysfn 18.9 |
||
723 | rb 15 |
||
724 | apm_entry dd ? ; entry point of APM BIOS |
||
725 | apm_version dw ? ; BCD |
||
726 | apm_flags dw ? |
||
727 | rb 8 |
||
728 | apm_code_32 dw ? |
||
729 | apm_code_16 dw ? |
||
730 | apm_data_16 dw ? |
||
8089 | dunkaist | 731 | rd_load_from db ? ; Device to load ramdisk from, RD_LOAD_FROM_* |
7132 | dunkaist | 732 | db ? |
733 | kernel_restart dw ? |
||
8089 | dunkaist | 734 | sys_disk dw ? ; Device to mount on /sys/, see loader_doc.txt for details |
7132 | dunkaist | 735 | acpi_rsdp dd ? |
8092 | dunkaist | 736 | syspath rb 0x17 |
737 | devicesdat_data dd ? |
||
738 | devicesdat_size dd ? |
||
7132 | dunkaist | 739 | bios_hd_cnt db ? ; number of BIOS hard disks |
740 | bios_hd rb 0x80 ; BIOS hard disks |
||
741 | memmap_block_cnt dd ? ; available physical memory map: number of blocks |
||
742 | memmap_blocks e820entry |
||
743 | rb sizeof.e820entry * (MAX_MEMMAP_BLOCKS - 1) |
||
2384 | hidnplayr | 744 | ends |
2288 | clevermous | 745 | |
7132 | dunkaist | 746 | virtual at BOOT_VARS |
747 | BOOT_LO boot_data |
||
748 | end virtual |
||
749 | virtual at OS_BASE + BOOT_VARS |
||
750 | BOOT boot_data |
||
751 | end virtual |
||
752 | |||
7522 | dunkaist | 753 | MAX_SCREEN_WIDTH = 3840 |
754 | MAX_SCREEN_HEIGHT = 2160 |
||
755 | |||
5351 | serge | 756 | struct display_t |
757 | x dd ? |
||
758 | y dd ? |
||
759 | width dd ? |
||
760 | height dd ? |
||
761 | bits_per_pixel dd ? |
||
762 | vrefresh dd ? |
||
6263 | serge | 763 | current_lfb dd ? |
5351 | serge | 764 | lfb_pitch dd ? |
765 | |||
766 | win_map_lock RWSEM |
||
767 | win_map dd ? |
||
768 | win_map_pitch dd ? |
||
769 | win_map_size dd ? |
||
770 | |||
771 | modes dd ? |
||
772 | ddev dd ? |
||
773 | connector dd ? |
||
774 | crtc dd ? |
||
775 | |||
776 | cr_list.next dd ? |
||
777 | cr_list.prev dd ? |
||
778 | |||
779 | cursor dd ? |
||
780 | |||
781 | init_cursor dd ? |
||
782 | select_cursor dd ? |
||
783 | show_cursor dd ? |
||
784 | move_cursor dd ? |
||
785 | restore_cursor dd ? |
||
786 | disable_mouse dd ? |
||
787 | mask_seqno dd ? |
||
788 | check_mouse dd ? |
||
789 | check_m_pixel dd ? |
||
790 | |||
791 | bytes_per_pixel dd ? |
||
792 | ends |
||
793 | |||
6079 | serge | 794 | struct DISPMODE |
795 | width dw ? |
||
796 | height dw ? |
||
797 | bpp dw ? |
||
798 | freq dw ? |
||
799 | ends |
||
5351 | serge | 800 | |
6079 | serge | 801 | |
3393 | clevermous | 802 | struct PCIDEV |
803 | bk dd ? |
||
804 | fd dd ? |
||
805 | vendor_device_id dd ? |
||
806 | class dd ? |
||
807 | devfn db ? |
||
808 | bus db ? |
||
4418 | clevermous | 809 | rb 2 |
810 | owner dd ? ; pointer to SRV or 0 |
||
3393 | clevermous | 811 | ends |
812 | |||
6079 | serge | 813 | struct IDE_DATA |
814 | ProgrammingInterface dd ? |
||
815 | Interrupt dw ? |
||
816 | RegsBaseAddres dw ? |
||
817 | BAR0_val dw ? |
||
818 | BAR1_val dw ? |
||
819 | BAR2_val dw ? |
||
820 | BAR3_val dw ? |
||
821 | dma_hdd_channel_1 db ? |
||
822 | dma_hdd_channel_2 db ? |
||
6816 | dunkaist | 823 | pcidev dd ? ; pointer to corresponding PCIDEV structure |
6079 | serge | 824 | ends |
825 | |||
826 | struct IDE_CACHE |
||
827 | pointer dd ? |
||
828 | size dd ? ; not use |
||
829 | data_pointer dd ? |
||
830 | system_data_size dd ? ; not use |
||
831 | appl_data_size dd ? ; not use |
||
832 | system_data dd ? |
||
833 | appl_data dd ? |
||
834 | system_sad_size dd ? |
||
835 | appl_sad_size dd ? |
||
836 | search_start dd ? |
||
837 | appl_search_start dd ? |
||
838 | ends |
||
839 | |||
840 | struct IDE_DEVICE |
||
841 | UDMA_possible_modes db ? |
||
842 | UDMA_set_mode db ? |
||
843 | ends |
||
844 | |||
3395 | clevermous | 845 | ; The following macro assume that we are on uniprocessor machine. |
846 | ; Serious work is needed for multiprocessor machines. |
||
847 | macro spin_lock_irqsave spinlock |
||
848 | { |
||
849 | pushf |
||
850 | cli |
||
851 | } |
||
852 | macro spin_unlock_irqrestore spinlock |
||
853 | { |
||
854 | popf |
||
855 | } |
||
856 | macro spin_lock_irq spinlock |
||
857 | { |
||
858 | cli |
||
859 | } |
||
860 | macro spin_unlock_irq spinlock |
||
861 | { |
||
862 | sti |
||
863 | } |
||
864 | |||
2384 | hidnplayr | 865 | struct MEM_STATE |
866 | mutex MUTEX |
||
867 | smallmap dd ? |
||
868 | treemap dd ? |
||
869 | topsize dd ? |
||
870 | top dd ? |
||
871 | smallbins rd 4*32 |
||
872 | treebins rd 32 |
||
873 | ends |
||
2288 | clevermous | 874 | |
2384 | hidnplayr | 875 | struct PG_DATA |
876 | mem_amount dd ? |
||
877 | vesa_mem dd ? |
||
878 | pages_count dd ? |
||
879 | pages_free dd ? |
||
880 | pages_faults dd ? |
||
881 | pagemap_size dd ? |
||
882 | kernel_pages dd ? |
||
883 | kernel_tables dd ? |
||
884 | sys_page_dir dd ? |
||
885 | mutex MUTEX |
||
886 | ends |
||
2288 | clevermous | 887 | |
2384 | hidnplayr | 888 | struct SRV |
889 | srv_name rb 16 ;ASCIIZ string |
||
890 | magic dd ? ;+0x10 ;'SRV ' |
||
891 | size dd ? ;+0x14 ;size of structure SRV |
||
892 | fd dd ? ;+0x18 ;next SRV descriptor |
||
893 | bk dd ? ;+0x1C ;prev SRV descriptor |
||
894 | base dd ? ;+0x20 ;service base address |
||
895 | entry dd ? ;+0x24 ;service START function |
||
896 | srv_proc dd ? ;+0x28 ;user mode service handler |
||
897 | srv_proc_ex dd ? ;+0x2C ;kernel mode service handler |
||
898 | ends |
||
2288 | clevermous | 899 | |
3520 | clevermous | 900 | struct USBSRV |
901 | srv SRV |
||
902 | usb_func dd ? |
||
903 | ends |
||
904 | |||
905 | struct USBFUNC |
||
906 | strucsize dd ? |
||
907 | add_device dd ? |
||
908 | device_disconnect dd ? |
||
909 | ends |
||
910 | |||
7136 | dunkaist | 911 | DRV_ENTRY = 1 |
912 | DRV_EXIT = -1 |
||
2288 | clevermous | 913 | |
2384 | hidnplayr | 914 | struct COFF_HEADER |
915 | machine dw ? |
||
916 | nSections dw ? |
||
917 | DataTime dd ? |
||
918 | pSymTable dd ? |
||
919 | nSymbols dd ? |
||
920 | optHeader dw ? |
||
921 | flags dw ? |
||
922 | ends |
||
2288 | clevermous | 923 | |
2384 | hidnplayr | 924 | struct COFF_SECTION |
925 | Name rb 8 |
||
926 | VirtualSize dd ? |
||
927 | VirtualAddress dd ? |
||
928 | SizeOfRawData dd ? |
||
929 | PtrRawData dd ? |
||
930 | PtrReloc dd ? |
||
931 | PtrLinenumbers dd ? |
||
932 | NumReloc dw ? |
||
933 | NumLinenum dw ? |
||
934 | Characteristics dd ? |
||
935 | ends |
||
2288 | clevermous | 936 | |
2384 | hidnplayr | 937 | struct COFF_RELOC |
938 | VirtualAddress dd ? |
||
939 | SymIndex dd ? |
||
940 | Type dw ? |
||
941 | ends |
||
2288 | clevermous | 942 | |
2384 | hidnplayr | 943 | struct COFF_SYM |
944 | Name rb 8 |
||
945 | Value dd ? |
||
946 | SectionNumber dw ? |
||
947 | Type dw ? |
||
948 | StorageClass db ? |
||
949 | NumAuxSymbols db ? |
||
950 | ends |
||
2288 | clevermous | 951 | |
5039 | clevermous | 952 | struct STRIPPED_PE_HEADER |
953 | Signature dw ? |
||
954 | Characteristics dw ? |
||
955 | AddressOfEntryPoint dd ? |
||
956 | ImageBase dd ? |
||
957 | SectionAlignmentLog db ? |
||
958 | FileAlignmentLog db ? |
||
959 | MajorOSVersion db ? |
||
960 | MinorOSVersion db ? |
||
961 | SizeOfImage dd ? |
||
962 | SizeOfStackReserve dd ? |
||
963 | SizeOfHeapReserve dd ? |
||
964 | SizeOfHeaders dd ? |
||
965 | Subsystem db ? |
||
966 | NumberOfRvaAndSizes db ? |
||
967 | NumberOfSections dw ? |
||
968 | ends |
||
969 | STRIPPED_PE_SIGNATURE = 0x4503 ; 'PE' xor 'S' |
||
970 | SPE_DIRECTORY_IMPORT = 0 |
||
971 | SPE_DIRECTORY_EXPORT = 1 |
||
972 | SPE_DIRECTORY_BASERELOC = 2 |
||
973 | |||
2384 | hidnplayr | 974 | struct IOCTL |
975 | handle dd ? |
||
976 | io_code dd ? |
||
977 | input dd ? |
||
978 | inp_size dd ? |
||
979 | output dd ? |
||
980 | out_size dd ? |
||
981 | ends |
||
2288 | clevermous | 982 | |
2384 | hidnplayr | 983 | struct IRQH |
984 | list LHEAD |
||
985 | handler dd ? ;handler roututine |
||
986 | data dd ? ;user-specific data |
||
3506 | clevermous | 987 | num_ints dd ? ;how many times handled |
2414 | Serge | 988 | ends8)|WB |
7122 | dunkaist | 989 |