forked from KolibriOS/kolibrios
style fixes, no binary changes (style checker was sick for some time)
git-svn-id: svn://kolibrios.org@3711 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
99a5913d54
commit
65d0cef44b
@ -142,10 +142,10 @@ hd_read_pio:
|
|||||||
add al, 128+64+32
|
add al, 128+64+32
|
||||||
out dx, al ; номер головки/номер диска
|
out dx, al ; номер головки/номер диска
|
||||||
inc edx
|
inc edx
|
||||||
mov al, 20h ; READ SECTOR(S)
|
mov al, 20h ; READ SECTOR(S)
|
||||||
out dx, al ; ATACommand регистр команд
|
out dx, al ; ATACommand регистр команд
|
||||||
popfd
|
popfd
|
||||||
jmp .continue
|
jmp .continue
|
||||||
.lba48:
|
.lba48:
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
@ -160,14 +160,14 @@ hd_read_pio:
|
|||||||
out dx, al ; Sector Count Current Sector count (7:0)
|
out dx, al ; Sector Count Current Sector count (7:0)
|
||||||
inc edx
|
inc edx
|
||||||
mov eax, [esp+4+4]
|
mov eax, [esp+4+4]
|
||||||
rol eax,8
|
rol eax, 8
|
||||||
out dx, al ; LBA Low Previous LBA (31:24)
|
out dx, al ; LBA Low Previous LBA (31:24)
|
||||||
xor eax,eax ; because only 32 bit cache
|
xor eax, eax; because only 32 bit cache
|
||||||
inc edx
|
inc edx
|
||||||
out dx, al ; LBA Mid Previous LBA (39:32)
|
out dx, al ; LBA Mid Previous LBA (39:32)
|
||||||
inc edx
|
inc edx
|
||||||
out dx, al ; LBA High Previous LBA (47:40)
|
out dx, al ; LBA High Previous LBA (47:40)
|
||||||
sub edx,2
|
sub edx, 2
|
||||||
mov eax, [esp+4+4]
|
mov eax, [esp+4+4]
|
||||||
out dx, al ; LBA Low Current LBA (7:0)
|
out dx, al ; LBA Low Current LBA (7:0)
|
||||||
shr eax, 8
|
shr eax, 8
|
||||||
@ -181,7 +181,7 @@ hd_read_pio:
|
|||||||
add al, 128+64+32
|
add al, 128+64+32
|
||||||
out dx, al; номер головки/номер диска
|
out dx, al; номер головки/номер диска
|
||||||
inc edx
|
inc edx
|
||||||
mov al, 24h ; READ SECTOR(S) EXT
|
mov al, 24h ; READ SECTOR(S) EXT
|
||||||
out dx, al; ATACommand регистр команд
|
out dx, al; ATACommand регистр команд
|
||||||
popfd
|
popfd
|
||||||
.continue:
|
.continue:
|
||||||
@ -339,7 +339,7 @@ cache_write_pio:
|
|||||||
mov al, 30h ; WRITE SECTOR(S)
|
mov al, 30h ; WRITE SECTOR(S)
|
||||||
out dx, al ; ATACommand регистр команд
|
out dx, al ; ATACommand регистр команд
|
||||||
popfd
|
popfd
|
||||||
jmp .continue
|
jmp .continue
|
||||||
.lba48:
|
.lba48:
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
@ -354,14 +354,14 @@ cache_write_pio:
|
|||||||
out dx, al ; Sector Count Current Sector count (7:0)
|
out dx, al ; Sector Count Current Sector count (7:0)
|
||||||
inc edx
|
inc edx
|
||||||
mov eax, [esi]
|
mov eax, [esi]
|
||||||
rol eax,8
|
rol eax, 8
|
||||||
out dx, al ; LBA Low Previous LBA (31:24)
|
out dx, al ; LBA Low Previous LBA (31:24)
|
||||||
xor eax,eax ; because only 32 bit cache
|
xor eax, eax; because only 32 bit cache
|
||||||
inc edx
|
inc edx
|
||||||
out dx, al ; LBA Mid Previous LBA (39:32)
|
out dx, al ; LBA Mid Previous LBA (39:32)
|
||||||
inc edx
|
inc edx
|
||||||
out dx, al ; LBA High Previous LBA (47:40)
|
out dx, al ; LBA High Previous LBA (47:40)
|
||||||
sub edx,2
|
sub edx, 2
|
||||||
mov eax, [esi]
|
mov eax, [esi]
|
||||||
out dx, al ; LBA Low Current LBA (7:0)
|
out dx, al ; LBA Low Current LBA (7:0)
|
||||||
shr eax, 8
|
shr eax, 8
|
||||||
@ -375,7 +375,7 @@ cache_write_pio:
|
|||||||
add al, 128+64+32
|
add al, 128+64+32
|
||||||
out dx, al; номер головки/номер диска
|
out dx, al; номер головки/номер диска
|
||||||
inc edx
|
inc edx
|
||||||
mov al, 34h ; WRITE SECTOR(S) EXT
|
mov al, 34h ; WRITE SECTOR(S) EXT
|
||||||
out dx, al; ATACommand регистр команд
|
out dx, al; ATACommand регистр команд
|
||||||
popfd
|
popfd
|
||||||
.continue:
|
.continue:
|
||||||
@ -925,10 +925,10 @@ write_cache_chain:
|
|||||||
uglobal
|
uglobal
|
||||||
IDEContrRegsBaseAddr dw ?
|
IDEContrRegsBaseAddr dw ?
|
||||||
IDEContrProgrammingInterface dw ?
|
IDEContrProgrammingInterface dw ?
|
||||||
IDE_BAR0_val dw ?
|
IDE_BAR0_val dw ?
|
||||||
IDE_BAR1_val dw ?
|
IDE_BAR1_val dw ?
|
||||||
IDE_BAR2_val dw ?
|
IDE_BAR2_val dw ?
|
||||||
IDE_BAR3_val dw ?
|
IDE_BAR3_val dw ?
|
||||||
endg
|
endg
|
||||||
; \end{Mario79}
|
; \end{Mario79}
|
||||||
|
|
||||||
|
@ -387,12 +387,12 @@ sayerr:
|
|||||||
|
|
||||||
push 0
|
push 0
|
||||||
pop es
|
pop es
|
||||||
xor ax,ax
|
xor ax, ax
|
||||||
and word [es:BOOT_IDE_BASE_ADDR], ax ;0
|
and word [es:BOOT_IDE_BASE_ADDR], ax ;0
|
||||||
and word [es:BOOT_IDE_BAR0_16], ax ;0
|
and word [es:BOOT_IDE_BAR0_16], ax ;0
|
||||||
and word [es:BOOT_IDE_BAR1_16], ax ;0
|
and word [es:BOOT_IDE_BAR1_16], ax ;0
|
||||||
and word [es:BOOT_IDE_BAR2_16], ax ;0
|
and word [es:BOOT_IDE_BAR2_16], ax ;0
|
||||||
and word [es:BOOT_IDE_BAR3_16], ax ;0
|
and word [es:BOOT_IDE_BAR3_16], ax ;0
|
||||||
; \begin{Mario79}
|
; \begin{Mario79}
|
||||||
; find HDD IDE DMA PCI device
|
; find HDD IDE DMA PCI device
|
||||||
; check for PCI BIOS
|
; check for PCI BIOS
|
||||||
@ -433,55 +433,55 @@ sayerr:
|
|||||||
int 0x1A
|
int 0x1A
|
||||||
jnc .found
|
jnc .found
|
||||||
|
|
||||||
jmp .nopci
|
jmp .nopci
|
||||||
.found_1:
|
.found_1:
|
||||||
; get memory base BAR4
|
; get memory base BAR4
|
||||||
mov ax, 0xB10A
|
mov ax, 0xB10A
|
||||||
mov di, 0x20 ; memory base is config register at 0x20
|
mov di, 0x20 ; memory base is config register at 0x20
|
||||||
push cx
|
push cx
|
||||||
int 0x1A
|
int 0x1A
|
||||||
jc .no_BAR4 ;.nopci
|
jc .no_BAR4 ;.nopci
|
||||||
and cx, 0xFFF0 ; clear address decode type
|
and cx, 0xFFF0 ; clear address decode type
|
||||||
mov [es:BOOT_IDE_BASE_ADDR], cx
|
mov [es:BOOT_IDE_BASE_ADDR], cx
|
||||||
.no_BAR4:
|
.no_BAR4:
|
||||||
pop cx
|
pop cx
|
||||||
.found:
|
.found:
|
||||||
; get memory base BAR0
|
; get memory base BAR0
|
||||||
mov ax, 0xB10A
|
mov ax, 0xB10A
|
||||||
mov di, 0x10 ; memory base is config register at 0x20
|
mov di, 0x10 ; memory base is config register at 0x20
|
||||||
push cx
|
push cx
|
||||||
int 0x1A
|
int 0x1A
|
||||||
jc .no_BAR0 ;.nopci
|
jc .no_BAR0 ;.nopci
|
||||||
mov [es:BOOT_IDE_BAR0_16], cx
|
mov [es:BOOT_IDE_BAR0_16], cx
|
||||||
.no_BAR0:
|
.no_BAR0:
|
||||||
pop cx
|
pop cx
|
||||||
; get memory base BAR1
|
; get memory base BAR1
|
||||||
mov ax, 0xB10A
|
mov ax, 0xB10A
|
||||||
mov di, 0x14 ; memory base is config register at 0x20
|
mov di, 0x14 ; memory base is config register at 0x20
|
||||||
push cx
|
push cx
|
||||||
int 0x1A
|
int 0x1A
|
||||||
jc .no_BAR1 ;.nopci
|
jc .no_BAR1 ;.nopci
|
||||||
mov [es:BOOT_IDE_BAR1_16], cx
|
mov [es:BOOT_IDE_BAR1_16], cx
|
||||||
.no_BAR1:
|
.no_BAR1:
|
||||||
pop cx
|
pop cx
|
||||||
; get memory base BAR2
|
; get memory base BAR2
|
||||||
mov ax, 0xB10A
|
mov ax, 0xB10A
|
||||||
mov di, 0x18 ; memory base is config register at 0x20
|
mov di, 0x18 ; memory base is config register at 0x20
|
||||||
push cx
|
push cx
|
||||||
int 0x1A
|
int 0x1A
|
||||||
jc .no_BAR2 ;.nopci
|
jc .no_BAR2 ;.nopci
|
||||||
mov [es:BOOT_IDE_BAR2_16], cx
|
mov [es:BOOT_IDE_BAR2_16], cx
|
||||||
.no_BAR2:
|
.no_BAR2:
|
||||||
pop cx
|
pop cx
|
||||||
; get memory base BAR3
|
; get memory base BAR3
|
||||||
mov ax, 0xB10A
|
mov ax, 0xB10A
|
||||||
mov di, 0x1C ; memory base is config register at 0x20
|
mov di, 0x1C ; memory base is config register at 0x20
|
||||||
push cx
|
push cx
|
||||||
int 0x1A
|
int 0x1A
|
||||||
jc .no_BAR3 ;.nopci
|
jc .no_BAR3 ;.nopci
|
||||||
mov [es:BOOT_IDE_BAR3_16], cx
|
mov [es:BOOT_IDE_BAR3_16], cx
|
||||||
.no_BAR3:
|
.no_BAR3:
|
||||||
pop cx
|
pop cx
|
||||||
.nopci:
|
.nopci:
|
||||||
; \end{Mario79}
|
; \end{Mario79}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ NextTD dd ?
|
|||||||
; Virtual pointer to the next processed TD.
|
; Virtual pointer to the next processed TD.
|
||||||
BufEnd dd ?
|
BufEnd dd ?
|
||||||
; Physical address of the last byte in the buffer for this TD.
|
; Physical address of the last byte in the buffer for this TD.
|
||||||
dd ? ; padding to align with uhci_gtd
|
dd ? ; padding to align with uhci_gtd
|
||||||
ends
|
ends
|
||||||
|
|
||||||
; OHCI isochronous transfer descriptor.
|
; OHCI isochronous transfer descriptor.
|
||||||
|
@ -65,19 +65,19 @@ FindHDD_1:
|
|||||||
inc byte [DRIVE_DATA+1]
|
inc byte [DRIVE_DATA+1]
|
||||||
inc byte [DRIVE_DATA+1]
|
inc byte [DRIVE_DATA+1]
|
||||||
Print_Device_Name:
|
Print_Device_Name:
|
||||||
pushad
|
pushad
|
||||||
pushfd
|
pushfd
|
||||||
mov esi,Sector512+27*2
|
mov esi, Sector512+27*2
|
||||||
mov edi,dev_name
|
mov edi, dev_name
|
||||||
mov ecx,20
|
mov ecx, 20
|
||||||
cld
|
cld
|
||||||
@@:
|
@@:
|
||||||
lodsw
|
lodsw
|
||||||
xchg ah,al
|
xchg ah, al
|
||||||
stosw
|
stosw
|
||||||
loop @b
|
loop @b
|
||||||
popfd
|
popfd
|
||||||
popad
|
popad
|
||||||
DEBUGF 1, "K : Dev: %s \n", dev_name
|
DEBUGF 1, "K : Dev: %s \n", dev_name
|
||||||
FindHDD_2_2:
|
FindHDD_2_2:
|
||||||
ret
|
ret
|
||||||
@ -91,7 +91,7 @@ FindHDD_3:
|
|||||||
uglobal
|
uglobal
|
||||||
SectorAddress DD ?
|
SectorAddress DD ?
|
||||||
dev_name:
|
dev_name:
|
||||||
rb 41
|
rb 41
|
||||||
endg
|
endg
|
||||||
;*************************************************
|
;*************************************************
|
||||||
;* ЧТЕНИЕ ИДЕНТИФИКАТОРА ЖЕСТКОГО ДИСКА *
|
;* ЧТЕНИЕ ИДЕНТИФИКАТОРА ЖЕСТКОГО ДИСКА *
|
||||||
|
@ -17,8 +17,8 @@ $Revision$
|
|||||||
search_partitions_ide0:
|
search_partitions_ide0:
|
||||||
test [DRIVE_DATA+1], byte 0x40
|
test [DRIVE_DATA+1], byte 0x40
|
||||||
jz search_partitions_ide1
|
jz search_partitions_ide1
|
||||||
mov eax,[hd_address_table]
|
mov eax, [hd_address_table]
|
||||||
mov [hdbase], eax ;0x1f0
|
mov [hdbase], eax ;0x1f0
|
||||||
mov [hdid], 0x0
|
mov [hdid], 0x0
|
||||||
mov [hdpos], 1
|
mov [hdpos], 1
|
||||||
mov [known_part], 1
|
mov [known_part], 1
|
||||||
@ -40,8 +40,8 @@ $Revision$
|
|||||||
search_partitions_ide1:
|
search_partitions_ide1:
|
||||||
test [DRIVE_DATA+1], byte 0x10
|
test [DRIVE_DATA+1], byte 0x10
|
||||||
jz search_partitions_ide2
|
jz search_partitions_ide2
|
||||||
mov eax,[hd_address_table]
|
mov eax, [hd_address_table]
|
||||||
mov [hdbase], eax ;0x1f0
|
mov [hdbase], eax ;0x1f0
|
||||||
mov [hdid], 0x10
|
mov [hdid], 0x10
|
||||||
mov [hdpos], 2
|
mov [hdpos], 2
|
||||||
mov [known_part], 1
|
mov [known_part], 1
|
||||||
@ -63,8 +63,8 @@ $Revision$
|
|||||||
search_partitions_ide2:
|
search_partitions_ide2:
|
||||||
test [DRIVE_DATA+1], byte 0x4
|
test [DRIVE_DATA+1], byte 0x4
|
||||||
jz search_partitions_ide3
|
jz search_partitions_ide3
|
||||||
mov eax,[hd_address_table+16]
|
mov eax, [hd_address_table+16]
|
||||||
mov [hdbase], eax ;0x170
|
mov [hdbase], eax ;0x170
|
||||||
mov [hdid], 0x0
|
mov [hdid], 0x0
|
||||||
mov [hdpos], 3
|
mov [hdpos], 3
|
||||||
mov [known_part], 1
|
mov [known_part], 1
|
||||||
@ -86,8 +86,8 @@ $Revision$
|
|||||||
search_partitions_ide3:
|
search_partitions_ide3:
|
||||||
test [DRIVE_DATA+1], byte 0x1
|
test [DRIVE_DATA+1], byte 0x1
|
||||||
jz end_search_partitions_ide
|
jz end_search_partitions_ide
|
||||||
mov eax,[hd_address_table+16]
|
mov eax, [hd_address_table+16]
|
||||||
mov [hdbase], eax ;0x170
|
mov [hdbase], eax ;0x170
|
||||||
mov [hdid], 0x10
|
mov [hdid], 0x10
|
||||||
mov [hdpos], 4
|
mov [hdpos], 4
|
||||||
mov [known_part], 1
|
mov [known_part], 1
|
||||||
|
@ -7,36 +7,36 @@
|
|||||||
macro workers_globals
|
macro workers_globals
|
||||||
{
|
{
|
||||||
; include global constants from previous workers
|
; include global constants from previous workers
|
||||||
workers_globals
|
workers_globals
|
||||||
align 4
|
align 4
|
||||||
; Callbacks for HID layer.
|
; Callbacks for HID layer.
|
||||||
keyboard_driver:
|
keyboard_driver:
|
||||||
dd keyboard_driver_add_device
|
dd keyboard_driver_add_device
|
||||||
dd keyboard_driver_disconnect
|
dd keyboard_driver_disconnect
|
||||||
dd keyboard_driver_begin_packet
|
dd keyboard_driver_begin_packet
|
||||||
dd keyboard_driver_array_overflow?
|
dd keyboard_driver_array_overflow?
|
||||||
dd keyboard_driver_input_field
|
dd keyboard_driver_input_field
|
||||||
dd keyboard_driver_end_packet
|
dd keyboard_driver_end_packet
|
||||||
; Callbacks for keyboard layer.
|
; Callbacks for keyboard layer.
|
||||||
kbd_functions:
|
kbd_functions:
|
||||||
dd 12
|
dd 12
|
||||||
dd CloseKeyboard
|
dd CloseKeyboard
|
||||||
dd SetKeyboardLights
|
dd SetKeyboardLights
|
||||||
; Kernel keyboard layer takes input in form of PS/2 scancodes.
|
; Kernel keyboard layer takes input in form of PS/2 scancodes.
|
||||||
; data for keyboard: correspondence between HID usage keys and PS/2 scancodes.
|
; data for keyboard: correspondence between HID usage keys and PS/2 scancodes.
|
||||||
EX = 80h ; if set, precede the scancode with special scancode 0xE0
|
EX = 80h ; if set, precede the scancode with special scancode 0xE0
|
||||||
label control_keys byte
|
label control_keys byte
|
||||||
; Usages 700E0h ... 700E7h: LCtrl, LShift, LAlt, LWin, RCtrl, RShift, RAlt, RWin
|
; Usages 700E0h ... 700E7h: LCtrl, LShift, LAlt, LWin, RCtrl, RShift, RAlt, RWin
|
||||||
db 1Dh, 2Ah, 38h, 5Bh+EX, 1Dh+EX, 36h, 38h+EX, 5Ch+EX
|
db 1Dh, 2Ah, 38h, 5Bh+EX, 1Dh+EX, 36h, 38h+EX, 5Ch+EX
|
||||||
; Usages 70004h ... 70004h + normal_keys_number - 1
|
; Usages 70004h ... 70004h + normal_keys_number - 1
|
||||||
label normal_keys byte
|
label normal_keys byte
|
||||||
db 1Eh, 30h, 2Eh, 20h, 12h, 21h, 22h, 23h, 17h, 24h, 25h, 26h, 32h, 31h, 18h, 19h
|
db 1Eh, 30h, 2Eh, 20h, 12h, 21h, 22h, 23h, 17h, 24h, 25h, 26h, 32h, 31h, 18h, 19h
|
||||||
db 10h, 13h, 1Fh, 14h, 16h, 2Fh, 11h, 2Dh, 15h, 2Ch, 02h, 03h, 04h, 05h, 06h, 07h
|
db 10h, 13h, 1Fh, 14h, 16h, 2Fh, 11h, 2Dh, 15h, 2Ch, 02h, 03h, 04h, 05h, 06h, 07h
|
||||||
db 08h, 09h, 0Ah, 0Bh, 1Ch, 01h, 0Eh, 0Fh, 39h, 0Ch, 0Dh, 1Ah, 1Bh, 2Bh, 0, 27h
|
db 08h, 09h, 0Ah, 0Bh, 1Ch, 01h, 0Eh, 0Fh, 39h, 0Ch, 0Dh, 1Ah, 1Bh, 2Bh, 0, 27h
|
||||||
db 28h, 29h, 33h, 34h, 35h, 3Ah, 3Bh, 3Ch, 3Dh, 3Eh, 3Fh, 40h, 41h, 42h, 43h, 44h
|
db 28h, 29h, 33h, 34h, 35h, 3Ah, 3Bh, 3Ch, 3Dh, 3Eh, 3Fh, 40h, 41h, 42h, 43h, 44h
|
||||||
db 57h, 58h,37h+EX,46h,0,52h+EX,47h+EX,49h+EX,53h+EX,4Fh+EX,51h+EX,4Dh+EX,4Bh+EX,50h+EX,48h+EX,45h
|
db 57h, 58h,37h+EX,46h,0,52h+EX,47h+EX,49h+EX,53h+EX,4Fh+EX,51h+EX,4Dh+EX,4Bh+EX,50h+EX,48h+EX,45h
|
||||||
db 35h+EX,37h,4Ah,4Eh,1Ch+EX,4Fh,50h, 51h, 4Bh, 4Ch, 4Dh, 47h, 48h, 49h, 52h, 53h
|
db 35h+EX,37h,4Ah,4Eh,1Ch+EX,4Fh,50h, 51h, 4Bh, 4Ch, 4Dh, 47h, 48h, 49h, 52h, 53h
|
||||||
db 0,5Dh+EX,5Eh+EX
|
db 0,5Dh+EX,5Eh+EX
|
||||||
normal_keys_number = $ - normal_keys
|
normal_keys_number = $ - normal_keys
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,13 +45,13 @@ struct keyboard_device_data
|
|||||||
handle dd ? ; keyboard handle from RegKeyboard
|
handle dd ? ; keyboard handle from RegKeyboard
|
||||||
timer dd ? ; auto-repeat timer handle
|
timer dd ? ; auto-repeat timer handle
|
||||||
repeatkey db ? ; auto-repeat key code
|
repeatkey db ? ; auto-repeat key code
|
||||||
rb 3 ; padding
|
rb 3 ; padding
|
||||||
usbdev dd ? ; pointer to device_data of USB and HID layers
|
usbdev dd ? ; pointer to device_data of USB and HID layers
|
||||||
modifiers dd ? ; state of LCtrl ... RWin
|
modifiers dd ? ; state of LCtrl ... RWin
|
||||||
led_report dd ? ; output report for LEDs state
|
led_report dd ? ; output report for LEDs state
|
||||||
numlock_bit dd ? ; position of NumLock bit in LED output report
|
numlock_bit dd ? ; position of NumLock bit in LED output report
|
||||||
capslock_bit dd ?
|
capslock_bit dd ?
|
||||||
scrolllock_bit dd ? ; guess what
|
scrolllock_bit dd ? ; guess what
|
||||||
ends
|
ends
|
||||||
|
|
||||||
; This procedure is called when HID layer detects a new keyboard.
|
; This procedure is called when HID layer detects a new keyboard.
|
||||||
@ -59,117 +59,117 @@ ends
|
|||||||
; out: eax = device-specific data or NULL on error
|
; out: eax = device-specific data or NULL on error
|
||||||
proc keyboard_driver_add_device
|
proc keyboard_driver_add_device
|
||||||
; 1. Allocate memory for keyboard_device_data. If failed, return NULL.
|
; 1. Allocate memory for keyboard_device_data. If failed, return NULL.
|
||||||
movi eax, sizeof.keyboard_device_data
|
movi eax, sizeof.keyboard_device_data
|
||||||
call Kmalloc
|
call Kmalloc
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .nothing
|
jz .nothing
|
||||||
; 2. Initialize keyboard_device_data: store pointer to USB layer data,
|
; 2. Initialize keyboard_device_data: store pointer to USB layer data,
|
||||||
; zero some fields, initialize bit positions to -1.
|
; zero some fields, initialize bit positions to -1.
|
||||||
mov [eax+keyboard_device_data.usbdev], ebx
|
mov [eax+keyboard_device_data.usbdev], ebx
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
mov [eax+keyboard_device_data.timer], ecx
|
mov [eax+keyboard_device_data.timer], ecx
|
||||||
mov [eax+keyboard_device_data.repeatkey], cl
|
mov [eax+keyboard_device_data.repeatkey], cl
|
||||||
mov [eax+keyboard_device_data.modifiers], ecx
|
mov [eax+keyboard_device_data.modifiers], ecx
|
||||||
mov [eax+keyboard_device_data.led_report], ecx
|
mov [eax+keyboard_device_data.led_report], ecx
|
||||||
dec ecx
|
dec ecx
|
||||||
mov [eax+keyboard_device_data.numlock_bit], ecx
|
mov [eax+keyboard_device_data.numlock_bit], ecx
|
||||||
mov [eax+keyboard_device_data.capslock_bit], ecx
|
mov [eax+keyboard_device_data.capslock_bit], ecx
|
||||||
mov [eax+keyboard_device_data.scrolllock_bit], ecx
|
mov [eax+keyboard_device_data.scrolllock_bit], ecx
|
||||||
; 3. Look for LED report and bits corresponding to indicators.
|
; 3. Look for LED report and bits corresponding to indicators.
|
||||||
; For now, assume that all LEDs are set by the same report.
|
; For now, assume that all LEDs are set by the same report.
|
||||||
; 3a. Save registers.
|
; 3a. Save registers.
|
||||||
push ebx esi
|
push ebx esi
|
||||||
; 3b. Prepare for loop over output reports: get the first output report.
|
; 3b. Prepare for loop over output reports: get the first output report.
|
||||||
; If there are no output records, skip step 3;
|
; If there are no output records, skip step 3;
|
||||||
; default values of led_report and *_bit were set in step 2.
|
; default values of led_report and *_bit were set in step 2.
|
||||||
mov edx, [edi+collection.output.first_report]
|
mov edx, [edi+collection.output.first_report]
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jz .led_report_set
|
jz .led_report_set
|
||||||
.scan_led_report:
|
.scan_led_report:
|
||||||
; Process one output report.
|
; Process one output report.
|
||||||
; 3c. Prepare for loop over field groups in the current report:
|
; 3c. Prepare for loop over field groups in the current report:
|
||||||
; get the first field group.
|
; get the first field group.
|
||||||
mov ecx, [edx+report.first_field]
|
mov ecx, [edx+report.first_field]
|
||||||
.scan_led_field:
|
.scan_led_field:
|
||||||
; Process one field group.
|
; Process one field group.
|
||||||
; 3d. If there are no more field groups, exit the loop over field groups.
|
; 3d. If there are no more field groups, exit the loop over field groups.
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .next_led_report
|
jz .next_led_report
|
||||||
; For now, assume that all LEDs are plain variable fields, not arrays.
|
; For now, assume that all LEDs are plain variable fields, not arrays.
|
||||||
; 3e. Ignore array field groups.
|
; 3e. Ignore array field groups.
|
||||||
test byte [ecx+report_field_group.flags], HID_FIELD_VARIABLE
|
test byte [ecx+report_field_group.flags], HID_FIELD_VARIABLE
|
||||||
jz .next_led_field
|
jz .next_led_field
|
||||||
; 3f. Loop over all fields in the current group.
|
; 3f. Loop over all fields in the current group.
|
||||||
push [ecx+report_field_group.count]
|
push [ecx+report_field_group.count]
|
||||||
; esi = pointer to usage of the current field
|
; esi = pointer to usage of the current field
|
||||||
lea esi, [ecx+report_field_group.common_sizeof]
|
lea esi, [ecx+report_field_group.common_sizeof]
|
||||||
; ebx = bit position of the current field
|
; ebx = bit position of the current field
|
||||||
mov ebx, [ecx+report_field_group.offset]
|
mov ebx, [ecx+report_field_group.offset]
|
||||||
; if report is numbered, add extra byte in the start of report
|
; if report is numbered, add extra byte in the start of report
|
||||||
cmp [edx+report.id], 0
|
cmp [edx+report.id], 0
|
||||||
jz .scan_led_usage
|
jz .scan_led_usage
|
||||||
add ebx, 8
|
add ebx, 8
|
||||||
.scan_led_usage:
|
.scan_led_usage:
|
||||||
; for USAGE_LED_*LOCK, store the current bit position in the corresponding field
|
; for USAGE_LED_*LOCK, store the current bit position in the corresponding field
|
||||||
; and store the current report as the LED report
|
; and store the current report as the LED report
|
||||||
cmp dword [esi], USAGE_LED_NUMLOCK
|
cmp dword [esi], USAGE_LED_NUMLOCK
|
||||||
jz .numlock
|
jz .numlock
|
||||||
cmp dword [esi], USAGE_LED_CAPSLOCK
|
cmp dword [esi], USAGE_LED_CAPSLOCK
|
||||||
jz .capslock
|
jz .capslock
|
||||||
cmp dword [esi], USAGE_LED_SCROLLLOCK
|
cmp dword [esi], USAGE_LED_SCROLLLOCK
|
||||||
jnz .next_field
|
jnz .next_field
|
||||||
.scrolllock:
|
.scrolllock:
|
||||||
mov [eax+keyboard_device_data.scrolllock_bit], ebx
|
mov [eax+keyboard_device_data.scrolllock_bit], ebx
|
||||||
jmp @f
|
jmp @f
|
||||||
.capslock:
|
.capslock:
|
||||||
mov [eax+keyboard_device_data.capslock_bit], ebx
|
mov [eax+keyboard_device_data.capslock_bit], ebx
|
||||||
jmp @f
|
jmp @f
|
||||||
.numlock:
|
.numlock:
|
||||||
mov [eax+keyboard_device_data.numlock_bit], ebx
|
mov [eax+keyboard_device_data.numlock_bit], ebx
|
||||||
@@:
|
@@:
|
||||||
mov [eax+keyboard_device_data.led_report], edx
|
mov [eax+keyboard_device_data.led_report], edx
|
||||||
.next_field:
|
.next_field:
|
||||||
add esi, 4
|
add esi, 4
|
||||||
add ebx, [ecx+report_field_group.size]
|
add ebx, [ecx+report_field_group.size]
|
||||||
dec dword [esp]
|
dec dword [esp]
|
||||||
jnz .scan_led_usage
|
jnz .scan_led_usage
|
||||||
pop ebx
|
pop ebx
|
||||||
.next_led_field:
|
.next_led_field:
|
||||||
; 3g. Continue loop over field groups: get next field group.
|
; 3g. Continue loop over field groups: get next field group.
|
||||||
mov ecx, [ecx+report_field_group.next]
|
mov ecx, [ecx+report_field_group.next]
|
||||||
jmp .scan_led_field
|
jmp .scan_led_field
|
||||||
.next_led_report:
|
.next_led_report:
|
||||||
; 3h. If the LED report has been set, break from the loop over reports.
|
; 3h. If the LED report has been set, break from the loop over reports.
|
||||||
; Otherwise, get the next report and continue if the current report is not
|
; Otherwise, get the next report and continue if the current report is not
|
||||||
; the last for this collection.
|
; the last for this collection.
|
||||||
cmp [eax+keyboard_device_data.led_report], 0
|
cmp [eax+keyboard_device_data.led_report], 0
|
||||||
jnz .led_report_set
|
jnz .led_report_set
|
||||||
cmp edx, [edi+collection.output.last_report]
|
cmp edx, [edi+collection.output.last_report]
|
||||||
mov edx, [edx+report.next]
|
mov edx, [edx+report.next]
|
||||||
jnz .scan_led_report
|
jnz .scan_led_report
|
||||||
.led_report_set:
|
.led_report_set:
|
||||||
; 3i. Restore registers.
|
; 3i. Restore registers.
|
||||||
pop esi ebx
|
pop esi ebx
|
||||||
; 4. Register keyboard in the kernel.
|
; 4. Register keyboard in the kernel.
|
||||||
; store pointer to keyboard_device_data in the stack
|
; store pointer to keyboard_device_data in the stack
|
||||||
push eax
|
push eax
|
||||||
; call kernel API
|
; call kernel API
|
||||||
stdcall RegKeyboard, kbd_functions, eax
|
stdcall RegKeyboard, kbd_functions, eax
|
||||||
; restore pointer to keyboard_device_data from the stack,
|
; restore pointer to keyboard_device_data from the stack,
|
||||||
; putting keyboard handle from API to the stack
|
; putting keyboard handle from API to the stack
|
||||||
xchg eax, [esp]
|
xchg eax, [esp]
|
||||||
; put keyboard handle from API from the stack to keyboard_device_data field
|
; put keyboard handle from API from the stack to keyboard_device_data field
|
||||||
pop [eax+keyboard_device_data.handle]
|
pop [eax+keyboard_device_data.handle]
|
||||||
; If failed, free keyboard_device_data and return NULL.
|
; If failed, free keyboard_device_data and return NULL.
|
||||||
cmp [eax+keyboard_device_data.handle], 0
|
cmp [eax+keyboard_device_data.handle], 0
|
||||||
jz .fail_free
|
jz .fail_free
|
||||||
; 5. Return pointer to keyboard_device_data.
|
; 5. Return pointer to keyboard_device_data.
|
||||||
.nothing:
|
.nothing:
|
||||||
ret
|
ret
|
||||||
.fail_free:
|
.fail_free:
|
||||||
call Kfree
|
call Kfree
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This procedure is called when HID layer detects disconnect of a previously
|
; This procedure is called when HID layer detects disconnect of a previously
|
||||||
@ -177,14 +177,14 @@ endp
|
|||||||
; in: edi -> keyboard_device_data (pointer returned from keyboard_driver_add_device)
|
; in: edi -> keyboard_device_data (pointer returned from keyboard_driver_add_device)
|
||||||
proc keyboard_driver_disconnect
|
proc keyboard_driver_disconnect
|
||||||
; 1. If an autorepeat timer is active, stop it.
|
; 1. If an autorepeat timer is active, stop it.
|
||||||
cmp [edi+keyboard_device_data.timer], 0
|
cmp [edi+keyboard_device_data.timer], 0
|
||||||
jz @f
|
jz @f
|
||||||
stdcall CancelTimerHS, [edi+keyboard_device_data.timer]
|
stdcall CancelTimerHS, [edi+keyboard_device_data.timer]
|
||||||
@@:
|
@@:
|
||||||
; 2. Unregister keyboard in the kernel.
|
; 2. Unregister keyboard in the kernel.
|
||||||
stdcall DelKeyboard, [edi+keyboard_device_data.handle]
|
stdcall DelKeyboard, [edi+keyboard_device_data.handle]
|
||||||
; We should free data in CloseKeyboard, not here.
|
; We should free data in CloseKeyboard, not here.
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This procedure is called when HID layer starts processing a new input packet
|
; This procedure is called when HID layer starts processing a new input packet
|
||||||
@ -192,7 +192,7 @@ endp
|
|||||||
; in: edi -> keyboard_device_data (pointer returned from keyboard_driver_add_device)
|
; in: edi -> keyboard_device_data (pointer returned from keyboard_driver_add_device)
|
||||||
proc keyboard_driver_begin_packet
|
proc keyboard_driver_begin_packet
|
||||||
; Nothing to do.
|
; Nothing to do.
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This procedure is called when HID layer processes every non-empty array field group.
|
; This procedure is called when HID layer processes every non-empty array field group.
|
||||||
@ -203,10 +203,10 @@ endp
|
|||||||
proc keyboard_driver_array_overflow?
|
proc keyboard_driver_array_overflow?
|
||||||
; The keyboard signals array overflow by filling the entire array with
|
; The keyboard signals array overflow by filling the entire array with
|
||||||
; USAGE_KBD_ROLLOVER codes.
|
; USAGE_KBD_ROLLOVER codes.
|
||||||
mov eax, [edx] ; eax = first field in the array
|
mov eax, [edx] ; eax = first field in the array
|
||||||
sub eax, USAGE_KBD_ROLLOVER ; eax = 0 if overflow, nonzero otherwise
|
sub eax, USAGE_KBD_ROLLOVER ; eax = 0 if overflow, nonzero otherwise
|
||||||
neg eax ; CF cleared if eax was zero, CF set if eax was nonzero
|
neg eax ; CF cleared if eax was zero, CF set if eax was nonzero
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This procedure is called from HID layer for every field.
|
; This procedure is called from HID layer for every field.
|
||||||
@ -220,112 +220,112 @@ end if
|
|||||||
; from USAGE_KBD_FIRST_KEY to USAGE_KBD_FIRST_KEY + normal_keys_number - 1,
|
; from USAGE_KBD_FIRST_KEY to USAGE_KBD_FIRST_KEY + normal_keys_number - 1,
|
||||||
; excluding zeroes in [normal_keys].
|
; excluding zeroes in [normal_keys].
|
||||||
; 1a. Test whether usage is in the range.
|
; 1a. Test whether usage is in the range.
|
||||||
lea eax, [ecx-USAGE_KBD_FIRST_KEY]
|
lea eax, [ecx-USAGE_KBD_FIRST_KEY]
|
||||||
cmp eax, normal_keys_number
|
cmp eax, normal_keys_number
|
||||||
jae .not_normal_key
|
jae .not_normal_key
|
||||||
; 1b. If the corresponding entry in [normal_keys] is zero,
|
; 1b. If the corresponding entry in [normal_keys] is zero,
|
||||||
; pass this field to the default handler - if HID_DUMP_UNCLAIMED is enabled,
|
; pass this field to the default handler - if HID_DUMP_UNCLAIMED is enabled,
|
||||||
; default handler is default_driver_input_field, otherwise just ignore the field.
|
; default handler is default_driver_input_field, otherwise just ignore the field.
|
||||||
cmp [normal_keys + eax], 0
|
cmp [normal_keys + eax], 0
|
||||||
jz .unclaimed
|
jz .unclaimed
|
||||||
; 1c. Get the scancode.
|
; 1c. Get the scancode.
|
||||||
movzx ecx, [normal_keys + eax]
|
movzx ecx, [normal_keys + eax]
|
||||||
; 1d. Further actions are slightly different for key press and key release.
|
; 1d. Further actions are slightly different for key press and key release.
|
||||||
; Decide what to do.
|
; Decide what to do.
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jz .normal_key_released
|
jz .normal_key_released
|
||||||
.normal_key_pressed:
|
.normal_key_pressed:
|
||||||
; The key is pressed.
|
; The key is pressed.
|
||||||
; 1e. Store the last pressed key for autorepeat.
|
; 1e. Store the last pressed key for autorepeat.
|
||||||
mov [edi+keyboard_device_data.repeatkey], cl
|
mov [edi+keyboard_device_data.repeatkey], cl
|
||||||
; 1f. Copy bit 7 to CF and send scancode with bit 7 cleared.
|
; 1f. Copy bit 7 to CF and send scancode with bit 7 cleared.
|
||||||
btr ecx, 7
|
btr ecx, 7
|
||||||
call .send_key
|
call .send_key
|
||||||
; 1g. Stop the previous autorepeat timer, if any.
|
; 1g. Stop the previous autorepeat timer, if any.
|
||||||
mov eax, [edi+keyboard_device_data.timer]
|
mov eax, [edi+keyboard_device_data.timer]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @f
|
jz @f
|
||||||
stdcall CancelTimerHS, eax
|
stdcall CancelTimerHS, eax
|
||||||
@@:
|
@@:
|
||||||
; 1h. Start the new autorepeat timer with 250 ms initial delay
|
; 1h. Start the new autorepeat timer with 250 ms initial delay
|
||||||
; and 50 ms subsequent delays.
|
; and 50 ms subsequent delays.
|
||||||
stdcall TimerHS, 25, 5, autorepeat_timer, edi
|
stdcall TimerHS, 25, 5, autorepeat_timer, edi
|
||||||
mov [edi+keyboard_device_data.timer], eax
|
mov [edi+keyboard_device_data.timer], eax
|
||||||
if ~HID_DUMP_UNCLAIMED
|
if ~HID_DUMP_UNCLAIMED
|
||||||
.unclaimed:
|
.unclaimed:
|
||||||
end if
|
end if
|
||||||
ret
|
ret
|
||||||
.normal_key_released:
|
.normal_key_released:
|
||||||
; The key is released.
|
; The key is released.
|
||||||
; 1i. Stop the autorepeat timer if it is autorepeating the released key.
|
; 1i. Stop the autorepeat timer if it is autorepeating the released key.
|
||||||
cmp [edi+keyboard_device_data.repeatkey], cl
|
cmp [edi+keyboard_device_data.repeatkey], cl
|
||||||
jnz .no_stop_timer
|
jnz .no_stop_timer
|
||||||
push ecx
|
push ecx
|
||||||
mov [edi+keyboard_device_data.repeatkey], 0
|
mov [edi+keyboard_device_data.repeatkey], 0
|
||||||
mov eax, [edi+keyboard_device_data.timer]
|
mov eax, [edi+keyboard_device_data.timer]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @f
|
jz @f
|
||||||
stdcall CancelTimerHS, eax
|
stdcall CancelTimerHS, eax
|
||||||
mov [edi+keyboard_device_data.timer], 0
|
mov [edi+keyboard_device_data.timer], 0
|
||||||
@@:
|
@@:
|
||||||
pop ecx
|
pop ecx
|
||||||
.no_stop_timer:
|
.no_stop_timer:
|
||||||
; 1j. Copy bit 7 to CF and send scancode with bit 7 set.
|
; 1j. Copy bit 7 to CF and send scancode with bit 7 set.
|
||||||
bts ecx, 7
|
bts ecx, 7
|
||||||
call .send_key
|
call .send_key
|
||||||
ret
|
ret
|
||||||
.not_normal_key:
|
.not_normal_key:
|
||||||
; 2. USAGE_KBD_NOEVENT is simply a filler for free array fields,
|
; 2. USAGE_KBD_NOEVENT is simply a filler for free array fields,
|
||||||
; ignore it.
|
; ignore it.
|
||||||
cmp ecx, USAGE_KBD_NOEVENT
|
cmp ecx, USAGE_KBD_NOEVENT
|
||||||
jz .nothing
|
jz .nothing
|
||||||
; 3. Process modifiers: 8 keys starting at USAGE_KBD_LCTRL.
|
; 3. Process modifiers: 8 keys starting at USAGE_KBD_LCTRL.
|
||||||
; 3a. Test whether usage is in range.
|
; 3a. Test whether usage is in range.
|
||||||
; If not, we don't know what this field means, so pass it to the default handler.
|
; If not, we don't know what this field means, so pass it to the default handler.
|
||||||
lea eax, [ecx-USAGE_KBD_LCTRL]
|
lea eax, [ecx-USAGE_KBD_LCTRL]
|
||||||
cmp eax, 8
|
cmp eax, 8
|
||||||
jae .unclaimed
|
jae .unclaimed
|
||||||
; 3b. Further actions are slightly different for modifier press
|
; 3b. Further actions are slightly different for modifier press
|
||||||
; and modifier release. Decide what to do.
|
; and modifier release. Decide what to do.
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jz .modifier_not_pressed
|
jz .modifier_not_pressed
|
||||||
.modifier_pressed:
|
.modifier_pressed:
|
||||||
; The modifier is pressed.
|
; The modifier is pressed.
|
||||||
; 3c. Set the corresponding status bit.
|
; 3c. Set the corresponding status bit.
|
||||||
; If it was not set, send the corresponding scancode to the kernel
|
; If it was not set, send the corresponding scancode to the kernel
|
||||||
; with bit 7 cleared.
|
; with bit 7 cleared.
|
||||||
bts [edi+keyboard_device_data.modifiers], eax
|
bts [edi+keyboard_device_data.modifiers], eax
|
||||||
jc @f
|
jc @f
|
||||||
movzx ecx, [control_keys+eax]
|
movzx ecx, [control_keys+eax]
|
||||||
btr ecx, 7
|
btr ecx, 7
|
||||||
call .send_key
|
call .send_key
|
||||||
@@:
|
@@:
|
||||||
.nothing:
|
.nothing:
|
||||||
ret
|
ret
|
||||||
.modifier_not_pressed:
|
.modifier_not_pressed:
|
||||||
; The modifier is not pressed.
|
; The modifier is not pressed.
|
||||||
; 3d. Clear the correspodning status bit.
|
; 3d. Clear the correspodning status bit.
|
||||||
; If it was set, send the corresponding scancode to the kernel
|
; If it was set, send the corresponding scancode to the kernel
|
||||||
; with bit 7 set.
|
; with bit 7 set.
|
||||||
btr [edi+keyboard_device_data.modifiers], eax
|
btr [edi+keyboard_device_data.modifiers], eax
|
||||||
jnc @f
|
jnc @f
|
||||||
movzx ecx, [control_keys+eax]
|
movzx ecx, [control_keys+eax]
|
||||||
bts ecx, 7
|
bts ecx, 7
|
||||||
call .send_key
|
call .send_key
|
||||||
@@:
|
@@:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; Helper procedure. Sends scancode from cl to the kernel.
|
; Helper procedure. Sends scancode from cl to the kernel.
|
||||||
; If CF is set, precede it with special code 0xE0.
|
; If CF is set, precede it with special code 0xE0.
|
||||||
.send_key:
|
.send_key:
|
||||||
jnc @f
|
jnc @f
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, 0xE0
|
mov ecx, 0xE0
|
||||||
call SetKeyboardData
|
call SetKeyboardData
|
||||||
pop ecx
|
pop ecx
|
||||||
@@:
|
@@:
|
||||||
call SetKeyboardData
|
call SetKeyboardData
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This procedure is called when HID layer ends processing a new input packet
|
; This procedure is called when HID layer ends processing a new input packet
|
||||||
@ -333,143 +333,143 @@ endp
|
|||||||
; in: edi -> keyboard_device_data (pointer returned from keyboard_driver_add_device)
|
; in: edi -> keyboard_device_data (pointer returned from keyboard_driver_add_device)
|
||||||
proc keyboard_driver_end_packet
|
proc keyboard_driver_end_packet
|
||||||
; Nothing to do.
|
; Nothing to do.
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; Timer callback for SetTimerHS.
|
; Timer callback for SetTimerHS.
|
||||||
proc autorepeat_timer
|
proc autorepeat_timer
|
||||||
virtual at esp
|
virtual at esp
|
||||||
dd ? ; return address
|
dd ? ; return address
|
||||||
.data dd ?
|
.data dd ?
|
||||||
end virtual
|
end virtual
|
||||||
; Just resend the last pressed key.
|
; Just resend the last pressed key.
|
||||||
mov eax, [.data]
|
mov eax, [.data]
|
||||||
movzx ecx, [eax+keyboard_device_data.repeatkey]
|
movzx ecx, [eax+keyboard_device_data.repeatkey]
|
||||||
; Copy bit 7 to CF and send scancode with bit 7 cleared.
|
; Copy bit 7 to CF and send scancode with bit 7 cleared.
|
||||||
btr ecx, 7
|
btr ecx, 7
|
||||||
call keyboard_driver_input_field.send_key
|
call keyboard_driver_input_field.send_key
|
||||||
ret 4
|
ret 4
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This function is called from the keyboard layer
|
; This function is called from the keyboard layer
|
||||||
; when it is safe to free keyboard data.
|
; when it is safe to free keyboard data.
|
||||||
proc CloseKeyboard
|
proc CloseKeyboard
|
||||||
virtual at esp
|
virtual at esp
|
||||||
dd ? ; return address
|
dd ? ; return address
|
||||||
.device_data dd ?
|
.device_data dd ?
|
||||||
end virtual
|
end virtual
|
||||||
mov eax, [.device_data]
|
mov eax, [.device_data]
|
||||||
call Kfree
|
call Kfree
|
||||||
ret 4
|
ret 4
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This function is called from the keyboard layer
|
; This function is called from the keyboard layer
|
||||||
; to update LED state on the keyboard.
|
; to update LED state on the keyboard.
|
||||||
proc SetKeyboardLights stdcall uses ebx esi edi, device_data, led_state
|
proc SetKeyboardLights stdcall uses ebx esi edi, device_data, led_state
|
||||||
locals
|
locals
|
||||||
size dd ?
|
size dd ?
|
||||||
endl
|
endl
|
||||||
; 1. Get the pointer to the LED report.
|
; 1. Get the pointer to the LED report.
|
||||||
; If there is no LED report, exit from the function.
|
; If there is no LED report, exit from the function.
|
||||||
mov ebx, [device_data]
|
mov ebx, [device_data]
|
||||||
mov esi, [ebx+keyboard_device_data.led_report]
|
mov esi, [ebx+keyboard_device_data.led_report]
|
||||||
test esi, esi
|
test esi, esi
|
||||||
jz .nothing
|
jz .nothing
|
||||||
; 2. Get report size in bytes.
|
; 2. Get report size in bytes.
|
||||||
; report.size is size in bits without possible report ID;
|
; report.size is size in bits without possible report ID;
|
||||||
; if an ID is assigned, the size is one byte greater.
|
; if an ID is assigned, the size is one byte greater.
|
||||||
mov eax, [esi+report.size]
|
mov eax, [esi+report.size]
|
||||||
add eax, 7
|
add eax, 7
|
||||||
shr eax, 3
|
shr eax, 3
|
||||||
cmp [esi+report.id], 0
|
cmp [esi+report.id], 0
|
||||||
jz @f
|
jz @f
|
||||||
inc eax
|
inc eax
|
||||||
@@:
|
@@:
|
||||||
mov [size], eax
|
mov [size], eax
|
||||||
; 3. Allocate memory for report + 8 bytes for setup packet.
|
; 3. Allocate memory for report + 8 bytes for setup packet.
|
||||||
; Dword-align size for subsequent rep stosd and bts.
|
; Dword-align size for subsequent rep stosd and bts.
|
||||||
; If failed, exit from the function.
|
; If failed, exit from the function.
|
||||||
add eax, 8 + 3
|
add eax, 8 + 3
|
||||||
and eax, not 3
|
and eax, not 3
|
||||||
push eax
|
push eax
|
||||||
call Kmalloc
|
call Kmalloc
|
||||||
pop ecx
|
pop ecx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .nothing
|
jz .nothing
|
||||||
; 4. Zero-initialize output report.
|
; 4. Zero-initialize output report.
|
||||||
push eax
|
push eax
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosd
|
rep stosd
|
||||||
pop edi
|
pop edi
|
||||||
add edi, 8
|
add edi, 8
|
||||||
; 5. Store report ID, if assigned. If not assigned, that would just write zero
|
; 5. Store report ID, if assigned. If not assigned, that would just write zero
|
||||||
; over zeroes.
|
; over zeroes.
|
||||||
mov edx, [esi+report.id]
|
mov edx, [esi+report.id]
|
||||||
mov [edi], edx
|
mov [edi], edx
|
||||||
; 6. Set report bits corresponding to active indicators.
|
; 6. Set report bits corresponding to active indicators.
|
||||||
mov eax, [led_state]
|
mov eax, [led_state]
|
||||||
test al, 1 ; PS/2 Scroll Lock
|
test al, 1 ; PS/2 Scroll Lock
|
||||||
jz @f
|
jz @f
|
||||||
mov ecx, [ebx+keyboard_device_data.scrolllock_bit]
|
mov ecx, [ebx+keyboard_device_data.scrolllock_bit]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
js @f
|
js @f
|
||||||
bts [edi], ecx
|
bts [edi], ecx
|
||||||
@@:
|
@@:
|
||||||
test al, 2 ; PS/2 Num Lock
|
test al, 2 ; PS/2 Num Lock
|
||||||
jz @f
|
jz @f
|
||||||
mov ecx, [ebx+keyboard_device_data.numlock_bit]
|
mov ecx, [ebx+keyboard_device_data.numlock_bit]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
js @f
|
js @f
|
||||||
bts [edi], ecx
|
bts [edi], ecx
|
||||||
@@:
|
@@:
|
||||||
test al, 4 ; PS/2 Caps Lock
|
test al, 4 ; PS/2 Caps Lock
|
||||||
jz @f
|
jz @f
|
||||||
mov ecx, [ebx+keyboard_device_data.capslock_bit]
|
mov ecx, [ebx+keyboard_device_data.capslock_bit]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
js @f
|
js @f
|
||||||
bts [edi], ecx
|
bts [edi], ecx
|
||||||
@@:
|
@@:
|
||||||
; 7. Fill setup packet.
|
; 7. Fill setup packet.
|
||||||
shl edx, 16 ; move Report ID to byte 2
|
shl edx, 16 ; move Report ID to byte 2
|
||||||
or edx, 21h + \ ; Class-specific request to Interface
|
or edx, 21h + \ ; Class-specific request to Interface
|
||||||
(9 shl 8) + \ ; SET_REPORT
|
(9 shl 8) + \ ; SET_REPORT
|
||||||
(2 shl 24) ; Report Type = Output
|
(2 shl 24) ; Report Type = Output
|
||||||
lea eax, [edi-8]
|
lea eax, [edi-8]
|
||||||
mov ebx, [ebx+keyboard_device_data.usbdev]
|
mov ebx, [ebx+keyboard_device_data.usbdev]
|
||||||
mov dword [eax], edx
|
mov dword [eax], edx
|
||||||
mov edx, [size]
|
mov edx, [size]
|
||||||
shl edx, 16 ; move Size to last word
|
shl edx, 16 ; move Size to last word
|
||||||
or edx, [ebx+usb_device_data.interface_number]
|
or edx, [ebx+usb_device_data.interface_number]
|
||||||
mov [eax+4], edx
|
mov [eax+4], edx
|
||||||
; 8. Submit output control request.
|
; 8. Submit output control request.
|
||||||
stdcall USBControlTransferAsync, [ebx+usb_device_data.configpipe], \
|
stdcall USBControlTransferAsync, [ebx+usb_device_data.configpipe], \
|
||||||
eax, edi, [size], after_set_keyboard_lights, ebx, 0
|
eax, edi, [size], after_set_keyboard_lights, ebx, 0
|
||||||
; If failed, free the buffer now.
|
; If failed, free the buffer now.
|
||||||
; If succeeded, the callback will free the buffer.
|
; If succeeded, the callback will free the buffer.
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .nothing
|
jnz .nothing
|
||||||
lea eax, [edi-8]
|
lea eax, [edi-8]
|
||||||
call Kfree
|
call Kfree
|
||||||
.nothing:
|
.nothing:
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This procedure is called from the USB subsystem when the request initiated by
|
; This procedure is called from the USB subsystem when the request initiated by
|
||||||
; SetKeyboardLights is completed, either successfully or unsuccessfully.
|
; SetKeyboardLights is completed, either successfully or unsuccessfully.
|
||||||
proc after_set_keyboard_lights
|
proc after_set_keyboard_lights
|
||||||
virtual at esp
|
virtual at esp
|
||||||
dd ? ; return address
|
dd ? ; return address
|
||||||
.pipe dd ?
|
.pipe dd ?
|
||||||
.status dd ?
|
.status dd ?
|
||||||
.buffer dd ?
|
.buffer dd ?
|
||||||
.length dd ?
|
.length dd ?
|
||||||
.calldata dd ?
|
.calldata dd ?
|
||||||
end virtual
|
end virtual
|
||||||
; Ignore status, just free the buffer allocated by SetKeyboardLights.
|
; Ignore status, just free the buffer allocated by SetKeyboardLights.
|
||||||
mov eax, [.buffer]
|
mov eax, [.buffer]
|
||||||
sub eax, 8
|
sub eax, 8
|
||||||
call Kfree
|
call Kfree
|
||||||
ret 20
|
ret 20
|
||||||
endp
|
endp
|
||||||
|
@ -7,24 +7,24 @@
|
|||||||
macro workers_globals
|
macro workers_globals
|
||||||
{
|
{
|
||||||
; include global constants from previous workers
|
; include global constants from previous workers
|
||||||
workers_globals
|
workers_globals
|
||||||
align 4
|
align 4
|
||||||
; Callbacks for HID layer.
|
; Callbacks for HID layer.
|
||||||
mouse_driver:
|
mouse_driver:
|
||||||
dd mouse_driver_add_device
|
dd mouse_driver_add_device
|
||||||
dd mouse_driver_disconnect
|
dd mouse_driver_disconnect
|
||||||
dd mouse_driver_begin_packet
|
dd mouse_driver_begin_packet
|
||||||
dd mouse_driver_array_overflow?
|
dd mouse_driver_array_overflow?
|
||||||
dd mouse_driver_input_field
|
dd mouse_driver_input_field
|
||||||
dd mouse_driver_end_packet
|
dd mouse_driver_end_packet
|
||||||
}
|
}
|
||||||
|
|
||||||
; Data that are specific for one mouse device.
|
; Data that are specific for one mouse device.
|
||||||
struct mouse_device_data
|
struct mouse_device_data
|
||||||
buttons dd ? ; buttons that are currently pressed
|
buttons dd ? ; buttons that are currently pressed
|
||||||
dx dd ? ; current x moving
|
dx dd ? ; current x moving
|
||||||
dy dd ? ; current y moving
|
dy dd ? ; current y moving
|
||||||
wheel dd ? ; current wheel moving
|
wheel dd ? ; current wheel moving
|
||||||
ends
|
ends
|
||||||
|
|
||||||
; This procedure is called when HID layer detects a new mouse.
|
; This procedure is called when HID layer detects a new mouse.
|
||||||
@ -32,9 +32,9 @@ ends
|
|||||||
; out: eax = device-specific data or NULL on error
|
; out: eax = device-specific data or NULL on error
|
||||||
proc mouse_driver_add_device
|
proc mouse_driver_add_device
|
||||||
; Just allocate memory; no initialization needed.
|
; Just allocate memory; no initialization needed.
|
||||||
movi eax, sizeof.mouse_device_data
|
movi eax, sizeof.mouse_device_data
|
||||||
call Kmalloc
|
call Kmalloc
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This procedure is called when HID layer detects disconnect of a previously
|
; This procedure is called when HID layer detects disconnect of a previously
|
||||||
@ -42,9 +42,9 @@ endp
|
|||||||
; in: edi -> mouse_device_data (pointer returned from mouse_driver_add_device)
|
; in: edi -> mouse_device_data (pointer returned from mouse_driver_add_device)
|
||||||
proc mouse_driver_disconnect
|
proc mouse_driver_disconnect
|
||||||
; Free the allocated memory.
|
; Free the allocated memory.
|
||||||
mov eax, edi
|
mov eax, edi
|
||||||
call Kfree
|
call Kfree
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This procedure is called when HID layer starts processing a new input packet
|
; This procedure is called when HID layer starts processing a new input packet
|
||||||
@ -52,11 +52,11 @@ endp
|
|||||||
; in: edi -> mouse_device_data (pointer returned from mouse_driver_add_device)
|
; in: edi -> mouse_device_data (pointer returned from mouse_driver_add_device)
|
||||||
proc mouse_driver_begin_packet
|
proc mouse_driver_begin_packet
|
||||||
; Zero all variables describing the current state.
|
; Zero all variables describing the current state.
|
||||||
mov [edi+mouse_device_data.buttons], 0
|
mov [edi+mouse_device_data.buttons], 0
|
||||||
mov [edi+mouse_device_data.dx], 0
|
mov [edi+mouse_device_data.dx], 0
|
||||||
mov [edi+mouse_device_data.dy], 0
|
mov [edi+mouse_device_data.dy], 0
|
||||||
mov [edi+mouse_device_data.wheel], 0
|
mov [edi+mouse_device_data.wheel], 0
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This procedure is called when HID layer processes every non-empty array field group.
|
; This procedure is called when HID layer processes every non-empty array field group.
|
||||||
@ -66,8 +66,8 @@ endp
|
|||||||
; out: CF set => array is ok, CF cleared => array should be ignored
|
; out: CF set => array is ok, CF cleared => array should be ignored
|
||||||
proc mouse_driver_array_overflow?
|
proc mouse_driver_array_overflow?
|
||||||
; no array fields, no overflows
|
; no array fields, no overflows
|
||||||
stc
|
stc
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This procedure is called from HID layer for every field.
|
; This procedure is called from HID layer for every field.
|
||||||
@ -77,58 +77,58 @@ proc mouse_driver_input_field
|
|||||||
; 1. Determine the handler. We process x/y moving, wheel and up to 32 buttons.
|
; 1. Determine the handler. We process x/y moving, wheel and up to 32 buttons.
|
||||||
; Pass other fields to the default handler - default_driver_input_field if
|
; Pass other fields to the default handler - default_driver_input_field if
|
||||||
; HID_DUMP_UNCLAIMED is enabled, just ignore otherwise.
|
; HID_DUMP_UNCLAIMED is enabled, just ignore otherwise.
|
||||||
cmp ecx, USAGE_GD_X
|
cmp ecx, USAGE_GD_X
|
||||||
jz .x
|
jz .x
|
||||||
cmp ecx, USAGE_GD_Y
|
cmp ecx, USAGE_GD_Y
|
||||||
jz .y
|
jz .y
|
||||||
cmp ecx, USAGE_GD_WHEEL
|
cmp ecx, USAGE_GD_WHEEL
|
||||||
jz .wheel
|
jz .wheel
|
||||||
sub ecx, USAGE_BUTTON_PAGE + 1
|
sub ecx, USAGE_BUTTON_PAGE + 1
|
||||||
jb .unclaimed
|
jb .unclaimed
|
||||||
cmp ecx, 32
|
cmp ecx, 32
|
||||||
jae .unclaimed
|
jae .unclaimed
|
||||||
; 2. This is a button.
|
; 2. This is a button.
|
||||||
; If a button is pressed, set the corresponding bit in the state.
|
; If a button is pressed, set the corresponding bit in the state.
|
||||||
; If a button is not pressed, do nothing.
|
; If a button is not pressed, do nothing.
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jz @f
|
jz @f
|
||||||
bts [edi+mouse_device_data.buttons], ecx
|
bts [edi+mouse_device_data.buttons], ecx
|
||||||
@@:
|
@@:
|
||||||
if ~HID_DUMP_UNCLAIMED
|
if ~HID_DUMP_UNCLAIMED
|
||||||
.unclaimed:
|
.unclaimed:
|
||||||
end if
|
end if
|
||||||
ret
|
ret
|
||||||
if HID_DUMP_UNCLAIMED
|
if HID_DUMP_UNCLAIMED
|
||||||
.unclaimed:
|
.unclaimed:
|
||||||
add ecx, USAGE_BUTTON_PAGE + 1
|
add ecx, USAGE_BUTTON_PAGE + 1
|
||||||
jmp default_driver_input_field
|
jmp default_driver_input_field
|
||||||
end if
|
end if
|
||||||
.x:
|
.x:
|
||||||
; 3. This is x moving. For relative fields, store the value in the state.
|
; 3. This is x moving. For relative fields, store the value in the state.
|
||||||
; Pass absolute field to the default handler.
|
; Pass absolute field to the default handler.
|
||||||
test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE
|
test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE
|
||||||
jz .unclaimed
|
jz .unclaimed
|
||||||
mov [edi+mouse_device_data.dx], edx
|
mov [edi+mouse_device_data.dx], edx
|
||||||
ret
|
ret
|
||||||
.y:
|
.y:
|
||||||
; 4. This is y moving. For relative fields, store the value in the state,
|
; 4. This is y moving. For relative fields, store the value in the state,
|
||||||
; changing the sign: HID uses "mathematics" scheme with Y axis increasing from
|
; changing the sign: HID uses "mathematics" scheme with Y axis increasing from
|
||||||
; bottom to top, the kernel expects "programming" PS/2-style with Y axis
|
; bottom to top, the kernel expects "programming" PS/2-style with Y axis
|
||||||
; increasing from top to bottom.
|
; increasing from top to bottom.
|
||||||
; Pass absolute fields to the default handler.
|
; Pass absolute fields to the default handler.
|
||||||
test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE
|
test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE
|
||||||
jz .unclaimed
|
jz .unclaimed
|
||||||
neg edx
|
neg edx
|
||||||
mov [edi+mouse_device_data.dy], edx
|
mov [edi+mouse_device_data.dy], edx
|
||||||
ret
|
ret
|
||||||
.wheel:
|
.wheel:
|
||||||
; 5. This is wheel event. For relative fields, store the value in the state,
|
; 5. This is wheel event. For relative fields, store the value in the state,
|
||||||
; changing the sign. Pass absolute fields to the default handler.
|
; changing the sign. Pass absolute fields to the default handler.
|
||||||
test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE
|
test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE
|
||||||
jz .unclaimed
|
jz .unclaimed
|
||||||
neg edx
|
neg edx
|
||||||
mov [edi+mouse_device_data.wheel], edx
|
mov [edi+mouse_device_data.wheel], edx
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; This procedure is called when HID layer ends processing a new input packet
|
; This procedure is called when HID layer ends processing a new input packet
|
||||||
@ -136,11 +136,11 @@ endp
|
|||||||
; in: edi -> mouse_device_data (pointer returned from mouse_driver_add_device)
|
; in: edi -> mouse_device_data (pointer returned from mouse_driver_add_device)
|
||||||
proc mouse_driver_end_packet
|
proc mouse_driver_end_packet
|
||||||
; Call the kernel, passing collected state.
|
; Call the kernel, passing collected state.
|
||||||
stdcall SetMouseData, \
|
stdcall SetMouseData, \
|
||||||
[edi+mouse_device_data.buttons], \
|
[edi+mouse_device_data.buttons], \
|
||||||
[edi+mouse_device_data.dx], \
|
[edi+mouse_device_data.dx], \
|
||||||
[edi+mouse_device_data.dy], \
|
[edi+mouse_device_data.dy], \
|
||||||
[edi+mouse_device_data.wheel], \
|
[edi+mouse_device_data.wheel], \
|
||||||
0
|
0
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,8 +2,8 @@
|
|||||||
; ecx = array size, edx = array pointer.
|
; ecx = array size, edx = array pointer.
|
||||||
; Destroys eax, ecx, esi, edi.
|
; Destroys eax, ecx, esi, edi.
|
||||||
sort:
|
sort:
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .done
|
jz .done
|
||||||
mov eax, ecx
|
mov eax, ecx
|
||||||
@@:
|
@@:
|
||||||
push eax
|
push eax
|
||||||
@ -38,18 +38,18 @@ sort:
|
|||||||
cmp esi, ecx
|
cmp esi, ecx
|
||||||
ja .doner
|
ja .doner
|
||||||
mov edi, [edx+eax*4-4]
|
mov edi, [edx+eax*4-4]
|
||||||
cmp [edx+esi*4-4], edi
|
cmp [edx+esi*4-4], edi
|
||||||
ja .need_xchg
|
ja .need_xchg
|
||||||
cmp esi, ecx
|
cmp esi, ecx
|
||||||
jae .doner
|
jae .doner
|
||||||
mov edi, [edx+eax*4-4]
|
mov edi, [edx+eax*4-4]
|
||||||
cmp [edx+esi*4], edi
|
cmp [edx+esi*4], edi
|
||||||
jbe .doner
|
jbe .doner
|
||||||
.need_xchg:
|
.need_xchg:
|
||||||
cmp esi, ecx
|
cmp esi, ecx
|
||||||
jz .do_xchg
|
jz .do_xchg
|
||||||
mov edi, [edx+esi*4-4]
|
mov edi, [edx+esi*4-4]
|
||||||
cmp [edx+esi*4], edi
|
cmp [edx+esi*4], edi
|
||||||
sbb esi, -1
|
sbb esi, -1
|
||||||
.do_xchg:
|
.do_xchg:
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
|
@ -11,25 +11,25 @@ if HID_DUMP_UNCLAIMED
|
|||||||
macro workers_globals
|
macro workers_globals
|
||||||
{
|
{
|
||||||
; include global constants from previous workers
|
; include global constants from previous workers
|
||||||
workers_globals
|
workers_globals
|
||||||
align 4
|
align 4
|
||||||
; Callbacks for HID layer.
|
; Callbacks for HID layer.
|
||||||
default_driver:
|
default_driver:
|
||||||
dd default_driver_add_device
|
dd default_driver_add_device
|
||||||
dd default_driver_disconnect
|
dd default_driver_disconnect
|
||||||
dd default_driver_begin_packet
|
dd default_driver_begin_packet
|
||||||
dd default_driver_array_overflow?
|
dd default_driver_array_overflow?
|
||||||
dd default_driver_input_field
|
dd default_driver_input_field
|
||||||
dd default_driver_end_packet
|
dd default_driver_end_packet
|
||||||
}
|
}
|
||||||
; This procedure is called when HID layer detects a new driverless device.
|
; This procedure is called when HID layer detects a new driverless device.
|
||||||
; in: ebx -> usb_device_data, edi -> collection
|
; in: ebx -> usb_device_data, edi -> collection
|
||||||
; out: eax = device-specific data or NULL on error
|
; out: eax = device-specific data or NULL on error
|
||||||
default_driver_add_device:
|
default_driver_add_device:
|
||||||
; just return something nonzero, no matter what
|
; just return something nonzero, no matter what
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
inc eax
|
inc eax
|
||||||
ret
|
ret
|
||||||
; This procedure is called when HID layer processes every non-empty array field group.
|
; This procedure is called when HID layer processes every non-empty array field group.
|
||||||
; in: edi -> keyboard_device_data (pointer returned from keyboard_driver_add_device)
|
; in: edi -> keyboard_device_data (pointer returned from keyboard_driver_add_device)
|
||||||
; in: ecx = fields count (always nonzero), edx = pointer to fields values
|
; in: ecx = fields count (always nonzero), edx = pointer to fields values
|
||||||
@ -37,24 +37,24 @@ default_driver_add_device:
|
|||||||
; out: CF set => group is ok, CF cleared => group should be ignored
|
; out: CF set => group is ok, CF cleared => group should be ignored
|
||||||
default_driver_array_overflow?:
|
default_driver_array_overflow?:
|
||||||
; parse everything
|
; parse everything
|
||||||
stc
|
stc
|
||||||
ret
|
ret
|
||||||
; This procedure is called from HID layer for every field.
|
; This procedure is called from HID layer for every field.
|
||||||
; in: ecx = field usage, edx = value, esi -> report_field_group
|
; in: ecx = field usage, edx = value, esi -> report_field_group
|
||||||
default_driver_input_field:
|
default_driver_input_field:
|
||||||
; Do not dump zero values in Variable fields,
|
; Do not dump zero values in Variable fields,
|
||||||
; they are present even if the corresponding control is inactive.
|
; they are present even if the corresponding control is inactive.
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jnz @f
|
jnz @f
|
||||||
test byte [esi+report_field_group.flags], HID_FIELD_VARIABLE
|
test byte [esi+report_field_group.flags], HID_FIELD_VARIABLE
|
||||||
jnz .nodump
|
jnz .nodump
|
||||||
@@:
|
@@:
|
||||||
DEBUGF 1,'K : unclaimed HID input: usage=%x, value=%x\n',ecx,edx
|
DEBUGF 1,'K : unclaimed HID input: usage=%x, value=%x\n',ecx,edx
|
||||||
.nodump:
|
.nodump:
|
||||||
; pass through
|
; pass through
|
||||||
; Three nothing-to-do procedures.
|
; Three nothing-to-do procedures.
|
||||||
default_driver_disconnect:
|
default_driver_disconnect:
|
||||||
default_driver_begin_packet:
|
default_driver_begin_packet:
|
||||||
default_driver_end_packet:
|
default_driver_end_packet:
|
||||||
ret
|
ret
|
||||||
end if
|
end if
|
||||||
|
@ -41,8 +41,8 @@ EXT4_FEATURE_INCOMPAT_FLEX_BG = 0x0200 ;RUS: гибкие группы блок
|
|||||||
|
|
||||||
;RUS: реализованные ext[234] features ;ENG: implemented ext[234] features
|
;RUS: реализованные ext[234] features ;ENG: implemented ext[234] features
|
||||||
EXT4_FEATURE_INCOMPAT_SUPP = EXT2_FEATURE_INCOMPAT_FILETYPE \
|
EXT4_FEATURE_INCOMPAT_SUPP = EXT2_FEATURE_INCOMPAT_FILETYPE \
|
||||||
or EXT4_FEATURE_INCOMPAT_EXTENTS \
|
or EXT4_FEATURE_INCOMPAT_EXTENTS \
|
||||||
or EXT4_FEATURE_INCOMPAT_FLEX_BG
|
or EXT4_FEATURE_INCOMPAT_FLEX_BG
|
||||||
|
|
||||||
;RUS: флаги, указываемые для inode в i_flags ;ENG: flags specified for inode in i_flags
|
;RUS: флаги, указываемые для inode в i_flags ;ENG: flags specified for inode in i_flags
|
||||||
EXT2_EXTENTS_FL = 0x00080000
|
EXT2_EXTENTS_FL = 0x00080000
|
||||||
|
@ -525,29 +525,29 @@ fs_NumFloppyServices = ($ - fs_FloppyServices)/4
|
|||||||
|
|
||||||
fs_OnHd0:
|
fs_OnHd0:
|
||||||
call reserve_hd1
|
call reserve_hd1
|
||||||
mov eax,[hd_address_table]
|
mov eax, [hd_address_table]
|
||||||
mov [hdbase], eax ;0x1F0
|
mov [hdbase], eax ;0x1F0
|
||||||
mov [hdid], 0
|
mov [hdid], 0
|
||||||
push 1
|
push 1
|
||||||
jmp fs_OnHd
|
jmp fs_OnHd
|
||||||
fs_OnHd1:
|
fs_OnHd1:
|
||||||
call reserve_hd1
|
call reserve_hd1
|
||||||
mov eax,[hd_address_table]
|
mov eax, [hd_address_table]
|
||||||
mov [hdbase], eax ;0x1F0
|
mov [hdbase], eax ;0x1F0
|
||||||
mov [hdid], 0x10
|
mov [hdid], 0x10
|
||||||
push 2
|
push 2
|
||||||
jmp fs_OnHd
|
jmp fs_OnHd
|
||||||
fs_OnHd2:
|
fs_OnHd2:
|
||||||
call reserve_hd1
|
call reserve_hd1
|
||||||
mov eax,[hd_address_table+16]
|
mov eax, [hd_address_table+16]
|
||||||
mov [hdbase], eax ;0x170
|
mov [hdbase], eax ;0x170
|
||||||
mov [hdid], 0
|
mov [hdid], 0
|
||||||
push 3
|
push 3
|
||||||
jmp fs_OnHd
|
jmp fs_OnHd
|
||||||
fs_OnHd3:
|
fs_OnHd3:
|
||||||
call reserve_hd1
|
call reserve_hd1
|
||||||
mov eax,[hd_address_table+16]
|
mov eax, [hd_address_table+16]
|
||||||
mov [hdbase], eax ;0x170
|
mov [hdbase], eax ;0x170
|
||||||
mov [hdid], 0x10
|
mov [hdid], 0x10
|
||||||
push 4
|
push 4
|
||||||
fs_OnHd:
|
fs_OnHd:
|
||||||
@ -948,7 +948,7 @@ process_replace_file_name:
|
|||||||
mov ebp, [full_file_name_table]
|
mov ebp, [full_file_name_table]
|
||||||
xor edi, edi
|
xor edi, edi
|
||||||
.loop:
|
.loop:
|
||||||
cmp edi,[full_file_name_table.size]
|
cmp edi, [full_file_name_table.size]
|
||||||
jae .notfound
|
jae .notfound
|
||||||
push esi edi
|
push esi edi
|
||||||
shl edi, 7 ; edi*128
|
shl edi, 7 ; edi*128
|
||||||
@ -1021,17 +1021,17 @@ sys_current_directory:
|
|||||||
mov edi, sysdir_name1
|
mov edi, sysdir_name1
|
||||||
; copying fake directory name
|
; copying fake directory name
|
||||||
mov ecx, 63
|
mov ecx, 63
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
; terminator of name, in case if we get the inlet trash
|
; terminator of name, in case if we get the inlet trash
|
||||||
inc esi
|
inc esi
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
stosb
|
stosb
|
||||||
; copying real directory path for mounting
|
; copying real directory path for mounting
|
||||||
mov ecx, 63
|
mov ecx, 63
|
||||||
rep movsb
|
rep movsb
|
||||||
; terminator of name, in case if we get the inlet trash
|
; terminator of name, in case if we get the inlet trash
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
stosb
|
stosb
|
||||||
@ -1040,7 +1040,7 @@ sys_current_directory:
|
|||||||
; block the ability to call f.30.3 because for one session is necessary
|
; block the ability to call f.30.3 because for one session is necessary
|
||||||
; for us only once
|
; for us only once
|
||||||
mov [lock_flag_for_f30_3], 1
|
mov [lock_flag_for_f30_3], 1
|
||||||
popfd
|
popfd
|
||||||
@@:
|
@@:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ read_skin_file:
|
|||||||
|
|
||||||
xchg eax, [skin_data]
|
xchg eax, [skin_data]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @f
|
jz @f
|
||||||
|
|
||||||
stdcall kernel_free, eax
|
stdcall kernel_free, eax
|
||||||
@@:
|
@@:
|
||||||
|
@ -82,7 +82,7 @@ macro ARP_init {
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, ARP_entries_num
|
mov edi, ARP_entries_num
|
||||||
mov ecx, 4*NET_DEVICES_MAX
|
mov ecx, 4*NET_DEVICES_MAX
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ ARP_add_entry:
|
|||||||
.add:
|
.add:
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, sizeof.ARP_entry/2
|
mov ecx, sizeof.ARP_entry/2
|
||||||
rep movsw
|
rep movsw
|
||||||
pop ecx
|
pop ecx
|
||||||
lea esi, [edi - sizeof.ARP_entry]
|
lea esi, [edi - sizeof.ARP_entry]
|
||||||
pop edi
|
pop edi
|
||||||
@ -450,12 +450,12 @@ ARP_del_entry:
|
|||||||
; move all trailing entries, sizeof.ARP_entry bytes to left.
|
; move all trailing entries, sizeof.ARP_entry bytes to left.
|
||||||
mov edi, esi
|
mov edi, esi
|
||||||
add esi, sizeof.ARP_entry
|
add esi, sizeof.ARP_entry
|
||||||
rep movsw
|
rep movsw
|
||||||
|
|
||||||
; now add an empty entry to the end (erasing previous one)
|
; now add an empty entry to the end (erasing previous one)
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov ecx, sizeof.ARP_entry/2
|
mov ecx, sizeof.ARP_entry/2
|
||||||
rep stosw
|
rep stosw
|
||||||
|
|
||||||
pop edi
|
pop edi
|
||||||
dec [ARP_entries_num + 4*edi]
|
dec [ARP_entries_num + 4*edi]
|
||||||
@ -646,7 +646,7 @@ ARP_api:
|
|||||||
imul ecx, sizeof.ARP_entry
|
imul ecx, sizeof.ARP_entry
|
||||||
lea esi, [eax + ecx]
|
lea esi, [eax + ecx]
|
||||||
mov ecx, sizeof.ARP_entry/2
|
mov ecx, sizeof.ARP_entry/2
|
||||||
rep movsw
|
rep movsw
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
|
@ -85,7 +85,7 @@ macro IPv4_init {
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, IP_LIST
|
mov edi, IP_LIST
|
||||||
mov ecx, 7*NET_DEVICES_MAX + (sizeof.FRAGMENT_slot*MAX_FRAGMENTS)/4
|
mov ecx, 7*NET_DEVICES_MAX + (sizeof.FRAGMENT_slot*MAX_FRAGMENTS)/4
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,10 +476,10 @@ IPv4_input: ; TODO: add IPv4
|
|||||||
|
|
||||||
push cx ; First copy dword-wise, then byte-wise
|
push cx ; First copy dword-wise, then byte-wise
|
||||||
shr cx, 2 ;
|
shr cx, 2 ;
|
||||||
rep movsd ;
|
rep movsd ;
|
||||||
pop cx ;
|
pop cx ;
|
||||||
and cx, 3 ;
|
and cx, 3 ;
|
||||||
rep movsb ;
|
rep movsb ;
|
||||||
|
|
||||||
push eax
|
push eax
|
||||||
push edx ; Push pointer to fragment onto stack
|
push edx ; Push pointer to fragment onto stack
|
||||||
@ -696,7 +696,7 @@ IPv4_output_raw:
|
|||||||
;; todo: check socket options if we should add header, or just compute checksum
|
;; todo: check socket options if we should add header, or just compute checksum
|
||||||
|
|
||||||
push edi ecx
|
push edi ecx
|
||||||
rep movsb
|
rep movsb
|
||||||
pop ecx edi
|
pop ecx edi
|
||||||
|
|
||||||
; [edi + IPv4_header.VersionAndIHL] ; IPv4, normal length (no Optional header)
|
; [edi + IPv4_header.VersionAndIHL] ; IPv4, normal length (no Optional header)
|
||||||
@ -786,7 +786,7 @@ IPv4_fragment:
|
|||||||
; copy header
|
; copy header
|
||||||
mov esi, [esp + 2*4]
|
mov esi, [esp + 2*4]
|
||||||
mov ecx, 5 ; 5 dwords: TODO: use IHL field of the header!
|
mov ecx, 5 ; 5 dwords: TODO: use IHL field of the header!
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
; copy data
|
; copy data
|
||||||
mov esi, [esp + 2*4]
|
mov esi, [esp + 2*4]
|
||||||
@ -795,7 +795,7 @@ IPv4_fragment:
|
|||||||
|
|
||||||
mov ecx, [esp + 1*4]
|
mov ecx, [esp + 1*4]
|
||||||
DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_fragment: copying %u bytes\n", ecx
|
DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_fragment: copying %u bytes\n", ecx
|
||||||
rep movsb
|
rep movsb
|
||||||
|
|
||||||
; now, correct header
|
; now, correct header
|
||||||
mov ecx, [esp + 1*4]
|
mov ecx, [esp + 1*4]
|
||||||
@ -823,7 +823,7 @@ IPv4_fragment:
|
|||||||
call [ebx + NET_DEVICE.transmit]
|
call [ebx + NET_DEVICE.transmit]
|
||||||
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||||
|
|
||||||
mov ecx, [esp+4]
|
mov ecx, [esp+4]
|
||||||
add [esp], ecx
|
add [esp], ecx
|
||||||
|
|
||||||
mov ecx, [esp+3*4+6+4] ; ptr to begin of buff
|
mov ecx, [esp+3*4+6+4] ; ptr to begin of buff
|
||||||
|
@ -57,7 +57,7 @@ macro IPv6_init {
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, IPv6
|
mov edi, IPv6
|
||||||
mov ecx, (4*4*4+2*4)MAX_IP
|
mov ecx, (4*4*4+2*4)MAX_IP
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ PPPoE_discovery_output:
|
|||||||
|
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
rep movsb
|
rep movsb
|
||||||
|
|
||||||
cmp edx, 60 ; Min ETH size
|
cmp edx, 60 ; Min ETH size
|
||||||
ja @f
|
ja @f
|
||||||
|
@ -118,7 +118,7 @@ macro ICMP_init {
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, ICMP_PACKETS_TX
|
mov edi, ICMP_PACKETS_TX
|
||||||
mov ecx, 2*NET_DEVICES_MAX
|
mov ecx, 2*NET_DEVICES_MAX
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,10 +355,10 @@ ICMP_output:
|
|||||||
add edi, sizeof.ICMP_header
|
add edi, sizeof.ICMP_header
|
||||||
push cx
|
push cx
|
||||||
shr cx, 2
|
shr cx, 2
|
||||||
rep movsd
|
rep movsd
|
||||||
pop cx
|
pop cx
|
||||||
and cx, 3
|
and cx, 3
|
||||||
rep movsb
|
rep movsb
|
||||||
|
|
||||||
sub edi, edx ;;; TODO: find a better way to remember start of packet
|
sub edi, edx ;;; TODO: find a better way to remember start of packet
|
||||||
push edx edi
|
push edx edi
|
||||||
@ -406,7 +406,7 @@ ICMP_output_raw:
|
|||||||
|
|
||||||
push edi ecx
|
push edi ecx
|
||||||
DEBUGF DEBUG_NETWORK_VERBOSE, "copying %u bytes from %x to %x\n", ecx, esi, edi
|
DEBUGF DEBUG_NETWORK_VERBOSE, "copying %u bytes from %x to %x\n", ecx, esi, edi
|
||||||
rep movsb
|
rep movsb
|
||||||
pop ecx edi
|
pop ecx edi
|
||||||
|
|
||||||
mov [edi + ICMP_header.Checksum], 0
|
mov [edi + ICMP_header.Checksum], 0
|
||||||
|
@ -40,7 +40,7 @@ LOOPBACK_DEVICE:
|
|||||||
.namestr db 'loopback', 0
|
.namestr db 'loopback', 0
|
||||||
|
|
||||||
.dummy_fn:
|
.dummy_fn:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
endg
|
endg
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ local .ok, .no_wrap
|
|||||||
|
|
||||||
mov edi, [ptr + queue.w_ptr] ; Current write pointer (FIFO!)
|
mov edi, [ptr + queue.w_ptr] ; Current write pointer (FIFO!)
|
||||||
mov ecx, entry_size/4 ; Write the queue entry
|
mov ecx, entry_size/4 ; Write the queue entry
|
||||||
rep movsd ;
|
rep movsd ;
|
||||||
|
|
||||||
lea ecx, [size*entry_size+ptr+sizeof.queue]
|
lea ecx, [size*entry_size+ptr+sizeof.queue]
|
||||||
cmp edi, ecx ; entry size
|
cmp edi, ecx ; entry size
|
||||||
|
@ -215,7 +215,7 @@ macro SOCKET_init {
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, net_sockets
|
mov edi, net_sockets
|
||||||
mov ecx, 5
|
mov ecx, 5
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
pseudo_random eax
|
pseudo_random eax
|
||||||
@ -923,7 +923,7 @@ SOCKET_receive_dgram:
|
|||||||
.nw:
|
.nw:
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .nd
|
jz .nd
|
||||||
rep movsd
|
rep movsd
|
||||||
.nd:
|
.nd:
|
||||||
|
|
||||||
call kernel_free ; free kernel buffer
|
call kernel_free ; free kernel buffer
|
||||||
@ -1371,7 +1371,7 @@ SOCKET_debug:
|
|||||||
|
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
mov ecx, SOCKETBUFFSIZE/4
|
mov ecx, SOCKETBUFFSIZE/4
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
mov dword[esp+32], 0
|
mov dword[esp+32], 0
|
||||||
ret
|
ret
|
||||||
@ -1662,7 +1662,7 @@ SOCKET_ring_write:
|
|||||||
.nw:
|
.nw:
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .nd
|
jz .nd
|
||||||
rep movsd
|
rep movsd
|
||||||
.nd:
|
.nd:
|
||||||
pop ecx
|
pop ecx
|
||||||
|
|
||||||
@ -1728,7 +1728,7 @@ SOCKET_ring_read:
|
|||||||
.nw:
|
.nw:
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .nd
|
jz .nd
|
||||||
rep movsd
|
rep movsd
|
||||||
.nd:
|
.nd:
|
||||||
pop ecx
|
pop ecx
|
||||||
ret
|
ret
|
||||||
@ -1957,7 +1957,7 @@ SOCKET_alloc:
|
|||||||
mov edi, eax
|
mov edi, eax
|
||||||
mov ecx, SOCKETBUFFSIZE / 4
|
mov ecx, SOCKETBUFFSIZE / 4
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosd
|
rep stosd
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
; set send-and receive procedures to return -1
|
; set send-and receive procedures to return -1
|
||||||
@ -2153,7 +2153,7 @@ SOCKET_fork:
|
|||||||
lea esi, [ebx + SOCKET.PID]
|
lea esi, [ebx + SOCKET.PID]
|
||||||
lea edi, [eax + SOCKET.PID]
|
lea edi, [eax + SOCKET.PID]
|
||||||
mov ecx, (SOCKET_QUEUE_LOCATION - SOCKET.PID + 3)/4
|
mov ecx, (SOCKET_QUEUE_LOCATION - SOCKET.PID + 3)/4
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
and [eax + SOCKET.options], not SO_ACCEPTCON
|
and [eax + SOCKET.options], not SO_ACCEPTCON
|
||||||
|
|
||||||
@ -2300,7 +2300,7 @@ SOCKET_check_owner:
|
|||||||
mov ebx, [TASK_BASE]
|
mov ebx, [TASK_BASE]
|
||||||
mov ebx, [ebx + TASKDATA.pid]
|
mov ebx, [ebx + TASKDATA.pid]
|
||||||
cmp [eax + SOCKET.PID], ebx
|
cmp [eax + SOCKET.PID], ebx
|
||||||
pop ebx
|
pop ebx
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ stack_init:
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, NET_RUNNING
|
mov edi, NET_RUNNING
|
||||||
mov ecx, (NET_DEVICES_MAX + 2)
|
mov ecx, (NET_DEVICES_MAX + 2)
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
PPPoE_init
|
PPPoE_init
|
||||||
|
|
||||||
@ -271,8 +271,8 @@ stack_init:
|
|||||||
; Wakeup every tick.
|
; Wakeup every tick.
|
||||||
proc stack_handler_has_work?
|
proc stack_handler_has_work?
|
||||||
|
|
||||||
mov eax, [timer_ticks]
|
mov eax, [timer_ticks]
|
||||||
cmp eax, [net_10ms]
|
cmp eax, [net_10ms]
|
||||||
|
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -366,7 +366,7 @@ NET_add_device:
|
|||||||
mov ecx, NET_DEVICES_MAX ; We need to check whole list because a device may be removed without re-organizing list
|
mov ecx, NET_DEVICES_MAX ; We need to check whole list because a device may be removed without re-organizing list
|
||||||
mov edi, NET_DRV_LIST
|
mov edi, NET_DRV_LIST
|
||||||
|
|
||||||
repne scasd ; See if device is already in the list
|
repne scasd ; See if device is already in the list
|
||||||
jz .error
|
jz .error
|
||||||
|
|
||||||
;----------------------------
|
;----------------------------
|
||||||
@ -375,7 +375,7 @@ NET_add_device:
|
|||||||
mov ecx, NET_DEVICES_MAX
|
mov ecx, NET_DEVICES_MAX
|
||||||
mov edi, NET_DRV_LIST
|
mov edi, NET_DRV_LIST
|
||||||
|
|
||||||
repne scasd
|
repne scasd
|
||||||
jnz .error
|
jnz .error
|
||||||
|
|
||||||
sub edi, 4
|
sub edi, 4
|
||||||
@ -426,7 +426,7 @@ NET_remove_device:
|
|||||||
mov ecx, NET_DEVICES_MAX
|
mov ecx, NET_DEVICES_MAX
|
||||||
mov edi, NET_DRV_LIST
|
mov edi, NET_DRV_LIST
|
||||||
|
|
||||||
repne scasd
|
repne scasd
|
||||||
jnz .error
|
jnz .error
|
||||||
|
|
||||||
;------------------------
|
;------------------------
|
||||||
@ -663,7 +663,7 @@ sys_network:
|
|||||||
mov edi, ecx
|
mov edi, ecx
|
||||||
|
|
||||||
mov ecx, 64/4 ; max length
|
mov ecx, 64/4 ; max length
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [esp+32], eax
|
mov [esp+32], eax
|
||||||
|
@ -154,7 +154,7 @@ macro TCP_init {
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, TCP_segments_tx
|
mov edi, TCP_segments_tx
|
||||||
mov ecx, (6*NET_DEVICES_MAX)
|
mov ecx, (6*NET_DEVICES_MAX)
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
pseudo_random eax
|
pseudo_random eax
|
||||||
mov [TCP_sequence_num], eax
|
mov [TCP_sequence_num], eax
|
||||||
|
@ -452,7 +452,7 @@ TCP_send:
|
|||||||
mov ecx, [esp + 4]
|
mov ecx, [esp + 4]
|
||||||
lea esi, [esp + 8]
|
lea esi, [esp + 8]
|
||||||
shr ecx, 2 ; count is in bytes, we will work with dwords
|
shr ecx, 2 ; count is in bytes, we will work with dwords
|
||||||
rep movsd
|
rep movsd
|
||||||
pop ecx ; full TCP packet size
|
pop ecx ; full TCP packet size
|
||||||
|
|
||||||
pop esi ; headersize
|
pop esi ; headersize
|
||||||
|
@ -48,7 +48,7 @@ macro UDP_init {
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, UDP_PACKETS_TX
|
mov edi, UDP_PACKETS_TX
|
||||||
mov ecx, 2*NET_DEVICES_MAX
|
mov ecx, 2*NET_DEVICES_MAX
|
||||||
rep stosd
|
rep stosd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -281,10 +281,10 @@ UDP_output:
|
|||||||
sub ecx, sizeof.UDP_header
|
sub ecx, sizeof.UDP_header
|
||||||
add edi, sizeof.UDP_header
|
add edi, sizeof.UDP_header
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
rep movsd
|
rep movsd
|
||||||
mov ecx, [esp]
|
mov ecx, [esp]
|
||||||
and ecx, 3
|
and ecx, 3
|
||||||
rep movsb
|
rep movsb
|
||||||
pop ecx edi
|
pop ecx edi
|
||||||
|
|
||||||
pop dword [edi + UDP_header.SourcePort]
|
pop dword [edi + UDP_header.SourcePort]
|
||||||
|
Loading…
Reference in New Issue
Block a user