Subversion Repositories Kolibri OS

Rev

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

Rev 1376 Rev 2382
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 1376 $
8
$Revision: 2382 $
9
 
9
 
10
 
10
 
Line 137... Line 137...
137
           mov eax, PG_LARGE+PG_SW
137
        mov     eax, PG_LARGE+PG_SW
138
           mov cr4, ebx
138
        mov     cr4, ebx
139
           dec [pg_data.kernel_tables-OS_BASE]
139
        dec     [pg_data.kernel_tables-OS_BASE]
Line 140... Line 140...
140
 
140
 
141
           mov [edx], eax
-
 
142
           add eax, 0x00400000
141
        mov     [edx], eax
Line 143... Line -...
143
           add edx, 4
-
 
144
 
142
        add     edx, 4
145
           mov eax, 0x400000+PG_SW
-
 
146
           mov ecx, [tmp_page_tabs]
143
 
147
           sub ecx, 0x400000
-
 
148
           shr ecx, 12          ;ecx/=4096
144
        mov     edi, [tmp_page_tabs]
149
           jmp .map_low
145
        jmp     .map_kernel_heap        ; new kernel fits to the first 4Mb - nothing to do with ".map_low"
150
.no_PSE:
146
.no_PSE:
151
           mov eax, PG_SW
147
        mov     eax, PG_SW
152
           mov ecx, [tmp_page_tabs]
148
        mov     ecx, [tmp_page_tabs]
Line 157... Line 153...
157
           stosd
153
        stosd
158
           add eax, 0x1000
154
        add     eax, 0x1000
159
           dec ecx
155
        dec     ecx
160
           jnz @B
156
        jnz     @B
Line -... Line 157...
-
 
157
 
161
 
158
.map_kernel_heap:
162
           mov ecx, [pg_data.kernel_tables-OS_BASE]
159
        mov     ecx, [pg_data.kernel_tables-OS_BASE]
163
           shl ecx, 10
160
        shl     ecx, 10
164
           xor eax, eax
161
        xor     eax, eax
Line 168... Line 165...
168
           mov eax, [tmp_page_tabs]
165
        mov     eax, [tmp_page_tabs]
169
           or eax, PG_SW
166
        or      eax, PG_SW
170
           mov edi, edx
167
        mov     edi, edx
Line 171... Line 168...
171
 
168
 
172
.map_kernel_tabs:
-
 
173
 
169
.map_kernel_tabs:
174
           stosd
170
        stosd
175
           add eax, 0x1000
171
        add     eax, 0x1000
176
           dec ecx
172
        dec     ecx
Line 268... Line 264...
268
 
264
 
269
           mov ebx, sys_pgmap
265
        mov     ebx, sys_pgmap
270
           add ebx, [pg_data.pagemap_size-OS_BASE]
266
        add     ebx, [pg_data.pagemap_size-OS_BASE]
Line 271... Line -...
271
           mov [page_end-OS_BASE], ebx
-
 
272
 
267
        mov     [page_end-OS_BASE], ebx
273
           mov [pg_data.pg_mutex-OS_BASE], 0
268
 
Line 274... Line 269...
274
           ret
269
        ret
Line 291... Line 286...
291
           movzx ecx, byte[edi + 9]
286
        movzx   ecx, byte[edi + 9]
292
           shl ecx, 4
287
        shl     ecx, 4
293
           mov esi, edi
288
        mov     esi, edi
294
           xor eax, eax
289
        xor     eax, eax
295
           cld   ; paranoia
290
        cld      ; paranoia
-
 
291
@@:
296
@@:	lodsb
292
        lodsb
297
           add ah, al
293
        add     ah, al
298
           loop @b
294
        loop    @b
299
           jnz .pcibios_nxt2 ; control summ must be zero
295
        jnz     .pcibios_nxt2; control summ must be zero
300
    ; BIOS32 service found !
296
    ; BIOS32 service found !
301
           mov ebp, [edi + 4]
297
        mov     ebp, [edi + 4]
Line 434... Line 430...
434
           shr eax, 8
430
        shr     eax, 8
435
           and eax, 0x0f
431
        and     eax, 0x0f
436
           ret
432
        ret
437
endp
433
endp
Line -... Line 434...
-
 
434
 
-
 
435
uglobal
-
 
436
align 4
-
 
437
acpi_rsdp         rd 1
-
 
438
acpi_rsdt         rd 1
-
 
439
acpi_madt         rd 1
-
 
440
 
-
 
441
acpi_dev_data     rd 1
-
 
442
acpi_dev_size     rd 1
-
 
443
 
-
 
444
acpi_rsdt_base    rd 1
-
 
445
acpi_madt_base    rd 1
-
 
446
acpi_lapic_base   rd 1
-
 
447
acpi_ioapic_base  rd 1
-
 
448
endg
-
 
449
 
-
 
450
ACPI_HI_RSDP_WINDOW_START  equ 0x000E0000
-
 
451
ACPI_HI_RSDP_WINDOW_END    equ 0x00100000
-
 
452
ACPI_RSDP_CHECKSUM_LENGTH  equ 20
-
 
453
ACPI_MADT_SIGN             equ 0x43495041
-
 
454
 
-
 
455
 
-
 
456
acpi_locate:
-
 
457
        push    ebx
-
 
458
        mov     ebx, ACPI_HI_RSDP_WINDOW_START
-
 
459
.check:
-
 
460
        cmp     [ebx], dword 0x20445352
-
 
461
        jne     .next
-
 
462
        cmp     [ebx+4], dword 0x20525450
-
 
463
        jne     .next
-
 
464
 
-
 
465
        mov     edx, ebx
-
 
466
        mov     ecx, ACPI_RSDP_CHECKSUM_LENGTH
-
 
467
        xor     eax, eax
-
 
468
.sum:
-
 
469
        add     al, [edx]
-
 
470
        inc     edx
-
 
471
        loop    .sum
-
 
472
 
-
 
473
        test    al, al
-
 
474
        jnz     .next
-
 
475
 
-
 
476
        mov     eax, ebx
-
 
477
        pop     ebx
-
 
478
        ret
-
 
479
.next:
-
 
480
        add     ebx, 16
-
 
481
        cmp     ebx, ACPI_HI_RSDP_WINDOW_END
-
 
482
        jb      .check
-
 
483
 
-
 
484
        pop     ebx
-
 
485
        xor     eax, eax
-
 
486
        ret
-
 
487
 
-
 
488
align 4
-
 
489
rsdt_find:           ;ecx= rsdt edx= SIG
-
 
490
        push    ebx
-
 
491
        push    esi
-
 
492
 
-
 
493
        lea     ebx, [ecx+36]
-
 
494
        mov     esi, [ecx+4]
-
 
495
        add     esi, ecx
-
 
496
.next:
-
 
497
        mov     eax, [ebx]
-
 
498
        cmp     [eax], edx
-
 
499
        je      .done
-
 
500
 
-
 
501
        add     ebx, 4
-
 
502
        cmp     ebx, esi
-
 
503
        jb      .next
-
 
504
 
-
 
505
        xor     eax, eax
-
 
506
        pop     esi
-
 
507
        pop     ebx
-
 
508
        ret
-
 
509
 
-
 
510
.done:
-
 
511
        mov     eax, [ebx]
-
 
512
        pop     esi
-
 
513
        pop     ebx
-
 
514
        ret
-
 
515
 
-
 
516
 
-
 
517
align 4
-
 
518
 
-
 
519
check_acpi:
-
 
520
 
-
 
521
        call    acpi_locate
-
 
522
        test    eax, eax
-
 
523
        jz      .done
-
 
524
 
-
 
525
        mov     ecx, [eax+16]
-
 
526
        mov     edx, ACPI_MADT_SIGN
-
 
527
        mov     [acpi_rsdt_base-OS_BASE], ecx
-
 
528
        call    rsdt_find
-
 
529
        test    eax, eax
-
 
530
        jz      .done
-
 
531
 
-
 
532
        mov     [acpi_madt_base-OS_BASE], eax
-
 
533
        mov     ecx, [eax+36]
-
 
534
        mov     [acpi_lapic_base-OS_BASE], ecx
-
 
535
 
-
 
536
        lea     edx, [eax+44]
-
 
537
        mov     ecx, [eax+4]
-
 
538
        add     ecx, eax
-
 
539
.check:
-
 
540
        mov     eax, [edx]
-
 
541
        cmp     al, 1
-
 
542
        je      .ioapic
-
 
543
 
-
 
544
.next:
-
 
545
        movzx   eax, ah
-
 
546
        add     edx, eax
-
 
547
        cmp     edx, ecx
-
 
548
        jb      .check
-
 
549
.done:
-
 
550
        ret
-
 
551
.ioapic:
-
 
552
        mov     eax, [edx+4]
-
 
553
        mov     [acpi_ioapic_base-OS_BASE], eax