Subversion Repositories Kolibri OS

Rev

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

Rev 428 Rev 430
Line 9... Line 9...
9
;;
9
;;
10
;;   Compile with last version FASM
10
;;   Compile with last version FASM
11
;;
11
;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 13... Line 13...
13
 
13
 
Line 14... Line 14...
14
$Revision:$
14
; $Revision: 430 $
15
 
15
 
16
include "proc32.inc"
16
include "proc32.inc"
Line 201... Line 201...
201
 
201
 
202
           mov eax, sys_pgdir-OS_BASE
202
           mov eax, sys_pgdir-OS_BASE
Line 203... Line 203...
203
           mov cr3, eax
203
           mov cr3, eax
204
 
204
 
205
           mov eax,cr0
205
           mov eax,cr0
Line 206... Line 206...
206
           or eax,CR0_PG
206
           or eax,CR0_PG+CR0_WP
207
           mov cr0,eax
207
           mov cr0,eax
Line 370... Line 370...
370
           mov ecx, MSR_AMD_STAR
370
           mov ecx, MSR_AMD_STAR
371
           wrmsr
371
           wrmsr
372
.noSYSCALL:
372
.noSYSCALL:
373
; -----------------------------------------
373
; -----------------------------------------
Line -... Line 374...
-
 
374
 
-
 
375
; LOAD IDT
-
 
376
 
-
 
377
           call build_interrupt_table
-
 
378
           lidt [idtreg]
374
 
379
 
375
           call init_kernel_heap
380
           call init_kernel_heap
376
           stdcall kernel_alloc, 0x2000
381
           stdcall kernel_alloc, RING0_STACK_SIZE+512
Line 377... Line 382...
377
           mov [os_stack_seg], eax
382
           mov [os_stack_seg], eax
Line -... Line 383...
-
 
383
 
-
 
384
           lea esp, [eax+RING0_STACK_SIZE]
-
 
385
 
-
 
386
           mov [tss._ss0], os_stack
-
 
387
           mov [tss._esp0], esp
-
 
388
           mov [tss._esp], esp
-
 
389
           mov [tss._cs],os_code
-
 
390
           mov [tss._ss],os_stack
-
 
391
           mov [tss._ds],app_data
-
 
392
           mov [tss._es],app_data
-
 
393
           mov [tss._fs],app_data
-
 
394
           mov [tss._gs],app_data
-
 
395
           mov [tss._io],128
-
 
396
;Add IO access table - bit array of permitted ports
-
 
397
           mov edi, tss._io_map_0
-
 
398
           xor eax, eax
-
 
399
           not eax
-
 
400
           mov ecx, 8192/4
-
 
401
           rep stosd                 ; access to 4096*8=65536 ports
-
 
402
 
378
 
403
           mov  ax,tss0
379
           lea esp, [eax+RING0_STACK_SIZE]
404
           ltr  ax
Line 380... Line 405...
380
 
405
 
381
           mov [LFBSize], 0x800000
406
           mov [LFBSize], 0x800000
382
           call init_mtrr
407
           call init_mtrr
Line 383... Line 408...
383
 
408
 
-
 
409
           call init_LFB
-
 
410
           call init_fpu
-
 
411
           call init_malloc
384
           call init_LFB
412
 
385
           call init_fpu
413
           stdcall alloc_kernel_space, 0x51000
Line 386... Line 414...
386
           call init_malloc
414
           mov [default_io_map], eax
387
 
415
 
Line 495... Line 523...
495
 
523
 
Line 496... Line 524...
496
; BUILD SCHEDULER
524
; BUILD SCHEDULER
Line 497... Line -...
497
 
-
 
498
        call   build_scheduler ; sys32.inc
-
 
499
 
-
 
500
; LOAD IDT
525
 
501
        lidt   [idtreg]
526
        call   build_scheduler ; sys32.inc
502
 
527
 
Line 503... Line 528...
503
        mov    esi,boot_devices
528
        mov    esi,boot_devices
Line 563... Line 588...
563
        mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
588
        mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
564
        mov edi, [os_stack_seg]
589
        mov edi, [os_stack_seg]
565
        mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
590
        mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
566
        add edi, 0x2000-512
591
        add edi, 0x2000-512
567
        mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
592
        mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
-
 
593
        mov dword [SLOT_BASE+256+APPDATA.io_map],\
-
 
594
                  (tss._io_map_0-OS_BASE+PG_MAP)
-
 
595
        mov dword [SLOT_BASE+256+APPDATA.io_map+4],\
-
 
596
                  (tss._io_map_1-OS_BASE+PG_MAP)
Line 568... Line 597...
568
 
597
 
569
        mov esi, fpu_data
598
        mov esi, fpu_data
570
        mov ecx, 512/4
599
        mov ecx, 512/4
571
        cld
600
        cld
Line 585... Line 614...
585
        mov [current_slot], SLOT_BASE+256
614
        mov [current_slot], SLOT_BASE+256
586
        mov  [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
615
        mov  [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
587
        mov  [TASK_DATA+TASKDATA.pid], 1        ; process id number
616
        mov  [TASK_DATA+TASKDATA.pid], 1        ; process id number
588
        mov  [TASK_DATA+TASKDATA.mem_start], 0  ; process base address
617
        mov  [TASK_DATA+TASKDATA.mem_start], 0  ; process base address
Line 589... Line -...
589
 
-
 
590
        mov  edi,tss_data+tss_step
-
 
591
        mov ecx, (tss_step)/4
-
 
592
        xor eax, eax
-
 
593
        cld
-
 
594
        rep stosd
-
 
595
 
-
 
596
        mov  edi,tss_data
-
 
597
        mov  [edi+TSS._ss0], os_stack
-
 
598
        mov  eax,cr3
-
 
599
        mov  [edi+TSS._cr3],eax
-
 
600
        mov  [edi+TSS._eip],osloop
-
 
601
        mov  [edi+TSS._eflags],dword 0x1202 ; sti and resume
-
 
602
        mov eax, [os_stack_seg]
-
 
603
        add eax, 0x2000-512
-
 
604
        mov  [edi+TSS._esp], eax
-
 
605
        mov  [edi+TSS._cs],os_code
-
 
606
        mov  [edi+TSS._ss],os_stack  ;os_stack
-
 
607
        mov  [edi+TSS._ds],app_data  ;os_data
-
 
608
        mov  [edi+TSS._es],app_data  ;os_data
-
 
609
        mov  [edi+TSS._fs],app_data  ;os_data
-
 
610
        mov  [edi+TSS._gs],app_data  ;os_data
-
 
611
 
-
 
612
        mov  ax,tss0
-
 
613
        ltr  ax
-
 
614
 
618
 
615
        call init_cursors
619
        call init_cursors
616
        mov eax, [def_cursor]
620
        mov eax, [def_cursor]
617
        mov [SLOT_BASE+APPDATA.cursor],eax
621
        mov [SLOT_BASE+APPDATA.cursor],eax
Line 665... Line 669...
665
        movsd
669
        movsd
666
        movsd
670
        movsd
667
        movsd
671
        movsd
668
        call    load_skin
672
        call    load_skin
Line -... Line 673...
-
 
673
 
-
 
674
;protect io permission map
-
 
675
 
-
 
676
           mov esi, [default_io_map]
-
 
677
           stdcall map_page,esi,(tss._io_map_0-OS_BASE), PG_MAP
-
 
678
           add esi, 0x1000
-
 
679
           stdcall map_page,esi,(tss._io_map_1-OS_BASE), PG_MAP
-
 
680
 
-
 
681
           stdcall map_page,tss._io_map_0,\
-
 
682
                   (tss._io_map_0-OS_BASE), PG_MAP
-
 
683
           stdcall map_page,tss._io_map_1,\
-
 
684
                   (tss._io_map_1-OS_BASE), PG_MAP
669
 
685
 
670
; LOAD FIRST APPLICATION
686
; LOAD FIRST APPLICATION
671
        cli
687
        cli
672
        cmp   byte [BOOT_VAR+0x9030],1
688
        cmp   byte [BOOT_VAR+0x9030],1
Line 3725... Line 3741...
3725
 
3741
 
Line 3726... Line 3742...
3726
set_io_access_rights:
3742
set_io_access_rights:
Line 3727... Line -...
3727
 
-
 
3728
     pushad
3743
 
3729
 
-
 
3730
     mov   edi,[CURRENT_TASK]
-
 
Line 3731... Line 3744...
3731
     imul  edi,tss_step
3744
     pushad
3732
     add   edi,tss_data+128
3745
 
Line 3733... Line 3746...
3733
;     add   edi,128
3746
     mov edi, tss._io_map_0
3734
 
3747
 
Line 3735... Line 3748...
3735
     mov   ecx,eax
3748
;     mov   ecx,eax
3736
     and   ecx,7    ; offset in byte
3749
;     and   ecx,7    ; offset in byte
Line 3737... Line 3750...
3737
 
3750
 
3738
     shr   eax,3    ; number of byte
3751
;     shr   eax,3    ; number of byte
Line 3739... Line 3752...
3739
     add   edi,eax
3752
;     add   edi,eax
3740
 
3753
 
-
 
3754
;     mov   ebx,1
Line 3741... Line 3755...
3741
     mov   ebx,1
3755
;     shl   ebx,cl
Line 3742... Line 3756...
3742
     shl   ebx,cl
3756
 
Line 3743... Line 3757...
3743
 
3757
     cmp   ebp,0                ; enable access - ebp = 0
Line -... Line 3758...
-
 
3758
     jne   siar1
3744
     cmp   ebp,0                ; enable access - ebp = 0
3759
 
Line 3745... Line 3760...
3745
     jne   siar1
3760
;     not   ebx
Line 3746... Line 3761...
3746
 
3761
;     and   [edi],byte bl