forked from KolibriOS/kolibrios
Refactored function 42, now its faster in about 100 times, than the old version from Menuet. See sysfuncs.txt (sysfuncr.txt) for more details.
git-svn-id: svn://kolibrios.org@760 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
064055e18f
commit
b6f863a2e2
@ -2036,26 +2036,43 @@ dd 638
|
||||
* eax = -1 ¤«ï ¥ª®à४⮣® ebx
|
||||
|
||||
======================================================================
|
||||
========== ”ãªæ¨ï 42 - ¯à®ç¨â âì ¤ ë¥, ¯®«ãç¥ë¥ ¯® IRQ. =========
|
||||
========== ”ãªæ¨ï 42 - à ¡®â á ¤ 묨, ¯®«ãç¥ë¬¨ ¯® IRQ. =======
|
||||
======================================================================
|
||||
|
||||
------------------------ —⥨¥ ¤ ëå -------------------------------
|
||||
<EFBFBD>ਠ¢®§¨ª®¢¥¨¨ IRQ á¨á⥬ ¬®¦¥â áç¨âë¢ âì ¤ ë¥ ¨§ 㪠§ ëå
|
||||
à ¥¥ äãªæ¨¥© 44 ¯®à⮢ ¨ § ¯¨áë¢ âì í⨠¤ ë¥ ¢ ¡ãä¥à.
|
||||
Ž¯¨áë¢ ¥¬ ï äãªæ¨ï áç¨âë¢ ¥â ¯®¡ ©â® ¤ ë¥ ¨§ í⮣® ¡ãä¥à .
|
||||
Ž¯¨áë¢ ¥¬ ï äãªæ¨ï áç¨âë¢ ¥â ¤ ë¥ ¨§ í⮣® ¡ãä¥à ¢ ¡ãä¥à
|
||||
㪠§ ë© ¢ ª ç¥á⢥ ¯ à ¬¥âà .
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 42 - ®¬¥à äãªæ¨¨
|
||||
* ebx = ®¬¥à IRQ, 0..15
|
||||
‚®§¢à é ¥¬®¥ § 票¥: (á¨âã æ¨î ¬®¦® à §«¨ç¨âì ¯® § 票î ecx)
|
||||
* bl = ®¬¥à IRQ, 0..15
|
||||
* bh = ®¬¥à ¯®¤äãªæ¨¨, 0
|
||||
Žáâ «ì ï ç áâì ॣ¨áâà ebx ¤®«¦ ¡ëâì ®¡ã«¥ .
|
||||
* ecx = 㪠§ â¥«ì ¡ãä¥à, ªã¤ ¡ã¤ã⠯ਨ¬ âìáï ¤ ë¥
|
||||
‚®§¢à é ¥¬®¥ § 票¥: (á¨âã æ¨î ¬®¦® à §«¨ç¨âì ¯® § 票î eax)
|
||||
* ¥á«¨ ¯®â®ª ¥ ï¥âáï ¢« ¤¥«ì楬 IRQ
|
||||
(¨«¨ ®¬¥à IRQ § ¤ ¥¢¥à®):
|
||||
* ecx = 2
|
||||
* eax = -1
|
||||
* ¥á«¨ ¤ ëå ¥â:
|
||||
* eax = 0
|
||||
* ecx = 1
|
||||
* ebx à §àãè ¥âáï
|
||||
* ¥á«¨ ¢áñ ¢ ¯®à浪¥ ¨ ¤ ë¥ ¡ë«¨:
|
||||
* eax = à §¬¥à ¤ ëå, ¥éñ ¥ ¯à®ç¨â ëå ¨§ ¡ãä¥à (¢ ¡ ©â å)
|
||||
* ecx = 0
|
||||
* ebx = ®ç¥à¥¤®© ¡ ©â
|
||||
* eax = à §¬¥à ¤ ëå, ¯à®ç¨â ëå ¨§ ¡ãä¥à (¢ ¡ ©â å)
|
||||
|
||||
‘¬®âà¨â¥ § ¬¥ç ¨ï ¨¦¥.
|
||||
|
||||
------------------------ “§ âì à §¬¥à ¤ ëå ¢ ¡ãä¥à¥ ---------------
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 42 - ®¬¥à äãªæ¨¨
|
||||
* bl = ®¬¥à IRQ, 0..15
|
||||
* bh = ®¬¥à ¯®¤äãªæ¨¨, 1
|
||||
Žáâ «ì ï ç áâì ॣ¨áâà ebx ¤®«¦ ¡ëâì ®¡ã«¥ .
|
||||
‚®§¢à é ¥¬®¥ § 票¥: (á¨âã æ¨î ¬®¦® à §«¨ç¨âì ¯® § 票î eax)
|
||||
* ¥á«¨ ¯®â®ª ¥ ï¥âáï ¢« ¤¥«ì楬 IRQ
|
||||
(¨«¨ ®¬¥à IRQ § ¤ ¥¢¥à®):
|
||||
* eax = -1
|
||||
* ¥á«¨ ¢áñ ¢ ¯®à浪¥, ¢ eax à §¬¥à ¤ ëå
|
||||
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>।¢ à¨â¥«ì® ¯®â®ª ¤®«¦¥ § १¥à¢¨à®¢ âì ¤«ï ᥡï 㪠§ ë© IRQ
|
||||
äãªæ¨¥© 45.
|
||||
|
@ -2010,26 +2010,45 @@ Returned value:
|
||||
* eax = -1 for incorrect ebx
|
||||
|
||||
======================================================================
|
||||
==================== Function 42 - read IRQ data. ====================
|
||||
==================== Function 42 - work with IRQ data. ===============
|
||||
======================================================================
|
||||
|
||||
------------------------ Reading data --------------------------------
|
||||
|
||||
When an IRQ occurs, the system reads data from ports indicated
|
||||
earlier by function 44 and writes this data to
|
||||
internal buffer. This function reads out data from that buffer
|
||||
bytewise.
|
||||
to the buffer specified as parameter.
|
||||
Parameters:
|
||||
* eax = 42 - function number
|
||||
* ebx = IRQ number, 0..15
|
||||
Returned value: (use value of ecx to distinguish)
|
||||
* bl = IRQ number, 0..15
|
||||
* bh = subfunction number, 0
|
||||
Other part of register ebx, must be zero.
|
||||
* ecx = pointer to the receive buffer
|
||||
Returned value: (use value of eax to distinguish)
|
||||
* if the thread is not IRQ owner (or IRQ number is incorrect):
|
||||
* ecx = 2
|
||||
* eax = -1
|
||||
* if there is no data:
|
||||
* eax = 0
|
||||
* ecx = 1
|
||||
* ebx destroyed
|
||||
* if all is ok:
|
||||
* eax = byte size of data, not yet read from buffer
|
||||
* ecx = 0
|
||||
* ebx = current byte
|
||||
* eax = byte size of data, read from buffer
|
||||
|
||||
See remarks below.
|
||||
|
||||
------------------------ Get data size -------------------------------
|
||||
|
||||
Parameters:
|
||||
* eax = 42 - function number
|
||||
* bl = IRQ number, 0..15
|
||||
* bh = subfunction number, 0
|
||||
Other part of register ebx, must be zero.
|
||||
* ecx = pointer to receive buffer
|
||||
Returned value: (use value of eax to distinguish)
|
||||
* if the thread is not IRQ owner (or IRQ number is incorrect):
|
||||
* eax = -1
|
||||
* if all is ok:
|
||||
* eax = byte size of data in buffer
|
||||
|
||||
Remarks:
|
||||
* Previously the thread must reserve indicated IRQ for itself
|
||||
by function 45.
|
||||
|
@ -3933,52 +3933,67 @@ sys_programirq:
|
||||
align 4
|
||||
|
||||
get_irq_data:
|
||||
cmp ebx,16
|
||||
movzx esi, bh ; save number of subfunction, if bh = 1, return data size, otherwise, read data
|
||||
xor bh, bh
|
||||
cmp ebx, 16
|
||||
jae .not_owner
|
||||
mov eax, [4 * ebx + irq_owner]
|
||||
mov edx, [4 * ebx + irq_owner] ; check for irq owner
|
||||
|
||||
mov edi,[TASK_BASE]
|
||||
mov eax,[TASK_BASE]
|
||||
|
||||
cmp eax,[edi+TASKDATA.pid]
|
||||
cmp edx,[eax+TASKDATA.pid]
|
||||
je gidril1
|
||||
.not_owner:
|
||||
mov [esp+28],dword 2 ; ecx=2
|
||||
ret
|
||||
xor edx, edx
|
||||
dec edx
|
||||
jmp gid1
|
||||
|
||||
gidril1:
|
||||
|
||||
shl ebx,12
|
||||
xor ecx, ecx
|
||||
inc ecx
|
||||
lea eax,[ebx + IRQ_SAVE]
|
||||
mov edx,[eax]
|
||||
test edx,edx
|
||||
shl ebx, 12
|
||||
lea eax, [ebx + IRQ_SAVE] ; calculate address of the beginning of buffer + 0x0 - data size
|
||||
mov edx, [eax] ; + 0x4 - data offset
|
||||
dec esi
|
||||
jz gid1
|
||||
test edx, edx ; check if buffer is empty
|
||||
jz gid1
|
||||
|
||||
dec edx
|
||||
mov [eax], edx
|
||||
mov ebx, [eax + 0x4]
|
||||
mov edi, ecx
|
||||
|
||||
mov ecx, [eax + 0x4]
|
||||
mov ecx, 4000 ; buffer size, used frequently
|
||||
|
||||
cmp ecx, 4000
|
||||
cmp ebx, ecx ; check for the end of buffer, if end of buffer, begin cycle again
|
||||
jb @f
|
||||
|
||||
xor ecx, ecx
|
||||
xor ebx, ebx
|
||||
|
||||
@@:
|
||||
inc ecx
|
||||
mov [eax + 0x4], ecx
|
||||
dec ecx
|
||||
add eax, ecx
|
||||
|
||||
movzx ebx,byte [eax + 0x10]
|
||||
lea esi, [ebx + edx] ; calculate data size and offset
|
||||
cld
|
||||
cmp esi, ecx ; if greater than the buffer size, begin cycle again
|
||||
jbe @f
|
||||
|
||||
xor ecx, ecx
|
||||
sub ecx, ebx
|
||||
sub edx, ecx
|
||||
|
||||
lea esi, [eax + ebx + 0x10]
|
||||
rep movsb
|
||||
|
||||
xor ebx, ebx
|
||||
@@:
|
||||
lea esi, [eax + ebx + 0x10]
|
||||
mov ecx, edx
|
||||
add ebx, edx
|
||||
|
||||
rep movsb
|
||||
mov edx, [eax]
|
||||
mov [eax], ecx ; set data size to zero
|
||||
mov [eax + 0x4], ebx ; set data offset
|
||||
|
||||
gid1:
|
||||
mov [esp+32],edx
|
||||
mov [esp+28],ecx
|
||||
mov [esp+20],ebx
|
||||
mov [esp+32], edx ; eax
|
||||
ret
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user