Subversion Repositories Kolibri OS

Rev

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

Rev 543 Rev 546
Line 53... Line 53...
53
;;
53
;;
54
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
54
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 55... Line 55...
55
 
55
 
Line 56... Line 56...
56
include 'macros.inc'
56
include 'macros.inc'
Line 57... Line 57...
57
 
57
 
58
$Revision: 543 $
58
$Revision: 546 $
59
 
59
 
Line 2344... Line 2344...
2344
  yes_floppy_save:
2344
  yes_floppy_save:
2345
    ret
2345
    ret
Line 2346... Line 2346...
2346
 
2346
 
2347
uglobal
2347
uglobal
-
 
2348
;  bgrchanged  dd  0x0
-
 
2349
bgrlock db 0
2348
;  bgrchanged  dd  0x0
2350
bgrlockpid dd 0
Line 2349... Line 2351...
2349
endg
2351
endg
Line 2350... Line 2352...
2350
 
2352
 
2351
sys_background:
2353
sys_background:
2352
 
2354
 
2353
    cmp   eax,1                            ; BACKGROUND SIZE
2355
    cmp   eax,1                            ; BACKGROUND SIZE
2354
    jnz   nosb1
2356
    jnz   nosb1
2355
    cmp   ebx,0
2357
    cmp   ebx,0
-
 
2358
    je    sbgrr
-
 
2359
    cmp   ecx,0
-
 
2360
    je    sbgrr
-
 
2361
@@:
-
 
2362
        mov     al, 1
-
 
2363
        xchg    [bgrlock], al
-
 
2364
        test    al, al
-
 
2365
        jz      @f
2356
    je    sbgrr
2366
        call    change_task
2357
    cmp   ecx,0
2367
        jmp     @b
2358
    je    sbgrr
2368
@@:
Line 2359... Line 2369...
2359
    mov   [BgrDataWidth],ebx
2369
    mov   [BgrDataWidth],ebx
Line 2377... Line 2387...
2377
    mov  eax,[BgrDataWidth]
2387
    mov  eax,[BgrDataWidth]
2378
    imul eax,[BgrDataHeight]
2388
    imul eax,[BgrDataHeight]
2379
    lea  eax,[eax*3]
2389
    lea  eax,[eax*3]
2380
    mov  [mem_BACKGROUND],eax
2390
    mov  [mem_BACKGROUND],eax
2381
; get memory for new background
2391
; get memory for new background
2382
    stdcall kernel_alloc, [mem_BACKGROUND]
2392
    stdcall kernel_alloc, eax
2383
    test eax, eax
2393
    test eax, eax
2384
    jz .exit_mem
2394
    jz .exit_mem
2385
    mov [img_background], eax
2395
    mov [img_background], eax
2386
.exit_mem:
2396
.exit_mem:
2387
    popad
2397
    popad
-
 
2398
        mov     [bgrlock], 0
Line 2388... Line 2399...
2388
 
2399
 
2389
  sbgrr:
2400
  sbgrr:
Line 2390... Line 2401...
2390
    ret
2401
    ret
Line 2442... Line 2453...
2442
    call  memmove
2453
    call  memmove
2443
  .fin:
2454
  .fin:
2444
    ret
2455
    ret
2445
  nosb5:
2456
  nosb5:
Line -... Line 2457...
-
 
2457
 
-
 
2458
        cmp     eax, 6
-
 
2459
        jnz     nosb6
-
 
2460
@@:
-
 
2461
        mov     al, 1
-
 
2462
        xchg    [bgrlock], al
-
 
2463
        test    al, al
-
 
2464
        jz      @f
-
 
2465
        call    change_task
-
 
2466
        jmp     @b
-
 
2467
@@:
-
 
2468
        mov     eax, [CURRENT_TASK]
-
 
2469
        mov     [bgrlockpid], eax
-
 
2470
        stdcall user_alloc, [mem_BACKGROUND]
-
 
2471
        mov     [esp+36], eax
-
 
2472
        test    eax, eax
-
 
2473
        jz      .nomem
-
 
2474
        mov     ebx, eax
-
 
2475
        shr     ebx, 12
-
 
2476
        or      dword [page_tabs+(ebx-1)*4], DONT_FREE_BLOCK
-
 
2477
        mov     esi, [img_background]
-
 
2478
        shr     esi, 12
-
 
2479
        mov     ecx, [mem_BACKGROUND]
-
 
2480
        add     ecx, 0xFFF
-
 
2481
        shr     ecx, 12
-
 
2482
.z:
-
 
2483
        mov     eax, [page_tabs+ebx*4]
-
 
2484
        test    al, 1
-
 
2485
        jz      @f
-
 
2486
        call    free_page
-
 
2487
@@:
-
 
2488
        mov     eax, [page_tabs+esi*4]
-
 
2489
        or      al, PG_UW
-
 
2490
        mov     [page_tabs+ebx*4], eax
-
 
2491
        mov     eax, ebx
-
 
2492
        shl     eax, 12
-
 
2493
        invlpg  [eax]
-
 
2494
        inc     ebx
-
 
2495
        inc     esi
-
 
2496
        loop    .z
-
 
2497
        ret
-
 
2498
.nomem:
-
 
2499
        and     [bgrlockpid], 0
-
 
2500
        mov     [bgrlock], 0
-
 
2501
nosb6:
-
 
2502
        cmp     eax, 7
-
 
2503
        jnz     nosb7
-
 
2504
        cmp     [bgrlock], 0
-
 
2505
        jz      .err
-
 
2506
        mov     eax, [CURRENT_TASK]
-
 
2507
        cmp     [bgrlockpid], eax
-
 
2508
        jnz     .err
-
 
2509
        mov     eax, ebx
-
 
2510
        shr     eax, 12
-
 
2511
        mov     ecx, [page_tabs+(eax-1)*4]
-
 
2512
        test    cl, USED_BLOCK+DONT_FREE_BLOCK
-
 
2513
        jz      .err
-
 
2514
        jnp     .err
-
 
2515
        push    eax
-
 
2516
        shr     ecx, 12
-
 
2517
@@:
-
 
2518
        and     dword [page_tabs+eax*4], 0
-
 
2519
        mov     edx, eax
-
 
2520
        shl     edx, 12
-
 
2521
        invlpg  [edx]
-
 
2522
        inc     eax
-
 
2523
        loop    @b
-
 
2524
        pop     eax
-
 
2525
        and     dword [page_tabs+(eax-1)*4], not DONT_FREE_BLOCK
-
 
2526
        stdcall user_free, ebx
-
 
2527
        mov     [esp+36], eax
-
 
2528
        and     [bgrlockpid], 0
-
 
2529
        mov     [bgrlock], 0
-
 
2530
        ret
-
 
2531
.err:
-
 
2532
        and     dword [esp+36], 0
-
 
2533
        ret
-
 
2534
 
2446
 
2535
nosb7:
Line 2447... Line 2536...
2447
    ret
2536
    ret