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:
CleverMouse 2013-06-26 23:35:43 +00:00
parent 99a5913d54
commit 65d0cef44b
26 changed files with 1282 additions and 1282 deletions

View File

@ -107,15 +107,15 @@ hd_read_pio:
mov al, byte [hdid]
add al, 128+64+32
out dx, al; номер головки/номер диска
call wait_for_hd_idle
cmp [hd_error], 0
jne hd_read_error
; ATA with 28 or 48 bit for sector number?
mov eax, [esp+4]
cmp eax, 0x10000000
jae .lba48
jae .lba48
.lba28:
pushfd
cli
@ -142,10 +142,10 @@ hd_read_pio:
add al, 128+64+32
out dx, al ; номер головки/номер диска
inc edx
mov al, 20h ; READ SECTOR(S)
mov al, 20h ; READ SECTOR(S)
out dx, al ; ATACommand регистр команд
popfd
jmp .continue
jmp .continue
.lba48:
pushfd
cli
@ -160,14 +160,14 @@ hd_read_pio:
out dx, al ; Sector Count Current Sector count (7:0)
inc edx
mov eax, [esp+4+4]
rol eax,8
rol eax, 8
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
out dx, al ; LBA Mid Previous LBA (39:32)
inc edx
out dx, al ; LBA High Previous LBA (47:40)
sub edx,2
sub edx, 2
mov eax, [esp+4+4]
out dx, al ; LBA Low Current LBA (7:0)
shr eax, 8
@ -181,7 +181,7 @@ hd_read_pio:
add al, 128+64+32
out dx, al; номер головки/номер диска
inc edx
mov al, 24h ; READ SECTOR(S) EXT
mov al, 24h ; READ SECTOR(S) EXT
out dx, al; ATACommand регистр команд
popfd
.continue:
@ -339,7 +339,7 @@ cache_write_pio:
mov al, 30h ; WRITE SECTOR(S)
out dx, al ; ATACommand регистр команд
popfd
jmp .continue
jmp .continue
.lba48:
pushfd
cli
@ -354,14 +354,14 @@ cache_write_pio:
out dx, al ; Sector Count Current Sector count (7:0)
inc edx
mov eax, [esi]
rol eax,8
rol eax, 8
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
out dx, al ; LBA Mid Previous LBA (39:32)
inc edx
out dx, al ; LBA High Previous LBA (47:40)
sub edx,2
sub edx, 2
mov eax, [esi]
out dx, al ; LBA Low Current LBA (7:0)
shr eax, 8
@ -375,7 +375,7 @@ cache_write_pio:
add al, 128+64+32
out dx, al; номер головки/номер диска
inc edx
mov al, 34h ; WRITE SECTOR(S) EXT
mov al, 34h ; WRITE SECTOR(S) EXT
out dx, al; ATACommand регистр команд
popfd
.continue:
@ -925,10 +925,10 @@ write_cache_chain:
uglobal
IDEContrRegsBaseAddr dw ?
IDEContrProgrammingInterface dw ?
IDE_BAR0_val dw ?
IDE_BAR1_val dw ?
IDE_BAR2_val dw ?
IDE_BAR3_val dw ?
IDE_BAR0_val dw ?
IDE_BAR1_val dw ?
IDE_BAR2_val dw ?
IDE_BAR3_val dw ?
endg
; \end{Mario79}

View File

@ -387,12 +387,12 @@ sayerr:
push 0
pop es
xor ax,ax
and word [es:BOOT_IDE_BASE_ADDR], 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_BAR2_16], ax ;0
and word [es:BOOT_IDE_BAR3_16], ax ;0
xor ax, ax
and word [es:BOOT_IDE_BASE_ADDR], 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_BAR2_16], ax ;0
and word [es:BOOT_IDE_BAR3_16], ax ;0
; \begin{Mario79}
; find HDD IDE DMA PCI device
; check for PCI BIOS
@ -433,55 +433,55 @@ sayerr:
int 0x1A
jnc .found
jmp .nopci
jmp .nopci
.found_1:
; get memory base BAR4
mov ax, 0xB10A
mov di, 0x20 ; memory base is config register at 0x20
push cx
push cx
int 0x1A
jc .no_BAR4 ;.nopci
jc .no_BAR4 ;.nopci
and cx, 0xFFF0 ; clear address decode type
mov [es:BOOT_IDE_BASE_ADDR], cx
.no_BAR4:
pop cx
.found:
pop cx
.found:
; get memory base BAR0
mov ax, 0xB10A
mov di, 0x10 ; memory base is config register at 0x20
push cx
push cx
int 0x1A
jc .no_BAR0 ;.nopci
jc .no_BAR0 ;.nopci
mov [es:BOOT_IDE_BAR0_16], cx
.no_BAR0:
pop cx
pop cx
; get memory base BAR1
mov ax, 0xB10A
mov di, 0x14 ; memory base is config register at 0x20
push cx
push cx
int 0x1A
jc .no_BAR1 ;.nopci
jc .no_BAR1 ;.nopci
mov [es:BOOT_IDE_BAR1_16], cx
.no_BAR1:
pop cx
pop cx
; get memory base BAR2
mov ax, 0xB10A
mov di, 0x18 ; memory base is config register at 0x20
push cx
push cx
int 0x1A
jc .no_BAR2 ;.nopci
jc .no_BAR2 ;.nopci
mov [es:BOOT_IDE_BAR2_16], cx
.no_BAR2:
pop cx
pop cx
; get memory base BAR3
mov ax, 0xB10A
mov di, 0x1C ; memory base is config register at 0x20
push cx
push cx
int 0x1A
jc .no_BAR3 ;.nopci
jc .no_BAR3 ;.nopci
mov [es:BOOT_IDE_BAR3_16], cx
.no_BAR3:
pop cx
pop cx
.nopci:
; \end{Mario79}

View File

@ -243,7 +243,7 @@ NextTD dd ?
; Virtual pointer to the next processed TD.
BufEnd dd ?
; 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
; OHCI isochronous transfer descriptor.

View File

@ -64,20 +64,20 @@ FindHDD_1:
jne FindHDD_2_2
inc byte [DRIVE_DATA+1]
inc byte [DRIVE_DATA+1]
Print_Device_Name:
pushad
pushfd
mov esi,Sector512+27*2
mov edi,dev_name
mov ecx,20
cld
Print_Device_Name:
pushad
pushfd
mov esi, Sector512+27*2
mov edi, dev_name
mov ecx, 20
cld
@@:
lodsw
xchg ah,al
stosw
loop @b
popfd
popad
lodsw
xchg ah, al
stosw
loop @b
popfd
popad
DEBUGF 1, "K : Dev: %s \n", dev_name
FindHDD_2_2:
ret
@ -91,7 +91,7 @@ FindHDD_3:
uglobal
SectorAddress DD ?
dev_name:
rb 41
rb 41
endg
;*************************************************
;* ЧТЕНИЕ ИДЕНТИФИКАТОРА ЖЕСТКОГО ДИСКА *

View File

@ -17,8 +17,8 @@ $Revision$
search_partitions_ide0:
test [DRIVE_DATA+1], byte 0x40
jz search_partitions_ide1
mov eax,[hd_address_table]
mov [hdbase], eax ;0x1f0
mov eax, [hd_address_table]
mov [hdbase], eax ;0x1f0
mov [hdid], 0x0
mov [hdpos], 1
mov [known_part], 1
@ -40,8 +40,8 @@ $Revision$
search_partitions_ide1:
test [DRIVE_DATA+1], byte 0x10
jz search_partitions_ide2
mov eax,[hd_address_table]
mov [hdbase], eax ;0x1f0
mov eax, [hd_address_table]
mov [hdbase], eax ;0x1f0
mov [hdid], 0x10
mov [hdpos], 2
mov [known_part], 1
@ -63,8 +63,8 @@ $Revision$
search_partitions_ide2:
test [DRIVE_DATA+1], byte 0x4
jz search_partitions_ide3
mov eax,[hd_address_table+16]
mov [hdbase], eax ;0x170
mov eax, [hd_address_table+16]
mov [hdbase], eax ;0x170
mov [hdid], 0x0
mov [hdpos], 3
mov [known_part], 1
@ -86,8 +86,8 @@ $Revision$
search_partitions_ide3:
test [DRIVE_DATA+1], byte 0x1
jz end_search_partitions_ide
mov eax,[hd_address_table+16]
mov [hdbase], eax ;0x170
mov eax, [hd_address_table+16]
mov [hdbase], eax ;0x170
mov [hdid], 0x10
mov [hdpos], 4
mov [known_part], 1

View File

@ -7,36 +7,36 @@
macro workers_globals
{
; include global constants from previous workers
workers_globals
workers_globals
align 4
; Callbacks for HID layer.
keyboard_driver:
dd keyboard_driver_add_device
dd keyboard_driver_disconnect
dd keyboard_driver_begin_packet
dd keyboard_driver_array_overflow?
dd keyboard_driver_input_field
dd keyboard_driver_end_packet
dd keyboard_driver_add_device
dd keyboard_driver_disconnect
dd keyboard_driver_begin_packet
dd keyboard_driver_array_overflow?
dd keyboard_driver_input_field
dd keyboard_driver_end_packet
; Callbacks for keyboard layer.
kbd_functions:
dd 12
dd CloseKeyboard
dd SetKeyboardLights
dd 12
dd CloseKeyboard
dd SetKeyboardLights
; Kernel keyboard layer takes input in form of 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
; Usages 700E0h ... 700E7h: LCtrl, LShift, LAlt, LWin, RCtrl, RShift, RAlt, RWin
db 1Dh, 2Ah, 38h, 5Bh+EX, 1Dh+EX, 36h, 38h+EX, 5Ch+EX
; Usages 70004h ... 70004h + normal_keys_number - 1
label normal_keys byte
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 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 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 35h+EX,37h,4Ah,4Eh,1Ch+EX,4Fh,50h, 51h, 4Bh, 4Ch, 4Dh, 47h, 48h, 49h, 52h, 53h
db 0,5Dh+EX,5Eh+EX
normal_keys_number = $ - normal_keys
}
@ -45,13 +45,13 @@ struct keyboard_device_data
handle dd ? ; keyboard handle from RegKeyboard
timer dd ? ; auto-repeat timer handle
repeatkey db ? ; auto-repeat key code
rb 3 ; padding
usbdev dd ? ; pointer to device_data of USB and HID layers
modifiers dd ? ; state of LCtrl ... RWin
led_report dd ? ; output report for LEDs state
numlock_bit dd ? ; position of NumLock bit in LED output report
capslock_bit dd ?
scrolllock_bit dd ? ; guess what
rb 3 ; padding
usbdev dd ? ; pointer to device_data of USB and HID layers
modifiers dd ? ; state of LCtrl ... RWin
led_report dd ? ; output report for LEDs state
numlock_bit dd ? ; position of NumLock bit in LED output report
capslock_bit dd ?
scrolllock_bit dd ? ; guess what
ends
; 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
proc keyboard_driver_add_device
; 1. Allocate memory for keyboard_device_data. If failed, return NULL.
movi eax, sizeof.keyboard_device_data
call Kmalloc
test eax, eax
jz .nothing
movi eax, sizeof.keyboard_device_data
call Kmalloc
test eax, eax
jz .nothing
; 2. Initialize keyboard_device_data: store pointer to USB layer data,
; zero some fields, initialize bit positions to -1.
mov [eax+keyboard_device_data.usbdev], ebx
xor ecx, ecx
mov [eax+keyboard_device_data.timer], ecx
mov [eax+keyboard_device_data.repeatkey], cl
mov [eax+keyboard_device_data.modifiers], ecx
mov [eax+keyboard_device_data.led_report], ecx
dec ecx
mov [eax+keyboard_device_data.numlock_bit], ecx
mov [eax+keyboard_device_data.capslock_bit], ecx
mov [eax+keyboard_device_data.scrolllock_bit], ecx
mov [eax+keyboard_device_data.usbdev], ebx
xor ecx, ecx
mov [eax+keyboard_device_data.timer], ecx
mov [eax+keyboard_device_data.repeatkey], cl
mov [eax+keyboard_device_data.modifiers], ecx
mov [eax+keyboard_device_data.led_report], ecx
dec ecx
mov [eax+keyboard_device_data.numlock_bit], ecx
mov [eax+keyboard_device_data.capslock_bit], ecx
mov [eax+keyboard_device_data.scrolllock_bit], ecx
; 3. Look for LED report and bits corresponding to indicators.
; For now, assume that all LEDs are set by the same report.
; 3a. Save registers.
push ebx esi
push ebx esi
; 3b. Prepare for loop over output reports: get the first output report.
; If there are no output records, skip step 3;
; default values of led_report and *_bit were set in step 2.
mov edx, [edi+collection.output.first_report]
test edx, edx
jz .led_report_set
mov edx, [edi+collection.output.first_report]
test edx, edx
jz .led_report_set
.scan_led_report:
; Process one output report.
; 3c. Prepare for loop over field groups in the current report:
; get the first field group.
mov ecx, [edx+report.first_field]
mov ecx, [edx+report.first_field]
.scan_led_field:
; Process one field group.
; 3d. If there are no more field groups, exit the loop over field groups.
test ecx, ecx
jz .next_led_report
test ecx, ecx
jz .next_led_report
; For now, assume that all LEDs are plain variable fields, not arrays.
; 3e. Ignore array field groups.
test byte [ecx+report_field_group.flags], HID_FIELD_VARIABLE
jz .next_led_field
test byte [ecx+report_field_group.flags], HID_FIELD_VARIABLE
jz .next_led_field
; 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
lea esi, [ecx+report_field_group.common_sizeof]
lea esi, [ecx+report_field_group.common_sizeof]
; 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
cmp [edx+report.id], 0
jz .scan_led_usage
add ebx, 8
cmp [edx+report.id], 0
jz .scan_led_usage
add ebx, 8
.scan_led_usage:
; for USAGE_LED_*LOCK, store the current bit position in the corresponding field
; and store the current report as the LED report
cmp dword [esi], USAGE_LED_NUMLOCK
jz .numlock
cmp dword [esi], USAGE_LED_CAPSLOCK
jz .capslock
cmp dword [esi], USAGE_LED_SCROLLLOCK
jnz .next_field
cmp dword [esi], USAGE_LED_NUMLOCK
jz .numlock
cmp dword [esi], USAGE_LED_CAPSLOCK
jz .capslock
cmp dword [esi], USAGE_LED_SCROLLLOCK
jnz .next_field
.scrolllock:
mov [eax+keyboard_device_data.scrolllock_bit], ebx
jmp @f
mov [eax+keyboard_device_data.scrolllock_bit], ebx
jmp @f
.capslock:
mov [eax+keyboard_device_data.capslock_bit], ebx
jmp @f
mov [eax+keyboard_device_data.capslock_bit], ebx
jmp @f
.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:
add esi, 4
add ebx, [ecx+report_field_group.size]
dec dword [esp]
jnz .scan_led_usage
pop ebx
add esi, 4
add ebx, [ecx+report_field_group.size]
dec dword [esp]
jnz .scan_led_usage
pop ebx
.next_led_field:
; 3g. Continue loop over field groups: get next field group.
mov ecx, [ecx+report_field_group.next]
jmp .scan_led_field
mov ecx, [ecx+report_field_group.next]
jmp .scan_led_field
.next_led_report:
; 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
; the last for this collection.
cmp [eax+keyboard_device_data.led_report], 0
jnz .led_report_set
cmp edx, [edi+collection.output.last_report]
mov edx, [edx+report.next]
jnz .scan_led_report
cmp [eax+keyboard_device_data.led_report], 0
jnz .led_report_set
cmp edx, [edi+collection.output.last_report]
mov edx, [edx+report.next]
jnz .scan_led_report
.led_report_set:
; 3i. Restore registers.
pop esi ebx
pop esi ebx
; 4. Register keyboard in the kernel.
; store pointer to keyboard_device_data in the stack
push eax
push eax
; call kernel API
stdcall RegKeyboard, kbd_functions, eax
stdcall RegKeyboard, kbd_functions, eax
; restore pointer to keyboard_device_data from 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
pop [eax+keyboard_device_data.handle]
pop [eax+keyboard_device_data.handle]
; If failed, free keyboard_device_data and return NULL.
cmp [eax+keyboard_device_data.handle], 0
jz .fail_free
cmp [eax+keyboard_device_data.handle], 0
jz .fail_free
; 5. Return pointer to keyboard_device_data.
.nothing:
ret
ret
.fail_free:
call Kfree
xor eax, eax
ret
call Kfree
xor eax, eax
ret
endp
; 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)
proc keyboard_driver_disconnect
; 1. If an autorepeat timer is active, stop it.
cmp [edi+keyboard_device_data.timer], 0
jz @f
cmp [edi+keyboard_device_data.timer], 0
jz @f
stdcall CancelTimerHS, [edi+keyboard_device_data.timer]
@@:
; 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.
ret
ret
endp
; 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)
proc keyboard_driver_begin_packet
; Nothing to do.
ret
ret
endp
; This procedure is called when HID layer processes every non-empty array field group.
@ -203,10 +203,10 @@ endp
proc keyboard_driver_array_overflow?
; The keyboard signals array overflow by filling the entire array with
; USAGE_KBD_ROLLOVER codes.
mov eax, [edx] ; eax = first field in the array
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
ret
mov eax, [edx] ; eax = first field in the array
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
ret
endp
; 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,
; excluding zeroes in [normal_keys].
; 1a. Test whether usage is in the range.
lea eax, [ecx-USAGE_KBD_FIRST_KEY]
cmp eax, normal_keys_number
jae .not_normal_key
lea eax, [ecx-USAGE_KBD_FIRST_KEY]
cmp eax, normal_keys_number
jae .not_normal_key
; 1b. If the corresponding entry in [normal_keys] is zero,
; 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.
cmp [normal_keys + eax], 0
jz .unclaimed
cmp [normal_keys + eax], 0
jz .unclaimed
; 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.
; Decide what to do.
test edx, edx
jz .normal_key_released
test edx, edx
jz .normal_key_released
.normal_key_pressed:
; The key is pressed.
; 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.
btr ecx, 7
call .send_key
btr ecx, 7
call .send_key
; 1g. Stop the previous autorepeat timer, if any.
mov eax, [edi+keyboard_device_data.timer]
test eax, eax
jz @f
stdcall CancelTimerHS, eax
mov eax, [edi+keyboard_device_data.timer]
test eax, eax
jz @f
stdcall CancelTimerHS, eax
@@:
; 1h. Start the new autorepeat timer with 250 ms initial delay
; and 50 ms subsequent delays.
stdcall TimerHS, 25, 5, autorepeat_timer, edi
mov [edi+keyboard_device_data.timer], eax
stdcall TimerHS, 25, 5, autorepeat_timer, edi
mov [edi+keyboard_device_data.timer], eax
if ~HID_DUMP_UNCLAIMED
.unclaimed:
end if
ret
ret
.normal_key_released:
; The key is released.
; 1i. Stop the autorepeat timer if it is autorepeating the released key.
cmp [edi+keyboard_device_data.repeatkey], cl
jnz .no_stop_timer
push ecx
mov [edi+keyboard_device_data.repeatkey], 0
mov eax, [edi+keyboard_device_data.timer]
test eax, eax
jz @f
stdcall CancelTimerHS, eax
mov [edi+keyboard_device_data.timer], 0
cmp [edi+keyboard_device_data.repeatkey], cl
jnz .no_stop_timer
push ecx
mov [edi+keyboard_device_data.repeatkey], 0
mov eax, [edi+keyboard_device_data.timer]
test eax, eax
jz @f
stdcall CancelTimerHS, eax
mov [edi+keyboard_device_data.timer], 0
@@:
pop ecx
pop ecx
.no_stop_timer:
; 1j. Copy bit 7 to CF and send scancode with bit 7 set.
bts ecx, 7
call .send_key
ret
bts ecx, 7
call .send_key
ret
.not_normal_key:
; 2. USAGE_KBD_NOEVENT is simply a filler for free array fields,
; ignore it.
cmp ecx, USAGE_KBD_NOEVENT
jz .nothing
cmp ecx, USAGE_KBD_NOEVENT
jz .nothing
; 3. Process modifiers: 8 keys starting at USAGE_KBD_LCTRL.
; 3a. Test whether usage is in range.
; If not, we don't know what this field means, so pass it to the default handler.
lea eax, [ecx-USAGE_KBD_LCTRL]
cmp eax, 8
jae .unclaimed
lea eax, [ecx-USAGE_KBD_LCTRL]
cmp eax, 8
jae .unclaimed
; 3b. Further actions are slightly different for modifier press
; and modifier release. Decide what to do.
test edx, edx
jz .modifier_not_pressed
test edx, edx
jz .modifier_not_pressed
.modifier_pressed:
; The modifier is pressed.
; 3c. Set the corresponding status bit.
; If it was not set, send the corresponding scancode to the kernel
; with bit 7 cleared.
bts [edi+keyboard_device_data.modifiers], eax
jc @f
movzx ecx, [control_keys+eax]
btr ecx, 7
call .send_key
bts [edi+keyboard_device_data.modifiers], eax
jc @f
movzx ecx, [control_keys+eax]
btr ecx, 7
call .send_key
@@:
.nothing:
ret
ret
.modifier_not_pressed:
; The modifier is not pressed.
; 3d. Clear the correspodning status bit.
; If it was set, send the corresponding scancode to the kernel
; with bit 7 set.
btr [edi+keyboard_device_data.modifiers], eax
jnc @f
movzx ecx, [control_keys+eax]
bts ecx, 7
call .send_key
btr [edi+keyboard_device_data.modifiers], eax
jnc @f
movzx ecx, [control_keys+eax]
bts ecx, 7
call .send_key
@@:
ret
ret
; Helper procedure. Sends scancode from cl to the kernel.
; If CF is set, precede it with special code 0xE0.
.send_key:
jnc @f
push ecx
mov ecx, 0xE0
call SetKeyboardData
pop ecx
jnc @f
push ecx
mov ecx, 0xE0
call SetKeyboardData
pop ecx
@@:
call SetKeyboardData
ret
call SetKeyboardData
ret
endp
; 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)
proc keyboard_driver_end_packet
; Nothing to do.
ret
ret
endp
; Timer callback for SetTimerHS.
proc autorepeat_timer
virtual at esp
dd ? ; return address
.data dd ?
dd ? ; return address
.data dd ?
end virtual
; Just resend the last pressed key.
mov eax, [.data]
movzx ecx, [eax+keyboard_device_data.repeatkey]
mov eax, [.data]
movzx ecx, [eax+keyboard_device_data.repeatkey]
; Copy bit 7 to CF and send scancode with bit 7 cleared.
btr ecx, 7
call keyboard_driver_input_field.send_key
ret 4
btr ecx, 7
call keyboard_driver_input_field.send_key
ret 4
endp
; This function is called from the keyboard layer
; when it is safe to free keyboard data.
proc CloseKeyboard
virtual at esp
dd ? ; return address
.device_data dd ?
dd ? ; return address
.device_data dd ?
end virtual
mov eax, [.device_data]
call Kfree
ret 4
mov eax, [.device_data]
call Kfree
ret 4
endp
; This function is called from the keyboard layer
; to update LED state on the keyboard.
proc SetKeyboardLights stdcall uses ebx esi edi, device_data, led_state
locals
size dd ?
size dd ?
endl
; 1. Get the pointer to the LED report.
; If there is no LED report, exit from the function.
mov ebx, [device_data]
mov esi, [ebx+keyboard_device_data.led_report]
test esi, esi
jz .nothing
mov ebx, [device_data]
mov esi, [ebx+keyboard_device_data.led_report]
test esi, esi
jz .nothing
; 2. Get report size in bytes.
; report.size is size in bits without possible report ID;
; if an ID is assigned, the size is one byte greater.
mov eax, [esi+report.size]
add eax, 7
shr eax, 3
cmp [esi+report.id], 0
jz @f
inc eax
mov eax, [esi+report.size]
add eax, 7
shr eax, 3
cmp [esi+report.id], 0
jz @f
inc eax
@@:
mov [size], eax
mov [size], eax
; 3. Allocate memory for report + 8 bytes for setup packet.
; Dword-align size for subsequent rep stosd and bts.
; If failed, exit from the function.
add eax, 8 + 3
and eax, not 3
push eax
call Kmalloc
pop ecx
test eax, eax
jz .nothing
add eax, 8 + 3
and eax, not 3
push eax
call Kmalloc
pop ecx
test eax, eax
jz .nothing
; 4. Zero-initialize output report.
push eax
mov edi, eax
shr ecx, 2
xor eax, eax
rep stosd
pop edi
add edi, 8
push eax
mov edi, eax
shr ecx, 2
xor eax, eax
rep stosd
pop edi
add edi, 8
; 5. Store report ID, if assigned. If not assigned, that would just write zero
; over zeroes.
mov edx, [esi+report.id]
mov [edi], edx
mov edx, [esi+report.id]
mov [edi], edx
; 6. Set report bits corresponding to active indicators.
mov eax, [led_state]
test al, 1 ; PS/2 Scroll Lock
jz @f
mov ecx, [ebx+keyboard_device_data.scrolllock_bit]
test ecx, ecx
js @f
bts [edi], ecx
mov eax, [led_state]
test al, 1 ; PS/2 Scroll Lock
jz @f
mov ecx, [ebx+keyboard_device_data.scrolllock_bit]
test ecx, ecx
js @f
bts [edi], ecx
@@:
test al, 2 ; PS/2 Num Lock
jz @f
mov ecx, [ebx+keyboard_device_data.numlock_bit]
test ecx, ecx
js @f
bts [edi], ecx
test al, 2 ; PS/2 Num Lock
jz @f
mov ecx, [ebx+keyboard_device_data.numlock_bit]
test ecx, ecx
js @f
bts [edi], ecx
@@:
test al, 4 ; PS/2 Caps Lock
jz @f
mov ecx, [ebx+keyboard_device_data.capslock_bit]
test ecx, ecx
js @f
bts [edi], ecx
test al, 4 ; PS/2 Caps Lock
jz @f
mov ecx, [ebx+keyboard_device_data.capslock_bit]
test ecx, ecx
js @f
bts [edi], ecx
@@:
; 7. Fill setup packet.
shl edx, 16 ; move Report ID to byte 2
or edx, 21h + \ ; Class-specific request to Interface
(9 shl 8) + \ ; SET_REPORT
(2 shl 24) ; Report Type = Output
lea eax, [edi-8]
mov ebx, [ebx+keyboard_device_data.usbdev]
mov dword [eax], edx
mov edx, [size]
shl edx, 16 ; move Size to last word
or edx, [ebx+usb_device_data.interface_number]
mov [eax+4], edx
shl edx, 16 ; move Report ID to byte 2
or edx, 21h + \ ; Class-specific request to Interface
(9 shl 8) + \ ; SET_REPORT
(2 shl 24) ; Report Type = Output
lea eax, [edi-8]
mov ebx, [ebx+keyboard_device_data.usbdev]
mov dword [eax], edx
mov edx, [size]
shl edx, 16 ; move Size to last word
or edx, [ebx+usb_device_data.interface_number]
mov [eax+4], edx
; 8. Submit output control request.
stdcall USBControlTransferAsync, [ebx+usb_device_data.configpipe], \
eax, edi, [size], after_set_keyboard_lights, ebx, 0
stdcall USBControlTransferAsync, [ebx+usb_device_data.configpipe], \
eax, edi, [size], after_set_keyboard_lights, ebx, 0
; If failed, free the buffer now.
; If succeeded, the callback will free the buffer.
test eax, eax
jnz .nothing
lea eax, [edi-8]
call Kfree
test eax, eax
jnz .nothing
lea eax, [edi-8]
call Kfree
.nothing:
ret
ret
endp
; This procedure is called from the USB subsystem when the request initiated by
; SetKeyboardLights is completed, either successfully or unsuccessfully.
proc after_set_keyboard_lights
virtual at esp
dd ? ; return address
.pipe dd ?
.status dd ?
.buffer dd ?
.length dd ?
.calldata dd ?
dd ? ; return address
.pipe dd ?
.status dd ?
.buffer dd ?
.length dd ?
.calldata dd ?
end virtual
; Ignore status, just free the buffer allocated by SetKeyboardLights.
mov eax, [.buffer]
sub eax, 8
call Kfree
ret 20
mov eax, [.buffer]
sub eax, 8
call Kfree
ret 20
endp

View File

@ -7,24 +7,24 @@
macro workers_globals
{
; include global constants from previous workers
workers_globals
workers_globals
align 4
; Callbacks for HID layer.
mouse_driver:
dd mouse_driver_add_device
dd mouse_driver_disconnect
dd mouse_driver_begin_packet
dd mouse_driver_array_overflow?
dd mouse_driver_input_field
dd mouse_driver_end_packet
dd mouse_driver_add_device
dd mouse_driver_disconnect
dd mouse_driver_begin_packet
dd mouse_driver_array_overflow?
dd mouse_driver_input_field
dd mouse_driver_end_packet
}
; Data that are specific for one mouse device.
struct mouse_device_data
buttons dd ? ; buttons that are currently pressed
dx dd ? ; current x moving
dy dd ? ; current y moving
wheel dd ? ; current wheel moving
buttons dd ? ; buttons that are currently pressed
dx dd ? ; current x moving
dy dd ? ; current y moving
wheel dd ? ; current wheel moving
ends
; 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
proc mouse_driver_add_device
; Just allocate memory; no initialization needed.
movi eax, sizeof.mouse_device_data
call Kmalloc
ret
movi eax, sizeof.mouse_device_data
call Kmalloc
ret
endp
; 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)
proc mouse_driver_disconnect
; Free the allocated memory.
mov eax, edi
call Kfree
ret
mov eax, edi
call Kfree
ret
endp
; 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)
proc mouse_driver_begin_packet
; Zero all variables describing the current state.
mov [edi+mouse_device_data.buttons], 0
mov [edi+mouse_device_data.dx], 0
mov [edi+mouse_device_data.dy], 0
mov [edi+mouse_device_data.wheel], 0
ret
mov [edi+mouse_device_data.buttons], 0
mov [edi+mouse_device_data.dx], 0
mov [edi+mouse_device_data.dy], 0
mov [edi+mouse_device_data.wheel], 0
ret
endp
; 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
proc mouse_driver_array_overflow?
; no array fields, no overflows
stc
ret
stc
ret
endp
; 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.
; Pass other fields to the default handler - default_driver_input_field if
; HID_DUMP_UNCLAIMED is enabled, just ignore otherwise.
cmp ecx, USAGE_GD_X
jz .x
cmp ecx, USAGE_GD_Y
jz .y
cmp ecx, USAGE_GD_WHEEL
jz .wheel
sub ecx, USAGE_BUTTON_PAGE + 1
jb .unclaimed
cmp ecx, 32
jae .unclaimed
cmp ecx, USAGE_GD_X
jz .x
cmp ecx, USAGE_GD_Y
jz .y
cmp ecx, USAGE_GD_WHEEL
jz .wheel
sub ecx, USAGE_BUTTON_PAGE + 1
jb .unclaimed
cmp ecx, 32
jae .unclaimed
; 2. This is a button.
; If a button is pressed, set the corresponding bit in the state.
; If a button is not pressed, do nothing.
test edx, edx
jz @f
bts [edi+mouse_device_data.buttons], ecx
test edx, edx
jz @f
bts [edi+mouse_device_data.buttons], ecx
@@:
if ~HID_DUMP_UNCLAIMED
.unclaimed:
end if
ret
ret
if HID_DUMP_UNCLAIMED
.unclaimed:
add ecx, USAGE_BUTTON_PAGE + 1
jmp default_driver_input_field
add ecx, USAGE_BUTTON_PAGE + 1
jmp default_driver_input_field
end if
.x:
; 3. This is x moving. For relative fields, store the value in the state.
; Pass absolute field to the default handler.
test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE
jz .unclaimed
mov [edi+mouse_device_data.dx], edx
ret
test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE
jz .unclaimed
mov [edi+mouse_device_data.dx], edx
ret
.y:
; 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
; bottom to top, the kernel expects "programming" PS/2-style with Y axis
; increasing from top to bottom.
; Pass absolute fields to the default handler.
test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE
jz .unclaimed
neg edx
mov [edi+mouse_device_data.dy], edx
ret
test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE
jz .unclaimed
neg edx
mov [edi+mouse_device_data.dy], edx
ret
.wheel:
; 5. This is wheel event. For relative fields, store the value in the state,
; changing the sign. Pass absolute fields to the default handler.
test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE
jz .unclaimed
neg edx
mov [edi+mouse_device_data.wheel], edx
ret
test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE
jz .unclaimed
neg edx
mov [edi+mouse_device_data.wheel], edx
ret
endp
; 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)
proc mouse_driver_end_packet
; Call the kernel, passing collected state.
stdcall SetMouseData, \
[edi+mouse_device_data.buttons], \
[edi+mouse_device_data.dx], \
[edi+mouse_device_data.dy], \
[edi+mouse_device_data.wheel], \
0
ret
stdcall SetMouseData, \
[edi+mouse_device_data.buttons], \
[edi+mouse_device_data.dx], \
[edi+mouse_device_data.dy], \
[edi+mouse_device_data.wheel], \
0
ret
endp

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,8 @@
; ecx = array size, edx = array pointer.
; Destroys eax, ecx, esi, edi.
sort:
test ecx, ecx
jz .done
test ecx, ecx
jz .done
mov eax, ecx
@@:
push eax
@ -38,18 +38,18 @@ sort:
cmp esi, ecx
ja .doner
mov edi, [edx+eax*4-4]
cmp [edx+esi*4-4], edi
cmp [edx+esi*4-4], edi
ja .need_xchg
cmp esi, ecx
jae .doner
mov edi, [edx+eax*4-4]
cmp [edx+esi*4], edi
cmp [edx+esi*4], edi
jbe .doner
.need_xchg:
cmp esi, ecx
jz .do_xchg
mov edi, [edx+esi*4-4]
cmp [edx+esi*4], edi
cmp [edx+esi*4], edi
sbb esi, -1
.do_xchg:
mov edi, eax

View File

@ -11,25 +11,25 @@ if HID_DUMP_UNCLAIMED
macro workers_globals
{
; include global constants from previous workers
workers_globals
workers_globals
align 4
; Callbacks for HID layer.
default_driver:
dd default_driver_add_device
dd default_driver_disconnect
dd default_driver_begin_packet
dd default_driver_array_overflow?
dd default_driver_input_field
dd default_driver_end_packet
dd default_driver_add_device
dd default_driver_disconnect
dd default_driver_begin_packet
dd default_driver_array_overflow?
dd default_driver_input_field
dd default_driver_end_packet
}
; This procedure is called when HID layer detects a new driverless device.
; in: ebx -> usb_device_data, edi -> collection
; out: eax = device-specific data or NULL on error
default_driver_add_device:
; just return something nonzero, no matter what
xor eax, eax
inc eax
ret
xor eax, eax
inc eax
ret
; 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: 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
default_driver_array_overflow?:
; parse everything
stc
ret
stc
ret
; This procedure is called from HID layer for every field.
; in: ecx = field usage, edx = value, esi -> report_field_group
default_driver_input_field:
; Do not dump zero values in Variable fields,
; they are present even if the corresponding control is inactive.
test edx, edx
jnz @f
test byte [esi+report_field_group.flags], HID_FIELD_VARIABLE
jnz .nodump
test edx, edx
jnz @f
test byte [esi+report_field_group.flags], HID_FIELD_VARIABLE
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:
; pass through
; Three nothing-to-do procedures.
default_driver_disconnect:
default_driver_begin_packet:
default_driver_end_packet:
ret
ret
end if

View File

@ -41,8 +41,8 @@ EXT4_FEATURE_INCOMPAT_FLEX_BG = 0x0200 ;RUS: гибкие группы блок
;RUS: реализованные ext[234] features ;ENG: implemented ext[234] features
EXT4_FEATURE_INCOMPAT_SUPP = EXT2_FEATURE_INCOMPAT_FILETYPE \
or EXT4_FEATURE_INCOMPAT_EXTENTS \
or EXT4_FEATURE_INCOMPAT_FLEX_BG
or EXT4_FEATURE_INCOMPAT_EXTENTS \
or EXT4_FEATURE_INCOMPAT_FLEX_BG
;RUS: флаги, указываемые для inode в i_flags ;ENG: flags specified for inode in i_flags
EXT2_EXTENTS_FL = 0x00080000
@ -500,7 +500,7 @@ ext2_get_inode:
mov ebx, [ext2_data.ext2_temp_block]
call ext2_get_block
test eax, eax
jnz .fail
jnz .fail
add ebx, edx ;RUS: локальный номер в блоке ;ENG: local number inside block
mov eax, [ebx + EXT2_BLOCK_GROUP_DESC.inode_table] ;RUS: номер блока - в терминах ext2
@ -1004,7 +1004,7 @@ ext2_HdRead:
test eax, eax
jnz .error_at_finish_block
mov ecx, edx
mov ecx, edx
mov esi, ebx
rep movsb ;кусок last блока
jmp @F
@ -1031,7 +1031,7 @@ ext2_HdRead:
.error_at_first_block:
pop edx
.error_at_read_cycle:
pop ebx
pop ebx
.error_at_finish_block:
pop ecx edx
or ebx, -1

View File

@ -525,29 +525,29 @@ fs_NumFloppyServices = ($ - fs_FloppyServices)/4
fs_OnHd0:
call reserve_hd1
mov eax,[hd_address_table]
mov [hdbase], eax ;0x1F0
mov eax, [hd_address_table]
mov [hdbase], eax ;0x1F0
mov [hdid], 0
push 1
jmp fs_OnHd
fs_OnHd1:
call reserve_hd1
mov eax,[hd_address_table]
mov [hdbase], eax ;0x1F0
mov eax, [hd_address_table]
mov [hdbase], eax ;0x1F0
mov [hdid], 0x10
push 2
jmp fs_OnHd
fs_OnHd2:
call reserve_hd1
mov eax,[hd_address_table+16]
mov [hdbase], eax ;0x170
mov eax, [hd_address_table+16]
mov [hdbase], eax ;0x170
mov [hdid], 0
push 3
jmp fs_OnHd
fs_OnHd3:
call reserve_hd1
mov eax,[hd_address_table+16]
mov [hdbase], eax ;0x170
mov eax, [hd_address_table+16]
mov [hdbase], eax ;0x170
mov [hdid], 0x10
push 4
fs_OnHd:
@ -948,7 +948,7 @@ process_replace_file_name:
mov ebp, [full_file_name_table]
xor edi, edi
.loop:
cmp edi,[full_file_name_table.size]
cmp edi, [full_file_name_table.size]
jae .notfound
push esi edi
shl edi, 7 ; edi*128
@ -1021,17 +1021,17 @@ sys_current_directory:
mov edi, sysdir_name1
; copying fake directory name
mov ecx, 63
pushfd
cli
pushfd
cli
cld
rep movsb
rep movsb
; terminator of name, in case if we get the inlet trash
inc esi
xor eax, eax
stosb
; copying real directory path for mounting
mov ecx, 63
rep movsb
rep movsb
; terminator of name, in case if we get the inlet trash
xor eax, eax
stosb
@ -1040,7 +1040,7 @@ sys_current_directory:
; block the ability to call f.30.3 because for one session is necessary
; for us only once
mov [lock_flag_for_f30_3], 1
popfd
popfd
@@:
ret

View File

@ -23,7 +23,7 @@ read_skin_file:
xchg eax, [skin_data]
test eax, eax
jz @f
jz @f
stdcall kernel_free, eax
@@:

View File

@ -82,7 +82,7 @@ macro ARP_init {
xor eax, eax
mov edi, ARP_entries_num
mov ecx, 4*NET_DEVICES_MAX
rep stosd
rep stosd
}
@ -408,7 +408,7 @@ ARP_add_entry:
.add:
push ecx
mov ecx, sizeof.ARP_entry/2
rep movsw
rep movsw
pop ecx
lea esi, [edi - sizeof.ARP_entry]
pop edi
@ -450,12 +450,12 @@ ARP_del_entry:
; move all trailing entries, sizeof.ARP_entry bytes to left.
mov edi, esi
add esi, sizeof.ARP_entry
rep movsw
rep movsw
; now add an empty entry to the end (erasing previous one)
xor eax, eax
mov ecx, sizeof.ARP_entry/2
rep stosw
rep stosw
pop edi
dec [ARP_entries_num + 4*edi]
@ -646,7 +646,7 @@ ARP_api:
imul ecx, sizeof.ARP_entry
lea esi, [eax + ecx]
mov ecx, sizeof.ARP_entry/2
rep movsw
rep movsw
xor eax, eax
ret

View File

@ -85,7 +85,7 @@ macro IPv4_init {
xor eax, eax
mov edi, IP_LIST
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
shr cx, 2 ;
rep movsd ;
rep movsd ;
pop cx ;
and cx, 3 ;
rep movsb ;
rep movsb ;
push eax
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
push edi ecx
rep movsb
rep movsb
pop ecx edi
; [edi + IPv4_header.VersionAndIHL] ; IPv4, normal length (no Optional header)
@ -786,7 +786,7 @@ IPv4_fragment:
; copy header
mov esi, [esp + 2*4]
mov ecx, 5 ; 5 dwords: TODO: use IHL field of the header!
rep movsd
rep movsd
; copy data
mov esi, [esp + 2*4]
@ -795,7 +795,7 @@ IPv4_fragment:
mov ecx, [esp + 1*4]
DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_fragment: copying %u bytes\n", ecx
rep movsb
rep movsb
; now, correct header
mov ecx, [esp + 1*4]
@ -823,7 +823,7 @@ IPv4_fragment:
call [ebx + NET_DEVICE.transmit]
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
mov ecx, [esp+4]
mov ecx, [esp+4]
add [esp], ecx
mov ecx, [esp+3*4+6+4] ; ptr to begin of buff

View File

@ -57,7 +57,7 @@ macro IPv6_init {
xor eax, eax
mov edi, IPv6
mov ecx, (4*4*4+2*4)MAX_IP
rep stosd
rep stosd
}

View File

@ -152,7 +152,7 @@ PPPoE_discovery_output:
mov edx, ecx
mov edi, eax
rep movsb
rep movsb
cmp edx, 60 ; Min ETH size
ja @f

View File

@ -118,7 +118,7 @@ macro ICMP_init {
xor eax, eax
mov edi, ICMP_PACKETS_TX
mov ecx, 2*NET_DEVICES_MAX
rep stosd
rep stosd
}
@ -355,10 +355,10 @@ ICMP_output:
add edi, sizeof.ICMP_header
push cx
shr cx, 2
rep movsd
rep movsd
pop cx
and cx, 3
rep movsb
rep movsb
sub edi, edx ;;; TODO: find a better way to remember start of packet
push edx edi
@ -406,7 +406,7 @@ ICMP_output_raw:
push edi ecx
DEBUGF DEBUG_NETWORK_VERBOSE, "copying %u bytes from %x to %x\n", ecx, esi, edi
rep movsb
rep movsb
pop ecx edi
mov [edi + ICMP_header.Checksum], 0

View File

@ -40,7 +40,7 @@ LOOPBACK_DEVICE:
.namestr db 'loopback', 0
.dummy_fn:
ret
ret
endg

View File

@ -66,7 +66,7 @@ local .ok, .no_wrap
mov edi, [ptr + queue.w_ptr] ; Current write pointer (FIFO!)
mov ecx, entry_size/4 ; Write the queue entry
rep movsd ;
rep movsd ;
lea ecx, [size*entry_size+ptr+sizeof.queue]
cmp edi, ecx ; entry size

View File

@ -215,7 +215,7 @@ macro SOCKET_init {
xor eax, eax
mov edi, net_sockets
mov ecx, 5
rep stosd
rep stosd
@@:
pseudo_random eax
@ -923,7 +923,7 @@ SOCKET_receive_dgram:
.nw:
test ecx, ecx
jz .nd
rep movsd
rep movsd
.nd:
call kernel_free ; free kernel buffer
@ -1371,7 +1371,7 @@ SOCKET_debug:
mov esi, eax
mov ecx, SOCKETBUFFSIZE/4
rep movsd
rep movsd
mov dword[esp+32], 0
ret
@ -1662,7 +1662,7 @@ SOCKET_ring_write:
.nw:
test ecx, ecx
jz .nd
rep movsd
rep movsd
.nd:
pop ecx
@ -1728,7 +1728,7 @@ SOCKET_ring_read:
.nw:
test ecx, ecx
jz .nd
rep movsd
rep movsd
.nd:
pop ecx
ret
@ -1957,7 +1957,7 @@ SOCKET_alloc:
mov edi, eax
mov ecx, SOCKETBUFFSIZE / 4
xor eax, eax
rep stosd
rep stosd
pop eax
; set send-and receive procedures to return -1
@ -2153,7 +2153,7 @@ SOCKET_fork:
lea esi, [ebx + SOCKET.PID]
lea edi, [eax + SOCKET.PID]
mov ecx, (SOCKET_QUEUE_LOCATION - SOCKET.PID + 3)/4
rep movsd
rep movsd
and [eax + SOCKET.options], not SO_ACCEPTCON
@ -2300,7 +2300,7 @@ SOCKET_check_owner:
mov ebx, [TASK_BASE]
mov ebx, [ebx + TASKDATA.pid]
cmp [eax + SOCKET.PID], ebx
pop ebx
pop ebx
ret

View File

@ -246,7 +246,7 @@ stack_init:
xor eax, eax
mov edi, NET_RUNNING
mov ecx, (NET_DEVICES_MAX + 2)
rep stosd
rep stosd
PPPoE_init
@ -271,8 +271,8 @@ stack_init:
; Wakeup every tick.
proc stack_handler_has_work?
mov eax, [timer_ticks]
cmp eax, [net_10ms]
mov eax, [timer_ticks]
cmp eax, [net_10ms]
ret
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 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
;----------------------------
@ -375,7 +375,7 @@ NET_add_device:
mov ecx, NET_DEVICES_MAX
mov edi, NET_DRV_LIST
repne scasd
repne scasd
jnz .error
sub edi, 4
@ -426,7 +426,7 @@ NET_remove_device:
mov ecx, NET_DEVICES_MAX
mov edi, NET_DRV_LIST
repne scasd
repne scasd
jnz .error
;------------------------
@ -663,7 +663,7 @@ sys_network:
mov edi, ecx
mov ecx, 64/4 ; max length
rep movsd
rep movsd
xor eax, eax
mov [esp+32], eax

View File

@ -154,7 +154,7 @@ macro TCP_init {
xor eax, eax
mov edi, TCP_segments_tx
mov ecx, (6*NET_DEVICES_MAX)
rep stosd
rep stosd
pseudo_random eax
mov [TCP_sequence_num], eax

View File

@ -916,7 +916,7 @@ TCP_process_input:
mov ecx, [esp]
add ecx, SOCKET.mutex
call mutex_lock
pop ebx
pop ebx
; Continue processing
xor edx, edx

View File

@ -452,7 +452,7 @@ TCP_send:
mov ecx, [esp + 4]
lea esi, [esp + 8]
shr ecx, 2 ; count is in bytes, we will work with dwords
rep movsd
rep movsd
pop ecx ; full TCP packet size
pop esi ; headersize

View File

@ -48,7 +48,7 @@ macro UDP_init {
xor eax, eax
mov edi, UDP_PACKETS_TX
mov ecx, 2*NET_DEVICES_MAX
rep stosd
rep stosd
}
@ -281,10 +281,10 @@ UDP_output:
sub ecx, sizeof.UDP_header
add edi, sizeof.UDP_header
shr ecx, 2
rep movsd
rep movsd
mov ecx, [esp]
and ecx, 3
rep movsb
rep movsb
pop ecx edi
pop dword [edi + UDP_header.SourcePort]