forked from KolibriOS/kolibrios
make macro for push imm/pop dst
git-svn-id: svn://kolibrios.org@3598 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e80ec77b74
commit
a77e7ee15d
@ -335,8 +335,7 @@ disk_add:
|
|||||||
push ebx esi ; save used registers to be stdcall
|
push ebx esi ; save used registers to be stdcall
|
||||||
; 1. Allocate the DISK structure.
|
; 1. Allocate the DISK structure.
|
||||||
; 1a. Call the heap manager.
|
; 1a. Call the heap manager.
|
||||||
push sizeof.DISK
|
movi eax, sizeof.DISK
|
||||||
pop eax
|
|
||||||
call malloc
|
call malloc
|
||||||
; 1b. Check the result. If allocation failed, return (go to 9) with eax = 0.
|
; 1b. Check the result. If allocation failed, return (go to 9) with eax = 0.
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@ -608,15 +607,13 @@ disk_call_driver:
|
|||||||
|
|
||||||
; The default implementation of DISKFUNC.querymedia.
|
; The default implementation of DISKFUNC.querymedia.
|
||||||
disk_default_querymedia:
|
disk_default_querymedia:
|
||||||
push DISK_STATUS_INVALID_CALL
|
movi eax, DISK_STATUS_INVALID_CALL
|
||||||
pop eax
|
|
||||||
ret 8
|
ret 8
|
||||||
|
|
||||||
; The default implementation of DISKFUNC.read and DISKFUNC.write.
|
; The default implementation of DISKFUNC.read and DISKFUNC.write.
|
||||||
disk_default_read:
|
disk_default_read:
|
||||||
disk_default_write:
|
disk_default_write:
|
||||||
push DISK_STATUS_INVALID_CALL
|
movi eax, DISK_STATUS_INVALID_CALL
|
||||||
pop eax
|
|
||||||
ret 20
|
ret 20
|
||||||
|
|
||||||
; The default implementation of DISKFUNC.close, DISKFUNC.closemedia and
|
; The default implementation of DISKFUNC.close, DISKFUNC.closemedia and
|
||||||
@ -1002,8 +999,7 @@ end virtual
|
|||||||
jnz .success
|
jnz .success
|
||||||
; 3. No file system has recognized the volume, so just allocate the PARTITION
|
; 3. No file system has recognized the volume, so just allocate the PARTITION
|
||||||
; structure without extra fields.
|
; structure without extra fields.
|
||||||
push sizeof.PARTITION
|
movi eax, sizeof.PARTITION
|
||||||
pop eax
|
|
||||||
call malloc
|
call malloc
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .nothing
|
jz .nothing
|
||||||
|
@ -1252,8 +1252,7 @@ fat_gen_short_name:
|
|||||||
stosd
|
stosd
|
||||||
pop edi
|
pop edi
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
push 8
|
movi ebx, 8
|
||||||
pop ebx
|
|
||||||
lea ecx, [edi+8]
|
lea ecx, [edi+8]
|
||||||
.loop:
|
.loop:
|
||||||
lodsb
|
lodsb
|
||||||
@ -1538,8 +1537,7 @@ fs_RamdiskRewrite:
|
|||||||
push ecx edi
|
push ecx edi
|
||||||
mov ecx, 8
|
mov ecx, 8
|
||||||
repnz scasb
|
repnz scasb
|
||||||
push 1
|
movi eax, 1 ; 1 entry
|
||||||
pop eax ; 1 entry
|
|
||||||
jnz .notilde
|
jnz .notilde
|
||||||
; we need ceil(strlen(esi)/13) additional entries = floor((strlen(esi)+12+13)/13) total
|
; we need ceil(strlen(esi)/13) additional entries = floor((strlen(esi)+12+13)/13) total
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@ -1764,8 +1762,7 @@ fs_RamdiskRewrite:
|
|||||||
add esp, 20
|
add esp, 20
|
||||||
mov [esp+16], ebx
|
mov [esp+16], ebx
|
||||||
popad
|
popad
|
||||||
push ERROR_DISK_FULL
|
movi eax, ERROR_DISK_FULL
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
.writedir:
|
.writedir:
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
@ -1957,8 +1954,7 @@ ramdisk_extend_file:
|
|||||||
jb @b
|
jb @b
|
||||||
.fat_err:
|
.fat_err:
|
||||||
pop ecx
|
pop ecx
|
||||||
push ERROR_FAT_TABLE
|
movi eax, ERROR_FAT_TABLE
|
||||||
pop eax
|
|
||||||
stc
|
stc
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
@ -2033,8 +2029,7 @@ ramdisk_extend_file:
|
|||||||
pop edi ecx
|
pop edi ecx
|
||||||
pop esi edx
|
pop esi edx
|
||||||
stc
|
stc
|
||||||
push ERROR_DISK_FULL
|
movi eax, ERROR_DISK_FULL
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
fat_update_datetime:
|
fat_update_datetime:
|
||||||
|
@ -50,8 +50,7 @@ real_start:
|
|||||||
; get file system information
|
; get file system information
|
||||||
; scan for Primary Volume Descriptor
|
; scan for Primary Volume Descriptor
|
||||||
db 66h
|
db 66h
|
||||||
push 10h-1
|
movi eax, 10h-1
|
||||||
pop eax
|
|
||||||
pvd_scan_loop:
|
pvd_scan_loop:
|
||||||
mov cx, 1
|
mov cx, 1
|
||||||
inc eax
|
inc eax
|
||||||
|
@ -680,8 +680,7 @@ end virtual
|
|||||||
jmp .no_device
|
jmp .no_device
|
||||||
.has_device:
|
.has_device:
|
||||||
push eax
|
push eax
|
||||||
push sizeof.PCIDEV
|
movi eax, sizeof.PCIDEV
|
||||||
pop eax
|
|
||||||
call malloc
|
call malloc
|
||||||
pop ecx
|
pop ecx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
|
@ -330,8 +330,7 @@ end if
|
|||||||
; 2b. Fill first 32 entries.
|
; 2b. Fill first 32 entries.
|
||||||
inc eax
|
inc eax
|
||||||
inc eax ; set Type to EHCI_TYPE_QH
|
inc eax ; set Type to EHCI_TYPE_QH
|
||||||
push 32
|
movi ecx, 32
|
||||||
pop ecx
|
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
@@:
|
@@:
|
||||||
stosd
|
stosd
|
||||||
@ -434,14 +433,12 @@ end if
|
|||||||
; now edi = MMIOBase2
|
; now edi = MMIOBase2
|
||||||
; 6. Transfer the controller to a known state.
|
; 6. Transfer the controller to a known state.
|
||||||
; 6b. Stop the controller if it is running.
|
; 6b. Stop the controller if it is running.
|
||||||
push 10
|
movi ecx, 10
|
||||||
pop ecx
|
|
||||||
test dword [edi+EhciStatusReg], 1 shl 12
|
test dword [edi+EhciStatusReg], 1 shl 12
|
||||||
jnz .stopped
|
jnz .stopped
|
||||||
and dword [edi+EhciCommandReg], not 1
|
and dword [edi+EhciCommandReg], not 1
|
||||||
@@:
|
@@:
|
||||||
push 1
|
movi esi, 1
|
||||||
pop esi
|
|
||||||
call delay_ms
|
call delay_ms
|
||||||
test dword [edi+EhciStatusReg], 1 shl 12
|
test dword [edi+EhciStatusReg], 1 shl 12
|
||||||
jnz .stopped
|
jnz .stopped
|
||||||
@ -451,11 +448,9 @@ end if
|
|||||||
.stopped:
|
.stopped:
|
||||||
; 6c. Reset the controller. Wait up to 50 ms checking status every 1 ms.
|
; 6c. Reset the controller. Wait up to 50 ms checking status every 1 ms.
|
||||||
or dword [edi+EhciCommandReg], 2
|
or dword [edi+EhciCommandReg], 2
|
||||||
push 50
|
movi ecx, 50
|
||||||
pop ecx
|
|
||||||
@@:
|
@@:
|
||||||
push 1
|
movi esi, 1
|
||||||
pop esi
|
|
||||||
call delay_ms
|
call delay_ms
|
||||||
test dword [edi+EhciCommandReg], 2
|
test dword [edi+EhciCommandReg], 2
|
||||||
jz .reset_ok
|
jz .reset_ok
|
||||||
@ -515,8 +510,7 @@ end if
|
|||||||
test byte [esi+ehci_controller.StructuralParams-sizeof.ehci_controller], 10h
|
test byte [esi+ehci_controller.StructuralParams-sizeof.ehci_controller], 10h
|
||||||
jz @f
|
jz @f
|
||||||
push esi
|
push esi
|
||||||
push 20
|
movi esi, 20
|
||||||
pop esi
|
|
||||||
call delay_ms
|
call delay_ms
|
||||||
pop esi
|
pop esi
|
||||||
@@:
|
@@:
|
||||||
@ -676,8 +670,7 @@ proc ehci_kickoff_bios
|
|||||||
test al, 1
|
test al, 1
|
||||||
jz .has_ownership
|
jz .has_ownership
|
||||||
push esi
|
push esi
|
||||||
push 1
|
movi esi, 1
|
||||||
pop esi
|
|
||||||
call delay_ms
|
call delay_ms
|
||||||
pop esi
|
pop esi
|
||||||
dec dword [esp]
|
dec dword [esp]
|
||||||
@ -862,8 +855,7 @@ end virtual
|
|||||||
push eax ecx
|
push eax ecx
|
||||||
sub edi, ehci_pipe.SoftwarePart
|
sub edi, ehci_pipe.SoftwarePart
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
push ehci_pipe.SoftwarePart/4
|
movi ecx, ehci_pipe.SoftwarePart/4
|
||||||
pop ecx
|
|
||||||
rep stosd
|
rep stosd
|
||||||
pop ecx eax
|
pop ecx eax
|
||||||
; 2. Setup PID in the first TD and make sure that the it is not active.
|
; 2. Setup PID in the first TD and make sure that the it is not active.
|
||||||
@ -883,8 +875,7 @@ end virtual
|
|||||||
and eax, 3FFF0000h
|
and eax, 3FFF0000h
|
||||||
; Use 1 requests per microframe for control/bulk endpoints,
|
; Use 1 requests per microframe for control/bulk endpoints,
|
||||||
; use value from the endpoint descriptor for periodic endpoints
|
; use value from the endpoint descriptor for periodic endpoints
|
||||||
push 1
|
movi edx, 1
|
||||||
pop edx
|
|
||||||
test [.type], 1
|
test [.type], 1
|
||||||
jz @f
|
jz @f
|
||||||
mov edx, [.maxpacket]
|
mov edx, [.maxpacket]
|
||||||
@ -1292,8 +1283,7 @@ proc ehci_port_init
|
|||||||
@@:
|
@@:
|
||||||
; 3. Call the worker procedure to notify the protocol layer
|
; 3. Call the worker procedure to notify the protocol layer
|
||||||
; about new EHCI device. It is high-speed.
|
; about new EHCI device. It is high-speed.
|
||||||
push USB_SPEED_HS
|
movi eax, USB_SPEED_HS
|
||||||
pop eax
|
|
||||||
call ehci_new_device
|
call ehci_new_device
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .nothing
|
jnz .nothing
|
||||||
@ -1794,8 +1784,7 @@ proc ehci_process_updated_td
|
|||||||
; all corresponding bits are set. In this case, return some error code,
|
; all corresponding bits are set. In this case, return some error code,
|
||||||
; the order is quite arbitrary.
|
; the order is quite arbitrary.
|
||||||
pop eax ; status
|
pop eax ; status
|
||||||
push USB_STATUS_UNDERRUN
|
movi ecx, USB_STATUS_UNDERRUN
|
||||||
pop ecx
|
|
||||||
test al, 40h ; not Halted?
|
test al, 40h ; not Halted?
|
||||||
jz .know_error
|
jz .know_error
|
||||||
mov cl, USB_STATUS_OVERRUN
|
mov cl, USB_STATUS_OVERRUN
|
||||||
|
@ -398,8 +398,7 @@ proc usb_process_wait_lists
|
|||||||
jnc @f
|
jnc @f
|
||||||
or byte [esp], 1 shl CONTROL_PIPE
|
or byte [esp], 1 shl CONTROL_PIPE
|
||||||
@@:
|
@@:
|
||||||
push 4
|
movi edx, 4
|
||||||
pop edx
|
|
||||||
call usb_process_one_wait_list
|
call usb_process_one_wait_list
|
||||||
jnc @f
|
jnc @f
|
||||||
or byte [esp], 1 shl INTERRUPT_PIPE
|
or byte [esp], 1 shl INTERRUPT_PIPE
|
||||||
|
@ -253,8 +253,7 @@ end virtual
|
|||||||
; 2a. Save registers.
|
; 2a. Save registers.
|
||||||
push edx
|
push edx
|
||||||
; 2b. Call the allocator.
|
; 2b. Call the allocator.
|
||||||
push 40
|
movi eax, 40
|
||||||
pop eax
|
|
||||||
call malloc
|
call malloc
|
||||||
; 2c. Restore registers.
|
; 2c. Restore registers.
|
||||||
pop ecx
|
pop ecx
|
||||||
|
@ -131,8 +131,7 @@ endg
|
|||||||
proc create_usb_thread
|
proc create_usb_thread
|
||||||
; 1. Create the thread.
|
; 1. Create the thread.
|
||||||
push edi
|
push edi
|
||||||
push 1
|
movi ebx, 1
|
||||||
pop ebx
|
|
||||||
mov ecx, usb_thread_proc
|
mov ecx, usb_thread_proc
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
call new_sys_threads
|
call new_sys_threads
|
||||||
|
@ -351,8 +351,7 @@ end if
|
|||||||
lea esi, [eax+ohci_controller.IntEDs+32*sizeof.ohci_static_ep]
|
lea esi, [eax+ohci_controller.IntEDs+32*sizeof.ohci_static_ep]
|
||||||
call get_pg_addr
|
call get_pg_addr
|
||||||
add eax, ohci_controller.IntEDs
|
add eax, ohci_controller.IntEDs
|
||||||
push 32
|
movi ecx, 32
|
||||||
pop ecx
|
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
@@:
|
@@:
|
||||||
stosd
|
stosd
|
||||||
@ -429,10 +428,8 @@ end if
|
|||||||
; 5c. Save FmInterval register.
|
; 5c. Save FmInterval register.
|
||||||
pushd [edi+OhciFmIntervalReg]
|
pushd [edi+OhciFmIntervalReg]
|
||||||
; 5d. Issue software reset and wait up to 10ms, checking status every 1 ms.
|
; 5d. Issue software reset and wait up to 10ms, checking status every 1 ms.
|
||||||
push 1
|
movi ecx, 1
|
||||||
pop ecx
|
movi edx, 10
|
||||||
push 10
|
|
||||||
pop edx
|
|
||||||
mov [edi+OhciCommandStatusReg], ecx
|
mov [edi+OhciCommandStatusReg], ecx
|
||||||
@@:
|
@@:
|
||||||
mov esi, ecx
|
mov esi, ecx
|
||||||
@ -633,14 +630,12 @@ proc ohci_kickoff_bios
|
|||||||
; (This should generate SMI, BIOS should release its ownership in SMI handler.)
|
; (This should generate SMI, BIOS should release its ownership in SMI handler.)
|
||||||
mov dword [eax+OhciCommandStatusReg], 8
|
mov dword [eax+OhciCommandStatusReg], 8
|
||||||
; 4c. Wait for result no more than 50 ms, checking for status every 1 ms.
|
; 4c. Wait for result no more than 50 ms, checking for status every 1 ms.
|
||||||
push 50
|
movi ecx, 50
|
||||||
pop ecx
|
|
||||||
@@:
|
@@:
|
||||||
test dword [eax+OhciControlReg], edx
|
test dword [eax+OhciControlReg], edx
|
||||||
jz .has_ownership
|
jz .has_ownership
|
||||||
push esi
|
push esi
|
||||||
push 1
|
movi esi, 1
|
||||||
pop esi
|
|
||||||
call delay_ms
|
call delay_ms
|
||||||
pop esi
|
pop esi
|
||||||
loop @b
|
loop @b
|
||||||
@ -984,8 +979,7 @@ end virtual
|
|||||||
; if so, return an error.
|
; if so, return an error.
|
||||||
lea edx, [esi + ohci_controller.IntEDs - sizeof.ohci_controller]
|
lea edx, [esi + ohci_controller.IntEDs - sizeof.ohci_controller]
|
||||||
lea eax, [esi + ohci_controller.IntEDs + 32*sizeof.ohci_static_ep - sizeof.ohci_controller]
|
lea eax, [esi + ohci_controller.IntEDs + 32*sizeof.ohci_static_ep - sizeof.ohci_controller]
|
||||||
push 64
|
movi ecx, 64
|
||||||
pop ecx
|
|
||||||
call usb1_select_interrupt_list
|
call usb1_select_interrupt_list
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jz .return0
|
jz .return0
|
||||||
|
@ -206,8 +206,7 @@ end virtual
|
|||||||
sub ecx, 3
|
sub ecx, 3
|
||||||
cmp ecx, 5 ; maximum 32ms
|
cmp ecx, 5 ; maximum 32ms
|
||||||
jbe @f
|
jbe @f
|
||||||
push 5
|
movi ecx, 5
|
||||||
pop ecx
|
|
||||||
@@:
|
@@:
|
||||||
; There are four nested loops,
|
; There are four nested loops,
|
||||||
; * Loop #4 (the innermost one) calculates the total periodic bandwidth
|
; * Loop #4 (the innermost one) calculates the total periodic bandwidth
|
||||||
@ -221,10 +220,8 @@ end virtual
|
|||||||
; ebx = number of iterations of loop #1
|
; ebx = number of iterations of loop #1
|
||||||
; [esp] = delta of counter for loop #3, in bytes
|
; [esp] = delta of counter for loop #3, in bytes
|
||||||
; [esp+4] = delta between the first group and the target group, in bytes
|
; [esp+4] = delta between the first group and the target group, in bytes
|
||||||
push 1
|
movi ebx, 1
|
||||||
pop ebx
|
movi edx, sizeof.ehci_static_ep
|
||||||
push sizeof.ehci_static_ep
|
|
||||||
pop edx
|
|
||||||
shl ebx, cl
|
shl ebx, cl
|
||||||
shl edx, cl
|
shl edx, cl
|
||||||
mov eax, 64*sizeof.ehci_static_ep
|
mov eax, 64*sizeof.ehci_static_ep
|
||||||
@ -282,8 +279,7 @@ end virtual
|
|||||||
ja @f
|
ja @f
|
||||||
mov [.bandwidth], edi
|
mov [.bandwidth], edi
|
||||||
mov [.target], edx
|
mov [.target], edx
|
||||||
push 1
|
movi eax, 1
|
||||||
pop eax
|
|
||||||
shl eax, cl
|
shl eax, cl
|
||||||
mov [.targetsmask], eax
|
mov [.targetsmask], eax
|
||||||
@@:
|
@@:
|
||||||
@ -317,8 +313,7 @@ end virtual
|
|||||||
mov ecx, [.targetsmask]
|
mov ecx, [.targetsmask]
|
||||||
add [edx+ehci_static_ep.Bandwidths+ecx*2], ax
|
add [edx+ehci_static_ep.Bandwidths+ecx*2], ax
|
||||||
add edx, ehci_static_ep.SoftwarePart
|
add edx, ehci_static_ep.SoftwarePart
|
||||||
push 1
|
movi eax, 1
|
||||||
pop eax
|
|
||||||
shl eax, cl
|
shl eax, cl
|
||||||
pop edi ebx ; restore used registers to be stdcall
|
pop edi ebx ; restore used registers to be stdcall
|
||||||
ret
|
ret
|
||||||
@ -371,8 +366,7 @@ virtual at esp
|
|||||||
end virtual
|
end virtual
|
||||||
; 10. Select the best variant.
|
; 10. Select the best variant.
|
||||||
; edx = S-Mask = bitmask of scheduled microframes
|
; edx = S-Mask = bitmask of scheduled microframes
|
||||||
push 0x11
|
movi edx, 0x11
|
||||||
pop edx
|
|
||||||
cmp ecx, 1
|
cmp ecx, 1
|
||||||
ja @f
|
ja @f
|
||||||
mov dl, 0x55
|
mov dl, 0x55
|
||||||
|
@ -315,8 +315,7 @@ end if
|
|||||||
; 2b. Fill first 32 entries.
|
; 2b. Fill first 32 entries.
|
||||||
inc eax
|
inc eax
|
||||||
inc eax ; set QH bit for uhci_pipe.NextQH
|
inc eax ; set QH bit for uhci_pipe.NextQH
|
||||||
push 32
|
movi ecx, 32
|
||||||
pop ecx
|
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
@@:
|
@@:
|
||||||
stosd
|
stosd
|
||||||
@ -416,12 +415,10 @@ end if
|
|||||||
mov ax, 2
|
mov ax, 2
|
||||||
out dx, ax
|
out dx, ax
|
||||||
; 5f. Wait up to 10ms.
|
; 5f. Wait up to 10ms.
|
||||||
push 10
|
movi ecx, 10
|
||||||
pop ecx
|
|
||||||
@@:
|
@@:
|
||||||
push esi
|
push esi
|
||||||
push 1
|
movi esi, 1
|
||||||
pop esi
|
|
||||||
call delay_ms
|
call delay_ms
|
||||||
pop esi
|
pop esi
|
||||||
in ax, dx
|
in ax, dx
|
||||||
@ -435,8 +432,7 @@ if 0
|
|||||||
; emergency variant for tests - always wait 10 ms
|
; emergency variant for tests - always wait 10 ms
|
||||||
; wait 10 ms
|
; wait 10 ms
|
||||||
push esi
|
push esi
|
||||||
push 10
|
movi esi, 10
|
||||||
pop esi
|
|
||||||
call delay_ms
|
call delay_ms
|
||||||
pop esi
|
pop esi
|
||||||
; clear reset signal
|
; clear reset signal
|
||||||
@ -998,8 +994,7 @@ end if
|
|||||||
; * if several non-fatal errors have occured during transaction retries,
|
; * if several non-fatal errors have occured during transaction retries,
|
||||||
; all corresponding bits are set. In this case, return some error code,
|
; all corresponding bits are set. In this case, return some error code,
|
||||||
; the order is quite arbitrary.
|
; the order is quite arbitrary.
|
||||||
push USB_STATUS_UNDERRUN
|
movi ecx, USB_STATUS_UNDERRUN
|
||||||
pop ecx
|
|
||||||
test al, 1 shl (22-16) ; not Stalled?
|
test al, 1 shl (22-16) ; not Stalled?
|
||||||
jz .know_error
|
jz .know_error
|
||||||
mov cl, USB_STATUS_OVERRUN
|
mov cl, USB_STATUS_OVERRUN
|
||||||
@ -1260,8 +1255,7 @@ proc uhci_port_reset_done
|
|||||||
; 2. Status bits in UHCI are invalid during reset signalling.
|
; 2. Status bits in UHCI are invalid during reset signalling.
|
||||||
; Wait a millisecond while status bits become valid again.
|
; Wait a millisecond while status bits become valid again.
|
||||||
push esi
|
push esi
|
||||||
push 1
|
movi esi, 1
|
||||||
pop esi
|
|
||||||
call delay_ms
|
call delay_ms
|
||||||
pop esi
|
pop esi
|
||||||
; 3. ConnectStatus bit is zero during reset and becomes 1 during step 2;
|
; 3. ConnectStatus bit is zero during reset and becomes 1 during step 2;
|
||||||
@ -1458,8 +1452,7 @@ end virtual
|
|||||||
; if so, return an error.
|
; if so, return an error.
|
||||||
lea edx, [esi + uhci_controller.IntEDs - sizeof.uhci_controller]
|
lea edx, [esi + uhci_controller.IntEDs - sizeof.uhci_controller]
|
||||||
lea eax, [esi + uhci_controller.IntEDs + 32*sizeof.uhci_static_ep - sizeof.uhci_controller]
|
lea eax, [esi + uhci_controller.IntEDs + 32*sizeof.uhci_static_ep - sizeof.uhci_controller]
|
||||||
push 64
|
movi ecx, 64
|
||||||
pop ecx
|
|
||||||
call usb1_select_interrupt_list
|
call usb1_select_interrupt_list
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jz .return0
|
jz .return0
|
||||||
|
@ -504,8 +504,7 @@ terminate: ; terminate application
|
|||||||
mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot]
|
mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .nodebug
|
jz .nodebug
|
||||||
push 8
|
movi ecx, 8
|
||||||
pop ecx
|
|
||||||
push dword [CURRENT_TASK+edi+TASKDATA.pid]; PID
|
push dword [CURRENT_TASK+edi+TASKDATA.pid]; PID
|
||||||
push 2
|
push 2
|
||||||
call debugger_notify
|
call debugger_notify
|
||||||
|
@ -82,8 +82,7 @@ proc timer_hs stdcall uses ebx, deltaStart:dword, interval:dword, \
|
|||||||
timerFunc:dword, userData:dword
|
timerFunc:dword, userData:dword
|
||||||
; 1. Allocate memory for the TIMER structure.
|
; 1. Allocate memory for the TIMER structure.
|
||||||
; 1a. Call the allocator.
|
; 1a. Call the allocator.
|
||||||
push sizeof.TIMER
|
movi eax, sizeof.TIMER
|
||||||
pop eax
|
|
||||||
call malloc
|
call malloc
|
||||||
; 1b. If allocation failed, return (go to 5) with eax = 0.
|
; 1b. If allocation failed, return (go to 5) with eax = 0.
|
||||||
test eax, eax
|
test eax, eax
|
||||||
|
@ -19,6 +19,20 @@
|
|||||||
; __DEBUG__ equ 1
|
; __DEBUG__ equ 1
|
||||||
; __DEBUG_LEVEL__ equ 5
|
; __DEBUG_LEVEL__ equ 5
|
||||||
|
|
||||||
|
; MOV Immediate.
|
||||||
|
; Useful for things like movi eax,10:
|
||||||
|
; shorter than regular mov, but slightly slower,
|
||||||
|
; do not use it in performance-critical places.
|
||||||
|
macro movi dst, imm
|
||||||
|
{
|
||||||
|
if imm >= -0x80 & imm <= 0x7F
|
||||||
|
push imm
|
||||||
|
pop dst
|
||||||
|
else
|
||||||
|
mov dst, imm
|
||||||
|
end if
|
||||||
|
}
|
||||||
|
|
||||||
macro debug_func name {
|
macro debug_func name {
|
||||||
if used name
|
if used name
|
||||||
name@of@func equ name
|
name@of@func equ name
|
||||||
@ -273,8 +287,7 @@ debug_beginf
|
|||||||
call fdo_debug_outchar
|
call fdo_debug_outchar
|
||||||
pop eax
|
pop eax
|
||||||
@@:
|
@@:
|
||||||
push 10
|
movi ecx, 10
|
||||||
pop ecx
|
|
||||||
push -'0'
|
push -'0'
|
||||||
.l1:
|
.l1:
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
|
@ -234,8 +234,7 @@ AddDevice:
|
|||||||
; 8 bytes for a packet and 8 bytes for previous packet, used by a keyboard.
|
; 8 bytes for a packet and 8 bytes for previous packet, used by a keyboard.
|
||||||
; 9. Initialize device data.
|
; 9. Initialize device data.
|
||||||
mov [ebx+device_data.intpipe], eax
|
mov [ebx+device_data.intpipe], eax
|
||||||
push 8
|
movi ecx, 8
|
||||||
pop ecx
|
|
||||||
cmp edx, ecx
|
cmp edx, ecx
|
||||||
jb @f
|
jb @f
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
@ -364,8 +363,7 @@ keyboard_data_ready:
|
|||||||
jb .controlloop
|
jb .controlloop
|
||||||
.nocontrol:
|
.nocontrol:
|
||||||
; 3. Initialize before loop for normal keys. esi = index.
|
; 3. Initialize before loop for normal keys. esi = index.
|
||||||
push 2
|
movi esi, 2
|
||||||
pop esi
|
|
||||||
.normalloop:
|
.normalloop:
|
||||||
; 4. Process one key which was pressed in the previous packet.
|
; 4. Process one key which was pressed in the previous packet.
|
||||||
; 4a. Get the next pressed key from the previous packet.
|
; 4a. Get the next pressed key from the previous packet.
|
||||||
@ -486,8 +484,7 @@ keyboard_data_ready:
|
|||||||
|
|
||||||
; Auxiliary procedure for keyboard_data_ready.
|
; Auxiliary procedure for keyboard_data_ready.
|
||||||
haskey:
|
haskey:
|
||||||
push 2
|
movi edx, 2
|
||||||
pop edx
|
|
||||||
@@:
|
@@:
|
||||||
cmp byte [ecx+edx], al
|
cmp byte [ecx+edx], al
|
||||||
jz @f
|
jz @f
|
||||||
|
@ -298,8 +298,7 @@ virtual at esp
|
|||||||
.UserData dd ? ; request_queue_item.UserData
|
.UserData dd ? ; request_queue_item.UserData
|
||||||
end virtual
|
end virtual
|
||||||
; 1. Allocate the memory for the request description.
|
; 1. Allocate the memory for the request description.
|
||||||
push request_queue_item.sizeof
|
movi eax, request_queue_item.sizeof
|
||||||
pop eax
|
|
||||||
call Kmalloc
|
call Kmalloc
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @f
|
jnz @f
|
||||||
@ -1004,10 +1003,8 @@ proc inquiry_callback
|
|||||||
; 4. Thus, create a temporary kernel thread which would do it.
|
; 4. Thus, create a temporary kernel thread which would do it.
|
||||||
mov edx, [esp+8]
|
mov edx, [esp+8]
|
||||||
push ebx ecx
|
push ebx ecx
|
||||||
push 51
|
movi eax, 51
|
||||||
pop eax
|
movi ebx, 1
|
||||||
push 1
|
|
||||||
pop ebx
|
|
||||||
mov ecx, new_disk_thread
|
mov ecx, new_disk_thread
|
||||||
; edx = parameter
|
; edx = parameter
|
||||||
int 0x40
|
int 0x40
|
||||||
@ -1069,8 +1066,7 @@ end virtual
|
|||||||
cmp [edx+usb_unit_data.UnitReadyAttempts], 3
|
cmp [edx+usb_unit_data.UnitReadyAttempts], 3
|
||||||
jz @f
|
jz @f
|
||||||
push ecx edx esi
|
push ecx edx esi
|
||||||
push 10
|
movi esi, 10
|
||||||
pop esi
|
|
||||||
call Sleep
|
call Sleep
|
||||||
pop esi edx ecx
|
pop esi edx ecx
|
||||||
stdcall queue_request, ecx, test_unit_ready_req, 0, test_unit_ready_callback, edx
|
stdcall queue_request, ecx, test_unit_ready_req, 0, test_unit_ready_callback, edx
|
||||||
@ -1124,8 +1120,7 @@ end virtual
|
|||||||
mov byte [edi-1], 'd'
|
mov byte [edi-1], 'd'
|
||||||
push eax
|
push eax
|
||||||
push -'0'
|
push -'0'
|
||||||
push 10
|
movi ecx, 10
|
||||||
pop ecx
|
|
||||||
@@:
|
@@:
|
||||||
cdq
|
cdq
|
||||||
div ecx
|
div ecx
|
||||||
|
@ -278,8 +278,7 @@ debug_beginf
|
|||||||
call fdo_debug_outchar
|
call fdo_debug_outchar
|
||||||
pop eax
|
pop eax
|
||||||
@@:
|
@@:
|
||||||
push 10
|
movi ecx, 10
|
||||||
pop ecx
|
|
||||||
push -'0'
|
push -'0'
|
||||||
.l1:
|
.l1:
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
|
@ -1311,8 +1311,7 @@ fs_FloppyRewrite:
|
|||||||
push ecx edi
|
push ecx edi
|
||||||
mov ecx, 8
|
mov ecx, 8
|
||||||
repnz scasb
|
repnz scasb
|
||||||
push 1
|
movi eax, 1 ; 1 entry
|
||||||
pop eax ; 1 entry
|
|
||||||
jnz .notilde
|
jnz .notilde
|
||||||
; we need ceil(strlen(esi)/13) additional entries = floor((strlen(esi)+12+13)/13) total
|
; we need ceil(strlen(esi)/13) additional entries = floor((strlen(esi)+12+13)/13) total
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@ -1822,8 +1821,7 @@ floppy_extend_file:
|
|||||||
jb @b
|
jb @b
|
||||||
.fat_err:
|
.fat_err:
|
||||||
pop ecx
|
pop ecx
|
||||||
push ERROR_FAT_TABLE
|
movi eax, ERROR_FAT_TABLE
|
||||||
pop eax
|
|
||||||
stc
|
stc
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
@ -1885,8 +1883,7 @@ floppy_extend_file:
|
|||||||
pop edi ecx
|
pop edi ecx
|
||||||
pop esi edx
|
pop esi edx
|
||||||
stc
|
stc
|
||||||
push ERROR_DISK_FULL
|
movi eax, ERROR_DISK_FULL
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;----------------------------------------------------------------
|
;----------------------------------------------------------------
|
||||||
|
@ -167,8 +167,7 @@ fat_create_partition:
|
|||||||
; in the normal operation, let's hope for the best and allocate data now; if
|
; in the normal operation, let's hope for the best and allocate data now; if
|
||||||
; it will prove wrong, just deallocate it.
|
; it will prove wrong, just deallocate it.
|
||||||
push ebx
|
push ebx
|
||||||
push sizeof.FAT
|
movi eax, sizeof.FAT
|
||||||
pop eax
|
|
||||||
call malloc
|
call malloc
|
||||||
pop ebx
|
pop ebx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@ -972,8 +971,7 @@ fs_HdReadFolder:
|
|||||||
jz ntfs_HdReadFolder
|
jz ntfs_HdReadFolder
|
||||||
cmp [fs_type], 2
|
cmp [fs_type], 2
|
||||||
jz ext2_HdReadFolder
|
jz ext2_HdReadFolder
|
||||||
push ERROR_UNSUPPORTED_FS
|
movi eax, ERROR_UNSUPPORTED_FS
|
||||||
pop eax
|
|
||||||
or ebx, -1
|
or ebx, -1
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
@ -1659,8 +1657,7 @@ fat_Rewrite:
|
|||||||
push ecx edi
|
push ecx edi
|
||||||
mov ecx, 8
|
mov ecx, 8
|
||||||
repnz scasb
|
repnz scasb
|
||||||
push 1
|
movi eax, 1 ; 1 entry
|
||||||
pop eax ; 1 entry
|
|
||||||
jnz .notilde
|
jnz .notilde
|
||||||
; we need ceil(strlen(esi)/13) additional entries = floor((strlen(esi)+12+13)/13) total
|
; we need ceil(strlen(esi)/13) additional entries = floor((strlen(esi)+12+13)/13) total
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@ -2362,8 +2359,7 @@ hd_extend_file:
|
|||||||
jmp .device_err2
|
jmp .device_err2
|
||||||
.disk_full:
|
.disk_full:
|
||||||
pop eax edx esi
|
pop eax edx esi
|
||||||
push ERROR_DISK_FULL
|
movi eax, ERROR_DISK_FULL
|
||||||
pop eax
|
|
||||||
stc
|
stc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -2390,8 +2386,7 @@ fs_HdSetFileEnd:
|
|||||||
jz ntfs_HdSetFileEnd
|
jz ntfs_HdSetFileEnd
|
||||||
cmp [fs_type], 2
|
cmp [fs_type], 2
|
||||||
jz ext2_HdSetFileEnd
|
jz ext2_HdSetFileEnd
|
||||||
push ERROR_UNKNOWN_FS
|
movi eax, ERROR_UNKNOWN_FS
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
sub ebx, 4
|
sub ebx, 4
|
||||||
@ -2566,8 +2561,7 @@ fat_SetFileEnd:
|
|||||||
pop eax ecx eax edi
|
pop eax ecx eax edi
|
||||||
call update_disk
|
call update_disk
|
||||||
call fat_unlock
|
call fat_unlock
|
||||||
push ERROR_DEVICE
|
movi eax, ERROR_DEVICE
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
; we will zero data at the end of last sector - remember it
|
; we will zero data at the end of last sector - remember it
|
||||||
@ -2640,8 +2634,7 @@ fat_SetFileEnd:
|
|||||||
pop eax ecx eax edi
|
pop eax ecx eax edi
|
||||||
call update_disk
|
call update_disk
|
||||||
call fat_unlock
|
call fat_unlock
|
||||||
push ERROR_FAT_TABLE
|
movi eax, ERROR_FAT_TABLE
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
fs_HdGetFileInfo:
|
fs_HdGetFileInfo:
|
||||||
@ -2771,8 +2764,7 @@ fs_HdDelete:
|
|||||||
jz ntfs_HdDelete
|
jz ntfs_HdDelete
|
||||||
cmp [fs_type], 2
|
cmp [fs_type], 2
|
||||||
jz ext2_HdDelete
|
jz ext2_HdDelete
|
||||||
push ERROR_UNKNOWN_FS
|
movi eax, ERROR_UNKNOWN_FS
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
sub ebx, 4
|
sub ebx, 4
|
||||||
@ -2866,23 +2858,20 @@ fat_Delete:
|
|||||||
.err2:
|
.err2:
|
||||||
pop edi
|
pop edi
|
||||||
call fat_unlock
|
call fat_unlock
|
||||||
push ERROR_DEVICE
|
movi eax, ERROR_DEVICE
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
.error_fat:
|
.error_fat:
|
||||||
popad
|
popad
|
||||||
pop edi
|
pop edi
|
||||||
call fat_unlock
|
call fat_unlock
|
||||||
push ERROR_FAT_TABLE
|
movi eax, ERROR_FAT_TABLE
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
.notempty:
|
.notempty:
|
||||||
popad
|
popad
|
||||||
.access_denied2:
|
.access_denied2:
|
||||||
pop edi
|
pop edi
|
||||||
call fat_unlock
|
call fat_unlock
|
||||||
push ERROR_ACCESS_DENIED
|
movi eax, ERROR_ACCESS_DENIED
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
.empty:
|
.empty:
|
||||||
popad
|
popad
|
||||||
|
@ -1139,15 +1139,13 @@ ntfs_HdRead:
|
|||||||
cmp byte [esi], 0
|
cmp byte [esi], 0
|
||||||
jnz @f
|
jnz @f
|
||||||
or ebx, -1
|
or ebx, -1
|
||||||
push ERROR_ACCESS_DENIED
|
movi eax, ERROR_ACCESS_DENIED
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
call ntfs_find_lfn
|
call ntfs_find_lfn
|
||||||
jnc .found
|
jnc .found
|
||||||
or ebx, -1
|
or ebx, -1
|
||||||
push ERROR_FILE_NOT_FOUND
|
movi eax, ERROR_FILE_NOT_FOUND
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
.found:
|
.found:
|
||||||
mov [ntfs_cur_attr], 0x80 ; $DATA
|
mov [ntfs_cur_attr], 0x80 ; $DATA
|
||||||
@ -1156,8 +1154,7 @@ ntfs_HdRead:
|
|||||||
call ntfs_read_attr
|
call ntfs_read_attr
|
||||||
jnc @f
|
jnc @f
|
||||||
or ebx, -1
|
or ebx, -1
|
||||||
push ERROR_ACCESS_DENIED
|
movi eax, ERROR_ACCESS_DENIED
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
pushad
|
pushad
|
||||||
@ -1171,8 +1168,7 @@ ntfs_HdRead:
|
|||||||
popad
|
popad
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
.eof:
|
.eof:
|
||||||
push ERROR_END_OF_FILE
|
movi eax, ERROR_END_OF_FILE
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
mov eax, [ebx]
|
mov eax, [ebx]
|
||||||
@ -1349,8 +1345,7 @@ ntfs_HdReadFolder:
|
|||||||
.nomem:
|
.nomem:
|
||||||
popad
|
popad
|
||||||
or ebx, -1
|
or ebx, -1
|
||||||
push 12
|
movi eax, 12
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
mov [ntfs_data.cur_index_buf], eax
|
mov [ntfs_data.cur_index_buf], eax
|
||||||
@ -1804,14 +1799,12 @@ ntfs_HdDelete:
|
|||||||
ntfs_HdGetFileInfo:
|
ntfs_HdGetFileInfo:
|
||||||
cmp byte [esi], 0
|
cmp byte [esi], 0
|
||||||
jnz @f
|
jnz @f
|
||||||
push 2
|
movi eax, 2
|
||||||
pop eax
|
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
call ntfs_find_lfn
|
call ntfs_find_lfn
|
||||||
jnc .doit
|
jnc .doit
|
||||||
push ERROR_FILE_NOT_FOUND
|
movi eax, ERROR_FILE_NOT_FOUND
|
||||||
pop eax
|
|
||||||
cmp [hd_error], 0
|
cmp [hd_error], 0
|
||||||
jz @f
|
jz @f
|
||||||
mov al, 11
|
mov al, 11
|
||||||
|
@ -139,8 +139,7 @@ endg
|
|||||||
|
|
||||||
register_keyboard:
|
register_keyboard:
|
||||||
push ebx
|
push ebx
|
||||||
push sizeof.KEYBOARD
|
movi eax, sizeof.KEYBOARD
|
||||||
pop eax
|
|
||||||
call malloc
|
call malloc
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .nothing
|
jz .nothing
|
||||||
|
@ -5567,8 +5567,7 @@ system_shutdown: ; shut down the system
|
|||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
call stop_all_services
|
call stop_all_services
|
||||||
push 3 ; stop playing cd
|
movi eax, 3
|
||||||
pop eax
|
|
||||||
call sys_cd_audio
|
call sys_cd_audio
|
||||||
|
|
||||||
yes_shutdown_param:
|
yes_shutdown_param:
|
||||||
@ -5576,8 +5575,7 @@ yes_shutdown_param:
|
|||||||
|
|
||||||
if ~ defined extended_primary_loader
|
if ~ defined extended_primary_loader
|
||||||
mov eax, kernel_file ; load kernel.mnt to 0x7000:0
|
mov eax, kernel_file ; load kernel.mnt to 0x7000:0
|
||||||
push 12
|
movi esi, 12
|
||||||
pop esi
|
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
or ecx, -1
|
or ecx, -1
|
||||||
mov edx, OS_BASE+0x70000
|
mov edx, OS_BASE+0x70000
|
||||||
|
@ -117,3 +117,16 @@ macro list_del entry
|
|||||||
mov [ecx+list_fd], edx
|
mov [ecx+list_fd], edx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; MOV Immediate.
|
||||||
|
; Useful for things like movi eax,10:
|
||||||
|
; shorter than regular mov, but slightly slower,
|
||||||
|
; do not use it in performance-critical places.
|
||||||
|
macro movi dst, imm
|
||||||
|
{
|
||||||
|
if imm >= -0x80 & imm <= 0x7F
|
||||||
|
push imm
|
||||||
|
pop dst
|
||||||
|
else
|
||||||
|
mov dst, imm
|
||||||
|
end if
|
||||||
|
}
|
||||||
|
@ -160,8 +160,7 @@ macro TCP_init {
|
|||||||
|
|
||||||
init_queue TCP_queue
|
init_queue TCP_queue
|
||||||
|
|
||||||
push 1
|
movi ebx, 1
|
||||||
pop ebx
|
|
||||||
mov ecx, TCP_process_input
|
mov ecx, TCP_process_input
|
||||||
call new_sys_threads
|
call new_sys_threads
|
||||||
|
|
||||||
|
@ -50,8 +50,7 @@ real_start:
|
|||||||
; get file system information
|
; get file system information
|
||||||
; scan for Primary Volume Descriptor
|
; scan for Primary Volume Descriptor
|
||||||
db 66h
|
db 66h
|
||||||
push 10h-1
|
movi eax, 10h-1
|
||||||
pop eax
|
|
||||||
pvd_scan_loop:
|
pvd_scan_loop:
|
||||||
mov cx, 1
|
mov cx, 1
|
||||||
inc eax
|
inc eax
|
||||||
|
Loading…
Reference in New Issue
Block a user