Subversion Repositories Kolibri OS

Rev

Rev 2437 | Rev 2441 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2437 Rev 2439
Line 67... Line 67...
67
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
67
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 68... Line 68...
68
 
68
 
69
include 'macros.inc'
69
include 'macros.inc'
Line 70... Line 70...
70
include 'struct.inc'
70
include 'struct.inc'
Line 71... Line 71...
71
 
71
 
Line 72... Line 72...
72
$Revision: 2437 $
72
$Revision: 2439 $
Line 340... Line 340...
340
 
340
 
341
        mov     ebx, cr4
341
        mov     ebx, cr4
342
        or      ebx, CR4_PGE
342
        or      ebx, CR4_PGE
343
        mov     cr4, ebx
343
        mov     cr4, ebx
-
 
344
@@:
-
 
345
        mov     esi, [LAPIC_BASE]
344
@@:
346
        xor     ebp, ebp
-
 
347
.1:
-
 
348
        mov ebx, [esi+0x20]               ;apic_id
-
 
349
        shr ebx, 24
345
.1:
350
        shl ebx, 6+2
346
        mov ebx, LFB_BASE
351
        add ebx, LFB_BASE
347
        mov edx, 128
352
        mov edx, 32
348
.2:
353
.2:
349
        mov ecx, 128
354
        mov ecx, 32
350
        mov edi, ebx
355
        mov edi, ebx
351
        mov eax, [_display.width]
356
        mov eax, [_display.width]
352
        lea ebx, [ebx+eax*4]
357
        lea ebx, [ebx+eax*4]
353
        mov eax, 0xFF808080
358
        mov eax, ebp
354
        rep stosd
359
        rep stosd
355
        dec edx
360
        dec edx
-
 
361
        jnz .2
356
        jnz .2
362
        dec ebp
Line 357... Line 363...
357
        jmp .1
363
        jmp .1
358
 
364
 
Line 464... Line 470...
464
@@:
470
@@:
465
        mov     eax, [_display.width]
471
        mov     eax, [_display.width]
466
        mul     [_display.height]
472
        mul     [_display.height]
467
        mov     [_WinMapSize], eax
473
        mov     [_WinMapSize], eax
Line -... Line 474...
-
 
474
 
-
 
475
        call    calculate_fast_getting_offset_for_WinMapAddress
468
 
476
 
469
        mov     esi, BOOT_VAR+0x9080
477
        mov     esi, BOOT_VAR+0x9080
470
        movzx   ecx, byte [esi-1]
478
        movzx   ecx, byte [esi-1]
471
        mov     [NumBiosDisks], ecx
479
        mov     [NumBiosDisks], ecx
472
        mov     edi, BiosDisksData
480
        mov     edi, BiosDisksData
Line 481... Line 489...
481
        cmp     [SCR_MODE], word 0100000000000000b
489
        cmp     [SCR_MODE], word 0100000000000000b
482
        jge     setvesa20
490
        jge     setvesa20
483
        cmp     [SCR_MODE], word 0x13  ; EGA 320*200 256 colors
491
        cmp     [SCR_MODE], word 0x13  ; EGA 320*200 256 colors
484
        je      v20ga32
492
        je      v20ga32
485
        jmp     v20ga24
493
        jmp     v20ga24
486
;        mov     [PUTPIXEL], dword Vesa12_putpixel24 ; Vesa 1.2
-
 
487
;        mov     [GETPIXEL], dword Vesa12_getpixel24
-
 
488
;        cmp     [ScreenBPP], byte 24
-
 
489
;        jz      ga24
-
 
490
;        mov     [PUTPIXEL], dword Vesa12_putpixel32
-
 
491
;        mov     [GETPIXEL], dword Vesa12_getpixel32
-
 
492
;      ga24:
494
 
493
;        jmp     v20ga24
-
 
494
setvesa20:
495
setvesa20:
495
        mov     [PUTPIXEL], dword Vesa20_putpixel24 ; Vesa 2.0
496
        mov     [PUTPIXEL], dword Vesa20_putpixel24 ; Vesa 2.0
496
        mov     [GETPIXEL], dword Vesa20_getpixel24
497
        mov     [GETPIXEL], dword Vesa20_getpixel24
497
        cmp     [ScreenBPP], byte 24
498
        cmp     [ScreenBPP], byte 24
498
        jz      v20ga24
499
        jz      v20ga24
Line 683... Line 684...
683
; Try to Initialize APIC
684
; Try to Initialize APIC
684
        call    APIC_init
685
        call    APIC_init
Line 685... Line 686...
685
 
686
 
Line -... Line 687...
-
 
687
        call    LAPIC_init
-
 
688
 
-
 
689
        mov     eax, 1
686
        call    LAPIC_init
690
        call    start_ap
687
 
691
 
688
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
692
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
689
; they are used: when partitions are scanned, hd_read relies on timer
693
; they are used: when partitions are scanned, hd_read relies on timer
690
        call    unmask_timer
694
        call    unmask_timer
Line 1990... Line 1994...
1990
        cmp     [_display.select_cursor], 0
1994
        cmp     [_display.select_cursor], 0
1991
        je      @f
1995
        je      @f
1992
; restore default cursor before killing
1996
; restore default cursor before killing
1993
        pusha
1997
        pusha
1994
        mov     ecx, [current_slot]
1998
        mov     ecx, [current_slot]
1995
        mov     eax, [def_cursor]
-
 
1996
        mov     [ecx+APPDATA.cursor], eax
-
 
1997
 
-
 
1998
        movzx   eax, word [MOUSE_Y]
-
 
1999
        movzx   ebx, word [MOUSE_X]
-
 
2000
        mov     ecx, [Screen_Max_X]
-
 
2001
        inc     ecx
-
 
2002
        mul     ecx
-
 
2003
        add     eax, [_WinMapAddress]
-
 
2004
        movzx   edx, byte [ebx+eax]
-
 
2005
        shl     edx, 8
-
 
2006
        mov     esi, [edx+SLOT_BASE+APPDATA.cursor]
-
 
2007
        push    esi
-
 
2008
        call    [_display.select_cursor]
1999
        call    restore_default_cursor_before_killing
2009
        mov     [current_cursor], esi
-
 
2010
        popa
2000
        popa
2011
@@:
2001
@@:
2012
;--------------------------------------
2002
;--------------------------------------
2013
        mov     ecx, [current_slot]
2003
        mov     ecx, [current_slot]
2014
        mov     eax, [ecx+APPDATA.tls_base]
2004
        mov     eax, [ecx+APPDATA.tls_base]
Line 2023... Line 2013...
2023
 
2013
 
2024
    waitterm:            ; wait here for termination
2014
    waitterm:            ; wait here for termination
2025
        mov     ebx, 100
2015
        mov     ebx, 100
2026
        call    delay_hs
2016
        call    delay_hs
-
 
2017
        jmp     waitterm
-
 
2018
;------------------------------------------------------------------------------
-
 
2019
restore_default_cursor_before_killing:
-
 
2020
        mov     eax, [def_cursor]
Line -... Line 2021...
-
 
2021
        mov     [ecx+APPDATA.cursor], eax
-
 
2022
 
-
 
2023
        movzx   eax, word [MOUSE_Y]
-
 
2024
        movzx   ebx, word [MOUSE_X]
-
 
2025
        mov     ecx, [Screen_Max_X]
-
 
2026
        inc     ecx
-
 
2027
        mul     ecx
-
 
2028
        add     eax, [_WinMapAddress]
-
 
2029
        movzx   edx, byte [ebx+eax]
-
 
2030
        shl     edx, 8
-
 
2031
        mov     esi, [edx+SLOT_BASE+APPDATA.cursor]
-
 
2032
        push    esi
-
 
2033
        call    [_display.select_cursor]
-
 
2034
        mov     [current_cursor], esi
2027
        jmp     waitterm
2035
        ret
2028
 
2036
;------------------------------------------------------------------------------
2029
iglobal
2037
iglobal
2030
align 4
2038
align 4
2031
sys_system_table:
2039
sys_system_table:
Line 2099... Line 2107...
2099
        je      @f
2107
        je      @f
2100
; restore default cursor before killing
2108
; restore default cursor before killing
2101
        pusha
2109
        pusha
2102
        mov     ecx, [esp+32]
2110
        mov     ecx, [esp+32]
2103
        shl     ecx, 8
2111
        shl     ecx, 8
2104
        mov     eax, [def_cursor]
-
 
2105
        mov     [ecx+SLOT_BASE+APPDATA.cursor], eax
-
 
2106
 
-
 
2107
        movzx   eax, word [MOUSE_Y]
-
 
2108
        movzx   ebx, word [MOUSE_X]
-
 
2109
        mov     ecx, [Screen_Max_X]
2112
        add     ecx, SLOT_BASE
2110
        inc     ecx
-
 
2111
        mul     ecx
-
 
2112
        add     eax, [_WinMapAddress]
-
 
2113
        movzx   edx, byte [ebx+eax]
-
 
2114
        shl     edx, 8
-
 
2115
        mov     esi, [edx+SLOT_BASE+APPDATA.cursor]
-
 
2116
        push    esi
-
 
2117
        call    [_display.select_cursor]
2113
        call    restore_default_cursor_before_killing
2118
        mov     [current_cursor], esi
-
 
2119
        popa
2114
        popa
2120
@@:
2115
@@:
2121
        add     esp, 4
2116
        add     esp, 4
2122
;--------------------------------------
2117
;--------------------------------------
2123
     ;call MEM_Heap_Lock      ;guarantee that process isn't working with heap
2118
     ;call MEM_Heap_Lock      ;guarantee that process isn't working with heap
Line 4873... Line 4868...
4873
 
4868
 
Line 4874... Line 4869...
4874
        ret
4869
        ret
4875
 
4870
 
-
 
4871
paleholder:
-
 
4872
        ret
-
 
4873
;------------------------------------------------------------------------------
-
 
4874
align 4
-
 
4875
calculate_fast_getting_offset_for_WinMapAddress:
-
 
4876
; calculate data area for fast getting offset to _WinMapAddress
-
 
4877
        mov     eax, [_display.width]
-
 
4878
        mov     ecx, [_display.height]
-
 
4879
        inc     ecx
4876
paleholder:
4880
        mov     edi, d_width_calc_area
-
 
4881
        cld
-
 
4882
@@:
-
 
4883
        stosd
-
 
4884
        add     eax, [_display.width]
-
 
4885
        dec     ecx
-
 
4886
        jnz     @r
4877
        ret
4887
        ret
4878
 
4888
;------------------------------------------------------------------------------
4879
align 4
4889
align 4
4880
set_screen:
4890
set_screen:
Line 4910... Line 4920...
4910
        stdcall kernel_alloc, eax
4920
        stdcall kernel_alloc, eax
4911
        mov     [_WinMapAddress], eax
4921
        mov     [_WinMapAddress], eax
4912
        test    eax, eax
4922
        test    eax, eax
4913
        jz      .epic_fail
4923
        jz      .epic_fail
Line -... Line 4924...
-
 
4924
 
-
 
4925
        call    calculate_fast_getting_offset_for_WinMapAddress
4914
 
4926
 
Line 4915... Line 4927...
4915
        popad
4927
        popad
4916
 
4928
 
4917
        call    repos_windows
4929
        call    repos_windows