Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2208 → Rev 2209

/kernel/branches/Kolibri-acpi/core/apic.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2007-2008. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/kernel/branches/Kolibri-acpi/hid/keyboard.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
;; Distributed under terms of the GNU General Public License ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8,8 → 8,6
$Revision$
 
 
;// mike.dld [
 
VKEY_LSHIFT = 0000000000000001b
VKEY_RSHIFT = 0000000000000010b
VKEY_LCONTROL = 0000000000000100b
51,28 → 49,32
dd hotkey_test4
hotkey_tests_num = 5
endg
 
;---------------------------------------------------------------------
hotkey_test0:
test al, al
setz al
ret
;---------------------------------------------------------------------
hotkey_test1:
test al, al
setnp al
ret
;---------------------------------------------------------------------
hotkey_test2:
cmp al, 3
setz al
ret
;---------------------------------------------------------------------
hotkey_test3:
cmp al, 1
setz al
ret
;---------------------------------------------------------------------
hotkey_test4:
cmp al, 2
setz al
ret
 
;---------------------------------------------------------------------
hotkey_do_test:
push eax
mov edx, [kb_state]
83,6 → 85,7
and eax, 15
cmp al, hotkey_tests_num
jae .fail
xchg eax, edx
and al, 3
call [hotkey_tests + edx*4]
89,16 → 92,14
cmp al, 1
pop eax
ret
;--------------------------------------
.fail:
stc
pop eax
ret
 
 
;---------------------------------------------------------------------
align 4
 
set_keyboard_data:
 
movzx eax,word[TASK_COUNT] ; top window process
movzx eax,word[WIN_POS+eax*2]
shl eax,8
107,22 → 108,13
 
mov eax, ecx
 
push ebx
push esi
push edi
push ebp
 
push ebx esi edi ebp
call send_scancode
 
pop ebp
pop edi
pop esi
pop ebx
pop ebp edi esi ebx
ret
 
;---------------------------------------------------------------------
align 4
irq1:
 
movzx eax,word[TASK_COUNT] ; top window process
movzx eax,word[WIN_POS+eax*2]
shl eax,8
130,20 → 122,18
mov [keyboard_mode],al
 
in al,0x60
 
;--------------------------------------
send_scancode:
 
mov [keyboard_data],al
 
; ch = scancode
; cl = ext_code
; bh = 0 - normal key
; bh = 1 - modifier (Shift/Ctrl/Alt)
; bh = 2 - extended code
 
mov ch,al
cmp al,0xE0
je @f
cmp al,0xE1
jne .normal_code
@@:
150,100 → 140,148
mov bh, 2
mov [ext_code], al
jmp .writekey
;--------------------------------------
.normal_code:
mov cl, 0
xchg cl, [ext_code]
and al,0x7F
mov bh, 1
@@: cmp al,0x2A
@@:
cmp al,0x2A
jne @f
cmp cl,0xE0
je .writekey
mov eax,VKEY_LSHIFT
jmp .modifier
@@: cmp al,0x36
;--------------------------------------
@@:
cmp al,0x36
jne @f
cmp cl,0xE0
je .writekey
mov eax,VKEY_RSHIFT
jmp .modifier
@@: cmp al,0x38
;--------------------------------------
@@:
cmp al,0x38
jne @f
mov eax, VKEY_LALT
test cl, cl
jz .modifier
mov al, VKEY_RALT
jmp .modifier
@@: cmp al,0x1D
;--------------------------------------
@@:
cmp al,0x1D
jne @f
mov eax, VKEY_LCONTROL
test cl, cl
jz .modifier
mov al, VKEY_RCONTROL
cmp cl, 0xE0
jz .modifier
mov [ext_code], cl
jmp .writekey
@@: cmp al,0x3A
;--------------------------------------
@@:
cmp al,0x3A
jne @f
mov bl,4
mov eax,VKEY_CAPSLOCK
jmp .no_key.xor
@@: cmp al,0x45
;--------------------------------------
@@:
cmp al,0x45
jne @f
test cl, cl
jnz .writekey
mov bl,2
mov eax,VKEY_NUMLOCK
jmp .no_key.xor
@@: cmp al,0x46
;--------------------------------------
@@:
cmp al,0x46
jne @f
mov bl,1
mov eax,VKEY_SCRLOCK
jmp .no_key.xor
;--------------------------------------
@@:
xor ebx,ebx
test ch,ch
js .writekey
movzx eax,ch ; plain key
mov bl,[keymap+eax]
mov edx,[kb_state]
test dl,VKEY_CONTROL ; ctrl alt del
jz .noctrlaltdel
test dl,VKEY_ALT
jz .noctrlaltdel
cmp ch,53h
jne .noctrlaltdel
mov [ctrl_alt_del],1
.noctrlaltdel:
test dl,VKEY_CONTROL ; ctrl on ?
jz @f
sub bl,0x60
@@: test dl,VKEY_SHIFT ; shift on ?
@@:
test dl,VKEY_CAPSLOCK ; caps lock on ?
jz .no_caps_lock
test dl,VKEY_SHIFT ; shift on ?
jz .keymap_shif
jmp @f
;--------------------------------------
.no_caps_lock:
test dl,VKEY_SHIFT ; shift on ?
jz @f
.keymap_shif:
mov bl,[keymap_shift+eax]
@@: test dl,VKEY_ALT ; alt on ?
@@:
test dl,VKEY_ALT ; alt on ?
jz @f
mov bl,[keymap_alt+eax]
@@:
jmp .writekey
;--------------------------------------
.modifier:
test ch, ch
js .modifier.up
or [kb_state], eax
jmp .writekey
;--------------------------------------
.modifier.up:
not eax
and [kb_state], eax
jmp .writekey
;--------------------------------------
.no_key.xor:
mov bh, 0
test ch, ch
js .writekey
xor [kb_state], eax
xor [kb_lights], bl
call set_lights
 
.writekey:
; test for system hotkeys
movzx eax, ch
250,6 → 288,7
cmp bh, 1
ja .nohotkey
jb @f
xor eax, eax
@@:
mov eax, [hotkey_scancodes + eax*4]
256,12 → 295,15
.hotkey_loop:
test eax, eax
jz .nohotkey
mov cl, 0
call hotkey_do_test
jc .hotkey_cont
mov cl, 2
call hotkey_do_test
jc .hotkey_cont
mov cl, 4
call hotkey_do_test
jnc .hotkey_found
268,6 → 310,7
.hotkey_cont:
mov eax, [eax]
jmp .hotkey_loop
;--------------------------------------
.hotkey_found:
mov eax, [eax+8]
; put key in buffer for process in slot eax
275,6 → 318,7
@@:
cmp dword [edi], 0
jz .found_free
add edi, 8
cmp edi, hotkey_buffer+120*8
jb @b
285,6 → 329,7
movzx eax, ch
cmp bh, 1
jnz @f
xor eax, eax
@@:
mov [edi+4], ax
291,37 → 336,40
mov eax, [kb_state]
mov [edi+6], ax
jmp .exit.irq1
;--------------------------------------
.nohotkey:
cmp [keyboard_mode],0 ; return from keymap
jne .scancode
test bh, bh
jnz .exit.irq1
test bl, bl
jz .exit.irq1
 
;.........................Part1 Start.......Code by Rus, optimize by Ghost...................................
test [kb_state], VKEY_NUMLOCK
jz .dowrite
cmp cl, 0xE0
jz .dowrite
 
cmp ch, 55
jnz @f
mov bl, 0x2A ;*
jmp .dowrite
;--------------------------------------
@@:
cmp ch, 71
jb .dowrite
cmp ch, 83
ja .dowrite
;push eax
movzx eax, ch
mov bl, [numlock_map + eax - 71]
;pop eax
 
;.........................Part1 End.................................................
 
jmp .dowrite
;--------------------------------------
.scancode:
mov bl, ch
.dowrite:
331,12 → 379,10
inc eax
mov [KEY_COUNT],al
mov [KEY_COUNT+eax],bl
 
.exit.irq1:
mov [check_idle_semaphore],5
 
ret
 
;---------------------------------------------------------------------
set_lights:
mov al,0xED
call kb_write
343,9 → 389,7
mov al,[kb_lights]
call kb_write
ret
 
;// mike.dld ]
;..........................Part2 Start.......Code by Rus.......................................
;---------------------------------------------------------------------
numlock_map:
db 0x37 ;Num 7
db 0x38 ;Num 8
360,4 → 404,4
db 0x33 ;Num 3
db 0x30 ;Num 0
db 0x2E ;Num .
;..........................Part2 End................................................
;---------------------------------------------------------------------
/kernel/branches/Kolibri-acpi/network/socket.inc
801,8 → 801,9
 
.exit:
lea ecx, [ebx + SOCKET.lock]
mov ebx,eax
call mutex_unlock
mov eax, edx
mov eax,ebx
ret ; at last, exit
 
.error:
814,8 → 815,9
mov [ebx + SOCKET.rxDataCount], esi ; store new count (zero)
call .start_copy
lea ecx, [ebx + SOCKET.lock]
mov ebx,eax
call mutex_unlock
mov eax, edx
mov eax,ebx
ret
 
.start_copy:
/kernel/branches/Kolibri-acpi/network/tcp.inc
964,8 → 964,10
 
.data:
push ecx
push ecx edx
lea ecx, [ebx+SOCKET.lock]
call mutex_lock
pop edx ecx
 
push ebx
mov eax, [ebx + SOCKET.rxDataCount]