Rev 4423 | Rev 5565 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4423 | Rev 5201 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; |
2 | ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. |
3 | ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. |
4 | ;; PROGRAMMING: |
4 | ;; PROGRAMMING: |
5 | ;; Ivan Poddubny |
5 | ;; Ivan Poddubny |
6 | ;; Marat Zakiyanov (Mario79) |
6 | ;; Marat Zakiyanov (Mario79) |
7 | ;; VaStaNi |
7 | ;; VaStaNi |
8 | ;; Trans |
8 | ;; Trans |
Line 69... | Line 69... | ||
69 | format binary as "mnt" |
69 | format binary as "mnt" |
Line 70... | Line 70... | ||
70 | 70 | ||
71 | include 'macros.inc' |
71 | include 'macros.inc' |
Line 72... | Line 72... | ||
72 | include 'struct.inc' |
72 | include 'struct.inc' |
Line 73... | Line 73... | ||
73 | 73 | ||
74 | $Revision: 4423 $ |
74 | $Revision: 5201 $ |
Line 289... | Line 289... | ||
289 | call init_mem |
289 | call init_mem |
290 | call init_page_map |
290 | call init_page_map |
Line 291... | Line 291... | ||
291 | 291 | ||
Line 292... | Line 292... | ||
292 | ; ENABLE PAGING |
292 | ; ENABLE PAGING |
293 | 293 | ||
Line 294... | Line 294... | ||
294 | mov eax, sys_pgdir-OS_BASE |
294 | mov eax, sys_proc-OS_BASE+PROC.pdt_0 |
295 | mov cr3, eax |
295 | mov cr3, eax |
296 | 296 | ||
Line 307... | Line 307... | ||
307 | 307 | ||
308 | use16 |
308 | use16 |
309 | org $-0x10000 |
309 | org $-0x10000 |
310 | include "boot/shutdown.inc" ; shutdown or restart |
310 | include "boot/shutdown.inc" ; shutdown or restart |
- | 311 | org $+0x10000 |
|
- | 312 | ||
- | 313 | ap_init16: |
|
- | 314 | cli |
|
- | 315 | lgdt [cs:gdts_ap-ap_init16] |
|
- | 316 | mov eax, [cs:cr3_ap-ap_init16] |
|
- | 317 | mov cr3, eax |
|
- | 318 | mov eax, [cs:cr4_ap-ap_init16] |
|
- | 319 | mov cr4, eax |
|
- | 320 | mov eax, CR0_PE+CR0_PG+CR0_WP |
|
- | 321 | mov cr0, eax |
|
- | 322 | jmp pword os_code:ap_init_high |
|
- | 323 | align 16 |
|
- | 324 | gdts_ap: |
|
- | 325 | dw gdte-gdts-1 |
|
- | 326 | dd gdts |
|
- | 327 | dw 0 |
|
- | 328 | cr3_ap dd ? |
|
- | 329 | cr4_ap dd ? |
|
311 | org $+0x10000 |
330 | ap_init16_size = $ - ap_init16 |
Line 312... | Line 331... | ||
312 | use32 |
331 | use32 |
313 | 332 | ||
314 | __DEBUG__ fix 1 |
333 | __DEBUG__ fix 1 |
Line 333... | Line 352... | ||
333 | mov gs, bx |
352 | mov gs, bx |
Line 334... | Line 353... | ||
334 | 353 | ||
335 | bt [cpu_caps], CAPS_PGE |
354 | bt [cpu_caps], CAPS_PGE |
Line 336... | Line 355... | ||
336 | jnc @F |
355 | jnc @F |
Line 337... | Line 356... | ||
337 | 356 | ||
338 | or dword [sys_pgdir+(OS_BASE shr 20)], PG_GLOBAL |
357 | or dword [sys_proc+PROC.pdt_0+(OS_BASE shr 20)], PG_GLOBAL |
339 | 358 | ||
340 | mov ebx, cr4 |
359 | mov ebx, cr4 |
341 | or ebx, CR4_PGE |
360 | or ebx, CR4_PGE |
342 | mov cr4, ebx |
361 | mov cr4, ebx |
343 | @@: |
362 | @@: |
Line 344... | Line 363... | ||
344 | xor eax, eax |
363 | xor eax, eax |
345 | mov dword [sys_pgdir], eax |
364 | mov dword [sys_proc+PROC.pdt_0], eax |
Line 346... | Line 365... | ||
346 | mov dword [sys_pgdir+4], eax |
365 | mov dword [sys_proc+PROC.pdt_0+4], eax |
Line 367... | Line 386... | ||
367 | call mutex_init |
386 | call mutex_init |
368 | mov ecx, ide_channel1_mutex |
387 | mov ecx, ide_channel1_mutex |
369 | call mutex_init |
388 | call mutex_init |
370 | mov ecx, ide_channel2_mutex |
389 | mov ecx, ide_channel2_mutex |
371 | call mutex_init |
390 | call mutex_init |
- | 391 | mov ecx, ide_channel3_mutex |
|
- | 392 | call mutex_init |
|
- | 393 | mov ecx, ide_channel4_mutex |
|
- | 394 | call mutex_init |
|
- | 395 | mov ecx, ide_channel5_mutex |
|
- | 396 | call mutex_init |
|
- | 397 | mov ecx, ide_channel6_mutex |
|
- | 398 | call mutex_init |
|
372 | ;----------------------------------------------------------------------------- |
399 | ;----------------------------------------------------------------------------- |
373 | ; SAVE REAL MODE VARIABLES |
400 | ; SAVE REAL MODE VARIABLES |
374 | ;----------------------------------------------------------------------------- |
401 | ;----------------------------------------------------------------------------- |
375 | save_variables_IDE_controller: |
- | |
376 | xor eax, eax |
- | |
377 | mov ax, [BOOT_VARS + BOOT_IDE_INTERR_16] |
- | |
378 | mov [IDE_Interrupt], ax |
- | |
379 | ;-------------------------------------- |
- | |
380 | mov ax, [BOOT_VARS + BOOT_IDE_PI_16] |
- | |
381 | mov [IDEContrProgrammingInterface], ax |
- | |
382 | ;-------------------------------------- |
- | |
383 | mov ax, [BOOT_VARS + BOOT_IDE_BASE_ADDR] |
- | |
384 | mov [IDEContrRegsBaseAddr], ax |
- | |
385 | ;-------------------------------------- |
- | |
386 | mov ax, [BOOT_VARS + BOOT_IDE_BAR0_16] |
- | |
387 | cmp ax, 0 |
- | |
388 | je @f |
- | |
389 | cmp ax, 1 |
- | |
390 | jne .no_PATA_BAR0 |
- | |
391 | @@: |
- | |
392 | mov ax, 0x1F0 |
- | |
393 | jmp @f |
- | |
394 | .no_PATA_BAR0: |
- | |
395 | and ax, 0xFFFC |
- | |
396 | @@: |
- | |
397 | mov [StandardATABases], ax |
- | |
398 | mov [hd_address_table], eax |
- | |
399 | mov [hd_address_table+8], eax |
- | |
400 | mov [IDE_BAR0_val], ax |
- | |
401 | ;-------------------------------------- |
- | |
402 | mov ax, [BOOT_VARS + BOOT_IDE_BAR1_16] |
- | |
403 | cmp ax, 0 |
- | |
404 | je @f |
- | |
405 | cmp ax, 1 |
- | |
406 | jne .no_PATA_BAR1 |
- | |
407 | @@: |
- | |
408 | mov ax, 0x3F4 |
- | |
409 | jmp @f |
- | |
410 | .no_PATA_BAR1: |
- | |
411 | and ax, 0xFFFC |
- | |
412 | @@: |
- | |
413 | mov [IDE_BAR1_val], ax |
- | |
414 | ;-------------------------------------- |
- | |
415 | mov ax, [BOOT_VARS + BOOT_IDE_BAR2_16] |
- | |
416 | cmp ax, 0 |
- | |
417 | je @f |
- | |
418 | cmp ax, 1 |
- | |
419 | jne .no_PATA_BAR2 |
- | |
420 | @@: |
- | |
421 | mov ax, 0x170 |
- | |
422 | jmp @f |
- | |
423 | .no_PATA_BAR2: |
- | |
424 | and ax, 0xFFFC |
- | |
425 | @@: |
- | |
426 | mov [StandardATABases+2], ax |
- | |
427 | mov [hd_address_table+16], eax |
- | |
428 | mov [hd_address_table+24], eax |
- | |
429 | mov [IDE_BAR2_val], ax |
- | |
430 | ;-------------------------------------- |
- | |
431 | mov ax, [BOOT_VARS + BOOT_IDE_BAR3_16] |
- | |
432 | cmp ax, 0 |
- | |
433 | je @f |
- | |
434 | cmp ax, 1 |
- | |
435 | jne .no_PATA_BAR3 |
- | |
436 | @@: |
- | |
437 | mov ax, 0x374 |
- | |
438 | jmp @f |
- | |
439 | .no_PATA_BAR3: |
- | |
440 | and ax, 0xFFFC |
- | |
441 | @@: |
- | |
442 | mov [IDE_BAR3_val], ax |
- | |
443 | - | ||
444 | ; --------------- APM --------------------- |
402 | ; --------------- APM --------------------- |
Line 445... | Line 403... | ||
445 | 403 | ||
446 | ; init selectors |
404 | ; init selectors |
447 | mov ebx, [BOOT_VARS+BOOT_APM_ENTRY] ; offset of APM entry point |
405 | mov ebx, [BOOT_VARS+BOOT_APM_ENTRY] ; offset of APM entry point |
Line 474... | Line 432... | ||
474 | mov [apm_vf], eax |
432 | mov [apm_vf], eax |
475 | ; ----------------------------------------- |
433 | ; ----------------------------------------- |
476 | mov al, [BOOT_VARS+BOOT_DMA] ; DMA access |
434 | mov al, [BOOT_VARS+BOOT_DMA] ; DMA access |
477 | mov [allow_dma_access], al |
435 | mov [allow_dma_access], al |
478 | movzx eax, byte [BOOT_VARS+BOOT_BPP] ; bpp |
436 | movzx eax, byte [BOOT_VARS+BOOT_BPP] ; bpp |
479 | mov [_display.bpp], eax |
437 | mov [_display.bits_per_pixel], eax |
480 | mov [_display.vrefresh], 60 |
438 | mov [_display.vrefresh], 60 |
481 | mov al, [BOOT_VARS+BOOT_DEBUG_PRINT] ; If nonzero, duplicates debug output to the screen |
439 | mov al, [BOOT_VARS+BOOT_DEBUG_PRINT] ; If nonzero, duplicates debug output to the screen |
482 | mov [debug_direct_print], al |
440 | mov [debug_direct_print], al |
483 | mov al, [BOOT_VARS+BOOT_LAUNCHER_START] ; Start the first app (LAUNCHER) after kernel is loaded? |
441 | mov al, [BOOT_VARS+BOOT_LAUNCHER_START] ; Start the first app (LAUNCHER) after kernel is loaded? |
484 | mov [launcher_start], al |
442 | mov [launcher_start], al |
485 | movzx eax, word [BOOT_VARS+BOOT_X_RES]; X max |
443 | movzx eax, word [BOOT_VARS+BOOT_X_RES]; X max |
486 | mov [_display.width], eax |
444 | mov [_display.width], eax |
487 | mov [display_width_standard], eax |
445 | mov [display_width_standard], eax |
488 | dec eax |
446 | dec eax |
- | 447 | mov [Screen_Max_X], eax |
|
489 | mov [screen_workarea.right], eax |
448 | mov [screen_workarea.right], eax |
490 | movzx eax, word [BOOT_VARS+BOOT_Y_RES]; Y max |
449 | movzx eax, word [BOOT_VARS+BOOT_Y_RES]; Y max |
491 | mov [_display.height], eax |
450 | mov [_display.height], eax |
492 | mov [display_height_standard], eax |
451 | mov [display_height_standard], eax |
493 | dec eax |
452 | dec eax |
- | 453 | mov [Screen_Max_Y], eax |
|
494 | mov [screen_workarea.bottom], eax |
454 | mov [screen_workarea.bottom], eax |
495 | movzx eax, word [BOOT_VARS+BOOT_VESA_MODE] ; screen mode |
455 | movzx eax, word [BOOT_VARS+BOOT_VESA_MODE] ; screen mode |
496 | mov dword [SCR_MODE], eax |
456 | mov dword [SCR_MODE], eax |
497 | ; mov eax, [BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add |
457 | ; mov eax, [BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add |
498 | ; mov [BANK_SWITCH], eax |
458 | ; mov [BANK_SWITCH], eax |
Line 518... | Line 478... | ||
518 | movzx ecx, byte [esi-1] |
478 | movzx ecx, byte [esi-1] |
519 | mov [NumBiosDisks], ecx |
479 | mov [NumBiosDisks], ecx |
520 | mov edi, BiosDisksData |
480 | mov edi, BiosDisksData |
521 | rep movsd |
481 | rep movsd |
Line 522... | Line 482... | ||
522 | 482 | ||
Line 523... | Line 483... | ||
523 | ; GRAPHICS ADDRESSES |
483 | setvideomode: |
524 | 484 | ||
Line 525... | Line 485... | ||
525 | mov eax, [BOOT_VARS+BOOT_LFB] |
485 | mov eax, [BOOT_VARS+BOOT_LFB] |
526 | mov [LFBAddress], eax |
486 | mov [LFBAddress], eax |
527 | 487 | ||
- | 488 | cmp word [SCR_MODE], 0x0012 ; VGA (640x480 16 colors) |
|
- | 489 | je .vga |
|
- | 490 | cmp word [SCR_MODE], 0x0013 ; MCGA (320*200 256 colors) |
|
- | 491 | je .32bpp |
|
528 | cmp [SCR_MODE], word 0100000000000000b |
492 | cmp byte [_display.bits_per_pixel], 32 |
- | 493 | je .32bpp |
|
- | 494 | cmp byte [_display.bits_per_pixel], 24 |
|
- | 495 | je .24bpp |
|
- | 496 | cmp byte [_display.bits_per_pixel], 16 |
|
- | 497 | je .16bpp |
|
- | 498 | ; cmp byte [_display.bits_per_pixel], 15 |
|
- | 499 | ; je .15bpp |
|
- | 500 | ||
- | 501 | .vga: |
|
529 | jge setvesa20 |
502 | mov [PUTPIXEL], VGA_putpixel |
530 | cmp [SCR_MODE], word 0x13 ; EGA 320*200 256 colors |
503 | mov [GETPIXEL], Vesa20_getpixel32 ; Conversion buffer is 32 bpp |
531 | je v20ga32 |
504 | mov [_display.bytes_per_pixel], 4 ; Conversion buffer is 32 bpp |
532 | jmp v20ga24 |
505 | jmp .finish |
533 | 506 | ||
534 | setvesa20: |
507 | ; .15bpp: |
535 | mov [PUTPIXEL], dword Vesa20_putpixel24 ; Vesa 2.0 |
508 | ; mov [PUTPIXEL], Vesa20_putpixel15 |
- | 509 | ; mov [GETPIXEL], Vesa20_getpixel15 |
|
536 | mov [GETPIXEL], dword Vesa20_getpixel24 |
510 | ; mov [_display.bytes_per_pixel], 2 |
537 | cmp byte [_display.bpp], 24 |
511 | ; jmp .finish |
538 | jz v20ga24 |
512 | |
- | 513 | .16bpp: |
|
539 | v20ga32: |
514 | mov [PUTPIXEL], Vesa20_putpixel16 |
- | 515 | mov [GETPIXEL], Vesa20_getpixel16 |
|
540 | mov [PUTPIXEL], dword Vesa20_putpixel32 |
516 | mov [_display.bytes_per_pixel], 2 |
- | 517 | jmp .finish |
|
541 | mov [GETPIXEL], dword Vesa20_getpixel32 |
518 | |
- | 519 | .24bpp: |
|
542 | jmp no_mode_0x12 |
520 | mov [PUTPIXEL], Vesa20_putpixel24 |
- | 521 | mov [GETPIXEL], Vesa20_getpixel24 |
|
- | 522 | mov [_display.bytes_per_pixel], 3 |
|
543 | v20ga24: |
523 | jmp .finish |
544 | cmp [SCR_MODE], word 0x12 ; 16 C VGA 640x480 |
524 | |
- | 525 | .32bpp: |
|
545 | jne no_mode_0x12 |
526 | mov [PUTPIXEL], Vesa20_putpixel32 |
Line -... | Line 527... | ||
- | 527 | mov [GETPIXEL], Vesa20_getpixel32 |
|
546 | mov [PUTPIXEL], dword VGA_putpixel |
528 | mov [_display.bytes_per_pixel], 4 |
547 | mov [GETPIXEL], dword Vesa20_getpixel32 |
529 | ; jmp .finish |
548 | no_mode_0x12: |
530 | |
Line 549... | Line 531... | ||
549 | 531 | .finish: |
|
550 | mov [MOUSE_PICTURE], dword mousepointer |
532 | mov [MOUSE_PICTURE], mousepointer |
Line 635... | Line 617... | ||
635 | mov [LFBSize], 0xC00000 |
617 | mov [LFBSize], 0xC00000 |
636 | call init_LFB |
618 | call init_LFB |
637 | call init_fpu |
619 | call init_fpu |
638 | call init_malloc |
620 | call init_malloc |
Line 639... | Line 621... | ||
639 | 621 | ||
640 | stdcall alloc_kernel_space, 0x51000 |
622 | stdcall alloc_kernel_space, 0x50000 ; FIXME check size |
Line 641... | Line 623... | ||
641 | mov [default_io_map], eax |
623 | mov [default_io_map], eax |
642 | 624 | ||
643 | add eax, 0x2000 |
625 | add eax, 0x2000 |
Line 652... | Line 634... | ||
652 | 634 | ||
653 | add eax, ebx |
635 | add eax, ebx |
Line 654... | Line 636... | ||
654 | mov [proc_mem_tab], eax |
636 | mov [proc_mem_tab], eax |
655 | - | ||
656 | add eax, ebx |
- | |
657 | mov [tmp_task_pdir], eax |
- | |
658 | 637 | ||
Line 659... | Line 638... | ||
659 | add eax, ebx |
638 | add eax, ebx |
660 | mov [tmp_task_ptab], eax |
639 | mov [tmp_task_ptab], eax |
Line 712... | Line 691... | ||
712 | ; SET UP OS TASK |
691 | ; SET UP OS TASK |
Line 713... | Line 692... | ||
713 | 692 | ||
714 | mov esi, boot_setostask |
693 | mov esi, boot_setostask |
Line -... | Line 694... | ||
- | 694 | call boot_log |
|
- | 695 | ||
- | 696 | mov edi, sys_proc |
|
- | 697 | list_init edi |
|
- | 698 | lea ecx, [edi+PROC.thr_list] |
|
- | 699 | list_init ecx |
|
- | 700 | mov [edi+PROC.pdt_0_phys], sys_proc-OS_BASE+PROC.pdt_0 |
|
- | 701 | ||
- | 702 | mov eax, -1 |
|
- | 703 | mov edi, thr_slot_map+4 |
|
- | 704 | mov [edi-4], dword 0xFFFFFFF8 |
|
- | 705 | stosd |
|
- | 706 | stosd |
|
- | 707 | stosd |
|
- | 708 | stosd |
|
- | 709 | stosd |
|
- | 710 | stosd |
|
- | 711 | stosd |
|
- | 712 | ||
715 | call boot_log |
713 | mov [current_process], sys_proc |
716 | 714 | ||
717 | mov edx, SLOT_BASE+256 |
715 | mov edx, SLOT_BASE+256*1 |
718 | mov ebx, [os_stack_seg] |
716 | mov ebx, [os_stack_seg] |
719 | add ebx, 0x2000 |
717 | add ebx, 0x2000 |
720 | call setup_os_slot |
718 | call setup_os_slot |
Line 735... | Line 733... | ||
735 | mov dword [CURRENT_TASK], 2 |
733 | mov dword [CURRENT_TASK], 2 |
736 | mov dword [TASK_COUNT], 2 |
734 | mov dword [TASK_COUNT], 2 |
737 | mov dword [current_slot], SLOT_BASE + 256*2 |
735 | mov dword [current_slot], SLOT_BASE + 256*2 |
738 | mov dword [TASK_BASE], CURRENT_TASK + 32*2 |
736 | mov dword [TASK_BASE], CURRENT_TASK + 32*2 |
Line -... | Line 737... | ||
- | 737 | ||
- | 738 | ; Move other CPUs to deep sleep, if it is useful |
|
- | 739 | uglobal |
|
- | 740 | use_mwait_for_idle db 0 |
|
- | 741 | endg |
|
- | 742 | cmp [cpu_vendor+8], 'ntel' |
|
- | 743 | jnz .no_wake_cpus |
|
- | 744 | bt [cpu_caps+4], CAPS_MONITOR-32 |
|
- | 745 | jnc .no_wake_cpus |
|
- | 746 | dbgstr 'using mwait for idle loop' |
|
- | 747 | inc [use_mwait_for_idle] |
|
- | 748 | mov ebx, [cpu_count] |
|
- | 749 | cmp ebx, 1 |
|
- | 750 | jbe .no_wake_cpus |
|
- | 751 | call create_trampoline_pgmap |
|
- | 752 | mov [cr3_ap+OS_BASE], eax |
|
- | 753 | mov eax, cr4 |
|
- | 754 | mov [cr4_ap+OS_BASE], eax |
|
- | 755 | mov esi, OS_BASE + ap_init16 |
|
- | 756 | mov edi, OS_BASE + 8000h |
|
- | 757 | mov ecx, (ap_init16_size + 3) / 4 |
|
- | 758 | rep movsd |
|
- | 759 | stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SW+PG_NOCACHE |
|
- | 760 | mov [LAPIC_BASE], eax |
|
- | 761 | lea edi, [eax+300h] |
|
- | 762 | mov esi, smpt+4 |
|
- | 763 | dec ebx |
|
- | 764 | .wake_cpus_loop: |
|
- | 765 | lodsd |
|
- | 766 | push esi |
|
- | 767 | xor esi, esi |
|
- | 768 | inc esi |
|
- | 769 | shl eax, 24 |
|
- | 770 | mov [edi+10h], eax |
|
- | 771 | ; assert INIT IPI |
|
- | 772 | mov dword [edi], 0C500h |
|
- | 773 | call delay_ms |
|
- | 774 | @@: |
|
- | 775 | test dword [edi], 1000h |
|
- | 776 | jnz @b |
|
- | 777 | ; deassert INIT IPI |
|
- | 778 | mov dword [edi], 8500h |
|
- | 779 | call delay_ms |
|
- | 780 | @@: |
|
- | 781 | test dword [edi], 1000h |
|
- | 782 | jnz @b |
|
- | 783 | ; send STARTUP IPI |
|
- | 784 | mov dword [edi], 600h + (8000h shr 12) |
|
- | 785 | call delay_ms |
|
- | 786 | @@: |
|
- | 787 | test dword [edi], 1000h |
|
- | 788 | jnz @b |
|
- | 789 | pop esi |
|
- | 790 | dec ebx |
|
- | 791 | jnz .wake_cpus_loop |
|
- | 792 | mov eax, [cpu_count] |
|
- | 793 | dec eax |
|
- | 794 | @@: |
|
- | 795 | cmp [ap_initialized], eax |
|
- | 796 | jnz @b |
|
- | 797 | mov eax, [cr3_ap+OS_BASE] |
|
- | 798 | call free_page |
|
- | 799 | .no_wake_cpus: |
|
Line 739... | Line 800... | ||
739 | 800 | ||
740 | 801 | ||
741 | ; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f |
802 | ; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f |
742 | mov esi, boot_initirq |
803 | mov esi, boot_initirq |
Line 756... | Line 817... | ||
756 | call boot_log |
817 | call boot_log |
757 | ; Initialize system timer (IRQ0) |
818 | ; Initialize system timer (IRQ0) |
758 | call PIT_init |
819 | call PIT_init |
Line 759... | Line 820... | ||
759 | 820 | ||
760 | ; Register ramdisk file system |
821 | ; Register ramdisk file system |
761 | mov esi, boot_initramdisk |
822 | cmp [boot_dev+OS_BASE+0x10000], 1 |
762 | call boot_log |
- | |
Line -... | Line 823... | ||
- | 823 | je @f |
|
- | 824 | ||
- | 825 | call register_ramdisk |
|
763 | call ramdisk_init |
826 | ;-------------------------------------- |
764 | 827 | @@: |
|
765 | mov esi, boot_initapic |
828 | mov esi, boot_initapic |
766 | call boot_log |
829 | call boot_log |
Line 773... | Line 836... | ||
773 | ; they are used: when partitions are scanned, hd_read relies on timer |
836 | ; they are used: when partitions are scanned, hd_read relies on timer |
774 | call unmask_timer |
837 | call unmask_timer |
775 | stdcall enable_irq, 2 ; @#$%! PIC |
838 | stdcall enable_irq, 2 ; @#$%! PIC |
776 | stdcall enable_irq, 13 ; co-processor |
839 | stdcall enable_irq, 13 ; co-processor |
Line 777... | Line 840... | ||
777 | 840 | ||
778 | cmp [IDEContrProgrammingInterface], 0 |
841 | ; Setup serial output console (if enabled) |
Line 779... | Line 842... | ||
779 | je @f |
842 | if defined debug_com_base |
780 | 843 | ||
781 | mov esi, boot_disabling_ide |
- | |
782 | call boot_log |
844 | ; reserve port so nobody else will use it |
783 | ;-------------------------------------- |
845 | xor ebx, ebx |
784 | ; Disable IDE interrupts, because the search |
- | |
785 | ; for IDE partitions is in the PIO mode. |
846 | mov ecx, debug_com_base |
786 | ;-------------------------------------- |
- | |
- | 847 | mov edx, debug_com_base+7 |
|
787 | .disable_IDE_interrupt: |
848 | call r_f_port_area |
788 | ; Disable interrupts in IDE controller for PIO |
849 | |
789 | mov al, 2 |
850 | ; enable Divisor latch |
790 | mov dx, [IDE_BAR1_val] ;0x3F4 |
851 | mov dx, debug_com_base+3 |
- | 852 | mov al, 1 shl 7 |
|
- | 853 | out dx, al |
|
791 | add dx, 2 ;0x3F6 |
854 | |
792 | out dx, al |
855 | ; Set speed to 115200 baud (max speed) |
793 | mov dx, [IDE_BAR3_val] ;0x374 |
856 | mov dx, debug_com_base |
794 | add dx, 2 ;0x376 |
- | |
795 | out dx, al |
- | |
796 | @@: |
- | |
797 | ;----------------------------------------------------------------------------- |
- | |
798 | ;!!!!!!!!!!!!!!!!!!!!!!!!!! |
- | |
799 | ; mov esi, boot_detectdisks |
- | |
800 | ; call boot_log |
- | |
801 | ;include 'detect/disks.inc' |
- | |
802 | mov esi, boot_detectfloppy |
- | |
803 | call boot_log |
- | |
804 | include 'detect/dev_fd.inc' |
- | |
805 | mov esi, boot_detecthdcd |
- | |
806 | call boot_log |
- | |
807 | include 'detect/dev_hdcd.inc' |
- | |
808 | mov esi, boot_getcache |
- | |
809 | call boot_log |
- | |
810 | include 'detect/getcache.inc' |
- | |
811 | mov esi, boot_detectpart |
- | |
812 | call boot_log |
- | |
Line 813... | Line 857... | ||
813 | include 'detect/sear_par.inc' |
857 | mov al, 0x01 |
814 | ;!!!!!!!!!!!!!!!!!!!!!!!!!! |
858 | out dx, al |
815 | 859 | ||
Line -... | Line 860... | ||
- | 860 | mov dx, debug_com_base+1 |
|
816 | mov esi, boot_init_sys |
861 | mov al, 0x00 |
- | 862 | out dx, al |
|
- | 863 | ||
- | 864 | ; No parity, 8bits words, one stop bit, dlab bit back to 0 |
|
- | 865 | mov dx, debug_com_base+3 |
|
- | 866 | mov al, 3 |
|
- | 867 | out dx, al |
|
- | 868 | ||
- | 869 | ; disable interrupts |
|
817 | call boot_log |
870 | mov dx, debug_com_base+1 |
- | 871 | mov al, 0 |
|
- | 872 | out dx, al |
|
818 | call Parser_params |
873 | |
Line 819... | Line -... | ||
819 | - | ||
820 | if ~ defined extended_primary_loader |
- | |
821 | ; ramdisk image should be loaded by extended primary loader if it exists |
- | |
822 | ; READ RAMDISK IMAGE FROM HD |
874 | ; clear + enable fifo (64 bits) |
823 | - | ||
Line -... | Line 875... | ||
- | 875 | mov dx, debug_com_base+2 |
|
- | 876 | mov al, 0x7 + 1 shl 5 |
|
- | 877 | out dx, al |
|
- | 878 | ||
- | 879 | end if |
|
- | 880 | ||
- | 881 | ||
- | 882 | ;----------------------------------------------------------------------------- |
|
- | 883 | ; show SVN version of kernel on the message board |
|
- | 884 | ;----------------------------------------------------------------------------- |
|
- | 885 | mov eax, [version_inf.rev] |
|
- | 886 | DEBUGF 1, "K : kernel SVN r%d\n", eax |
|
- | 887 | ;----------------------------------------------------------------------------- |
|
- | 888 | ; show CPU count on the message board |
|
- | 889 | ;----------------------------------------------------------------------------- |
|
- | 890 | mov eax, [cpu_count] |
|
- | 891 | test eax, eax |
|
- | 892 | jnz @F |
|
- | 893 | mov al, 1 ; at least one CPU |
|
- | 894 | @@: |
|
- | 895 | DEBUGF 1, "K : %d CPU detected\n", eax |
|
- | 896 | ;----------------------------------------------------------------------------- |
|
- | 897 | ; detect Floppy drives |
|
- | 898 | ;----------------------------------------------------------------------------- |
|
- | 899 | mov esi, boot_detectfloppy |
|
- | 900 | call boot_log |
|
- | 901 | include 'detect/dev_fd.inc' |
|
- | 902 | ;----------------------------------------------------------------------------- |
|
- | 903 | ; create pci-devices list |
|
- | 904 | ;----------------------------------------------------------------------------- |
|
- | 905 | mov [pci_access_enabled], 1 |
|
824 | ;!!!!!!!!!!!!!!!!!!!!!!! |
906 | call pci_enum |
825 | include 'boot/rdload.inc' |
907 | ;----------------------------------------------------------------------------- |
826 | ;!!!!!!!!!!!!!!!!!!!!!!! |
908 | ; initialisation IDE ATA code |
827 | end if |
909 | ;----------------------------------------------------------------------------- |
Line 875... | Line 957... | ||
875 | ; call build_scheduler; sys32.inc |
957 | ; call build_scheduler; sys32.inc |
Line 876... | Line 958... | ||
876 | 958 | ||
877 | ; mov esi, boot_devices |
959 | ; mov esi, boot_devices |
Line 878... | Line 960... | ||
878 | ; call boot_log |
960 | ; call boot_log |
- | 961 | ||
879 | 962 | call clear_pci_ide_interrupts |
|
Line 880... | Line 963... | ||
880 | mov [pci_access_enabled], 1 |
963 | |
Line 881... | Line 964... | ||
881 | call pci_enum |
964 | include "detect/vortex86.inc" ; Vortex86 SoC detection code |
Line 882... | Line 965... | ||
882 | 965 | ||
Line 917... | Line 1000... | ||
917 | rdtsc |
1000 | rdtsc |
918 | mov ecx, eax |
1001 | mov ecx, eax |
919 | mov esi, 250 ; wait 1/4 a second |
1002 | mov esi, 250 ; wait 1/4 a second |
920 | call delay_ms |
1003 | call delay_ms |
921 | rdtsc |
1004 | rdtsc |
- | 1005 | sti |
|
Line 922... | Line 1006... | ||
922 | 1006 | ||
923 | sub eax, ecx |
1007 | sub eax, ecx |
924 | xor edx, edx |
1008 | xor edx, edx |
925 | shld edx, eax, 2 |
1009 | shld edx, eax, 2 |
Line 984... | Line 1068... | ||
984 | stdcall map_page, tss._io_map_0, \ |
1068 | stdcall map_page, tss._io_map_0, \ |
985 | [SLOT_BASE+256+APPDATA.io_map], PG_MAP |
1069 | [SLOT_BASE+256+APPDATA.io_map], PG_MAP |
986 | stdcall map_page, tss._io_map_1, \ |
1070 | stdcall map_page, tss._io_map_1, \ |
987 | [SLOT_BASE+256+APPDATA.io_map+4], PG_MAP |
1071 | [SLOT_BASE+256+APPDATA.io_map+4], PG_MAP |
Line 988... | Line -... | ||
988 | - | ||
989 | ; LOAD FIRST APPLICATION |
- | |
990 | cmp byte [launcher_start], 1 ; Check if starting LAUNCHER is selected on blue screen (1 = yes) |
- | |
991 | jnz first_app_found |
- | |
992 | - | ||
993 | cli |
- | |
994 | mov ebp, firstapp |
- | |
995 | call fs_execute_from_sysdir |
- | |
996 | test eax, eax |
- | |
997 | jns first_app_found |
- | |
998 | - | ||
999 | mov esi, boot_failed |
- | |
1000 | call boot_log |
- | |
1001 | - | ||
1002 | mov eax, 0xDEADBEEF ; otherwise halt |
- | |
1003 | hlt |
- | |
1004 | - | ||
1005 | first_app_found: |
- | |
1006 | - | ||
1007 | cli |
- | |
1008 | 1072 | ||
1009 | ; SET KEYBOARD PARAMETERS |
1073 | ; SET KEYBOARD PARAMETERS |
1010 | mov al, 0xf6 ; reset keyboard, scan enabled |
1074 | mov al, 0xf6 ; reset keyboard, scan enabled |
1011 | call kb_write |
1075 | call kb_write_wait_ack |
1012 | test ah, ah |
1076 | test ah, ah |
Line 1013... | Line -... | ||
1013 | jnz .no_keyboard |
- | |
1014 | - | ||
1015 | ; wait until 8042 is ready |
- | |
1016 | xor ecx, ecx |
- | |
1017 | @@: |
- | |
1018 | in al, 64h |
- | |
1019 | and al, 00000010b |
- | |
1020 | loopnz @b |
1077 | jnz .no_keyboard |
1021 | 1078 | ||
1022 | iglobal |
1079 | iglobal |
1023 | align 4 |
1080 | align 4 |
1024 | ps2_keyboard_functions: |
1081 | ps2_keyboard_functions: |
1025 | dd .end - $ |
1082 | dd .end - $ |
1026 | dd 0 ; no close |
1083 | dd 0 ; no close |
1027 | dd ps2_set_lights |
1084 | dd ps2_set_lights |
1028 | .end: |
1085 | .end: |
1029 | endg |
1086 | endg |
1030 | stdcall register_keyboard, ps2_keyboard_functions, 0 |
1087 | stdcall register_keyboard, ps2_keyboard_functions, 0 |
1031 | ; mov al, 0xED ; Keyboard LEDs - only for testing! |
- | |
1032 | ; call kb_write |
1088 | ; mov al, 0xED ; Keyboard LEDs - only for testing! |
1033 | ; call kb_read |
1089 | ; call kb_write_wait_ack |
1034 | ; mov al, 111b |
- | |
Line 1035... | Line 1090... | ||
1035 | ; call kb_write |
1090 | ; mov al, 111b |
1036 | ; call kb_read |
1091 | ; call kb_write_wait_ack |
1037 | - | ||
1038 | mov al, 0xF3 ; set repeat rate & delay |
1092 | |
1039 | call kb_write |
1093 | mov al, 0xF3 ; set repeat rate & delay |
1040 | ; call kb_read |
- | |
1041 | mov al, 0; 30 250 ;00100010b ; 24 500 ;00100100b ; 20 500 |
1094 | call kb_write_wait_ack |
1042 | call kb_write |
1095 | mov al, 0; 30 250 ;00100010b ; 24 500 ;00100100b ; 20 500 |
1043 | ; call kb_read |
1096 | call kb_write_wait_ack |
1044 | ;// mike.dld [ |
1097 | ;// mike.dld [ |
1045 | call set_lights |
1098 | call set_lights |
1046 | ;// mike.dld ] |
1099 | ;// mike.dld ] |
Line 1047... | Line 1100... | ||
1047 | stdcall attach_int_handler, 1, irq1, 0 |
1100 | stdcall attach_int_handler, 1, irq1, 0 |
Line 1048... | Line 1101... | ||
1048 | DEBUGF 1, "K : IRQ1 error code %x\n", eax |
1101 | DEBUGF 1, "K : IRQ1 return code %x\n", eax |
1049 | .no_keyboard: |
- | |
Line 1050... | Line 1102... | ||
1050 | 1102 | .no_keyboard: |
|
1051 | ; SET MOUSE |
1103 | |
1052 | 1104 | ; Load PS/2 mouse driver |
|
Line 1053... | Line -... | ||
1053 | stdcall load_driver, szPS2MDriver |
- | |
1054 | ; stdcall load_driver, szCOM_MDriver |
- | |
1055 | - | ||
1056 | mov esi, boot_setmouse |
- | |
1057 | call boot_log |
- | |
1058 | call setmouse |
- | |
1059 | - | ||
1060 | ; Setup serial output console (if enabled) |
- | |
1061 | - | ||
1062 | if defined debug_com_base |
- | |
1063 | - | ||
1064 | ; enable Divisor latch |
- | |
1065 | - | ||
1066 | mov dx, debug_com_base+3 |
- | |
1067 | mov al, 1 shl 7 |
- | |
1068 | out dx, al |
- | |
1069 | - | ||
1070 | ; Set speed to 115200 baud (max speed) |
1105 | |
1071 | - | ||
1072 | mov dx, debug_com_base |
- | |
1073 | mov al, 0x01 |
1106 | stdcall load_pe_driver, szPS2MDriver, 0 |
1074 | out dx, al |
- | |
1075 | - | ||
1076 | mov dx, debug_com_base+1 |
- | |
1077 | mov al, 0x00 |
- | |
1078 | out dx, al |
- | |
1079 | - | ||
1080 | ; No parity, 8bits words, one stop bit, dlab bit back to 0 |
- | |
1081 | - | ||
1082 | mov dx, debug_com_base+3 |
- | |
1083 | mov al, 3 |
- | |
1084 | out dx, al |
- | |
1085 | - | ||
1086 | ; disable interrupts |
- | |
1087 | - | ||
1088 | mov dx, debug_com_base+1 |
1107 | |
1089 | mov al, 0 |
- | |
1090 | out dx, al |
- | |
1091 | - | ||
1092 | ; clear + enable fifo (64 bits) |
- | |
1093 | - | ||
1094 | mov dx, debug_com_base+2 |
- | |
Line -... | Line 1108... | ||
- | 1108 | mov esi, boot_setmouse |
|
1095 | mov al, 0x7 + 1 shl 5 |
1109 | call boot_log |
- | 1110 | call setmouse |
|
1096 | out dx, al |
1111 | |
1097 | 1112 | ; LOAD FIRST APPLICATION |
|
1098 | - | ||
1099 | end if |
- | |
1100 | mov eax, [version_inf.rev] |
- | |
Line 1101... | Line 1113... | ||
1101 | DEBUGF 1, "K : kernel SVN r%d\n", eax |
1113 | cmp byte [launcher_start], 1 ; Check if starting LAUNCHER is selected on blue screen (1 = yes) |
- | 1114 | jnz first_app_found |
|
Line 1102... | Line -... | ||
1102 | - | ||
1103 | mov eax, [cpu_count] |
1115 | |
1104 | test eax, eax |
1116 | cli |
- | 1117 | mov ebp, firstapp |
|
1105 | jnz @F |
1118 | call fs_execute_from_sysdir |
1106 | mov al, 1 ; at least one CPU |
- | |
1107 | @@: |
- | |
1108 | DEBUGF 1, "K : %d CPU detected\n", eax |
- | |
Line 1109... | Line 1119... | ||
1109 | 1119 | test eax, eax |
|
Line 1110... | Line 1120... | ||
1110 | include "detect/vortex86.inc" ; Vortex86 SoC detection code |
1120 | jns first_app_found |
1111 | 1121 | ||
Line 1127... | Line 1137... | ||
1127 | in al, 0x60 ; wait for ESC key press |
1137 | in al, 0x60 ; wait for ESC key press |
1128 | cmp al, 129 |
1138 | cmp al, 129 |
1129 | jne .bll1 |
1139 | jne .bll1 |
1130 | end if |
1140 | end if |
Line 1131... | Line -... | ||
1131 | - | ||
1132 | push eax edx |
- | |
1133 | mov dx, [IDEContrRegsBaseAddr] |
- | |
1134 | xor eax, eax |
- | |
1135 | add dx, 2 |
- | |
1136 | in al, dx |
- | |
1137 | DEBUGF 1, "K : Primary Bus Master IDE Status Register %x\n", eax |
- | |
1138 | - | ||
1139 | add dx, 8 |
- | |
1140 | in al, dx |
- | |
1141 | DEBUGF 1, "K : Secondary Bus Master IDE Status Register %x\n", eax |
- | |
1142 | pop edx eax |
- | |
1143 | - | ||
1144 | cmp [IDEContrRegsBaseAddr], 0 |
- | |
1145 | setnz [dma_hdd] |
- | |
1146 | - | ||
1147 | cmp [IDEContrProgrammingInterface], 0 |
- | |
1148 | je set_interrupts_for_IDE_controllers.continue |
- | |
1149 | - | ||
1150 | mov ax, [IDE_Interrupt] |
- | |
1151 | cmp al, 0xff |
- | |
1152 | jne @f |
- | |
1153 | - | ||
1154 | mov [dma_hdd], 0 |
- | |
1155 | jmp set_interrupts_for_IDE_controllers.end_set_interrupts |
- | |
1156 | @@: |
- | |
1157 | ;----------------------------------------------------------------------------- |
- | |
1158 | ; set interrupts for IDE Controller |
- | |
1159 | ;----------------------------------------------------------------------------- |
- | |
1160 | mov esi, boot_set_int_IDE |
- | |
1161 | call boot_log |
- | |
1162 | set_interrupts_for_IDE_controllers: |
- | |
1163 | mov ax, [IDEContrProgrammingInterface] |
- | |
1164 | cmp ax, 0x0180 |
- | |
1165 | je .pata_ide |
- | |
1166 | - | ||
1167 | cmp ax, 0x018a |
- | |
1168 | jne .sata_ide |
- | |
1169 | ;-------------------------------------- |
- | |
1170 | .pata_ide: |
- | |
1171 | cmp [IDEContrRegsBaseAddr], 0 |
- | |
1172 | je .end_set_interrupts |
- | |
1173 | - | ||
1174 | stdcall attach_int_handler, 14, IDE_irq_14_handler, 0 |
- | |
1175 | DEBUGF 1, "K : Set IDE IRQ14 return code %x\n", eax |
- | |
1176 | stdcall attach_int_handler, 15, IDE_irq_15_handler, 0 |
- | |
1177 | DEBUGF 1, "K : Set IDE IRQ15 return code %x\n", eax |
- | |
1178 | jmp .enable_IDE_interrupt |
- | |
1179 | ;-------------------------------------- |
- | |
1180 | .sata_ide: |
- | |
1181 | cmp ax, 0x0185 |
- | |
1182 | je .sata_ide_1 |
- | |
1183 | - | ||
1184 | cmp ax, 0x018f |
- | |
1185 | jne .end_set_interrupts |
- | |
1186 | ;-------------------------------------- |
- | |
1187 | .sata_ide_1: |
- | |
1188 | cmp [IDEContrRegsBaseAddr], 0 |
- | |
1189 | je .end_set_interrupts |
- | |
1190 | - | ||
1191 | mov ax, [IDE_Interrupt] |
- | |
1192 | movzx eax, al |
- | |
1193 | stdcall attach_int_handler, eax, IDE_common_irq_handler, 0 |
- | |
1194 | DEBUGF 1, "K : Set IDE IRQ%d return code %x\n", [IDE_Interrupt]:1, eax |
- | |
1195 | ;-------------------------------------- |
- | |
1196 | .enable_IDE_interrupt: |
- | |
1197 | mov esi, boot_enabling_ide |
- | |
1198 | call boot_log |
- | |
1199 | ; Enable interrupts in IDE controller for DMA |
- | |
1200 | mov al, 0 |
- | |
1201 | mov dx, [IDE_BAR1_val] ;0x3F4 |
- | |
1202 | add dx, 2 ;0x3F6 |
- | |
1203 | out dx, al |
- | |
1204 | mov dx, [IDE_BAR3_val] ;0x374 |
- | |
1205 | add dx, 2 ;0x376 |
- | |
1206 | out dx, al |
- | |
1207 | ;-------------------------------------- |
- | |
1208 | .end_set_interrupts: |
- | |
1209 | ;----------------------------------------------------------------------------- |
- | |
1210 | cmp [dma_hdd], 0 |
- | |
1211 | je .print_pio |
- | |
1212 | .print_dma: |
- | |
1213 | DEBUGF 1, "K : IDE DMA mode\n" |
- | |
1214 | jmp .continue |
- | |
1215 | - | ||
1216 | .print_pio: |
- | |
1217 | DEBUGF 1, "K : IDE PIO mode\n" |
- | |
1218 | .continue: |
- | |
1219 | 1141 | ||
Line 1220... | Line 1142... | ||
1220 | mov [timer_ticks_enable], 1 ; for cd driver |
1142 | mov [timer_ticks_enable], 1 ; for cd driver |
- | 1143 | ||
1221 | 1144 | sti |
|
Line 1222... | Line 1145... | ||
1222 | sti |
1145 | |
Line 1223... | Line 1146... | ||
1223 | ; call change_task |
1146 | call mtrr_validate |
Line -... | Line 1147... | ||
- | 1147 | ||
- | 1148 | jmp osloop |
|
- | 1149 | ||
- | 1150 | ||
- | 1151 | ; Fly :) |
|
- | 1152 | ||
- | 1153 | uglobal |
|
- | 1154 | align 4 |
|
- | 1155 | ap_initialized dd 0 |
|
- | 1156 | endg |
|
- | 1157 | ||
- | 1158 | ap_init_high: |
|
- | 1159 | mov ax, os_stack |
|
- | 1160 | mov bx, app_data |
|
- | 1161 | mov cx, app_tls |
|
- | 1162 | mov ss, ax |
|
- | 1163 | mov ds, bx |
|
- | 1164 | mov es, bx |
|
- | 1165 | mov fs, cx |
|
- | 1166 | mov gs, bx |
|
- | 1167 | xor esp, esp |
|
1224 | 1168 | mov eax, sys_proc-OS_BASE+PROC.pdt_0 |
|
Line 1225... | Line 1169... | ||
1225 | jmp osloop |
1169 | mov cr3, eax |
1226 | 1170 | lock inc [ap_initialized] |
|
1227 | 1171 | jmp idle_loop |
|
Line 1282... | Line 1226... | ||
1282 | mov dword [edx+APPDATA.fd_obj], eax |
1226 | mov dword [edx+APPDATA.fd_obj], eax |
1283 | mov dword [edx+APPDATA.bk_obj], eax |
1227 | mov dword [edx+APPDATA.bk_obj], eax |
Line 1284... | Line 1228... | ||
1284 | 1228 | ||
Line 1285... | Line 1229... | ||
1285 | mov dword [edx+APPDATA.cur_dir], sysdir_path |
1229 | mov dword [edx+APPDATA.cur_dir], sysdir_path |
- | 1230 | ||
- | 1231 | mov [edx + APPDATA.process], sys_proc |
|
- | 1232 | ||
- | 1233 | lea ebx, [edx+APPDATA.list] |
|
Line 1286... | Line 1234... | ||
1286 | 1234 | lea ecx, [sys_proc+PROC.thr_list] |
|
1287 | mov [edx + APPDATA.dir_table], sys_pgdir - OS_BASE |
1235 | list_add_tail ebx, ecx |
1288 | 1236 | ||
1289 | mov eax, edx |
1237 | mov eax, edx |
Line 1307... | Line 1255... | ||
1307 | call Wait_events |
1255 | call Wait_events |
1308 | xor eax, eax |
1256 | xor eax, eax |
1309 | xchg eax, [osloop_nonperiodic_work] |
1257 | xchg eax, [osloop_nonperiodic_work] |
1310 | test eax, eax |
1258 | test eax, eax |
1311 | jz .no_periodic |
1259 | jz .no_periodic |
1312 | ; call [draw_pointer] |
- | |
- | 1260 | ||
1313 | call __sys_draw_pointer |
1261 | call __sys_draw_pointer |
1314 | call window_check_events |
1262 | call window_check_events |
1315 | call mouse_check_events |
1263 | call mouse_check_events |
1316 | call checkmisc |
1264 | call checkmisc |
1317 | call checkVga_N13 |
1265 | call checkVga_N13 |
- | 1266 | ;-------------------------------------- |
|
1318 | .no_periodic: |
1267 | .no_periodic: |
1319 | call stack_handler |
1268 | call stack_handler |
1320 | call check_fdd_motor_status |
1269 | call check_fdd_motor_status |
1321 | call check_ATAPI_device_event |
1270 | call check_ATAPI_device_event |
1322 | call check_lights_state |
1271 | call check_lights_state |
1323 | call check_timers |
1272 | call check_timers |
- | 1273 | ||
1324 | jmp osloop |
1274 | jmp osloop |
1325 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1275 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1326 | ; ; |
1276 | ; ; |
1327 | ; MAIN OS LOOP END ; |
1277 | ; MAIN OS LOOP END ; |
1328 | ; ; |
1278 | ; ; |
Line 1357... | Line 1307... | ||
1357 | uglobal |
1307 | uglobal |
1358 | align 4 |
1308 | align 4 |
1359 | osloop_nonperiodic_work dd ? |
1309 | osloop_nonperiodic_work dd ? |
1360 | endg |
1310 | endg |
Line -... | Line 1311... | ||
- | 1311 | ||
1361 | 1312 | uglobal |
|
- | 1313 | align 64 |
|
- | 1314 | idle_addr rb 64 |
|
- | 1315 | endg |
|
1362 | align 4 |
1316 | |
1363 | idle_thread: |
1317 | idle_thread: |
- | 1318 | sti |
|
- | 1319 | ||
- | 1320 | ; The following code can be executed by all CPUs in the system. |
|
- | 1321 | ; All other parts of the kernel do not expect multi-CPU. |
|
- | 1322 | ; Also, APs don't even have a stack here. |
|
1364 | sti |
1323 | ; Beware. Don't do anything here. Anything at all. |
- | 1324 | idle_loop: |
|
- | 1325 | cmp [use_mwait_for_idle], 0 |
|
- | 1326 | jnz idle_loop_mwait |
|
- | 1327 | ||
1365 | idle_loop: |
1328 | idle_loop_hlt: |
1366 | hlt |
1329 | hlt |
Line -... | Line 1330... | ||
- | 1330 | jmp idle_loop_hlt |
|
- | 1331 | ||
- | 1332 | idle_loop_mwait: |
|
- | 1333 | mov eax, idle_addr |
|
- | 1334 | xor ecx, ecx |
|
- | 1335 | xor edx, edx |
|
- | 1336 | monitor |
|
- | 1337 | xor ecx, ecx |
|
- | 1338 | mov eax, 20h ; or 10h |
|
Line 1367... | Line 1339... | ||
1367 | jmp idle_loop |
1339 | mwait |
1368 | 1340 | jmp idle_loop_mwait |
|
1369 | 1341 | ||
Line 1686... | Line 1658... | ||
1686 | mov ecx, [esp+64+32-12+4] |
1658 | mov ecx, [esp+64+32-12+4] |
1687 | and ecx, not 0x80000000 ; force counted string |
1659 | and ecx, not 0x80000000 ; force counted string |
1688 | mov eax, [esp+64+8] ; background color (if given) |
1660 | mov eax, [esp+64+8] ; background color (if given) |
1689 | mov edi, [esp+64+4] |
1661 | mov edi, [esp+64+4] |
1690 | jmp dtext |
1662 | jmp dtext |
- | 1663 | ;----------------------------------------------------------------------------- |
|
- | 1664 | iglobal |
|
- | 1665 | midi_base dw 0 |
|
1691 | 1666 | endg |
|
- | 1667 | ;----------------------------------------------------------------------------- |
|
1692 | align 4 |
1668 | align 4 |
1693 | - | ||
1694 | sys_setup: |
1669 | sys_setup: |
1695 | - | ||
1696 | ; 1=roland mpu midi base , base io address |
1670 | ; 1 = roland mpu midi base , base io address |
1697 | ; 2=keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus |
1671 | ; 2 = keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus |
1698 | ; 3=cd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave |
1672 | ; 3 = not used |
- | 1673 | ; 4 = not used |
|
1699 | ; 5=system language, 1eng 2fi 3ger 4rus |
1674 | ; 5 = system language, 1eng 2fi 3ger 4rus |
- | 1675 | ; 6 = not used |
|
1700 | ; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave |
1676 | ; 7 = not used |
1701 | ; 8=fat32 partition in hd |
1677 | ; 8 = not used |
1702 | ; 9 |
1678 | ; 9 = not used |
1703 | ; 10 = sound dma channel |
1679 | ; 10 = not used |
1704 | ; 11 = enable lba read |
1680 | ; 11 = enable lba read |
1705 | ; 12 = enable pci access |
1681 | ; 12 = enable pci access |
1706 | - | ||
1707 | - | ||
- | 1682 | ;----------------------------------------------------------------------------- |
|
1708 | and [esp+32], dword 0 |
1683 | and [esp+32], dword 0 |
- | 1684 | ; F.21.1 - set MPU MIDI base port |
|
1709 | dec ebx ; MIDI |
1685 | dec ebx |
1710 | jnz nsyse1 |
1686 | jnz @f |
- | 1687 | ||
1711 | cmp ecx, 0x100 |
1688 | cmp ecx, 0x100 |
- | 1689 | jb @f |
|
Line 1712... | Line -... | ||
1712 | - | ||
1713 | jb nsyse1 |
1690 | |
1714 | mov esi, 65535 |
1691 | mov esi, 65535 |
- | 1692 | cmp esi, ecx |
|
Line 1715... | Line -... | ||
1715 | cmp esi, ecx |
- | |
1716 | 1693 | jb @f |
|
1717 | jb nsyse1 |
1694 | |
1718 | mov [midi_base], cx ;bx |
1695 | mov [midi_base], cx |
1719 | mov word [mididp], cx;bx |
1696 | mov word [mididp], cx |
1720 | inc cx ;bx |
1697 | inc cx |
- | 1698 | mov word [midisp], cx |
|
- | 1699 | ret |
|
- | 1700 | ;-------------------------------------- |
|
- | 1701 | @@: |
|
- | 1702 | ; F.21.2 - set keyboard layout |
|
Line 1721... | Line -... | ||
1721 | mov word [midisp], cx;bx |
- | |
1722 | ret |
- | |
1723 | - | ||
1724 | iglobal |
- | |
1725 | midi_base dw 0 |
- | |
1726 | endg |
- | |
1727 | - | ||
1728 | nsyse1: |
1703 | dec ebx |
1729 | dec ebx ; KEYBOARD |
1704 | jnz @f |
1730 | jnz nsyse2 |
1705 | |
1731 | mov edi, [TASK_BASE] |
- | |
- | 1706 | mov edi, [TASK_BASE] |
|
1732 | mov eax, [edi+TASKDATA.mem_start] |
1707 | mov eax, [edi+TASKDATA.mem_start] |
1733 | add eax, edx |
1708 | add eax, edx |
- | 1709 | ; 1 = normal layout |
|
1734 | 1710 | dec ecx |
|
1735 | dec ecx |
1711 | jnz .shift |
1736 | jnz kbnobase |
1712 | |
1737 | mov ebx, keymap |
1713 | mov ebx, keymap |
- | 1714 | mov ecx, 128 |
|
1738 | mov ecx, 128 |
1715 | call memmove |
- | 1716 | ret |
|
1739 | call memmove |
1717 | ;-------------------------------------- |
1740 | ret |
1718 | .shift: |
Line 1741... | Line 1719... | ||
1741 | kbnobase: |
1719 | ; 2 = layout at pressed Shift |
1742 | dec ecx |
1720 | dec ecx |
1743 | jnz kbnoshift |
1721 | jnz .alt |
1744 | 1722 | ||
- | 1723 | mov ebx, keymap_shift |
|
- | 1724 | mov ecx, 128 |
|
1745 | mov ebx, keymap_shift |
1725 | call memmove |
1746 | mov ecx, 128 |
1726 | ret |
1747 | call memmove |
1727 | ;-------------------------------------- |
- | 1728 | .alt: |
|
1748 | ret |
1729 | ; 3 = layout at pressed Alt |
1749 | kbnoshift: |
1730 | dec ecx |
1750 | dec ecx |
1731 | jnz .country |
1751 | jnz kbnoalt |
1732 | |
- | 1733 | mov ebx, keymap_alt |
|
1752 | mov ebx, keymap_alt |
1734 | mov ecx, 128 |
- | 1735 | call memmove |
|
1753 | mov ecx, 128 |
1736 | ret |
1754 | call memmove |
- | |
1755 | ret |
- | |
1756 | kbnoalt: |
- | |
1757 | sub ecx, 6 |
- | |
1758 | jnz kbnocountry |
- | |
1759 | mov word [keyboard], dx |
- | |
1760 | ret |
- | |
1761 | kbnocountry: |
- | |
1762 | mov [esp+32], dword 1 |
1737 | ;-------------------------------------- |
Line 1763... | Line -... | ||
1763 | ret |
- | |
1764 | nsyse2: |
- | |
1765 | dec ebx ; CD |
- | |
1766 | jnz nsyse4 |
- | |
1767 | - | ||
1768 | test ecx, ecx |
1738 | .country: |
1769 | jz nosesl |
- | |
1770 | - | ||
1771 | cmp ecx, 4 |
- | |
1772 | ja nosesl |
- | |
1773 | mov [cd_base], cl |
- | |
1774 | - | ||
1775 | dec ecx |
- | |
1776 | jnz noprma |
- | |
1777 | mov eax, [hd_address_table] |
- | |
1778 | mov [cdbase], eax ;0x1f0 |
- | |
1779 | mov [cdid], 0xa0 |
- | |
1780 | noprma: |
- | |
1781 | - | ||
1782 | dec ecx |
- | |
1783 | jnz noprsl |
- | |
1784 | mov eax, [hd_address_table] |
- | |
1785 | mov [cdbase], eax ;0x1f0 |
- | |
1786 | mov [cdid], 0xb0 |
- | |
1787 | noprsl: |
- | |
1788 | dec ecx |
- | |
1789 | jnz nosema |
- | |
1790 | mov eax, [hd_address_table+16] |
- | |
1791 | mov [cdbase], eax ;0x170 |
- | |
1792 | mov [cdid], 0xa0 |
- | |
1793 | nosema: |
- | |
1794 | dec ecx |
- | |
1795 | jnz nosesl |
1739 | ; country identifier |
- | 1740 | sub ecx, 6 |
|
- | 1741 | jnz .error |
|
- | 1742 | ||
- | 1743 | mov word [keyboard], dx |
|
- | 1744 | ret |
|
Line 1796... | Line -... | ||
1796 | mov eax, [hd_address_table+16] |
- | |
1797 | mov [cdbase], eax ;0x170 |
- | |
1798 | mov [cdid], 0xb0 |
- | |
1799 | nosesl: |
- | |
1800 | ret |
- | |
1801 | - | ||
1802 | iglobal |
- | |
1803 | cd_base db 0 |
- | |
1804 | 1745 | ;-------------------------------------- |
|
1805 | endg |
1746 | @@: |
1806 | nsyse4: |
- | |
1807 | - | ||
1808 | sub ebx, 2 ; SYSTEM LANGUAGE |
1747 | ; F.21.5 - set system language |
1809 | jnz nsyse5 |
- | |
1810 | mov [syslang], ecx |
1748 | sub ebx, 3 |
1811 | ret |
- | |
1812 | nsyse5: |
- | |
1813 | - | ||
1814 | sub ebx, 2 ; HD BASE - obsolete |
- | |
1815 | jnz nsyse7 |
- | |
1816 | - | ||
1817 | nosethd: |
- | |
1818 | ret |
- | |
1819 | - | ||
1820 | nsyse7: |
- | |
1821 | - | ||
1822 | ; cmp eax,8 ; HD PARTITION - obsolete |
1749 | jnz @f |
1823 | dec ebx |
1750 | |
1824 | jnz nsyse8 |
1751 | mov [syslang], ecx |
1825 | ret |
1752 | ret |
- | 1753 | ;-------------------------------------- |
|
1826 | 1754 | @@: |
|
1827 | nsyse8: |
1755 | ; F.21.11 - enable/disable low-level access to HD |
- | 1756 | and ecx, 1 |
|
1828 | ; cmp eax,11 ; ENABLE LBA READ |
1757 | sub ebx, 6 |
1829 | and ecx, 1 |
- | |
1830 | sub ebx, 3 |
1758 | jnz @f |
1831 | jnz no_set_lba_read |
1759 | |
1832 | mov [lba_read_enabled], ecx |
1760 | mov [lba_read_enabled], ecx |
- | 1761 | ret |
|
1833 | ret |
1762 | ;-------------------------------------- |
1834 | 1763 | @@: |
|
1835 | no_set_lba_read: |
- | |
- | 1764 | ; F.21.12 - enable/disable low-level access to PCI |
|
1836 | ; cmp eax,12 ; ENABLE PCI ACCESS |
1765 | dec ebx |
1837 | dec ebx |
1766 | jnz .error |
1838 | jnz sys_setup_err |
1767 | |
1839 | mov [pci_access_enabled], ecx |
- | |
- | 1768 | mov [pci_access_enabled], ecx |
|
1840 | ret |
1769 | ret |
1841 | - | ||
1842 | sys_setup_err: |
1770 | ;-------------------------------------- |
1843 | or [esp+32], dword -1 |
- | |
1844 | ret |
1771 | .error: |
1845 | 1772 | or [esp+32], dword -1 |
|
1846 | align 4 |
1773 | ret |
- | 1774 | ;----------------------------------------------------------------------------- |
|
1847 | 1775 | align 4 |
|
- | 1776 | sys_getsetup: |
|
1848 | sys_getsetup: |
1777 | ; 1 = roland mpu midi base , base io address |
1849 | 1778 | ; 2 = keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus |
|
1850 | ; 1=roland mpu midi base , base io address |
1779 | ; 3 = not used |
1851 | ; 2=keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus |
- | |
1852 | ; 3=cd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave |
1780 | ; 4 = not used |
- | 1781 | ; 5 = system language, 1eng 2fi 3ger 4rus |
|
- | 1782 | ; 6 = not used |
|
- | 1783 | ; 7 = not used |
|
- | 1784 | ; 8 = not used |
|
1853 | ; 5=system language, 1eng 2fi 3ger 4rus |
1785 | ; 9 = get hs timer tic |
1854 | ; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave |
1786 | ; 10 = not used |
- | 1787 | ; 11 = get the state "lba read" |
|
1855 | ; 8=fat32 partition in hd |
1788 | ; 12 = get the state "pci access" |
1856 | ; 9=get hs timer tic |
1789 | ;----------------------------------------------------------------------------- |
1857 | 1790 | ; F.26.1 - get MPU MIDI base port |
|
- | 1791 | dec ebx |
|
1858 | ; cmp eax,1 |
1792 | jnz @f |
1859 | dec ebx |
1793 | |
1860 | jnz ngsyse1 |
1794 | movzx eax, [midi_base] |
1861 | movzx eax, [midi_base] |
1795 | mov [esp+32], eax |
Line 1862... | Line 1796... | ||
1862 | mov [esp+32], eax |
1796 | ret |
1863 | ret |
1797 | ;-------------------------------------- |
1864 | ngsyse1: |
1798 | @@: |
1865 | ; cmp eax,2 |
- | |
1866 | dec ebx |
1799 | ; F.26.2 - get keyboard layout |
1867 | jnz ngsyse2 |
1800 | dec ebx |
1868 | 1801 | jnz @f |
|
- | 1802 | ||
1869 | mov edi, [TASK_BASE] |
1803 | mov edi, [TASK_BASE] |
1870 | mov ebx, [edi+TASKDATA.mem_start] |
1804 | mov ebx, [edi+TASKDATA.mem_start] |
1871 | add ebx, edx |
1805 | add ebx, edx |
1872 | 1806 | ; 1 = normal layout |
|
- | 1807 | dec ecx |
|
1873 | ; cmp ebx,1 |
1808 | jnz .shift |
1874 | dec ecx |
1809 | |
1875 | jnz kbnobaseret |
1810 | mov eax, keymap |
1876 | mov eax, keymap |
1811 | mov ecx, 128 |
Line 1877... | Line 1812... | ||
1877 | mov ecx, 128 |
1812 | call memmove |
1878 | call memmove |
1813 | ret |
1879 | ret |
1814 | ;-------------------------------------- |
1880 | kbnobaseret: |
1815 | .shift: |
- | 1816 | ; 2 = layout with pressed Shift |
|
1881 | ; cmp ebx,2 |
1817 | dec ecx |
1882 | dec ecx |
1818 | jnz .alt |
1883 | jnz kbnoshiftret |
1819 | |
1884 | 1820 | mov eax, keymap_shift |
|
Line 1885... | Line 1821... | ||
1885 | mov eax, keymap_shift |
1821 | mov ecx, 128 |
1886 | mov ecx, 128 |
1822 | call memmove |
1887 | call memmove |
1823 | ret |
1888 | ret |
1824 | ;-------------------------------------- |
- | 1825 | .alt: |
|
1889 | kbnoshiftret: |
1826 | ; 3 = layout with pressed Alt |
1890 | ; cmp ebx,3 |
1827 | dec ecx |
1891 | dec ecx |
1828 | jne .country |
1892 | jne kbnoaltret |
1829 | |
- | 1830 | mov eax, keymap_alt |
|
1893 | 1831 | mov ecx, 128 |
|
1894 | mov eax, keymap_alt |
1832 | call memmove |
1895 | mov ecx, 128 |
1833 | ret |
- | 1834 | ;-------------------------------------- |
|
- | 1835 | .country: |
|
- | 1836 | ; 9 = country identifier |
|
- | 1837 | sub ecx, 6 |
|
- | 1838 | jnz .error |
|
Line 1896... | Line -... | ||
1896 | call memmove |
- | |
1897 | ret |
- | |
1898 | kbnoaltret: |
- | |
1899 | ; cmp ebx,9 |
- | |
1900 | sub ecx, 6 |
- | |
1901 | jnz ngsyse2 |
- | |
1902 | movzx eax, word [keyboard] |
- | |
1903 | mov [esp+32], eax |
- | |
1904 | ret |
- | |
1905 | - | ||
1906 | - | ||
1907 | ngsyse2: |
- | |
1908 | ; cmp eax,3 |
1839 | |
1909 | dec ebx |
1840 | movzx eax, word [keyboard] |
1910 | jnz ngsyse3 |
1841 | mov [esp+32], eax |
1911 | movzx eax, [cd_base] |
- | |
1912 | mov [esp+32], eax |
- | |
1913 | ret |
- | |
1914 | ngsyse3: |
- | |
1915 | ; cmp eax,5 |
- | |
1916 | sub ebx, 2 |
1842 | ret |
1917 | jnz ngsyse5 |
- | |
1918 | mov eax, [syslang] |
1843 | ;-------------------------------------- |
1919 | mov [esp+32], eax |
1844 | @@: |
1920 | ret |
1845 | ; F.26.5 - get system language |
1921 | ngsyse5: |
1846 | sub ebx, 3 |
1922 | ; cmp eax,7 |
- | |
1923 | sub ebx, 2 |
- | |
1924 | jnz ngsyse7 |
- | |
1925 | xor eax, eax |
1847 | jnz @f |
1926 | mov [esp+32], eax |
- | |
1927 | ret |
- | |
1928 | ngsyse7: |
- | |
1929 | ; cmp eax,8 |
1848 | |
1930 | dec ebx |
1849 | mov eax, [syslang] |
1931 | jnz ngsyse8 |
1850 | mov [esp+32], eax |
- | 1851 | ret |
|
1932 | mov eax, [fat32part] |
1852 | ;-------------------------------------- |
1933 | mov [esp+32], eax |
1853 | @@: |
1934 | ret |
1854 | ; F.26.9 - get the value of the time counter |
1935 | ngsyse8: |
1855 | sub ebx, 4 |
- | 1856 | jnz @f |
|
1936 | ; cmp eax,9 |
1857 | |
1937 | dec ebx |
1858 | mov eax, [timer_ticks] |
1938 | jnz ngsyse9 |
1859 | mov [esp+32], eax |
- | 1860 | ret |
|
1939 | mov eax, [timer_ticks];[0xfdf0] |
1861 | ;-------------------------------------- |
1940 | mov [esp+32], eax |
1862 | @@: |
1941 | ret |
1863 | ; F.26.11 - Find out whether low-level HD access is enabled |
1942 | ngsyse9: |
1864 | sub ebx, 2 |
- | 1865 | jnz @f |
|
1943 | ; cmp eax,11 |
1866 | |
1944 | sub ebx, 2 |
1867 | mov eax, [lba_read_enabled] |
1945 | jnz ngsyse11 |
1868 | mov [esp+32], eax |
- | 1869 | ret |
|
1946 | mov eax, [lba_read_enabled] |
1870 | ;-------------------------------------- |
1947 | mov [esp+32], eax |
1871 | @@: |
1948 | ret |
1872 | ; F.26.12 - Find out whether low-level PCI access is enabled |
1949 | ngsyse11: |
- | |
1950 | ; cmp eax,12 |
- | |
- | 1873 | dec ebx |
|
1951 | dec ebx |
1874 | jnz .error |
1952 | jnz ngsyse12 |
1875 | |
1953 | mov eax, [pci_access_enabled] |
1876 | mov eax, [pci_access_enabled] |
1954 | mov [esp+32], eax |
- | |
- | 1877 | mov [esp+32], eax |
|
1955 | ret |
1878 | ret |
1956 | ngsyse12: |
1879 | ;-------------------------------------- |
1957 | mov [esp+32], dword 1 |
1880 | .error: |
1958 | ret |
1881 | or [esp+32], dword -1 |
1959 | 1882 | ret |
|
1960 | 1883 | ;----------------------------------------------------------------------------- |
|
1961 | get_timer_ticks: |
1884 | get_timer_ticks: |
1962 | mov eax, [timer_ticks] |
1885 | mov eax, [timer_ticks] |
1963 | ret |
- | |
- | 1886 | ret |
|
1964 | 1887 | ;----------------------------------------------------------------------------- |
|
Line 1965... | Line 1888... | ||
1965 | iglobal |
1888 | iglobal |
1966 | align 4 |
1889 | align 4 |
1967 | mousefn dd msscreen, mswin, msbutton, msset |
1890 | mousefn dd msscreen, mswin, msbutton, msset |
Line 2441... | Line 2364... | ||
2441 | call wakeup_osloop |
2364 | call wakeup_osloop |
2442 | ret |
2365 | ret |
2443 | ;------------------------------------------------------------------------------ |
2366 | ;------------------------------------------------------------------------------ |
2444 | align 4 |
2367 | align 4 |
2445 | sysfn_getdiskinfo: ; 18.11 = get disk info table |
2368 | sysfn_getdiskinfo: ; 18.11 = get disk info table |
2446 | ; cmp ecx,1 |
- | |
2447 | dec ecx |
2369 | dec ecx |
2448 | jnz full_table |
2370 | jnz .exit |
2449 | small_table: |
2371 | .small_table: |
2450 | call for_all_tables |
- | |
2451 | mov ecx, 10 |
- | |
2452 | cld |
- | |
2453 | rep movsb |
- | |
2454 | ret |
- | |
2455 | for_all_tables: |
- | |
2456 | mov edi, edx |
2372 | mov edi, edx |
2457 | mov esi, DRIVE_DATA |
2373 | mov esi, DRIVE_DATA |
2458 | ret |
- | |
2459 | full_table: |
- | |
2460 | ; cmp ecx,2 |
- | |
2461 | dec ecx |
- | |
2462 | jnz exit_for_anyone |
- | |
2463 | call for_all_tables |
- | |
2464 | mov ecx, DRIVE_DATA_SIZE/4 |
2374 | mov ecx, DRIVE_DATA_SIZE ;10 |
2465 | cld |
2375 | cld |
2466 | rep movsd |
2376 | rep movsb |
- | 2377 | .exit: |
|
2467 | ret |
2378 | ret |
2468 | ;------------------------------------------------------------------------------ |
2379 | ;------------------------------------------------------------------------------ |
2469 | sysfn_lastkey: ; 18.12 = return 0 (backward compatibility) |
2380 | sysfn_lastkey: ; 18.12 = return 0 (backward compatibility) |
2470 | and dword [esp+32], 0 |
2381 | and dword [esp+32], 0 |
2471 | ret |
2382 | ret |
Line 2493... | Line 2404... | ||
2493 | ; removed here by |
2404 | ; removed here by |
2494 | ; call mouse_centered |
2405 | ; call mouse_centered |
2495 | ;* mouse centered - start code- Mario79 |
2406 | ;* mouse centered - start code- Mario79 |
2496 | ;mouse_centered: |
2407 | ;mouse_centered: |
2497 | ; push eax |
2408 | ; push eax |
2498 | mov eax, [_display.width] |
2409 | mov eax, [Screen_Max_X] |
2499 | shr eax, 1 |
2410 | shr eax, 1 |
2500 | mov [MOUSE_X], ax |
2411 | mov [MOUSE_X], ax |
2501 | mov eax, [_display.height] |
2412 | mov eax, [Screen_Max_Y] |
2502 | shr eax, 1 |
2413 | shr eax, 1 |
2503 | mov [MOUSE_Y], ax |
2414 | mov [MOUSE_Y], ax |
2504 | call wakeup_osloop |
2415 | call wakeup_osloop |
2505 | ; ret |
2416 | ; ret |
2506 | ;* mouse centered - end code- Mario79 |
2417 | ;* mouse centered - end code- Mario79 |
Line 2538... | Line 2449... | ||
2538 | ret |
2449 | ret |
2539 | .set_pointer_position: |
2450 | .set_pointer_position: |
2540 | ; cmp ecx,4 ; set mouse pointer position |
2451 | ; cmp ecx,4 ; set mouse pointer position |
2541 | dec ecx |
2452 | dec ecx |
2542 | jnz .set_mouse_button |
2453 | jnz .set_mouse_button |
2543 | cmp dx, word[_display.height] |
2454 | cmp dx, word[Screen_Max_Y] |
2544 | jae .end |
2455 | ja .end |
2545 | rol edx, 16 |
2456 | rol edx, 16 |
2546 | cmp dx, word[_display.width] |
2457 | cmp dx, word[Screen_Max_X] |
2547 | jae .end |
2458 | ja .end |
2548 | mov [MOUSE_X], edx |
2459 | mov [MOUSE_X], edx |
- | 2460 | mov [mouse_active], 1 |
|
2549 | call wakeup_osloop |
2461 | call wakeup_osloop |
2550 | ret |
2462 | ret |
2551 | .set_mouse_button: |
2463 | .set_mouse_button: |
2552 | ; cmp ecx,5 ; set mouse button features |
2464 | ; cmp ecx,5 ; set mouse button features |
2553 | dec ecx |
2465 | dec ecx |
Line 2629... | Line 2541... | ||
2629 | pushfd |
2541 | pushfd |
2630 | cli |
2542 | cli |
2631 | mov eax, ecx |
2543 | mov eax, ecx |
2632 | mov ecx, [_display.pitch] |
2544 | mov ecx, [_display.pitch] |
2633 | mov [_display.width], eax |
2545 | mov [_display.width], eax |
- | 2546 | dec eax |
|
2634 | mov [_display.height], edx |
2547 | mov [_display.height], edx |
- | 2548 | dec edx |
|
2635 | ; eax - new Screen_Max_X |
2549 | ; eax - new Screen_Max_X |
2636 | ; edx - new Screen_Max_Y |
2550 | ; edx - new Screen_Max_Y |
2637 | mov [do_not_touch_winmap], 1 |
2551 | mov [do_not_touch_winmap], 1 |
2638 | call set_screen |
2552 | call set_screen |
2639 | mov [do_not_touch_winmap], 0 |
2553 | mov [do_not_touch_winmap], 0 |
Line 2966... | Line 2880... | ||
2966 | nosb8: |
2880 | nosb8: |
2967 | cmp ebx, 9 |
2881 | cmp ebx, 9 |
2968 | jnz nosb9 |
2882 | jnz nosb9 |
2969 | ; ecx = [left]*65536 + [right] |
2883 | ; ecx = [left]*65536 + [right] |
2970 | ; edx = [top]*65536 + [bottom] |
2884 | ; edx = [top]*65536 + [bottom] |
2971 | mov eax, [_display.width] |
2885 | mov eax, [Screen_Max_X] |
2972 | mov ebx, [_display.height] |
2886 | mov ebx, [Screen_Max_Y] |
2973 | ; check [right] |
2887 | ; check [right] |
2974 | cmp cx, ax |
2888 | cmp cx, ax |
2975 | jae .exit |
2889 | ja .exit |
2976 | ; check [left] |
2890 | ; check [left] |
2977 | ror ecx, 16 |
2891 | ror ecx, 16 |
2978 | cmp cx, ax |
2892 | cmp cx, ax |
2979 | jae .exit |
2893 | ja .exit |
2980 | ; check [bottom] |
2894 | ; check [bottom] |
2981 | cmp dx, bx |
2895 | cmp dx, bx |
2982 | jae .exit |
2896 | ja .exit |
2983 | ; check [top] |
2897 | ; check [top] |
2984 | ror edx, 16 |
2898 | ror edx, 16 |
2985 | cmp dx, bx |
2899 | cmp dx, bx |
2986 | jae .exit |
2900 | ja .exit |
Line 2987... | Line 2901... | ||
2987 | 2901 | ||
2988 | movzx eax, cx ; [left] |
2902 | movzx eax, cx ; [left] |
Line 2989... | Line 2903... | ||
2989 | movzx ebx, dx ; [top] |
2903 | movzx ebx, dx ; [top] |
Line 3019... | Line 2933... | ||
3019 | align 4 |
2933 | align 4 |
3020 | force_redraw_background: |
2934 | force_redraw_background: |
3021 | and [draw_data+32 + RECT.left], 0 |
2935 | and [draw_data+32 + RECT.left], 0 |
3022 | and [draw_data+32 + RECT.top], 0 |
2936 | and [draw_data+32 + RECT.top], 0 |
3023 | push eax ebx |
2937 | push eax ebx |
3024 | mov eax, [_display.width] |
2938 | mov eax, [Screen_Max_X] |
3025 | mov ebx, [_display.height] |
2939 | mov ebx, [Screen_Max_Y] |
3026 | mov [draw_data+32 + RECT.right], eax |
2940 | mov [draw_data+32 + RECT.right], eax |
3027 | mov [draw_data+32 + RECT.bottom], ebx |
2941 | mov [draw_data+32 + RECT.bottom], ebx |
3028 | pop ebx eax |
2942 | pop ebx eax |
3029 | inc byte[REDRAW_BACKGROUND] |
2943 | inc byte[REDRAW_BACKGROUND] |
3030 | call wakeup_osloop |
2944 | call wakeup_osloop |
Line 3094... | Line 3008... | ||
3094 | mov edx, [TASK_COUNT] |
3008 | mov edx, [TASK_COUNT] |
3095 | cmp ecx, edx |
3009 | cmp ecx, edx |
3096 | jne .finish |
3010 | jne .finish |
3097 | cmp [KEY_COUNT], byte 0 |
3011 | cmp [KEY_COUNT], byte 0 |
3098 | je .finish |
3012 | je .finish |
- | 3013 | movzx ax, byte [KEY_BUFF + 120 + 2] |
|
- | 3014 | shl eax, 8 |
|
3099 | movzx eax, byte [KEY_BUFF] |
3015 | mov al, byte [KEY_BUFF] |
3100 | shl eax, 8 |
3016 | shl eax, 8 |
3101 | push eax |
3017 | push eax |
3102 | dec byte [KEY_COUNT] |
3018 | dec byte [KEY_COUNT] |
3103 | and byte [KEY_COUNT], 127 |
3019 | and byte [KEY_COUNT], 127 |
3104 | movzx ecx, byte [KEY_COUNT] |
3020 | movzx ecx, byte [KEY_COUNT] |
3105 | add ecx, 2 |
3021 | add ecx, 2 |
3106 | mov eax, KEY_BUFF + 1 |
3022 | mov eax, KEY_BUFF + 1 |
3107 | mov ebx, KEY_BUFF |
3023 | mov ebx, KEY_BUFF |
3108 | call memmove |
3024 | call memmove |
- | 3025 | add eax, 120 + 2 |
|
- | 3026 | add ebx, 120 + 2 |
|
- | 3027 | call memmove |
|
3109 | pop eax |
3028 | pop eax |
3110 | ;-------------------------------------- |
3029 | ;-------------------------------------- |
3111 | align 4 |
3030 | align 4 |
3112 | .ret_eax: |
3031 | .ret_eax: |
3113 | mov [esp + 32], eax |
3032 | mov [esp + 32], eax |
Line 3205... | Line 3124... | ||
3205 | lea edi, [ebx+12] |
3124 | lea edi, [ebx+12] |
3206 | xor eax, eax |
3125 | xor eax, eax |
3207 | mov edx, 0x100000*16 |
3126 | mov edx, 0x100000*16 |
3208 | cmp ecx, 1 shl 5 |
3127 | cmp ecx, 1 shl 5 |
3209 | je .os_mem |
3128 | je .os_mem |
3210 | mov edx, [SLOT_BASE+ecx*8+APPDATA.mem_size] |
3129 | mov edx, [SLOT_BASE+ecx*8+APPDATA.process] |
- | 3130 | mov edx, [edx+PROC.mem_used] |
|
3211 | mov eax, std_application_base_address |
3131 | mov eax, std_application_base_address |
3212 | .os_mem: |
3132 | .os_mem: |
3213 | stosd |
3133 | stosd |
3214 | lea eax, [edx-1] |
3134 | lea eax, [edx-1] |
3215 | stosd |
3135 | stosd |
Line 3376... | Line 3296... | ||
3376 | 3296 | ||
3377 | mov edx, [TASK_BASE] ; return whole screen draw area for this app |
3297 | mov edx, [TASK_BASE] ; return whole screen draw area for this app |
3378 | add edx, draw_data - CURRENT_TASK |
3298 | add edx, draw_data - CURRENT_TASK |
3379 | mov [edx + RECT.left], 0 |
3299 | mov [edx + RECT.left], 0 |
3380 | mov [edx + RECT.top], 0 |
3300 | mov [edx + RECT.top], 0 |
3381 | mov eax, [_display.width] |
3301 | mov eax, [Screen_Max_X] |
3382 | mov [edx + RECT.right], eax |
3302 | mov [edx + RECT.right], eax |
3383 | mov eax, [_display.height] |
3303 | mov eax, [Screen_Max_Y] |
Line 3384... | Line 3304... | ||
3384 | mov [edx + RECT.bottom], eax |
3304 | mov [edx + RECT.bottom], eax |
3385 | 3305 | ||
Line 3677... | Line 3597... | ||
3677 | markz: |
3597 | markz: |
3678 | push ecx edx |
3598 | push ecx edx |
3679 | cmp [edx+TASKDATA.state], 9 |
3599 | cmp [edx+TASKDATA.state], 9 |
3680 | jz .nokill |
3600 | jz .nokill |
3681 | lea edx, [(edx-(CURRENT_TASK and 1FFFFFFFh))*8+SLOT_BASE] |
3601 | lea edx, [(edx-(CURRENT_TASK and 1FFFFFFFh))*8+SLOT_BASE] |
3682 | cmp [edx+APPDATA.dir_table], sys_pgdir - OS_BASE |
3602 | cmp [edx+APPDATA.process], sys_proc |
3683 | jz .nokill |
3603 | jz .nokill |
3684 | call request_terminate |
3604 | call request_terminate |
3685 | jmp .common |
3605 | jmp .common |
3686 | .nokill: |
3606 | .nokill: |
3687 | dec byte [SYS_SHUTDOWN] |
3607 | dec byte [SYS_SHUTDOWN] |
Line 4701... | Line 4621... | ||
4701 | ; call vesa20_drawbar |
4621 | ; call vesa20_drawbar |
4702 | ; call [draw_pointer] |
4622 | ; call [draw_pointer] |
4703 | ; ret |
4623 | ; ret |
4704 | ;----------------------------------------------------------------------------- |
4624 | ;----------------------------------------------------------------------------- |
4705 | align 4 |
4625 | align 4 |
4706 | kb_read: |
- | |
4707 | - | ||
4708 | push ecx edx |
- | |
4709 | - | ||
4710 | mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's |
- | |
4711 | kr_loop: |
- | |
4712 | in al, 0x64 |
- | |
4713 | test al, 1 |
- | |
4714 | jnz kr_ready |
- | |
4715 | loop kr_loop |
- | |
4716 | mov ah, 1 |
- | |
4717 | jmp kr_exit |
- | |
4718 | kr_ready: |
- | |
4719 | push ecx |
- | |
4720 | mov ecx, 32 |
- | |
4721 | kr_delay: |
- | |
4722 | loop kr_delay |
- | |
4723 | pop ecx |
- | |
4724 | in al, 0x60 |
- | |
4725 | xor ah, ah |
- | |
4726 | kr_exit: |
- | |
4727 | - | ||
4728 | pop edx ecx |
- | |
4729 | - | ||
4730 | ret |
- | |
4731 | ;----------------------------------------------------------------------------- |
- | |
4732 | align 4 |
- | |
4733 | kb_write: |
4626 | kb_write_wait_ack: |
Line 4734... | Line 4627... | ||
4734 | 4627 | ||
Line 4735... | Line 4628... | ||
4735 | push ecx edx |
4628 | push ecx edx |
4736 | - | ||
4737 | mov dl, al |
- | |
4738 | ; mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's |
- | |
4739 | ; kw_loop1: |
- | |
4740 | ; in al,0x64 |
- | |
4741 | ; test al,0x20 |
- | |
4742 | ; jz kw_ok1 |
- | |
4743 | ; loop kw_loop1 |
- | |
4744 | ; mov ah,1 |
- | |
4745 | ; jmp kw_exit |
- | |
4746 | ; kw_ok1: |
4629 | |
4747 | in al, 0x60 |
4630 | mov dl, al |
4748 | mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's |
4631 | mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's |
4749 | kw_loop: |
4632 | .wait_output_ready: |
4750 | in al, 0x64 |
4633 | in al, 0x64 |
4751 | test al, 2 |
4634 | test al, 2 |
4752 | jz kw_ok |
4635 | jz @f |
4753 | loop kw_loop |
4636 | loop .wait_output_ready |
4754 | mov ah, 1 |
4637 | mov ah, 1 |
4755 | jmp kw_exit |
4638 | jmp .nothing |
4756 | kw_ok: |
4639 | @@: |
4757 | mov al, dl |
4640 | mov al, dl |
4758 | out 0x60, al |
- | |
4759 | mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's |
- | |
4760 | kw_loop3: |
- | |
4761 | in al, 0x64 |
- | |
4762 | test al, 2 |
- | |
4763 | jz kw_ok3 |
- | |
4764 | loop kw_loop3 |
- | |
4765 | mov ah, 1 |
4641 | out 0x60, al |
4766 | jmp kw_exit |
- | |
4767 | kw_ok3: |
- | |
4768 | mov ah, 8 |
- | |
4769 | kw_loop4: |
- | |
4770 | mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's |
4642 | mov ecx, 0xfffff; last 0xffff, new value in view of fast CPU's |
4771 | kw_loop5: |
4643 | .wait_ack: |
4772 | in al, 0x64 |
4644 | in al, 0x64 |
4773 | test al, 1 |
4645 | test al, 1 |
4774 | jnz kw_ok4 |
4646 | jnz @f |
4775 | loop kw_loop5 |
4647 | loop .wait_ack |
- | 4648 | mov ah, 1 |
|
4776 | dec ah |
4649 | jmp .nothing |
4777 | jnz kw_loop4 |
4650 | @@: |
4778 | kw_ok4: |
- | |
Line -... | Line 4651... | ||
- | 4651 | in al, 0x60 |
|
4779 | xor ah, ah |
4652 | xor ah, ah |
Line 4780... | Line 4653... | ||
4780 | kw_exit: |
4653 | |
4781 | 4654 | .nothing: |
|
4782 | pop edx ecx |
- | |
4783 | - | ||
4784 | ret |
- | |
4785 | ;----------------------------------------------------------------------------- |
- | |
4786 | align 4 |
- | |
4787 | kb_cmd: |
- | |
4788 | - | ||
4789 | mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's |
- | |
4790 | c_wait: |
- | |
4791 | in al, 0x64 |
- | |
4792 | test al, 2 |
- | |
4793 | jz c_send |
- | |
4794 | loop c_wait |
- | |
4795 | jmp c_error |
- | |
4796 | c_send: |
- | |
4797 | mov al, bl |
- | |
4798 | out 0x64, al |
- | |
4799 | mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's |
- | |
4800 | c_accept: |
- | |
4801 | in al, 0x64 |
- | |
4802 | test al, 2 |
- | |
4803 | jz c_ok |
- | |
4804 | loop c_accept |
- | |
4805 | c_error: |
- | |
4806 | mov ah, 1 |
- | |
4807 | jmp c_exit |
- | |
4808 | c_ok: |
- | |
Line 4809... | Line 4655... | ||
4809 | xor ah, ah |
4655 | pop edx ecx |
4810 | c_exit: |
4656 | |
Line 4811... | Line 4657... | ||
4811 | ret |
4657 | ret |
Line 4945... | Line 4791... | ||
4945 | add word [msg_board_pos+2], 6 |
4791 | add word [msg_board_pos+2], 6 |
4946 | cmp bl, 10 |
4792 | cmp bl, 10 |
4947 | jnz @f |
4793 | jnz @f |
4948 | mov word [msg_board_pos+2], (42*6) |
4794 | mov word [msg_board_pos+2], (42*6) |
4949 | add word [msg_board_pos], 10 |
4795 | add word [msg_board_pos], 10 |
4950 | mov ax, word [_display.height] |
4796 | mov ax, word [Screen_Max_Y] |
4951 | cmp word [msg_board_pos], ax |
4797 | cmp word [msg_board_pos], ax |
4952 | jb @f |
4798 | jbe @f |
4953 | mov word [msg_board_pos], 10 |
4799 | mov word [msg_board_pos], 10 |
4954 | @@: |
4800 | @@: |
4955 | ; // end if |
4801 | ; // end if |
Line 4956... | Line 4802... | ||
4956 | 4802 | ||
Line 5164... | Line 5010... | ||
5164 | or [esp+32], dword -1 |
5010 | or [esp+32], dword -1 |
5165 | ret |
5011 | ret |
Line 5166... | Line 5012... | ||
5166 | 5012 | ||
5167 | 5013 | ||
5168 | .1: ; resolution |
5014 | .1: ; resolution |
5169 | mov eax, [_display.width] |
5015 | mov eax, [Screen_Max_X] |
5170 | shl eax, 16 |
5016 | shl eax, 16 |
5171 | mov ax, word [_display.height] |
5017 | mov ax, word [Screen_Max_Y] |
5172 | add eax, 0x00010001 |
5018 | add eax, 0x00010001 |
5173 | mov [esp+32], eax |
5019 | mov [esp+32], eax |
5174 | ret |
5020 | ret |
5175 | .2: ; bits per pixel |
5021 | .2: ; bits per pixel |
5176 | mov eax, [_display.bpp] |
5022 | mov eax, [_display.bits_per_pixel] |
5177 | mov [esp+32], eax |
5023 | mov [esp+32], eax |
5178 | ret |
5024 | ret |
5179 | .3: ; bytes per scanline |
5025 | .3: ; bytes per scanline |
Line 5252... | Line 5098... | ||
5252 | .drectr: |
5098 | .drectr: |
5253 | ret |
5099 | ret |
Line 5254... | Line 5100... | ||
5254 | 5100 | ||
5255 | align 4 |
5101 | align 4 |
5256 | syscall_getscreensize: ; GetScreenSize |
5102 | syscall_getscreensize: ; GetScreenSize |
5257 | mov ax, word [_display.width] |
5103 | mov ax, word [Screen_Max_X] |
5258 | shl eax, 16 |
5104 | shl eax, 16 |
5259 | mov ax, word [_display.height] |
5105 | mov ax, word [Screen_Max_Y] |
5260 | mov [esp + 32], eax |
5106 | mov [esp + 32], eax |
5261 | ret |
- | |
- | 5107 | ret |
|
5262 | 5108 | ;----------------------------------------------------------------------------- |
|
- | 5109 | align 4 |
|
- | 5110 | syscall_cdaudio: |
|
- | 5111 | ; ECX - position of CD/DVD-drive |
|
- | 5112 | ; from 0=Primary Master to 3=Secondary Slave for first IDE contr. |
|
- | 5113 | ; from 4=Primary Master to 7=Secondary Slave for second IDE contr. |
|
- | 5114 | ; from 8=Primary Master to 11=Secondary Slave for third IDE contr. |
|
- | 5115 | cmp ecx, 11 |
|
- | 5116 | ja .exit |
|
- | 5117 | ||
- | 5118 | mov eax, ecx |
|
- | 5119 | shr eax, 2 |
|
- | 5120 | lea eax, [eax*5] |
|
Line -... | Line 5121... | ||
- | 5121 | mov al, [eax+DRIVE_DATA+1] |
|
- | 5122 | ||
5263 | align 4 |
5123 | push ecx ebx |
- | 5124 | mov ebx, ecx |
|
- | 5125 | and ebx, 11b |
|
- | 5126 | shl ebx, 1 |
|
- | 5127 | mov cl, 6 |
|
- | 5128 | sub cl, bl |
|
- | 5129 | shr al, cl |
|
- | 5130 | test al, 2 ; it's not an ATAPI device |
|
- | 5131 | pop ebx ecx |
|
Line 5264... | Line 5132... | ||
5264 | 5132 | ||
5265 | syscall_cdaudio: ; CD |
- | |
5266 | 5133 | jz .exit |
|
- | 5134 | ||
5267 | cmp ebx, 4 |
5135 | cmp ebx, 4 |
5268 | jb .audio |
5136 | je .eject |
- | 5137 | ||
- | 5138 | cmp ebx, 5 |
|
- | 5139 | je .load |
|
- | 5140 | ;-------------------------------------- |
|
5269 | jz .eject |
5141 | .exit: |
5270 | cmp ebx, 5 |
5142 | ret |
5271 | jnz .ret |
5143 | ;-------------------------------------- |
5272 | .load: |
- | |
5273 | call .reserve |
5144 | .load: |
5274 | call LoadMedium |
5145 | call .reserve |
5275 | ;call .free |
5146 | call LoadMedium |
5276 | jmp .free |
5147 | jmp .free |
5277 | ; ret |
5148 | ;-------------------------------------- |
5278 | .eject: |
5149 | .eject: |
5279 | call .reserve |
5150 | call .reserve |
5280 | call clear_CD_cache |
- | |
5281 | call allow_medium_removal |
5151 | call clear_CD_cache |
5282 | call EjectMedium |
- | |
5283 | ; call .free |
- | |
5284 | jmp .free |
- | |
5285 | ; ret |
5152 | call allow_medium_removal |
5286 | .audio: |
- | |
5287 | call sys_cd_audio |
- | |
5288 | mov [esp+36-4], eax |
- | |
5289 | .ret: |
5153 | call EjectMedium |
5290 | ret |
5154 | jmp .free |
- | 5155 | ;-------------------------------------- |
|
- | 5156 | .reserve: |
|
- | 5157 | call reserve_cd |
|
- | 5158 | ||
- | 5159 | mov ebx, ecx |
|
5291 | 5160 | inc ebx |
|
5292 | .reserve: |
5161 | mov [cdpos], ebx |
5293 | call reserve_cd |
5162 | |
5294 | mov eax, ecx |
5163 | mov eax, ecx |
5295 | shr eax, 1 |
5164 | shr eax, 1 |
5296 | and eax, 1 |
5165 | and eax, 1 |
5297 | inc eax |
5166 | inc eax |
5298 | mov [ChannelNumber], ax |
5167 | mov [ChannelNumber], ax |
5299 | mov eax, ecx |
5168 | mov eax, ecx |
5300 | and eax, 1 |
- | |
5301 | mov [DiskNumber], al |
- | |
5302 | call reserve_cd_channel |
- | |
5303 | and ebx, 3 |
- | |
5304 | inc ebx |
- | |
5305 | mov [cdpos], ebx |
- | |
5306 | add ebx, ebx |
- | |
5307 | mov cl, 8 |
- | |
5308 | sub cl, bl |
- | |
5309 | mov al, [DRIVE_DATA+1] |
- | |
5310 | shr al, cl |
5169 | and eax, 1 |
- | 5170 | mov [DiskNumber], al |
|
5311 | test al, 2 |
5171 | call reserve_cd_channel |
5312 | jz .free;.err |
5172 | ret |
5313 | ret |
5173 | ;-------------------------------------- |
5314 | .free: |
5174 | .free: |
5315 | call free_cd_channel |
- | |
5316 | and [cd_status], 0 |
- | |
5317 | ret |
- | |
5318 | .err: |
- | |
5319 | call .free |
5175 | call free_cd_channel |
5320 | ; pop eax |
5176 | and [cd_status], 0 |
5321 | ret |
5177 | ret |
5322 | ;----------------------------------------------------------------------------- |
5178 | ;----------------------------------------------------------------------------- |
5323 | align 4 |
5179 | align 4 |
5324 | syscall_getpixel_WinMap: ; GetPixel WinMap |
5180 | syscall_getpixel_WinMap: ; GetPixel WinMap |
5325 | cmp ebx, [_display.width] |
5181 | cmp ebx, [Screen_Max_X] |
5326 | jb @f |
5182 | jbe @f |
5327 | cmp ecx, [_display.height] |
5183 | cmp ecx, [Screen_Max_Y] |
5328 | jb @f |
5184 | jbe @f |
5329 | xor eax, eax |
5185 | xor eax, eax |
5330 | jmp .store |
5186 | jmp .store |
Line 5340... | Line 5196... | ||
5340 | mov [esp + 32], eax |
5196 | mov [esp + 32], eax |
5341 | ret |
5197 | ret |
5342 | ;----------------------------------------------------------------------------- |
5198 | ;----------------------------------------------------------------------------- |
5343 | align 4 |
5199 | align 4 |
5344 | syscall_getpixel: ; GetPixel |
5200 | syscall_getpixel: ; GetPixel |
5345 | mov ecx, [_display.width] |
5201 | mov ecx, [Screen_Max_X] |
- | 5202 | inc ecx |
|
5346 | xor edx, edx |
5203 | xor edx, edx |
5347 | mov eax, ebx |
5204 | mov eax, ebx |
5348 | div ecx |
5205 | div ecx |
5349 | mov ebx, edx |
5206 | mov ebx, edx |
5350 | xchg eax, ebx |
5207 | xchg eax, ebx |
Line 5585... | Line 5442... | ||
5585 | ; edx - new Screen_Max_Y |
5442 | ; edx - new Screen_Max_Y |
Line 5586... | Line 5443... | ||
5586 | 5443 | ||
5587 | pushfd |
5444 | pushfd |
Line -... | Line 5445... | ||
- | 5445 | cli |
|
- | 5446 | ||
5588 | cli |
5447 | mov [Screen_Max_X], eax |
Line 5589... | Line 5448... | ||
5589 | 5448 | mov [Screen_Max_Y], edx |
|
5590 | mov [_display.pitch], ecx |
5449 | mov [_display.pitch], ecx |
Line 5626... | Line 5485... | ||
5626 | popad |
5485 | popad |
Line 5627... | Line 5486... | ||
5627 | 5486 | ||
5628 | call repos_windows |
5487 | call repos_windows |
5629 | xor eax, eax |
5488 | xor eax, eax |
5630 | xor ebx, ebx |
5489 | xor ebx, ebx |
5631 | mov ecx, [_display.width] |
5490 | mov ecx, [Screen_Max_X] |
5632 | mov edx, [_display.height] |
5491 | mov edx, [Screen_Max_Y] |
5633 | call calculatescreen |
5492 | call calculatescreen |
5634 | pop edi |
5493 | pop edi |
5635 | pop esi |
5494 | pop esi |
Line 5711... | Line 5570... | ||
5711 | cmp byte [BOOT_VARS+0x9030], 1 |
5570 | cmp byte [BOOT_VARS+0x9030], 1 |
5712 | jne @F |
5571 | jne @F |
5713 | ret |
5572 | ret |
5714 | @@: |
5573 | @@: |
5715 | call stop_all_services |
5574 | call stop_all_services |
5716 | movi eax, 3 |
- | |
5717 | call sys_cd_audio |
- | |
Line 5718... | Line 5575... | ||
5718 | 5575 | ||
- | 5576 | yes_shutdown_param: |
|
- | 5577 | ; Shutdown other CPUs, if initialized |
|
- | 5578 | cmp [ap_initialized], 0 |
|
- | 5579 | jz .no_shutdown_cpus |
|
- | 5580 | mov edi, [LAPIC_BASE] |
|
- | 5581 | add edi, 300h |
|
- | 5582 | mov esi, smpt+4 |
|
- | 5583 | mov ebx, [cpu_count] |
|
- | 5584 | dec ebx |
|
- | 5585 | .shutdown_cpus_loop: |
|
- | 5586 | lodsd |
|
- | 5587 | push esi |
|
- | 5588 | xor esi, esi |
|
- | 5589 | inc esi |
|
- | 5590 | shl eax, 24 |
|
- | 5591 | mov [edi+10h], eax |
|
- | 5592 | ; assert INIT IPI |
|
- | 5593 | mov dword [edi], 0C500h |
|
- | 5594 | call delay_ms |
|
- | 5595 | @@: |
|
- | 5596 | test dword [edi], 1000h |
|
- | 5597 | jnz @b |
|
- | 5598 | ; deassert INIT IPI |
|
- | 5599 | mov dword [edi], 8500h |
|
- | 5600 | call delay_ms |
|
- | 5601 | @@: |
|
- | 5602 | test dword [edi], 1000h |
|
- | 5603 | jnz @b |
|
- | 5604 | ; don't send STARTUP IPI: let other CPUs be in wait-for-startup state |
|
- | 5605 | pop esi |
|
- | 5606 | dec ebx |
|
- | 5607 | jnz .shutdown_cpus_loop |
|
- | 5608 | .no_shutdown_cpus: |
|
5719 | yes_shutdown_param: |
5609 | |
Line 5720... | Line 5610... | ||
5720 | cli |
5610 | cli |
5721 | 5611 | ||
5722 | if ~ defined extended_primary_loader |
5612 | if ~ defined extended_primary_loader |
Line 5738... | Line 5628... | ||
5738 | ; cld |
5628 | ; cld |
5739 | ; rep movsd |
5629 | ; rep movsd |
Line 5740... | Line 5630... | ||
5740 | 5630 | ||
Line 5741... | Line -... | ||
5741 | call IRQ_mask_all |
- | |
5742 | - | ||
5743 | if 0 |
- | |
5744 | mov word [OS_BASE+0x467+0], pr_mode_exit |
- | |
5745 | mov word [OS_BASE+0x467+2], 0x1000 |
- | |
5746 | - | ||
5747 | mov al, 0x0F |
- | |
5748 | out 0x70, al |
- | |
5749 | mov al, 0x05 |
- | |
5750 | out 0x71, al |
- | |
5751 | - | ||
5752 | mov al, 0xFE |
- | |
5753 | out 0x64, al |
- | |
5754 | - | ||
5755 | hlt |
- | |
5756 | jmp $-1 |
- | |
5757 | 5631 | call IRQ_mask_all |
|
5758 | else |
5632 | |
Line 5759... | Line 5633... | ||
5759 | cmp byte [OS_BASE + 0x9030], 2 |
5633 | cmp byte [OS_BASE + 0x9030], 2 |
5760 | jnz no_acpi_power_off |
5634 | jnz no_acpi_power_off |
Line 5899... | Line 5773... | ||
5899 | out dx, ax |
5773 | out dx, ax |
5900 | @@: |
5774 | @@: |
5901 | jmp $ |
5775 | jmp $ |
Line 5902... | Line -... | ||
5902 | - | ||
5903 | - | ||
5904 | no_acpi_power_off: |
- | |
5905 | mov word [OS_BASE+0x467+0], pr_mode_exit |
- | |
5906 | mov word [OS_BASE+0x467+2], 0x1000 |
- | |
5907 | - | ||
5908 | mov al, 0x0F |
- | |
5909 | out 0x70, al |
- | |
5910 | mov al, 0x05 |
- | |
5911 | out 0x71, al |
- | |
5912 | - | ||
5913 | mov al, 0xFE |
- | |
5914 | out 0x64, al |
- | |
5915 | - | ||
5916 | hlt |
- | |
5917 | jmp $-1 |
5776 | |
5918 | 5777 | ||
5919 | scan_rsdp: |
5778 | scan_rsdp: |
5920 | add eax, OS_BASE |
5779 | add eax, OS_BASE |
5921 | .s: |
5780 | .s: |
Line 5936... | Line 5795... | ||
5936 | add eax, 10h |
5795 | add eax, 10h |
5937 | loop .s |
5796 | loop .s |
5938 | stc |
5797 | stc |
5939 | .ok: |
5798 | .ok: |
5940 | ret |
5799 | ret |
- | 5800 | ||
- | 5801 | no_acpi_power_off: |
|
- | 5802 | call create_trampoline_pgmap |
|
- | 5803 | mov cr3, eax |
|
- | 5804 | jmp become_real+0x10000 |
|
- | 5805 | iglobal |
|
- | 5806 | align 4 |
|
- | 5807 | realmode_gdt: |
|
- | 5808 | ; selector 0 - not used |
|
- | 5809 | dw 23 |
|
- | 5810 | dd realmode_gdt-OS_BASE |
|
- | 5811 | dw 0 |
|
- | 5812 | ; selector 8 - code from 1000:0000 to 1000:FFFF |
|
- | 5813 | dw 0FFFFh |
|
- | 5814 | dw 0 |
|
- | 5815 | db 1 |
|
- | 5816 | db 10011011b |
|
- | 5817 | db 00000000b |
|
- | 5818 | db 0 |
|
- | 5819 | ; selector 10h - data from 1000:0000 to 1000:FFFF |
|
- | 5820 | dw 0FFFFh |
|
- | 5821 | dw 0 |
|
- | 5822 | db 1 |
|
- | 5823 | db 10010011b |
|
- | 5824 | db 00000000b |
|
- | 5825 | db 0 |
|
5941 | end if |
5826 | endg |
Line 5942... | Line 5827... | ||
5942 | 5827 | ||
5943 | if ~ lang eq sp |
5828 | if ~ lang eq sp |
5944 | diff16 "end of .text segment",0,$ |
5829 | diff16 "end of .text segment",0,$ |