Subversion Repositories Kolibri OS

Rev

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

Rev 3727 Rev 3732
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: 3727 $
74
$Revision: 3732 $
Line 263... Line 263...
263
        shr     ecx, 2
263
        shr     ecx, 2
264
        rep stosd
264
        rep stosd
Line 265... Line 265...
265
 
265
 
Line 266... Line -...
266
; SAVE & CLEAR 0-0xffff
-
 
267
 
-
 
268
        xor     esi, esi
-
 
269
        mov     edi, (BOOT_VAR-OS_BASE)
-
 
270
        mov     ecx, 0x10000 / 4
266
; SAVE & CLEAR 0-0xffff
271
        rep movsd
267
 
-
 
268
        mov     edi, 0x1000
-
 
269
        mov     ecx, 0x8000 / 4
-
 
270
        rep stosd
272
        mov     edi, 0x1000
271
        mov     edi, 0xa000
Line 273... Line 272...
273
        mov     ecx, 0xf000 / 4
272
        mov     ecx, 0x6000 / 4
274
        rep stosd
273
        rep stosd
Line 357... Line 356...
357
        mov     ecx, application_table_mutex
356
        mov     ecx, application_table_mutex
358
        call    mutex_init
357
        call    mutex_init
Line 359... Line 358...
359
 
358
 
360
; SAVE REAL MODE VARIABLES
359
; SAVE REAL MODE VARIABLES
361
        xor     eax, eax
360
        xor     eax, eax
362
        mov     ax, [BOOT_VAR + BOOT_IDE_PI_16]
361
        mov     ax, [BOOT_VARS + BOOT_IDE_PI_16]
363
        mov     [IDEContrProgrammingInterface], ax
362
        mov     [IDEContrProgrammingInterface], ax
364
        mov     ax, [BOOT_VAR + BOOT_IDE_BASE_ADDR]
363
        mov     ax, [BOOT_VARS + BOOT_IDE_BASE_ADDR]
365
        mov     [IDEContrRegsBaseAddr], ax
364
        mov     [IDEContrRegsBaseAddr], ax
366
        mov     ax, [BOOT_VAR + BOOT_IDE_BAR0_16]
365
        mov     ax, [BOOT_VARS + BOOT_IDE_BAR0_16]
Line 367... Line 366...
367
        mov     [IDE_BAR0_val], ax
366
        mov     [IDE_BAR0_val], ax
368
        
367
 
369
        cmp     ax, 0
368
        cmp     ax, 0
Line 373... Line 372...
373
        and     ax, 0xfff0
372
        and     ax, 0xfff0
374
        mov     [StandardATABases], ax
373
        mov     [StandardATABases], ax
375
        mov     [hd_address_table], eax
374
        mov     [hd_address_table], eax
376
        mov     [hd_address_table+8], eax
375
        mov     [hd_address_table+8], eax
377
@@:
376
@@:
378
        mov     ax, [BOOT_VAR + BOOT_IDE_BAR1_16]
377
        mov     ax, [BOOT_VARS + BOOT_IDE_BAR1_16]
379
        mov     [IDE_BAR1_val], ax
378
        mov     [IDE_BAR1_val], ax
380
        mov     ax, [BOOT_VAR + BOOT_IDE_BAR2_16]
379
        mov     ax, [BOOT_VARS + BOOT_IDE_BAR2_16]
381
        mov     [IDE_BAR2_val], ax
380
        mov     [IDE_BAR2_val], ax
Line 382... Line 381...
382
 
381
 
383
        cmp     ax, 0
382
        cmp     ax, 0
384
        je      @f
383
        je      @f
Line 387... Line 386...
387
        and     ax, 0xfff0
386
        and     ax, 0xfff0
388
        mov     [StandardATABases+2], ax
387
        mov     [StandardATABases+2], ax
389
        mov     [hd_address_table+16], eax
388
        mov     [hd_address_table+16], eax
390
        mov     [hd_address_table+24], eax
389
        mov     [hd_address_table+24], eax
391
@@:
390
@@:
392
        mov     ax, [BOOT_VAR + BOOT_IDE_BAR3_16]
391
        mov     ax, [BOOT_VARS + BOOT_IDE_BAR3_16]
393
        mov     [IDE_BAR3_val], ax
392
        mov     [IDE_BAR3_val], ax
Line 394... Line 393...
394
        
393
 
Line 395... Line 394...
395
; --------------- APM ---------------------
394
; --------------- APM ---------------------
396
 
395
 
397
; init selectors
396
; init selectors
398
        mov     ebx, [BOOT_VAR+BOOT_APM_ENTRY]        ; offset of APM entry point
397
        mov     ebx, [BOOT_VARS+BOOT_APM_ENTRY]        ; offset of APM entry point
399
        movzx   eax, word [BOOT_VAR+BOOT_APM_CODE_32] ; real-mode segment base address of
398
        movzx   eax, word [BOOT_VARS+BOOT_APM_CODE_32] ; real-mode segment base address of
400
                                                                                ; protected-mode 32-bit code segment
399
                                                                                ; protected-mode 32-bit code segment
401
        movzx   ecx, word [BOOT_VAR+BOOT_APM_CODE_16]; real-mode segment base address of
400
        movzx   ecx, word [BOOT_VARS+BOOT_APM_CODE_16]; real-mode segment base address of
402
                                                                                ; protected-mode 16-bit code segment
401
                                                                                ; protected-mode 16-bit code segment
Line 403... Line 402...
403
        movzx   edx, word [BOOT_VAR+BOOT_APM_DATA_16]; real-mode segment base address of
402
        movzx   edx, word [BOOT_VARS+BOOT_APM_DATA_16]; real-mode segment base address of
404
                                                                                ; protected-mode 16-bit data segment
403
                                                                                ; protected-mode 16-bit data segment
405
 
404
 
Line 419... Line 418...
419
        mov     [dword apm_data_16 + 4], dl
418
        mov     [dword apm_data_16 + 4], dl
Line 420... Line 419...
420
 
419
 
421
        mov     dword[apm_entry], ebx
420
        mov     dword[apm_entry], ebx
Line 422... Line 421...
422
        mov     word [apm_entry + 4], apm_code_32 - gdts
421
        mov     word [apm_entry + 4], apm_code_32 - gdts
423
 
422
 
424
        mov     eax, [BOOT_VAR + BOOT_APM_VERSION] ; version & flags
423
        mov     eax, [BOOT_VARS + BOOT_APM_VERSION] ; version & flags
425
        mov     [apm_vf], eax
424
        mov     [apm_vf], eax
426
; -----------------------------------------
425
; -----------------------------------------
427
        mov     al, [BOOT_VAR+BOOT_DMA]            ; DMA access
426
        mov     al, [BOOT_VARS+BOOT_DMA]            ; DMA access
428
        mov     [allow_dma_access], al
427
        mov     [allow_dma_access], al
429
        movzx   eax, byte [BOOT_VAR+BOOT_BPP]      ; bpp
428
        movzx   eax, byte [BOOT_VARS+BOOT_BPP]      ; bpp
Line 430... Line 429...
430
        mov     [_display.bpp], eax
429
        mov     [_display.bpp], eax
431
        mov     [_display.vrefresh], 60
430
        mov     [_display.vrefresh], 60
432
 
431
 
433
        movzx   eax, word [BOOT_VAR+BOOT_X_RES]; X max
432
        movzx   eax, word [BOOT_VARS+BOOT_X_RES]; X max
434
        mov     [_display.width], eax
433
        mov     [_display.width], eax
435
        mov     [display_width_standard], eax
434
        mov     [display_width_standard], eax
436
        dec     eax
435
        dec     eax
437
        mov     [Screen_Max_X], eax
436
        mov     [Screen_Max_X], eax
438
        mov     [screen_workarea.right], eax
437
        mov     [screen_workarea.right], eax
439
        movzx   eax, word [BOOT_VAR+BOOT_Y_RES]; Y max
438
        movzx   eax, word [BOOT_VARS+BOOT_Y_RES]; Y max
440
        mov     [_display.height], eax
439
        mov     [_display.height], eax
441
        mov     [display_height_standard], eax
440
        mov     [display_height_standard], eax
442
        dec     eax
441
        dec     eax
443
        mov     [Screen_Max_Y], eax
442
        mov     [Screen_Max_Y], eax
444
        mov     [screen_workarea.bottom], eax
443
        mov     [screen_workarea.bottom], eax
445
        movzx   eax, word [BOOT_VAR+BOOT_VESA_MODE] ; screen mode
444
        movzx   eax, word [BOOT_VARS+BOOT_VESA_MODE] ; screen mode
446
        mov     dword [SCR_MODE], eax
445
        mov     dword [SCR_MODE], eax
447
;        mov     eax, [BOOT_VAR+0x9014]             ; Vesa 1.2 bnk sw add
446
;        mov     eax, [BOOT_VAR+0x9014]             ; Vesa 1.2 bnk sw add
448
;        mov     [BANK_SWITCH], eax
447
;        mov     [BANK_SWITCH], eax
449
        mov     eax, 640 *4                         ; Bytes PerScanLine
448
        mov     eax, 640 *4                         ; Bytes PerScanLine
450
        cmp     [SCR_MODE], word 0x13               ; 320x200
449
        cmp     [SCR_MODE], word 0x13               ; 320x200
451
        je      @f
450
        je      @f
452
        cmp     [SCR_MODE], word 0x12               ; VGA 640x480
451
        cmp     [SCR_MODE], word 0x12               ; VGA 640x480
453
        je      @f
452
        je      @f
454
        movzx   eax, word[BOOT_VAR+BOOT_PITCH]      ; for other modes
453
        movzx   eax, word[BOOT_VARS+BOOT_PITCH]      ; for other modes
455
@@:
454
@@:
456
        mov     [_display.pitch], eax
455
        mov     [_display.pitch], eax
Line 462... Line 461...
462
; for Qemu or non standart video cards
461
; for Qemu or non standart video cards
463
; Unfortunately [BytesPerScanLine] does not always
462
; Unfortunately [BytesPerScanLine] does not always
464
;                             equal to [_display.width] * [ScreenBPP] / 8
463
;                             equal to [_display.width] * [ScreenBPP] / 8
465
        call    calculate_fast_getting_offset_for_LFB
464
        call    calculate_fast_getting_offset_for_LFB
Line 466... Line 465...
466
 
465
 
467
        mov     esi, BOOT_VAR+0x9080
466
        mov     esi, BOOT_VARS+0x9080
468
        movzx   ecx, byte [esi-1]
467
        movzx   ecx, byte [esi-1]
469
        mov     [NumBiosDisks], ecx
468
        mov     [NumBiosDisks], ecx
470
        mov     edi, BiosDisksData
469
        mov     edi, BiosDisksData
Line 471... Line 470...
471
        rep movsd
470
        rep movsd
Line 472... Line 471...
472
 
471
 
473
; GRAPHICS ADDRESSES
472
; GRAPHICS ADDRESSES
Line 474... Line 473...
474
 
473
 
475
        mov     eax, [BOOT_VAR+BOOT_LFB]
474
        mov     eax, [BOOT_VARS+BOOT_LFB]
476
        mov     [LFBAddress], eax
475
        mov     [LFBAddress], eax
Line 915... Line 914...
915
                [SLOT_BASE+256+APPDATA.io_map+4], PG_MAP
914
                [SLOT_BASE+256+APPDATA.io_map+4], PG_MAP
Line 916... Line 915...
916
 
915
 
917
; LOAD FIRST APPLICATION
916
; LOAD FIRST APPLICATION
Line 918... Line -...
918
        cli
-
 
919
 
-
 
920
;        cmp   byte [BOOT_VAR+0x9030],1
-
 
921
;        jne   no_load_vrr_m
-
 
922
 
-
 
923
;        mov     ebp, vrr_m
-
 
924
;        call    fs_execute_from_sysdir
-
 
925
;
-
 
926
;;        cmp   eax,2                  ; if vrr_m app found (PID=2)
-
 
927
;       sub   eax,2
-
 
928
;        jz    first_app_found
-
 
929
;
-
 
930
;no_load_vrr_m:
917
        cli
931
 
918
 
932
        mov     ebp, firstapp
-
 
933
        call    fs_execute_from_sysdir
-
 
934
 
919
        mov     ebp, firstapp
935
;        cmp   eax,2                  ; continue if a process has been loaded
920
        call    fs_execute_from_sysdir
Line 936... Line 921...
936
        test    eax, eax
921
        test    eax, eax
937
        jns     first_app_found
922
        jns     first_app_found
Line 1282... Line 1267...
1282
.fl60:
1267
.fl60:
1283
        in      al, 0x60
1268
        in      al, 0x60
1284
        loop    .fl60
1269
        loop    .fl60
1285
        push    eax
1270
        push    eax
Line 1286... Line 1271...
1286
 
1271
 
1287
        mov     ax, [BOOT_VAR+BOOT_Y_RES]
1272
        mov     ax, [BOOT_VARS+BOOT_Y_RES]
1288
        shr     ax, 1
1273
        shr     ax, 1
1289
        shl     eax, 16
1274
        shl     eax, 16
1290
        mov     ax, [BOOT_VAR+BOOT_X_RES]
1275
        mov     ax, [BOOT_VARS+BOOT_X_RES]
1291
        shr     ax, 1
1276
        shr     ax, 1
1292
        mov     [MOUSE_X], eax
1277
        mov     [MOUSE_X], eax
Line 1293... Line 1278...
1293
        call    wakeup_osloop
1278
        call    wakeup_osloop
Line 2172... Line 2157...
2172
sysfn_shutdown:          ; 18.9 = system shutdown
2157
sysfn_shutdown:          ; 18.9 = system shutdown
2173
        cmp     ecx, 1
2158
        cmp     ecx, 1
2174
        jl      exit_for_anyone
2159
        jl      exit_for_anyone
2175
        cmp     ecx, 4
2160
        cmp     ecx, 4
2176
        jg      exit_for_anyone
2161
        jg      exit_for_anyone
2177
        mov     [BOOT_VAR+0x9030], cl
2162
        mov     [BOOT_VARS+0x9030], cl
Line 2178... Line 2163...
2178
 
2163
 
2179
        mov     eax, [TASK_COUNT]
2164
        mov     eax, [TASK_COUNT]
2180
        mov     [SYS_SHUTDOWN], al
2165
        mov     [SYS_SHUTDOWN], al
2181
        mov     [shutdown_processes], eax
2166
        mov     [shutdown_processes], eax
Line 5626... Line 5611...
5626
        ret
5611
        ret
Line 5627... Line 5612...
5627
 
5612
 
5628
align 4
5613
align 4
Line 5629... Line 5614...
5629
system_shutdown:          ; shut down the system
5614
system_shutdown:          ; shut down the system
5630
 
5615
 
5631
        cmp     byte [BOOT_VAR+0x9030], 1
5616
        cmp     byte [BOOT_VARS+0x9030], 1
5632
        jne     @F
5617
        jne     @F
5633
        ret
5618
        ret
5634
@@:
5619
@@:
Line 5651... Line 5636...
5651
        mov     edi, OS_BASE+0x40000
5636
        mov     edi, OS_BASE+0x40000
5652
        mov     ecx, 1000
5637
        mov     ecx, 1000
5653
        rep movsb
5638
        rep movsb
5654
end if
5639
end if
Line 5655... Line 5640...
5655
 
5640
 
5656
        mov     esi, BOOT_VAR    ; restore 0x0 - 0xffff
5641
;        mov     esi, BOOT_VAR    ; restore 0x0 - 0xffff
5657
        mov     edi, OS_BASE
5642
;        mov     edi, OS_BASE
5658
        mov     ecx, 0x10000/4
5643
;        mov     ecx, 0x10000/4
5659
        cld
5644
;        cld
Line 5660... Line 5645...
5660
        rep movsd
5645
;        rep movsd
Line 5661... Line 5646...
5661
 
5646