Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2218 → Rev 2219

/kernel/branches/Kolibri-acpi/bus/pci/pci32.inc
652,47 → 652,3
.return_a:
mov dword[esp + 32], eax
ret
 
align 4
 
pci_irq_fixup:
 
push ebp
 
stdcall load_file, dev_data_path
test eax, eax
jz .fail
 
push eax
 
mov esi, eax
lea edi, [eax+ebx]
 
.iterate:
 
cmp esi, edi
jae .done
 
mov eax, [esi]
cmp eax, -1
je .done
 
movzx ebx, al
movzx ebp, ah
 
stdcall pci_read32, ebp, ebx, 0
 
cmp eax, [esi+4]
jne .skip
 
mov eax, [esi+8]
stdcall pci_write8, ebp, ebx, 0x3C, eax
.skip:
add esi, 16
jmp .iterate
 
.done:
call kernel_free ;and pop file base from stack
.fail:
pop ebp
ret
/kernel/branches/Kolibri-acpi/const.inc
143,6 → 143,8
 
SSE_INIT equ (SSE_IM+SSE_DM+SSE_ZM+SSE_OM+SSE_UM+SSE_PM)
 
IRQ_PIC equ 0
IRQ_APIC equ 1
 
struc TSS
{
/kernel/branches/Kolibri-acpi/core/apic.inc
12,7 → 12,7
endg
 
uglobal
APIC rd 1
irq_mode rd 1
IOAPIC_base rd 1
LAPIC_BASE rd 1
endg
44,10 → 44,17
 
align 4
APIC_init:
mov dword[APIC], 0
mov [irq_mode], IRQ_PIC
 
mov eax, [acpi_ioapic_base]
cmp [acpi_ioapic_base], 0
jz .no_apic
 
cmp [acpi_lapic_base], 0
jz .no_apic
 
stdcall load_file, dev_data_path
test eax, eax
mov [acpi_dev_data], eax
jz .no_apic
 
call IRQ_mask_all
98,7 → 105,7
 
call LAPIC_init
 
mov dword[APIC], 0xffffffff
mov [irq_mode], IRQ_APIC
 
mov al, 0x70
out 0x22, al
105,8 → 112,6
mov al, 1
out 0x23, al
 
; mov dword[irq_type_to_set], IRQ_TYPE_APIC
 
.no_apic:
 
;init handlers table
242,6 → 247,7
;===========================================================
; Remap all IRQ to 0x20+ Vectors
; IRQ0 to vector 0x20, IRQ1 to vector 0x21....
align 4
PIC_init:
cli
mov al,0x11 ; icw4, edge triggered
268,6 → 274,7
 
; -----------------------------------------
; TIMER SET TO 1/100 S
align 4
PIT_init:
mov al,0x34 ; set to 100Hz
out 0x43,al
278,9 → 285,11
ret
 
; -----------------------------------------
align 4
unmask_timer:
test dword[APIC], 0xffffffff
jnz @f
cmp [irq_mode], IRQ_APIC
je @f
 
stdcall enable_irq, 0
ret
@@:
306,9 → 315,11
 
; -----------------------------------------
; Disable all IRQ
align 4
IRQ_mask_all:
test dword[APIC], 0xffffffff
jnz .APIC
cmp [irq_mode], IRQ_APIC
je .APIC
 
mov al, 0xFF
out 0x21, al
out 0xA1, al
331,10 → 342,10
; -----------------------------------------
; End Of Interrupt
; cl - IRQ number
align 16
align 4
irq_eoi: ; __fastcall
test dword[APIC], 0xffffffff
jnz .APIC
cmp [irq_mode], IRQ_APIC
je .APIC
 
cmp cl, 8
mov al, 0x20
354,8 → 365,8
align 4
proc enable_irq stdcall, irq_line:dword
mov ebx, [irq_line]
test dword[APIC], 0xffffffff
jnz .APIC
cmp [irq_mode], IRQ_APIC
je .APIC
 
mov edx, 0x21
cmp ebx, 8
379,8 → 390,46
ret
endp
 
align 4
pci_irq_fixup:
 
push ebp
 
mov esi, [acpi_dev_data]
mov ebx, [acpi_dev_size]
 
lea edi, [esi+ebx]
 
.iterate:
 
cmp esi, edi
jae .done
 
mov eax, [esi]
 
cmp eax, -1
je .done
 
movzx ebx, al
movzx ebp, ah
 
stdcall pci_read32, ebp, ebx, 0
 
cmp eax, [esi+4]
jne .skip
 
mov eax, [esi+8]
stdcall pci_write8, ebp, ebx, 0x3C, eax
.skip:
add esi, 16
jmp .iterate
 
.done:
.fail:
pop ebp
ret
 
 
; IRQ_TYPE_DISABLE equ 0
; IRQ_TYPE_PIC equ 1
; IRQ_TYPE_APIC equ 2
/kernel/branches/Kolibri-acpi/gui/window.inc
1306,7 → 1306,18
mov ecx, 4
repz cmpsd
pop edi
jz .exit
jnz @f
mov edi,eax
mov eax, [edi + BOX.left - 2]
mov ax, word[edi + BOX.left]
add ax, word[edi + BOX.width]
mov ebx, [edi + BOX.top - 2]
mov bx, word[edi + BOX.top]
add bx, word[edi + BOX.height]
xor esi,esi
call draw_rectangle.forced
jmp .exit
@@:
 
add esp, -BOX.sizeof
/kernel/branches/Kolibri-acpi/init.inc
437,6 → 437,9
acpi_rsdt rd 1
acpi_madt rd 1
 
acpi_dev_data rd 1
acpi_dev_size rd 1
 
acpi_rsdt_base rd 1
acpi_madt_base rd 1
acpi_lapic_base rd 1
514,8 → 517,6
 
check_acpi:
 
xchg bx, bx
 
call acpi_locate
test eax, eax
jz .done
/kernel/branches/Kolibri-acpi/kernel.asm
679,10 → 679,12
 
; Display APIC status
mov esi, boot_APIC_found
test dword[APIC], 0xffffffff
jnz @f
cmp [irq_mode], IRQ_APIC
jne @f
 
mov esi, boot_APIC_nfound
@@: call boot_log
@@:
call boot_log
 
; PRINT AMOUNT OF MEMORY
mov esi, boot_memdetect