Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2111 → Rev 2112

/kernel/trunk/core/dll.inc
14,191 → 14,9
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT
PID_KERNEL equ 1 ;os_idle thread
 
align 4
proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
 
pushfd
cli
 
push ebx
 
mov ebx, [irq] ;irq num
test ebx, ebx
jz .err
cmp ebx, 15 ; hidnplayr says: we only have 16 IRQ's
ja .err
mov eax, [handler]
test eax, eax
jz .err
 
mov [irq_tab+ebx*4], eax
stdcall enable_irq, [irq]
pop ebx
mov eax, 1
popfd
ret
.err:
pop ebx
xor eax, eax
popfd
ret
endp
 
align 4
proc get_int_handler stdcall, irq:dword
 
mov eax, [irq]
cmp eax, 15
ja .fail
mov eax, [irq_tab + 4 * eax]
ret
.fail:
xor eax, eax
ret
endp
 
align 4
proc detach_int_handler
 
ret
endp
 
align 4
proc enable_irq stdcall, irq_line:dword
mov ebx, [irq_line]
mov edx, 0x21
cmp ebx, 8
jb @F
mov edx, 0xA1
sub ebx,8
@@:
in al,dx
btr eax, ebx
out dx, al
ret
endp
 
align 16
;; proc irq_serv
 
irq_serv:
 
.irq_1:
push 1
jmp .main
align 4
.irq_2:
push 2
jmp .main
align 4
.irq_3:
push 3
jmp .main
align 4
.irq_4:
push 4
jmp .main
align 4
.irq_5:
push 5
jmp .main
align 4
.irq_6:
push 6
jmp .main
align 4
.irq_7:
push 7
jmp .main
align 4
.irq_8:
push 8
jmp .main
align 4
.irq_9:
push 9
jmp .main
align 4
.irq_10:
push 10
jmp .main
align 4
.irq_11:
push 11
jmp .main
align 4
.irq_12:
push 12
jmp .main
; align 4
; .irq_13:
; push 13
; jmp .main
align 4
.irq_14:
push 14
jmp .main
align 4
.irq_15:
push 15
jmp .main
 
align 16
.main:
save_ring3_context
mov eax, [esp + 32]
mov bx, app_data ;os_data
mov ds, bx
mov es, bx
 
cmp [v86_irqhooks+eax*8], 0
jnz v86_irq
 
cmp al, 6
jnz @f
push eax
call [fdc_irq_func]
mov [check_idle_semaphore],5
pop eax
@@:
 
cmp al, 14
jnz @f
push eax
call [irq14_func]
mov [check_idle_semaphore],5
pop eax
@@:
cmp al, 15
jnz @f
push eax
call [irq15_func]
mov [check_idle_semaphore],5
pop eax
@@:
 
mov ebx, [irq_tab+eax*4]
test ebx, ebx
jz .exit
 
call ebx
mov [check_idle_semaphore],5
 
.exit:
 
cmp dword [esp + 32], 8
mov al, 0x20
jb @f
out 0xa0, al
@@:
out 0x20, al
 
restore_ring3_context
add esp, 4
 
iret
 
align 4
proc get_notify stdcall, p_ev:dword
 
.wait:
803,6 → 621,7
ret
endp
 
align 4
proc rebase_coff stdcall uses ebx esi, coff:dword, sym:dword, \
delta:dword
locals
1626,70 → 1445,3
 
call free ;release object memory
ret
 
 
 
if 0
 
irq:
 
.irq0:
pusfd
pushad
push IRQ_0
jmp .master
.irq_1:
pusfd
pushad
push IRQ_1
jmp .master
 
.master:
mov ax, app_data
mov ds, eax
mov es, eax
mov ebx, [esp+4] ;IRQ_xx
mov eax, [irq_handlers+ebx+4]
call intr_handler
mov ecx, [esp+4]
cmp [irq_actids+ecx*4], 0
je @F
in al, 0x21
bts eax, ecx
out 0x21, al
mov al, 0x20
out 0x20, al
jmp .restart
 
.slave:
mov ax, app_data
mov ds, eax
mov es, eax
mov ebx, [esp+4] ;IRQ_xx
mov eax, [irq_handlers+ebx+4]
call intr_handler
mov ecx, [esp+4]
sub ecx, 8
cmp [irq_actids+ecx*4], 0
je @F
in al, 0xA1
bts eax, ecx
out 0xA1, al
mov al, 0x20
out 0xA0, al
out 0x20, al
.restart:
mov ebx, [next_slot]
test ebx, ebx
jz @F
mov [next_task],0
mov esi, [prev_slot]
call do_change_task
add esp, 4
iretd
 
end if
 
 
 
 
/kernel/trunk/core/exports.inc
16,7 → 16,7
szGetService db 'GetService',0
szServiceHandler db 'ServiceHandler',0
szAttachIntHandler db 'AttachIntHandler',0
szGetIntHandler db 'GetIntHandler', 0
; szGetIntHandler db 'GetIntHandler', 0
szFpuSave db 'FpuSave',0
szFpuRestore db 'FpuRestore',0
szReservePortArea db 'ReservePortArea',0
92,7 → 92,7
dd szGetService , get_service
dd szServiceHandler , srv_handler
dd szAttachIntHandler, attach_int_handler
dd szGetIntHandler , get_int_handler
; dd szGetIntHandler , get_int_handler
dd szFpuSave , fpu_save
dd szFpuRestore , fpu_restore
dd szReservePortArea , r_f_port_area
/kernel/trunk/core/sys32.inc
39,17 → 39,15
times 12 dd unknown_interrupt ;int_20..int_31
 
;interrupt handlers addresses (for interrupt gate construction)
; 0x20 .. 0x2F - IRQ handlers
dd irq0, irq_serv.irq_1, irq_serv.irq_2
; if USE_COM_IRQ
dd irq_serv.irq_3, irq_serv.irq_4
; else
; dd p_irq3, p_irq4 ;??? íåñòûêîâêà
; end if
dd irq_serv.irq_5, irq_serv.irq_6, irq_serv.irq_7
dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10
dd irq_serv.irq_11, irq_serv.irq_12, irqD, irq_serv.irq_14, irq_serv.irq_15
times 16 dd unknown_interrupt ;int_0x30..int_0x3F
 
 
times 32 - IRQ_RESERVED dd unknown_interrupt
;int_0x40 gate trap (for directly copied)
dw i40 and 0xFFFF, os_code, 11101111b shl 8, i40 shr 16
 
186,6 → 184,7
stosd
mov [edi], ebx
restore_ring3_context
; simply return control to interrupted process
unknown_interrupt:
iretd
 
/kernel/trunk/core/v86.inc
328,7 → 328,7
cmp edx, -1
jz .noirqhook
uglobal
v86_irqhooks rd 16*2
v86_irqhooks rd IRQ_RESERVED * 2
endg
cmp [v86_irqhooks+edx*8], 0
jz @f
/kernel/trunk/data32.inc
98,6 → 98,9
end if
end if
 
boot_APIC_found db 'APIC enabled', 0
boot_APIC_nfound db 'APIC not found', 0
 
;new_process_loading db 'K : New Process - loading',13,10,0
;new_process_running db 'K : New Process - done',13,10,0
start_not_enough_memory db 'K : New Process - not enough memory',13,10,0
294,9 → 297,6
cur_saved_data rb 4096
fpu_data: rb 512
 
; on irq read ports
irq_tab rd 16
 
mem_block_map rb 512
mem_block_list rd 64
large_block_list rd 31
/kernel/trunk/kernel.asm
561,11 → 561,6
mov [srv.fd], eax
mov [srv.bk], eax
 
mov edi, irq_tab
xor eax, eax
mov ecx, 16
rep stosd
 
;Set base of graphic segment to linear address of LFB
mov eax,[LFBAddress] ; set for gs
mov [graph_data_l+2],ax
602,6 → 597,7
 
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
 
call init_irqs
call rerouteirqs
 
; Initialize system V86 machine
724,12 → 720,6
call boot_log
call reserve_irqs_ports
 
; SET PORTS FOR IRQ HANDLERS
 
;mov esi,boot_setrports
;call boot_log
;call setirqreadports
 
; SET UP OS TASK
 
mov esi,boot_setostask
987,6 → 977,7
 
; START MULTITASKING
 
; A 'All set - press ESC to start' messages if need
if preboot_blogesc
mov esi, boot_tasking
call boot_log
2302,10 → 2293,14
sound_flag db 0
endg
 
UID_NONE=0
UID_MENUETOS=1 ;official
UID_KOLIBRI=2 ;russian
 
iglobal
version_inf:
db 0,7,7,0 ; version 0.7.7.0
db 0 ;reserved
db UID_KOLIBRI
dd __REV__
version_end:
endg
/kernel/trunk/kernel32.inc
221,6 → 221,8
include "core/exports.inc"
include "core/string.inc"
include "core/v86.inc" ; virtual-8086 manager
;include "core/apic.inc" ; Interrupt Controller functions
include "core/irq.inc" ; irq handling functions
 
; GUI stuff
include "gui/window.inc"