Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 760 → Rev 759

/kernel/trunk/kernel.asm
3933,67 → 3933,52
align 4
 
get_irq_data:
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 edx, [4 * ebx + irq_owner] ; check for irq owner
mov eax, [4 * ebx + irq_owner]
 
mov eax,[TASK_BASE]
mov edi,[TASK_BASE]
 
cmp edx,[eax+TASKDATA.pid]
cmp eax,[edi+TASKDATA.pid]
je gidril1
.not_owner:
xor edx, edx
dec edx
jmp gid1
mov [esp+28],dword 2 ; ecx=2
ret
 
gidril1:
 
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
xor ecx, ecx
inc ecx
lea eax,[ebx + IRQ_SAVE]
mov edx,[eax]
test edx,edx
jz gid1
test edx, edx ; check if buffer is empty
jz gid1
 
mov ebx, [eax + 0x4]
mov edi, ecx
dec edx
mov [eax], edx
 
mov ecx, 4000 ; buffer size, used frequently
mov ecx, [eax + 0x4]
 
cmp ebx, ecx ; check for the end of buffer, if end of buffer, begin cycle again
cmp ecx, 4000
jb @f
 
xor ebx, ebx
xor ecx, ecx
 
@@:
inc ecx
mov [eax + 0x4], ecx
dec ecx
add eax, ecx
 
lea esi, [ebx + edx] ; calculate data size and offset
cld
cmp esi, ecx ; if greater than the buffer size, begin cycle again
jbe @f
movzx ebx,byte [eax + 0x10]
 
sub ecx, ebx
sub edx, ecx
xor ecx, 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 ; eax
mov [esp+32],edx
mov [esp+28],ecx
mov [esp+20],ebx
ret
 
 
/kernel/trunk/docs/sysfuncr.txt
2036,43 → 2036,26
* eax = -1 ¤«ï ­¥ª®à४⭮£® ebx
 
======================================================================
========== ”ã­ªæ¨ï 42 - à ¡®â  á ¤ ­­ë¬¨, ¯®«ã祭­ë¬¨ ¯® IRQ. =======
========== ”ã­ªæ¨ï 42 - ¯à®ç¨â âì ¤ ­­ë¥, ¯®«ã祭­ë¥ ¯® IRQ. =========
======================================================================
 
------------------------ —⥭¨¥ ¤ ­­ëå -------------------------------
à¨ ¢®§­¨ª­®¢¥­¨¨ IRQ á¨á⥬  ¬®¦¥â áç¨â뢠âì ¤ ­­ë¥ ¨§ 㪠§ ­­ëå
à ­¥¥ ä㭪樥© 44 ¯®à⮢ ¨ § ¯¨á뢠âì í⨠¤ ­­ë¥ ¢ ¡ãä¥à.
Ž¯¨á뢠¥¬ ï äã­ªæ¨ï áç¨â뢠¥â ¤ ­­ë¥ ¨§ í⮣® ¡ãä¥à  ¢ ¡ãä¥à
㪠§ ­­ë© ¢ ª ç¥á⢥ ¯ à ¬¥âà .
Ž¯¨á뢠¥¬ ï äã­ªæ¨ï áç¨â뢠¥â ¯®¡ ©â­® ¤ ­­ë¥ ¨§ í⮣® ¡ãä¥à .
 à ¬¥âàë:
* eax = 42 - ­®¬¥à ä㭪樨
* bl = ­®¬¥à IRQ, 0..15
* bh = ­®¬¥à ¯®¤ä㭪樨, 0
Žáâ «ì­ ï ç áâì ॣ¨áâà  ebx ¤®«¦­  ¡ëâì ®¡­ã«¥­ .
* ecx = 㪠§ â¥«ì ­  ¡ãä¥à, ªã¤  ¡ã¤ã⠯ਭ¨¬ âìáï ¤ ­­ë¥
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: (á¨âã æ¨î ¬®¦­® à §«¨ç¨âì ¯® §­ ç¥­¨î eax)
* ebx = ­®¬¥à IRQ, 0..15
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: (á¨âã æ¨î ¬®¦­® à §«¨ç¨âì ¯® §­ ç¥­¨î ecx)
* ¥á«¨ ¯®â®ª ­¥ ï¥âáï ¢« ¤¥«ì楬 IRQ
(¨«¨ ­®¬¥à IRQ § ¤ ­ ­¥¢¥à­®):
* eax = -1
* ecx = 2
* ¥á«¨ ¤ ­­ëå ­¥â:
* eax = 0
* ecx = 1
* ebx à §àãè ¥âáï
* ¥á«¨ ¢áñ ¢ ¯®à浪¥ ¨ ¤ ­­ë¥ ¡ë«¨:
* eax = à §¬¥à ¤ ­­ëå, ¯à®ç¨â ­­ëå ¨§ ¡ãä¥à  (¢ ¡ ©â å)
 
‘¬®âà¨â¥ § ¬¥ç ­¨ï ­¨¦¥.
 
------------------------ “§­ âì à §¬¥à ¤ ­­ëå ¢ ¡ãä¥à¥ ---------------
 à ¬¥âàë:
* eax = 42 - ­®¬¥à ä㭪樨
* bl = ­®¬¥à IRQ, 0..15
* bh = ­®¬¥à ¯®¤ä㭪樨, 1
Žáâ «ì­ ï ç áâì ॣ¨áâà  ebx ¤®«¦­  ¡ëâì ®¡­ã«¥­ .
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: (á¨âã æ¨î ¬®¦­® à §«¨ç¨âì ¯® §­ ç¥­¨î eax)
* ¥á«¨ ¯®â®ª ­¥ ï¥âáï ¢« ¤¥«ì楬 IRQ
(¨«¨ ­®¬¥à IRQ § ¤ ­ ­¥¢¥à­®):
* eax = -1
* ¥á«¨ ¢áñ ¢ ¯®à浪¥, ¢ eax à §¬¥à ¤ ­­ëå
 
* eax = à §¬¥à ¤ ­­ëå, ¥éñ ­¥ ¯à®ç¨â ­­ëå ¨§ ¡ãä¥à  (¢ ¡ ©â å)
* ecx = 0
* ebx = ®ç¥à¥¤­®© ¡ ©â
‡ ¬¥ç ­¨ï:
* à¥¤¢ à¨â¥«ì­® ¯®â®ª ¤®«¦¥­ § à¥§¥à¢¨à®¢ âì ¤«ï ᥡï 㪠§ ­­ë© IRQ
ä㭪樥© 45.
/kernel/trunk/docs/sysfuncs.txt
2010,45 → 2010,26
* eax = -1 for incorrect ebx
 
======================================================================
==================== Function 42 - work with IRQ data. ===============
==================== Function 42 - read 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
to the buffer specified as parameter.
bytewise.
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 the receive buffer
Returned value: (use value of eax to distinguish)
* ebx = IRQ number, 0..15
Returned value: (use value of ecx to distinguish)
* if the thread is not IRQ owner (or IRQ number is incorrect):
* eax = -1
* ecx = 2
* if there is no data:
* eax = 0
* ecx = 1
* ebx destroyed
* if all is ok:
* 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
 
* eax = byte size of data, not yet read from buffer
* ecx = 0
* ebx = current byte
Remarks:
* Previously the thread must reserve indicated IRQ for itself
by function 45.