Subversion Repositories Kolibri OS

Rev

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

Rev 163 Rev 164
Line 8... Line 8...
8
;;
8
;;
9
;;
9
;;
10
;;   Compile with last version FASM
10
;;   Compile with last version FASM
11
;;
11
;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
13
include "proc32.inc"
13
include "kglobals.inc"
14
include "kglobals.inc"
14
include "lang.inc"
15
include "lang.inc"
Line -... Line 16...
-
 
16
 
-
 
17
include "const.inc"
-
 
18
 
-
 
19
NEW    equ 0
15
 
20
 
16
WinMapAddress           equ     0x460000
21
;WinMapAddress      equ     0x460000
Line 17... Line 22...
17
display_data       = 0x460000
22
;display_data       = 0x460000
Line 18... Line 23...
18
 
23
 
19
max_processes      equ   255
24
max_processes      equ   255
20
 
25
 
21
window_data        equ   0x0000
26
;window_data        equ   0x0000
22
tss_data           equ   0xD20000
27
;tss_data           equ   0xD20000
23
;tss_step           equ   (128+2048) ; tss & i/o - 16384 ports, * 256=557056
28
;tss_step           equ   (128+2048) ; tss & i/o - 16384 ports, * 256=557056
24
tss_step           equ   (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
-
 
Line 25... Line 29...
25
draw_data          equ   0xC00000
29
tss_step           equ   (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
Line 26... Line 30...
26
sysint_stack_data  equ   0xC03000
30
;draw_data          equ   0xC00000
27
 
31
;sysint_stack_data  equ   0xC03000
28
 
32
 
29
twdw               equ   (0x3000-window_data)
33
;twdw               equ   (0x3000-window_data)
Line 114... Line 118...
114
 
118
 
Line 115... Line 119...
115
 
119
 
116
 
-
 
117
; CR0 Flags - Protected mode and Paging
-
 
118
 
-
 
119
        mov     ecx,0x00000001
-
 
120
        ;and     ebx,65535
-
 
121
        ;cmp     ebx,00100000000000000b ; lfb -> paging
-
 
122
        ;jb      no_paging
-
 
123
        ;mov     ax,0x0000
-
 
124
        ;mov     es,ax
-
 
125
        ;mov     al,[es:0x901E]
-
 
Line 126... Line 120...
126
        ;cmp     al,1
120
 
Line 127... Line 121...
127
        ;je      no_paging
121
; CR0 Flags - Protected mode and Paging
Line 226... Line 220...
226
 
220
 
Line 227... Line 221...
227
.bll2:   popad
221
.bll2:   popad
Line 228... Line -...
228
 
-
 
229
         ret
-
 
230
 
-
 
231
uglobal
-
 
232
  cpuid_0    dd  0,0,0,0
-
 
233
  cpuid_1    dd  0,0,0,0
-
 
234
  cpuid_2    dd  0,0,0,0
-
 
235
  cpuid_3    dd  0,0,0,0
222
 
236
endg
223
         ret
237
 
224
 
238
iglobal
225
iglobal
239
  firstapp   db  '/rd/1/LAUNCHER',0
226
  firstapp   db  '/rd/1/LAUNCHER',0
Line 333... Line 320...
333
        ;cmp     [0x2f0000+0x901e],byte 1
320
        ;cmp     [0x2f0000+0x901e],byte 1
334
        ;jne     no_d_lfb
321
        ;jne     no_d_lfb
335
        mov     byte [0x2f0000+0x901e],0x0
322
        mov     byte [0x2f0000+0x901e],0x0
336
        mov     eax,[0x2f0000+0x9018]
323
        mov     eax,[0x2f0000+0x9018]
337
      ;no_d_lfb:
324
      ;no_d_lfb:
338
        mov     [0xfe80],eax
325
        mov     [LFBAddress],eax
Line 339... Line 326...
339
 
326
 
340
        cmp     [0xfe0c],word 0100000000000000b
327
        cmp     [0xfe0c],word 0100000000000000b
341
        jge     setvesa20
328
        jge     setvesa20
342
        cmp     [0xfe0c],word 0x13
329
        cmp     [0xfe0c],word 0x13
Line 364... Line 351...
364
        mov     [0xe024],dword Vesa20_getpixel32
351
        mov     [0xe024],dword Vesa20_getpixel32
365
      no_mode_0x12:
352
      no_mode_0x12:
Line 366... Line 353...
366
 
353
 
Line 367... Line -...
367
; MEMORY MODEL
-
 
368
 
-
 
369
;        mov     [0xfe84],dword 0x100000*16        ; apps mem base address
354
; MEMORY MODEL
370
;        movzx   ecx,byte [0x2f0000+0x9030]
-
 
371
;        dec     ecx
-
 
372
;        mov     eax,16*0x100000 ; memory-16
-
 
373
;        shl     eax,cl
355
 
374
;        mov     [0xfe8c],eax      ; memory for use
-
 
375
;        cmp     eax,16*0x100000
-
 
376
;        jne     no16mb
-
 
377
;        mov     [0xfe84],dword 0xD80000 ; !!! 10 !!!
-
 
378
;      no16mb:
-
 
379
 
-
 
380
; init:
-
 
Line 381... Line -...
381
;  1) 0xFE84 - applications base
-
 
382
;  2) 0xFE8C - total amount of memory
-
 
383
 
-
 
384
        xor     edi, edi
-
 
385
  m_GMS_loop:
-
 
386
        add     edi, 0x400000
-
 
387
        mov     eax, dword [edi]
-
 
388
        mov     dword [edi], 'TEST'
-
 
389
        wbinvd
-
 
390
        cmp     dword [edi], 'TEST'
-
 
391
        jne     m_GMS_exit
356
           call mem_test
392
        cmp     dword [0], 'TEST'
-
 
393
        je      m_GMS_exit
-
 
394
        mov     dword [es:edi], eax
357
           mov [MEM_AMOUNT], eax
395
        jmp     m_GMS_loop
-
 
396
  m_GMS_exit:
-
 
397
        mov     [edi], eax
-
 
398
        ; now edi contains the EXACT amount of memory
-
 
399
 
-
 
Line -... Line 358...
-
 
358
 
-
 
359
           mov [pg_data.mem_amount], eax
-
 
360
           mov [pg_data.kernel_max], eax
400
        mov     eax, 0x100000*16
361
 
-
 
362
           shr eax, 12
-
 
363
           mov edx, eax
-
 
364
           mov [pg_data.pages_count], eax
-
 
365
           mov [pg_data.kernel_pages], eax
401
        cmp     edi, eax ;0x100000*16
366
 
-
 
367
           shr eax, 3
402
        jb      $                 ; less than 16 Mb
368
           mov [pg_data.pagemap_size], eax
403
 
369
 
404
        mov     dword [0xFE84], eax ;0x100000*16
370
           shr edx, 10
405
        cmp     edi, eax ;0x100000*16
371
           cmp edx, 4
-
 
372
           ja @f
Line 406... Line 373...
406
        jne     @f
373
           inc edx       ;at least 4Mb for kernel heap
407
        mov     dword [0xFE84], 0xD80000 ; =0x100000*13.5
374
@@:
408
      @@:
375
           mov [pg_data.kernel_tables], edx
Line 409... Line 376...
409
        mov     dword [0xFE8C], edi
376
 
410
 
377
 
-
 
378
;!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
379
include 'detect/disks.inc'
-
 
380
;!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
381
 
-
 
382
; CHECK EXTRA REGION
-
 
383
; ENABLE PAGING
-
 
384
 
-
 
385
           call test_cpu
-
 
386
;           btr [cpu_caps], CAPS_SSE    ;test: dont't use sse code
-
 
387
;           btr [cpu_caps], CAPS_SSE2   ;test: don't use sse2
-
 
388
 
-
 
389
;           btr [cpu_caps], CAPS_FXSR   ;test: disable sse support
-
 
390
                                        ;all sse commands rise #UD exption
-
 
391
;           btr [cpu_caps], CAPS_PSE    ;test: don't use large pages
-
 
392
;           btr [cpu_caps], CAPS_PGE    ;test: don't use global pages
-
 
393
;           btr [cpu_caps], CAPS_MTRR   ;test: don't use MTRR
-
 
394
;           btr [cpu_caps], CAPS_TSC    ;test: don't use TSC
-
 
395
 
411
;!!!!!!!!!!!!!!!!!!!!!!!!!!
396
           call init_memEx
412
include 'detect/disks.inc'
397
           call init_page_map
413
;!!!!!!!!!!!!!!!!!!!!!!!!!!
398
 
414
 
-
 
Line 415... Line 399...
415
; CHECK EXTRA REGION
399
           mov eax, sys_pgdir     ;+PG_NOCACHE
416
; ENABLE PAGING
-
 
417
        mov     eax,cr0
-
 
418
        or      eax,0x80000000
400
           mov cr3, eax
419
        mov     cr0,eax
-
 
420
        jmp     $+2
-
 
421
        
-
 
422
        call    MEM_Init
401
 
423
;add 0x800000-0xc00000 area
-
 
424
        cmp     word [0xfe0c],0x13
-
 
425
        jle     .less_memory
-
 
426
        mov     eax,0x800000      ;linear address
-
 
427
        mov     ebx,0x400000 shr 12 ;size in pages (4Mb)
-
 
428
        mov     ecx,0x800000        ;physical address
-
 
429
        jmp     .end_first_block
402
           mov     eax,cr0
430
.less_memory:
403
           or      eax,0x80000000
431
        mov     eax,0x980000      ;linear address
-
 
432
        mov     ebx,0x280000 shr 12 ;size in pages (2.5Mb)
404
           mov     cr0,eax
433
        mov     ecx,0x980000        ;physical address
405
 
-
 
406
           call init_kernel_heap
434
.end_first_block:
407
           call init_LFB
435
        call    MEM_Add_Heap        ;nobody can lock mutex yet
408
           call init_mtrr
436
 
-
 
-
 
409
 
437
        call    create_general_page_table
410
           stdcall alloc_kernel_space, 0x50000
438
;add 0x1000000(0xd80000)-end_of_memory area
411
           mov [ipc_tmp], eax
439
        mov     eax,second_base_address
-
 
440
        mov     ebx,[0xfe8c]
-
 
Line -... Line 412...
-
 
412
           mov ebx, 0x1000
-
 
413
 
-
 
414
           add eax, 0x40000
-
 
415
           mov [proc_mem_map], eax
-
 
416
 
-
 
417
           add eax, 0x8000
-
 
418
           mov [proc_mem_pdir], eax
-
 
419
 
-
 
420
           add eax, ebx
-
 
421
           mov [proc_mem_tab], eax
-
 
422
 
-
 
423
           add eax, ebx
-
 
424
           mov [current_pdir], eax
-
 
425
 
-
 
426
           add eax, ebx
-
 
427
           mov [tmp_task_pdir], eax
-
 
428
 
-
 
429
           add eax, ebx
441
        mov     ecx,[0xfe84]
430
           mov [tmp_task_ptab], eax
-
 
431
 
-
 
432
           add eax, ebx
-
 
433
           mov [ipc_pdir], eax
-
 
434
 
-
 
435
           add eax, ebx
-
 
436
           mov [ipc_ptab], eax
-
 
437
 
-
 
438
           stdcall kernel_alloc, 0x1000
-
 
439
           mov [tmp_task_data], eax
-
 
440
 
-
 
441
           mov [dll_map], 0xFFFFFFFF
-
 
442
           mov [srv_map], 0xFFFFFFFF
-
 
443
 
-
 
444
           call alloc_dll
-
 
445
           mov edi, eax
-
 
446
           mov esi, szKernel
-
 
447
           mov ecx, 16
-
 
448
           rep movsb
-
 
449
 
-
 
450
           bt [cpu_caps], CAPS_FXSR
-
 
451
           jnc .no_FXSR
-
 
452
 
-
 
453
           stdcall kernel_alloc, 512*256
-
 
454
           mov [fpu_data], eax
-
 
455
           mov ebx, cr4
-
 
456
           or ebx, CR4_OSFXSR
-
 
457
           mov cr4, ebx
-
 
458
           jmp .clts
-
 
459
.no_FXSR:
-
 
460
           stdcall kernel_alloc, 112*256
-
 
461
           mov [fpu_data], eax
-
 
462
           mov ebx, cr4
-
 
463
           and ebx, not (CR4_OSFXSR+CR4_OSXMMEXPT)
-
 
464
           mov cr4, ebx
Line 442... Line 465...
442
        sub     ebx,ecx
465
.clts:
443
        shr     ebx,12
466
           clts
444
        add     eax,ecx
467
           fninit
445
        call    MEM_Add_Heap
468
 
446
;init physical memory manager.
469
           mov edi, irq_tab
447
        call    Init_Physical_Memory_Manager        
470
           xor eax, eax
Line 500... Line 523...
500
 
523
 
501
        movzx   ecx, word [boot_y]
524
        movzx   ecx, word [boot_y]
502
        or      ecx, (10+29*6) shl 16 ; "Determining amount of memory"
525
        or      ecx, (10+29*6) shl 16 ; "Determining amount of memory"
503
        sub     ecx, 10
526
        sub     ecx, 10
504
        mov     edx, 0xFFFFFF
527
        mov     edx, 0xFFFFFF
505
        mov     ebx, [0xFE8C]
528
        mov     ebx, [MEM_AMOUNT]
506
        shr     ebx, 20
529
        shr     ebx, 20
507
        mov     edi, 1
530
        mov     edi, 1
508
        mov     eax, 0x00040000
531
        mov     eax, 0x00040000
Line 509... Line -...
509
        call    display_number
-
 
510
 
-
 
511
; CHECK EXTENDED REGION
-
 
512
;        mov     dword [0x80000000],0x12345678
-
 
513
;        cmp     dword [0x80000000],0x12345678
-
 
514
;        jz      extended_region_found
-
 
515
;        mov     esi,boot_ext_region
-
 
516
;        call    boot_log
-
 
517
;        jmp     $
-
 
518
;extended_region_found:
-
 
519
 
-
 
520
 
532
        call    display_number
Line 521... Line 533...
521
 
533
 
522
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
534
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
523
 
535
 
Line 533... Line 545...
533
        call   build_scheduler ; sys32.inc
545
        call   build_scheduler ; sys32.inc
Line 534... Line 546...
534
 
546
 
535
; LOAD IDT
547
; LOAD IDT
Line 536... Line -...
536
        lidt   [cs:idtreg]
-
 
537
 
-
 
538
; READ CPUID RESULT
-
 
539
 
-
 
540
        mov     esi,boot_cpuid
-
 
541
        call    boot_log
-
 
542
        pushfd                  ; get current flags
-
 
543
        pop     eax
-
 
544
        mov     ecx,eax
-
 
545
        xor     eax,0x00200000  ; attempt to toggle ID bit
-
 
546
        push    eax
-
 
547
        popfd
-
 
548
        pushfd                  ; get new EFLAGS
-
 
549
        pop     eax
-
 
550
        push    ecx             ; restore original flags
-
 
551
        popfd
-
 
552
        and     eax,0x00200000  ; if we couldn't toggle ID,
-
 
553
        and     ecx,0x00200000  ; then this is i486
-
 
554
        cmp     eax,ecx
-
 
555
        jz      nopentium
-
 
556
        ; It's Pentium or later. Use CPUID
-
 
557
        mov     edi,cpuid_0
-
 
558
        mov     esi,0
-
 
559
      cpuid_new_read:
-
 
560
        mov     eax,esi
-
 
561
        cpuid
-
 
562
        call    cpuid_save
-
 
563
        add     edi,4*4
-
 
564
        cmp     esi,3
-
 
565
        jge     cpuid_done
-
 
566
        cmp     esi,[cpuid_0]
-
 
567
        jge     cpuid_done
-
 
568
        inc     esi
-
 
569
        jmp     cpuid_new_read
-
 
570
      cpuid_save:
-
 
571
        mov     [edi+00],eax
-
 
572
        mov     [edi+04],ebx
-
 
573
        mov     [edi+8],ecx
-
 
574
        mov     [edi+12],edx
-
 
575
        ret
-
 
576
      cpuid_done:
-
 
577
      nopentium:
-
 
578
 
-
 
579
; CR4 flags - enable fxsave / fxrstore
-
 
580
;
-
 
581
;        finit
-
 
582
;        mov     eax,1
-
 
583
;        cpuid
-
 
584
;        test    edx,1000000h
-
 
585
;        jz      fail_fpu
-
 
586
;        mov     eax,cr4
-
 
587
;        or      eax,200h        ; Enable fxsave/fxstor
-
 
588
;        mov     cr4,eax
-
 
589
;     fail_fpu:
548
        lidt   [cs:idtreg]
590
 
549
 
591
;The CPU to this moment should be already in PM,
550
;The CPU to this moment should be already in PM,
592
;and bit MP of the register cr0 should be installed in 1.
551
;and bit MP of the register cr0 should be installed in 1.
593
finit ;reset of the FPU (finit, instead of fninit)
552
;finit ;reset of the FPU (finit, instead of fninit)
594
fsetpm ;enable PM of the FPU
553
;fsetpm ;enable PM of the FPU
595
finit ;reset the registers, contents which are still equal RM
554
;finit ;reset the registers, contents which are still equal RM
Line 596... Line 555...
596
;Now FPU too in PM
555
;Now FPU too in PM
597
; DETECT DEVICES
556
; DETECT DEVICES
Line 646... Line 605...
646
        mov  esi,boot_setostask
605
        mov  esi,boot_setostask
647
        call boot_log
606
        call boot_log
648
        ; name for OS/IDLE process
607
        ; name for OS/IDLE process
649
        mov  dword [0x80000+256+APPDATA.app_name],   dword 'OS/I'
608
        mov  dword [0x80000+256+APPDATA.app_name],   dword 'OS/I'
650
        mov  dword [0x80000+256+APPDATA.app_name+4], dword 'DLE '
609
        mov  dword [0x80000+256+APPDATA.app_name+4], dword 'DLE '
-
 
610
        mov eax, [fpu_data]
-
 
611
        mov  dword [0x80000+APPDATA.fpu_state], eax
-
 
612
        mov  dword [0x80000+APPDATA.fpu_handler], 0
-
 
613
        mov  dword [0x80000+APPDATA.sse_handler], 0
-
 
614
 
-
 
615
        add eax, 112
-
 
616
        bt [cpu_caps], CAPS_FXSR
-
 
617
        jnc .no_sse
-
 
618
        add eax, 512-112
-
 
619
.no_sse:
-
 
620
        mov  dword [0x80000+256+APPDATA.fpu_state], eax
-
 
621
        mov  dword [0x80000+256+APPDATA.fpu_handler], 0
-
 
622
        mov  dword [0x80000+256+APPDATA.sse_handler], 0
651
        ; task list
623
        ; task list
652
        mov  [0x3020+TASKDATA.wnd_number], 1 ; on screen number
624
        mov  [0x3020+TASKDATA.wnd_number], 1 ; on screen number
653
        mov  [0x3020+TASKDATA.pid], 1        ; process id number
625
        mov  [0x3020+TASKDATA.pid], 1        ; process id number
654
        mov  [0x3020+TASKDATA.mem_start], 0  ; process base address
626
        mov  [0x3020+TASKDATA.mem_start], 0  ; process base address
Line 723... Line 695...
723
        movsd
695
        movsd
724
        movsd
696
        movsd
725
        movsd
697
        movsd
726
        call    load_skin
698
        call    load_skin
Line 727... Line -...
727
 
-
 
728
; MTRR'S
-
 
729
 
-
 
730
        call  enable_mtrr
-
 
731
 
-
 
732
 
699
 
733
; LOAD FIRST APPLICATION
700
; LOAD FIRST APPLICATION
734
        mov   [0x3000],dword 1
701
        mov   [0x3000],dword 1
735
        mov   [0x3004],dword 1
702
        mov   [0x3004],dword 1
736
        cli
703
        cli
Line 816... Line 783...
816
        out   0x20,al
783
        out   0x20,al
817
        out   0xa0,al
784
        out   0xa0,al
Line 818... Line 785...
818
 
785
 
Line -... Line 786...
-
 
786
        loop  ready_for_irqs         ; flush the queue
-
 
787
 
819
        loop  ready_for_irqs         ; flush the queue
788
        stdcall attach_int_handler, dword 1, irq1
820
 
789
 
821
;        mov    [dma_hdd],1
790
;        mov    [dma_hdd],1
Line 822... Line 791...
822
        cmp     [IDEContrRegsBaseAddr], 0
791
        cmp     [IDEContrRegsBaseAddr], 0
Line 925... Line 894...
925
;                                                                      ;
894
;                                                                      ;
926
;                       KERNEL FUNCTIONS                               ;
895
;                       KERNEL FUNCTIONS                               ;
927
;                                                                      ;
896
;                                                                      ;
928
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
897
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 929... Line -...
929
 
-
 
930
enable_mtrr:
-
 
931
 
-
 
932
        pushad
-
 
933
 
-
 
934
        cmp    [0x2f0000+0x901c],byte 2
-
 
935
        je     no_mtrr
-
 
936
        mov    eax,[0xFE0C]                ; if no LFB then no MTRR
-
 
937
        test   eax,0100000000000000b
-
 
938
        jz     no_mtrr
-
 
939
        mov    edx,[cpuid_1+3*4]           ; edx - MTRR's supported ?
-
 
940
        test   edx,1000000000000b
-
 
941
        jz     no_mtrr
-
 
942
        call   find_empty_mtrr
-
 
943
        cmp    ecx,0
-
 
944
        jz     no_mtrr
-
 
945
        mov    esi,boot_mtrr               ; 'setting mtrr'
-
 
946
        call   boot_log
-
 
947
        mov    edx,0x0                     ; LFB , +8 M , write combine
-
 
948
        mov    eax,[0x2f9018]
-
 
949
        or     eax,1
-
 
950
        wrmsr
-
 
951
        inc    ecx
-
 
952
        mov    edx,0xf
-
 
953
        mov    eax,0xff800800
-
 
954
        wrmsr
-
 
955
        mov    ecx,0x2ff                   ; enable mtrr's
-
 
956
        rdmsr
-
 
957
        or     eax,100000000000b           ; set
-
 
958
        wrmsr
-
 
959
     no_mtrr:
-
 
960
 
-
 
961
        popad
-
 
962
        ret
-
 
963
 
-
 
964
 
-
 
965
find_empty_mtrr:  ; 8 pairs checked
-
 
966
 
-
 
967
        mov    ecx,0x201-2
-
 
968
      mtrr_find:
-
 
969
        add    ecx,2
-
 
970
        cmp    ecx,0x200+8*2
-
 
971
        jge    no_free_mtrr
-
 
972
        rdmsr
-
 
973
        test   eax,0x0800
-
 
974
        jnz    mtrr_find
-
 
975
        dec    ecx
-
 
976
        ret
-
 
977
      no_free_mtrr:
-
 
978
        mov    ecx,0
-
 
979
        ret
-
 
980
 
898
 
Line 981... Line 899...
981
reserve_irqs_ports:
899
reserve_irqs_ports:
Line 982... Line 900...
982
 
900
 
Line 4344... Line 4262...
4344
 
4262
 
Line 4345... Line 4263...
4345
     ret
4263
     ret
4346
 
-
 
4347
 
-
 
4348
_rdtsc:
4264
 
4349
 
4265
 
4350
     mov   edx,[cpuid_1+3*4]
4266
_rdtsc:
4351
     test  edx,00010000b
4267
     bt [cpu_caps], CAPS_TSC
4352
     jz    ret_rdtsc
4268
     jnc ret_rdtsc
4353
     rdtsc
4269
     rdtsc
4354
     ret
4270
     ret
Line 4622... Line 4538...
4622
 
4538
 
4623
no_del_keyboard_hotkey:
4539
no_del_keyboard_hotkey:
Line 4624... Line -...
4624
     ret
-
 
4625
 
-
 
4626
 
-
 
4627
sys_ipc:
-
 
4628
     cmp  eax,1                      ; DEFINE IPC MEMORY
-
 
4629
     jne  no_ipc_def
-
 
4630
     mov  edi,[0x3000]
-
 
4631
     shl  edi,8
-
 
4632
     add  edi,0x80000
-
 
4633
     mov  [edi + APPDATA.ipc_start], ebx
-
 
4634
     mov  [edi + APPDATA.ipc_size], ecx
-
 
4635
     mov  [esp+36],dword 0
-
 
4636
     ret
-
 
4637
   no_ipc_def:
-
 
4638
 
-
 
4639
     cmp  eax,2                      ; SEND IPC MESSAGE
-
 
4640
     jne  no_ipc_send
-
 
4641
     mov  esi,1
-
 
4642
     mov  edi,0x3020
-
 
4643
    ipcs1:
-
 
4644
     cmp  [edi+TASKDATA.pid], ebx
-
 
4645
     je   ipcs2
-
 
4646
     add  edi,0x20
-
 
4647
     inc  esi
-
 
4648
     cmp  esi,[0x3004]
-
 
4649
     jbe  ipcs1
-
 
4650
     mov  [esp+36],dword 4
-
 
4651
     ret
-
 
4652
    ipcs2:
-
 
4653
 
-
 
4654
     cli
-
 
4655
 
-
 
4656
     push esi
-
 
4657
     mov  eax,esi
-
 
4658
     shl  eax,8
-
 
4659
     mov  ebx,[eax+0x80000 + APPDATA.ipc_start]
-
 
4660
     test ebx,ebx                  ; ipc area not defined ?
-
 
4661
     je   ipc_err1
-
 
4662
 
-
 
4663
     add  ebx,[eax+0x80000 + APPDATA.ipc_size]
-
 
4664
     mov  eax,esi
-
 
4665
     shl  eax,5
-
 
4666
     add  ebx,[eax+0x3000 + TASKDATA.mem_start]    ; ebx <- max data position
-
 
4667
 
-
 
4668
     mov  eax,esi                  ; to
-
 
4669
     shl  esi,8
-
 
4670
     add  esi,0x80000
-
 
4671
     mov  edi,[esi+APPDATA.ipc_start]
-
 
4672
     shl  eax,5
-
 
4673
     add  eax,0x3000
-
 
4674
     add  edi,[eax+TASKDATA.mem_start]
-
 
4675
 
-
 
4676
     cmp  [edi],byte 0             ; overrun ?
-
 
4677
     jne  ipc_err2
-
 
4678
 
-
 
4679
     mov  ebp,edi
-
 
4680
     add  edi,[edi+4]
-
 
4681
     add  edi,8
-
 
4682
 
-
 
4683
     mov  esi,ecx                  ; from
-
 
4684
     mov  eax,[0x3010]
-
 
4685
     mov  eax,[eax+TASKDATA.mem_start]
-
 
4686
     add  esi,eax
-
 
4687
 
-
 
4688
     mov  ecx,edx                  ; size
-
 
4689
 
-
 
4690
     mov  eax,edi
-
 
4691
     add  eax,ecx
-
 
4692
     cmp  eax,ebx
-
 
4693
     jg   ipc_err3                 ; not enough room ?
-
 
4694
 
-
 
4695
     push ecx
-
 
4696
 
-
 
4697
     mov  eax,[0x3010]
-
 
4698
     mov  eax,[eax+TASKDATA.pid]
-
 
4699
     mov  [edi-8],eax
-
 
4700
     mov  [edi-4],ecx
-
 
4701
     cld
-
 
4702
     rep  movsb
-
 
4703
 
-
 
4704
     pop  ecx
-
 
4705
     add  ecx,8
-
 
4706
 
-
 
4707
     mov  edi,ebp                  ; increase memory position
-
 
4708
     add  dword [edi+4],ecx
-
 
4709
 
-
 
4710
     mov  edi,[esp]
-
 
4711
     shl  edi,8
-
 
4712
     or   dword [edi+0x80000+APPDATA.event_mask],dword 01000000b ; ipc message
-
 
4713
 
-
 
4714
     cmp  [check_idle_semaphore],dword 20
-
 
4715
     jge  ipc_no_cis
-
 
4716
     mov  [check_idle_semaphore],5
-
 
4717
   ipc_no_cis:
-
 
4718
 
-
 
4719
     xor  eax, eax
-
 
4720
 
-
 
4721
    ipc_err:
-
 
4722
     add  esp,4
-
 
4723
     mov  [esp+36],eax
-
 
4724
     sti
-
 
4725
     ret
-
 
4726
 
-
 
4727
    ipc_err1:
-
 
4728
     add  esp,4
-
 
4729
     mov  [esp+36],dword 1
-
 
4730
     sti
-
 
4731
     ret
-
 
4732
    ipc_err2:
-
 
4733
     add  esp,4
-
 
4734
     mov  [esp+36],dword 2
-
 
4735
     sti
-
 
4736
     ret
-
 
4737
    ipc_err3:
-
 
4738
     add  esp,4
-
 
4739
     mov  [esp+36],dword 3
-
 
4740
     sti
-
 
4741
     ret
-
 
4742
 
-
 
4743
   no_ipc_send:
-
 
4744
 
-
 
4745
     mov  [esp+36],dword -1
-
 
4746
     ret
4540
     ret
Line 4747... Line 4541...
4747
 
4541
 
Line 4748... Line 4542...
4748
 
4542
 
Line 5235... Line 5029...
5235
  sb16       dd 0x0
5029
  sb16       dd 0x0
5236
  wss        dd 0x0
5030
  wss        dd 0x0
Line 5237... Line 5031...
5237
 
5031
 
5238
  buttontype         dd 0x0
5032
  buttontype         dd 0x0
-
 
5033
  windowtypechanged  dd 0x0
-
 
5034
 
-
 
5035
align 4
-
 
5036
  pg_data  PG_DATA
-
 
5037
  heap_test   dd ?
5239
  windowtypechanged  dd 0x0
5038
  cpu_caps    dd 4 dup(0)
Line 5240... Line 5039...
5240
endg
5039
endg
5241
 
5040
 
5242
iglobal
5041
iglobal