forked from KolibriOS/kolibrios
trunk: print cpu count on the debug board
git-svn-id: svn://kolibrios.org@2443 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3340831e5e
commit
2f5fd7a295
@ -61,7 +61,7 @@ APIC_init:
|
|||||||
call IRQ_mask_all
|
call IRQ_mask_all
|
||||||
|
|
||||||
; IOAPIC init
|
; IOAPIC init
|
||||||
stdcall map_io_mem, [acpi_ioapic_base], 0x20, PG_SW
|
stdcall map_io_mem, [acpi_ioapic_base], 0x20, PG_SW+PG_NOCACHE
|
||||||
mov [IOAPIC_base], eax
|
mov [IOAPIC_base], eax
|
||||||
|
|
||||||
mov eax, IOAPIC_VER
|
mov eax, IOAPIC_VER
|
||||||
@ -121,14 +121,11 @@ APIC_init:
|
|||||||
;===========================================================
|
;===========================================================
|
||||||
align 4
|
align 4
|
||||||
LAPIC_init:
|
LAPIC_init:
|
||||||
; Check MSR support
|
|
||||||
;....
|
|
||||||
; Get LAPIC base address
|
|
||||||
; mov ecx, 0x1b
|
|
||||||
; rdmsr ; it may be replaced to
|
|
||||||
; and ax, 0xf000 ; mov eax, 0xfee00000
|
|
||||||
|
|
||||||
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SW
|
cmp [LAPIC_BASE], 0
|
||||||
|
jne .done
|
||||||
|
|
||||||
|
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SW+PG_NOCACHE
|
||||||
mov [LAPIC_BASE], eax
|
mov [LAPIC_BASE], eax
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
|
|
||||||
@ -200,6 +197,8 @@ LAPIC_init:
|
|||||||
; Start (every 0.01 sec)
|
; Start (every 0.01 sec)
|
||||||
mov dword[esi + APIC_LVT_timer], 0x30020; periodic int 0x20
|
mov dword[esi + APIC_LVT_timer], 0x30020; periodic int 0x20
|
||||||
mov dword[esi + APIC_timer_init], eax
|
mov dword[esi + APIC_timer_init], eax
|
||||||
|
|
||||||
|
.done:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;===========================================================
|
;===========================================================
|
||||||
|
@ -548,6 +548,7 @@ align 4
|
|||||||
align 4
|
align 4
|
||||||
.exit:
|
.exit:
|
||||||
pop ebp
|
pop ebp
|
||||||
|
inc [_display.mask_seqno]
|
||||||
popfd
|
popfd
|
||||||
pop esi
|
pop esi
|
||||||
ret
|
ret
|
||||||
@ -998,6 +999,7 @@ waredraw: ;////////////////////////////////////////////////////////////////////
|
|||||||
mov edi, [TASK_COUNT]
|
mov edi, [TASK_COUNT]
|
||||||
movzx esi, word[WIN_POS + edi * 2]
|
movzx esi, word[WIN_POS + edi * 2]
|
||||||
call window._.set_screen
|
call window._.set_screen
|
||||||
|
inc [_display.mask_seqno]
|
||||||
popad
|
popad
|
||||||
|
|
||||||
; tell application to redraw itself
|
; tell application to redraw itself
|
||||||
@ -1102,7 +1104,7 @@ align 4
|
|||||||
add ecx, eax
|
add ecx, eax
|
||||||
add edx, ebx
|
add edx, ebx
|
||||||
call ebp
|
call ebp
|
||||||
|
inc [_display.mask_seqno]
|
||||||
mov byte[MOUSE_BACKGROUND], 0
|
mov byte[MOUSE_BACKGROUND], 0
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@ -1204,6 +1206,7 @@ align 4
|
|||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.exit:
|
.exit:
|
||||||
|
inc [_display.mask_seqno]
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@ -1949,6 +1952,7 @@ align 4
|
|||||||
align 4
|
align 4
|
||||||
.exit:
|
.exit:
|
||||||
popad
|
popad
|
||||||
|
inc [_display.mask_seqno]
|
||||||
ret
|
ret
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
|
@ -432,6 +432,11 @@ proc test_cpu
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
iglobal
|
||||||
|
align 4
|
||||||
|
acpi_lapic_base dd 0xfee00000 ; default local apic base
|
||||||
|
endg
|
||||||
|
|
||||||
uglobal
|
uglobal
|
||||||
align 4
|
align 4
|
||||||
acpi_rsdp rd 1
|
acpi_rsdp rd 1
|
||||||
@ -443,8 +448,10 @@ acpi_dev_size rd 1
|
|||||||
|
|
||||||
acpi_rsdt_base rd 1
|
acpi_rsdt_base rd 1
|
||||||
acpi_madt_base rd 1
|
acpi_madt_base rd 1
|
||||||
acpi_lapic_base rd 1
|
|
||||||
acpi_ioapic_base rd 1
|
acpi_ioapic_base rd 1
|
||||||
|
|
||||||
|
cpu_count rd 1
|
||||||
|
smpt rd 16
|
||||||
endg
|
endg
|
||||||
|
|
||||||
ACPI_HI_RSDP_WINDOW_START equ 0x000E0000
|
ACPI_HI_RSDP_WINDOW_START equ 0x000E0000
|
||||||
@ -493,6 +500,7 @@ rsdt_find: ;ecx= rsdt edx= SIG
|
|||||||
lea ebx, [ecx+36]
|
lea ebx, [ecx+36]
|
||||||
mov esi, [ecx+4]
|
mov esi, [ecx+4]
|
||||||
add esi, ecx
|
add esi, ecx
|
||||||
|
align 4
|
||||||
.next:
|
.next:
|
||||||
mov eax, [ebx]
|
mov eax, [ebx]
|
||||||
cmp [eax], edx
|
cmp [eax], edx
|
||||||
@ -513,9 +521,7 @@ rsdt_find: ;ecx= rsdt edx= SIG
|
|||||||
pop ebx
|
pop ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
|
|
||||||
check_acpi:
|
check_acpi:
|
||||||
|
|
||||||
call acpi_locate
|
call acpi_locate
|
||||||
@ -533,22 +539,47 @@ check_acpi:
|
|||||||
mov ecx, [eax+36]
|
mov ecx, [eax+36]
|
||||||
mov [acpi_lapic_base-OS_BASE], ecx
|
mov [acpi_lapic_base-OS_BASE], ecx
|
||||||
|
|
||||||
|
mov edi, smpt-OS_BASE
|
||||||
|
mov ebx, [ecx+0x20]
|
||||||
|
shr ebx, 24 ; read APIC ID
|
||||||
|
|
||||||
|
mov [edi], ebx ; bootstrap always first
|
||||||
|
inc [cpu_count-OS_BASE]
|
||||||
|
add edi, 4
|
||||||
|
|
||||||
lea edx, [eax+44]
|
lea edx, [eax+44]
|
||||||
mov ecx, [eax+4]
|
mov ecx, [eax+4]
|
||||||
add ecx, eax
|
add ecx, eax
|
||||||
.check:
|
.check:
|
||||||
mov eax, [edx]
|
mov eax, [edx]
|
||||||
cmp al, 1
|
cmp al, 0
|
||||||
je .ioapic
|
jne .io_apic
|
||||||
|
|
||||||
|
shr eax, 24 ; get APIC ID
|
||||||
|
cmp eax, ebx ; skip self
|
||||||
|
je .next
|
||||||
|
|
||||||
|
test [edx+4], byte 1 ; is enabled ?
|
||||||
|
jz .next
|
||||||
|
|
||||||
|
cmp [cpu_count-OS_BASE], 16
|
||||||
|
jae .next
|
||||||
|
|
||||||
|
stosd ; store APIC ID
|
||||||
|
inc [cpu_count-OS_BASE]
|
||||||
.next:
|
.next:
|
||||||
|
mov eax, [edx]
|
||||||
movzx eax, ah
|
movzx eax, ah
|
||||||
add edx, eax
|
add edx, eax
|
||||||
cmp edx, ecx
|
cmp edx, ecx
|
||||||
jb .check
|
jb .check
|
||||||
.done:
|
.done:
|
||||||
ret
|
ret
|
||||||
.ioapic:
|
|
||||||
|
.io_apic:
|
||||||
|
cmp al, 1
|
||||||
|
jne .next
|
||||||
|
|
||||||
mov eax, [edx+4]
|
mov eax, [edx+4]
|
||||||
mov [acpi_ioapic_base-OS_BASE], eax
|
mov [acpi_ioapic_base-OS_BASE], eax
|
||||||
ret
|
jmp .next
|
||||||
|
@ -295,6 +295,8 @@ include 'init.inc'
|
|||||||
|
|
||||||
org OS_BASE+$
|
org OS_BASE+$
|
||||||
|
|
||||||
|
include 'fdo.inc'
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
high_code:
|
high_code:
|
||||||
mov ax, os_stack
|
mov ax, os_stack
|
||||||
@ -980,6 +982,13 @@ if defined debug_com_base
|
|||||||
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
mov eax, [cpu_count]
|
||||||
|
test eax, eax
|
||||||
|
jnz @F
|
||||||
|
mov al, 1 ; at least one CPU
|
||||||
|
@@:
|
||||||
|
DEBUGF 1, "K : %d CPU detected\n", eax
|
||||||
|
|
||||||
; START MULTITASKING
|
; START MULTITASKING
|
||||||
|
|
||||||
; A 'All set - press ESC to start' messages if need
|
; A 'All set - press ESC to start' messages if need
|
||||||
@ -1005,7 +1014,6 @@ end if
|
|||||||
; Fly :)
|
; Fly :)
|
||||||
|
|
||||||
include 'unpacker.inc'
|
include 'unpacker.inc'
|
||||||
include 'fdo.inc'
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
boot_log:
|
boot_log:
|
||||||
|
Loading…
Reference in New Issue
Block a user