Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1637 → Rev 1638

/kernel/branches/Kolibri-acpi/kernel.asm
591,28 → 591,22
 
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
 
call rerouteirqs
call PIC_init
 
; Initialize system V86 machine
call init_sys_v86
 
; TIMER SET TO 1/100 S
; Initialize system timer (IRQ0)
call PIT_init
 
mov al,0x34 ; set to 100Hz
out 0x43,al
mov al,0x9b ; lsb 1193180 / 1193
out 0x40,al
mov al,0x2e ; msb
out 0x40,al
; Try to Initialize APIC
call APIC_init
 
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
; they are used: when partitions are scanned, hd_read relies on timer
; Also enable IRQ2, because in some configurations
; IRQs from slave controller are not delivered until IRQ2 on master is enabled
mov al, 0xFA
out 0x21, al
mov al, 0x3F
out 0xA1, al
call unmask_timer
stdcall enable_irq, 14
stdcall enable_irq, 15
 
; Enable interrupts in IDE controller
mov al, 0
662,6 → 656,13
mov esi,boot_fonts
call boot_log
 
; Display APIC status
mov esi, boot_APIC_found
test dword[APIC], 0xffffffff
jnz @f
mov esi, boot_APIC_nfound
@@: call boot_log
 
; PRINT AMOUNT OF MEMORY
mov esi, boot_memdetect
call boot_log
779,9 → 780,6
mov [CPU_FREQ],eax ; save tsc / sec
; mov ebx, 1000000
; div ebx
; ¢®®¡é¥-â® ¯à®¨§¢®¤¨â¥«ì­®áâì ¢ ¤ ­­®¬ ª®­ªà¥â­®¬ ¬¥áâ¥
; ᮢ¥à襭­® ­¥ªà¨â¨ç­ , ­® çâ®¡ë § âª­ãâì «î¡¨â¥«¥©
; ®¯â¨¬¨§¨àãîé¨å ª®¬¯¨«ïâ®à®¢ Ÿ‚“...
mov edx, 2251799814
mul edx
shr edx, 19
805,7 → 803,6
 
; SET MOUSE
 
;call detect_devices
stdcall load_driver, szPS2MDriver
; stdcall load_driver, szCOM_MDriver
 
904,7 → 901,7
and al,00000010b
loopnz @b
 
; mov al, 0xED ; svetodiody - only for testing!
; mov al, 0xED ; Keyboard LEDs - only for testing!
; call kb_write
; call kb_read
; mov al, 111b
963,8 → 960,9
 
end if
 
; START MULTITASKING
;-=-=-=-=-=-=- START MULTITASKING -=-=-=-=-=-=-=-=-
 
; A 'All set - press ESC to start' messages if need
if preboot_blogesc
mov esi, boot_tasking
call boot_log
973,7 → 971,6
jne .bll1
end if
 
; mov [ENABLE_TASKSWITCH],byte 1 ; multitasking enabled
 
; UNMASK ALL IRQ'S
 
994,8 → 991,12
; out 0xa0,al
;
; loop ready_for_irqs ; flush the queue
cli ;guarantee forbidance of interrupts.
stdcall enable_irq, 2 ; @#$%! PIC
stdcall enable_irq, 6 ; FDD
stdcall enable_irq, 13 ; co-processor
 
stdcall attach_int_handler, 1, irq1, 0
stdcall attach_int_handler, dword 1, irq1, dword 0 ; keyboard
 
; mov [dma_hdd],1
cmp [IDEContrRegsBaseAddr], 0
1007,7 → 1008,6
 
jmp osloop
 
; jmp $ ; wait here for timer to take control
 
; Fly :)
 
1150,8 → 1150,8
 
setirqreadports:
 
mov [irq12read+0],dword 0x60 + 0x01000000 ; read port 0x60 , byte
and dword [irq12read+4],0 ; end of port list
mov [irq00read+12*4*16],dword 0x60 + 0x01000000 ; read port 0x60 , byte
and dword [irq00read+12*4*16],0 ; end of port list
; mov [irq12read+4],dword 0 ; end of port list
;mov [irq04read+0],dword 0x3f8 + 0x01000000 ; read port 0x3f8 , byte
;mov [irq04read+4],dword 0 ; end of port list
3744,19 → 3744,19
 
push ecx
lea ecx, [irq_owner + 4 * ecx]
mov edx, [ecx]
mov edx, [ecx] ; IRQ owner PID
mov eax, [TASK_BASE]
mov edi, [eax + TASKDATA.pid]
mov edi, [eax + TASKDATA.pid] ; current task PID
pop eax
dec ebx
jnz reserve_irq
 
cmp edx, edi
; free irq
cmp edx, edi ; check owner
jne ril1
dec esi
mov [ecx], esi
mov [ecx], esi ; esi = 0
 
jmp ril1
jmp ril1 ; return successful
 
reserve_irq:
 
3793,6 → 3793,18
dd p_irq14
dd p_irq15
 
; I don`t known how to use IRQ_RESERVE
if IRQ_RESERVE > 16
dd p_irq16
dd p_irq17
dd p_irq18
dd p_irq19
dd p_irq20
dd p_irq21
dd p_irq22
dd p_irq23
end if
 
endg
 
drawbackground:
4286,64 → 4298,6
ret
end if
 
rerouteirqs:
 
cli
 
mov al,0x11 ; icw4, edge triggered
out 0x20,al
call pic_delay
out 0xA0,al
call pic_delay
 
mov al,0x20 ; generate 0x20 +
out 0x21,al
call pic_delay
mov al,0x28 ; generate 0x28 +
out 0xA1,al
call pic_delay
 
mov al,0x04 ; slave at irq2
out 0x21,al
call pic_delay
mov al,0x02 ; at irq9
out 0xA1,al
call pic_delay
 
mov al,0x01 ; 8086 mode
out 0x21,al
call pic_delay
out 0xA1,al
call pic_delay
 
mov al,255 ; mask all irq's
out 0xA1,al
call pic_delay
out 0x21,al
call pic_delay
 
mov ecx,0x1000
cld
picl1: call pic_delay
loop picl1
 
mov al,255 ; mask all irq's
out 0xA1,al
call pic_delay
out 0x21,al
call pic_delay
 
cli
 
ret
 
 
pic_delay:
 
jmp pdl1
pdl1: ret
 
 
sys_msg_board_str:
 
pushad
5118,9 → 5072,7
 
call restorefatchain
 
mov al, 0xFF
out 0x21, al
out 0xA1, al
call IRQ_mask_all
 
if 0
mov word [OS_BASE+0x467+0],pr_mode_exit