Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 313 → Rev 314

/kernel/trunk/const.inc
138,8 → 138,6
TASK_DATA equ OS_BASE+0x0003020
TASK_EVENT equ OS_BASE+0x0003020
 
save_syscall_data equ OS_BASE+0x0005000
 
;mouseunder equ OS_BASE+0x0006900
FLOPPY_BUFF equ OS_BASE+0x0008000
ACTIVE_PROC_STACK equ OS_BASE+0x000A400
/kernel/trunk/core/syscall.inc
14,16 → 14,13
mov ds,ax
mov es,ax
 
; for syscall trace function
call save_registers
 
; load all registers in crossed order
mov edi,[esp+28] ; eax
mov eax,[esp+16] ; ebx
mov ebx,[esp+24] ; ecx
mov ecx,[esp+20] ; edx
mov edx,[esp+4] ; esi
mov esi,[esp+0] ; edi
mov eax, ebx
mov ebx, ecx
mov ecx, edx
mov edx, esi
mov esi, edi
mov edi, [esp+28]
 
; enable interupts - a task switch or an IRQ _CAN_ interrupt i40 handler
sti
31,35 → 28,13
and edi,0xff
call dword [servetable+edi*4]
pop eax
cli
; cli
 
popad
pop es ds
iretd
 
align 4
save_registers:
mov esi, [0x3010]
mov eax, [esi+TASKDATA.pid] ; load PID
lea esi, [esp+4]
inc [save_syscall_count]
mov edi,[save_syscall_count]
and edi,0xF
shl edi,6
add edi,save_syscall_data+32
mov [edi-32],eax
mov ecx,32 / 4
cld
rep movsd
ret
 
uglobal
save_syscall_count dd 0x0
endg
 
;label save_syscall_data dword at 0x5000
 
 
iglobal
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SYSTEM FUNCTIONS TABLE ;;
127,7 → 102,7
dd undefined_syscall ; 56-reserved
dd undefined_syscall ; 57-reserved
dd file_system ; 58-Common file system interface
dd sys_trace ; 59-System call trace
dd undefined_syscall ; 59-reserved
dd sys_IPC ; 60-Inter Process Communication
dd sys_gs ; 61-Direct graphics access
dd sys_pci ; 62-PCI functions
/kernel/trunk/docs/sysfuncr.txt
1,4 → 1,4
‘ˆ‘’…Œ›… ”“Š–ˆˆ Ž…€–ˆŽŽ‰ ‘ˆ‘’…Œ› Kolibri 0.6.3.0
‘ˆ‘’…Œ›… ”“Š–ˆˆ Ž…€–ˆŽŽ‰ ‘ˆ‘’…Œ› Kolibri 0.6.4.0
 
®¬¥à ä㭪樨 ¯®¬¥é ¥âáï ¢ ॣ¨áâà eax.
‚맮¢ á¨á⥬­®© ä㭪樨 ®áãé¥á⢫ï¥âáï ª®¬ ­¤®© "int 0x40".
851,8 → 851,8
db a,b,c,d ¤«ï ¢¥àᨨ a.b.c.d
db UID_xxx: ®¤­® ¨§ UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
db 'name',0 - ASCIIZ-áâப  á ¨¬¥­¥¬
„«ï ï¤à  Kolibri 0.6.3.0:
db 0,6,3,0
„«ï ï¤à  Kolibri 0.6.4.0:
db 0,6,4,0
db 2
db 'Kolibri',0
 
2717,6 → 2717,21
* ebx à §àãè ¥âáï
 
======================================================================
==== ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 10 - ¯®«ãç¨âì áâ âãá ª ¡¥«ï Ethernet. ====
======================================================================
 à ¬¥âàë:
* eax = 53 - ­®¬¥à ä㭪樨
* ebx = 10 - ­®¬¥à ¯®¤ä㭪樨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* al = -1 - ¤à ©¢¥à á¥â¥¢®© ª àâë ­¥ § £à㦥­ ¨«¨
­¥ ¯®¤¤¥à¦¨¢ ¥â íâã äã­ªæ¨î
* al = 0 - ª ¡¥«ì ­¥ ¯®¤ª«îçñ­
* al = 1 - ª ¡¥«ì ¯®¤ª«îçñ­
‡ ¬¥ç ­¨ï:
* ’¥ªãé ï ॠ«¨§ æ¨ï ï¤à  ¯®¤¤¥à¦¨¢ ¥â íâã äã­ªæ¨î
⮫쪮 ¤«ï á¥â¥¢ëå ª àâ RTL8139.
 
======================================================================
”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 255 - ®â« ¤®ç­ ï ¨­ä®à¬ æ¨ï á¥â¥¢®£® ¤à ©¢¥à .
======================================================================
 à ¬¥âàë:
3129,55 → 3144,6
¢ ᥪâ®à å) ¨ ®¡é¥¥ ç¨á«® ª« áâ¥à®¢ ¤«ï ¦ñáâª¨å ¤¨áª®¢.
 
======================================================================
=== ”ã­ªæ¨ï 59 - ¯®«ãç¨âì ¨­ä®à¬ æ¨î ® ¯®á«¥¤­¨å á¨á⥬­ëå ¢ë§®¢ å. ==
======================================================================
®«ã砥⠤ ­­ë¥ ® ¢á¥å á¨á⥬­ëå ¢ë§®¢ å ¢á¥å ¯à®æ¥áᮢ.
 à ¬¥âàë:
* eax = 59 - ­®¬¥à ä㭪樨
* ebx = 0 - ¥¤¨­á⢥­­ ï ¯®¤äã­ªæ¨ï
* ecx = 㪠§ â¥«ì ­  ¡ãä¥à
* edx = à §¬¥à ¡ãä¥à 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = ®¡é¥¥ ç¨á«® á¨á⥬­ëå ¢ë§®¢®¢,
ᤥ« ­­ëå á ¬®¬¥­â  § £à㧪¨ á¨á⥬ë (¯® ¬®¤ã«î 2^32)
* ebx = 0
”®à¬ â ¨­ä®à¬ æ¨¨ ®¡ ®¤­®¬ ¢ë§®¢¥: (à §¬¥à = 0x40 = 64 ¡ ©â )
* +0: dword: PID ¯à®æ¥áá /¯®â®ª 
* +4: 7*dword: ¬ãá®à
* +32 = +0x20: dword: §­ ç¥­¨¥ edi ¯à¨ ¢ë§®¢¥
* +36 = +0x24: dword: esi
* +40 = +0x28: dword: ebp
* +44 = +0x2C: dword: 㪠§ â¥«ì áâíª  ®¡à ¡®â稪  ï¤à 
* +48 = +0x30: dword: ebx
* +52 = +0x34: dword: edx
* +56 = +0x38: dword: ecx
* +60 = +0x3C: dword: eax (=­®¬¥à á¨á⥬­®© ä㭪樨)
‡ ¬¥ç ­¨ï:
* ”ã­ªæ¨ï ¨á¯®«ì§ã¥âáï ⮫쪮 ¢ ¯à¨«®¦¥­¨¨ systrace.
„®¢®«ì­® âà㤭® ¯à¥¤áâ ¢¨âì á¨âã æ¨î, ¢ ª®â®à®© íâ® ¯à¨«®¦¥­¨¥
¨«¨ íâ  äã­ªæ¨ï ¤¥©á⢨⥫쭮 ¯®«¥§­ë,   ¢®â ¢á¥ á¨á⥬­ë¥ ¢ë§®¢ë
¤«ï ¯®¤¤¥à¦ª¨ í⮩ ä㭪樨 ­¥áª®«ìª® § ¬¥¤«ïîâáï
(å®âï ¨ ­¥­ ¬­®£®)...
* ‚ á¢ï§¨ á í⨬ ¥áâì ¯à¥¤«®¦¥­¨¥ ¯®¤¤¥à¦ªã í⮩ ä㭪樨
¨§ ï¤à  ã¡à âì ᮢᥬ, ¢¬¥áâ¥ á ¯à¨«®¦¥­¨¥¬ systrace.
* ˆ­ä®à¬ æ¨ï ® á¨á⥬­ëå ¢ë§®¢ å á®åà ­ï¥âáï ¢
á¨á⥬­®¬ ª®«ì楢®¬ ¡ãä¥à¥ ­  0x10 ¢å®¤®¢.
â  äã­ªæ¨ï ¯à®áâ® ª®¯¨àã¥â 㪠§ ­­ë© ®¡êñ¬ ¤ ­­ëå
¨§ 㯮¬ï­ã⮣® ¡ãä¥à  ¯® 㪠§ ­­®¬ã  ¤à¥áã.
* Š ª®© ¨§ ¢å®¤®¢ ¢ ¡ãä¥à¥ ᮮ⢥âáâ¢ã¥â ¯®á«¥¤­¥¬ã ¢ë§®¢ã,
¬®¦­® ®¯à¥¤¥«¨âì ¯® §­ ç¥­¨î eax,   ¨¬¥­­®,
¢å®¤ (eax and 0xF) (¯® ᬥ饭¨î (eax and 0xF)*0x40).
* ‚ ⥪ã饩 ॠ«¨§ æ¨¨ ¢®§¬®¦­ë ।ª® ¢áâà¥ç î騥áï
¯à®¡«¥¬ë à áᨭåà®­¨§ æ¨¨, ª®£¤  ® ­¥ª®â®àëå ¢ë§®¢ å
¨­ä®à¬ æ¨ï ãáâ à¥¢ ¥â.
* ®¤ á¨á⥬­ë© ¡ãä¥à ¢ë¤¥«¥­  áâà ­¨æ , 4Š¡.
 §¬¥à ¢å®¤  = 64 ¡ ©â .
®ç¥¬ã ¨á¯®«ì§ã¥âáï ⮫쪮 16 ¢å®¤®¢ - ­¥¯®­ïâ­®.
* ‡­ ç¥­¨¥ esp ¢ ¬®¬¥­â á¨á⥬­®£® ¢ë§®¢ 
í⮩ ä㭪樥© 㧭 âì ­¥«ì§ï.
* à®¢¥àª¨ ª®à४⭮á⨠edx ¢ ⥪ã饩 ॠ«¨§ æ¨¨ ­¥ ¤¥« ¥âáï.
 
======================================================================
=========== ”ã­ªæ¨ï 60 - Inter Process Communication (IPC). ==========
======================================================================
IPC ¯à¨¬¥­ï¥âáï ¤«ï ¯®áë«®ª á®®¡é¥­¨© ®â ®¤­®£® ¯à®æ¥áá /¯®â®ª 
3469,8 → 3435,11
* ebx = 㪠§ â¥«ì ­  ¨§®¡à ¦¥­¨¥
* ecx = [à §¬¥à ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ y]
* edx = [ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [ª®®à¤¨­ â  ¯® ®á¨ y]
* esi = ç¨á«® ¡¨â ­  ¯¨ªá¥«ì, ¤®«¦­® ¡ëâì 8 ¢ ⥪ã饩 ॠ«¨§ æ¨¨
* edi = 㪠§ â¥«ì ­  ¯ «¨âàã (256 梥⮢ 0x00RRGGBB)
* esi = ç¨á«® ¡¨â ­  ¯¨ªá¥«ì, ¤®«¦­® ¡ëâì 8, 24 ¨«¨ 32
* edi = 㪠§ â¥«ì ­  ¯ «¨âàã (256 梥⮢ 0x00RRGGBB);
¨£­®à¨àã¥âáï ¯à¨ esi = 24 ¨ 32
* ebp = ᬥ饭¨¥ ¤ ­­ëå ª ¦¤®© á«¥¤ãî饩 áâப¨ ¨§®¡à ¦¥­¨ï
®â­®á¨â¥«ì­® ¯à¥¤ë¤ã饩
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
‡ ¬¥ç ­¨ï:
3480,6 → 3449,8
* Š ¦¤ë© ¡ ©â ¨§®¡à ¦¥­¨ï à áᬠâਢ ¥âáï ª ª ¨­¤¥ªá ¢ ¯ «¨âà¥.
* …᫨ ¨§®¡à ¦¥­¨¥ ¨á¯®«ì§ã¥â ­¥ ¢á¥ 256 梥⮢,   ¬¥­ìè¥,
à §¬¥à ¯ «¨âàë ¬®¦¥â ¡ëâì ¬¥­ìè¥ 256.
* ‚맮¢ ä㭪樨 7 íª¢¨¢ «¥­â¥­ ¢ë§®¢ã í⮩ ä㭪樨 á ¯ à ¬¥âà ¬¨
esi=24, ebp=0.
 
======================================================================
================= ”ã­ªæ¨ï 66 - à ¡®â  á ª« ¢¨ âãன. =================
/kernel/trunk/docs/sysfuncs.txt
1,4 → 1,4
SYSTEM FUNCTIONS of OS Kolibri 0.6.3.0
SYSTEM FUNCTIONS of OS Kolibri 0.6.4.0
 
Number of the function is located in the register eax.
The call of the system function is executed by "int 0x40" command.
850,8 → 850,8
db a,b,c,d for version a.b.c.d
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
db 'name',0 - ASCIIZ-string with the name
For Kolibri 0.6.3.0 kernel:
db 0,6,3,0
For Kolibri 0.6.4.0 kernel:
db 0,6,4,0
db 2
db 'Kolibri',0
 
2693,6 → 2693,21
* ebx destroyed
 
======================================================================
===== Function 53, subfunction 10 - query Ethernet cable status. =====
======================================================================
Parameters:
* eax = 53 - function number
* ebx = 10 - subfunction number
Returned value:
* al = -1 - a network driver is not loaded or
does not support this function
* al = 0 - Ethernet cable is unplugged
* al = 1 - Ethernet cable is plugged
Remarks:
* The current kernel implementation supports this function
only for RTL8139 network cards.
 
======================================================================
= Function 53, subfunction 255 - debug information of network driver.
======================================================================
Parameters:
3101,55 → 3116,6
for hard disks.
 
======================================================================
=============== Function 59 - trace last system calls. ===============
======================================================================
Gets data on all system calls of all processes.
Parameters:
* eax = 59 - function number
* ebx = 0 - unique subfunction
* ecx = pointer to the buffer
* edx = size of the buffer
Returned value:
* eax = total number of system calls made from system boot
(modulo 2^32)
* ebx = 0
Format of information on one call: (size = 0x40 = 64 bytes)
* +0: dword: PID of process/thread
* +4: 7*dword: garbage
* +32 = +0x20: dword: value of edi at the call
* +36 = +0x24: dword: esi
* +40 = +0x28: dword: ebp
* +44 = +0x2C: dword: stack pointer of the kernel handler
* +48 = +0x30: dword: ebx
* +52 = +0x34: dword: edx
* +56 = +0x38: dword: ecx
* +60 = +0x3C: dword: eax (=number of system function)
Remarks:
* The function is used only in the application 'systrace'.
It is rather difficult to imagine a situation, in which
this application or this function are really useful;
and all system calls for support of this function are a little
decelerated (though not strongly)...
* So there is a proposition to delete from the kernel
support of this function, together with application 'systrace'.
* The information on system calls saves in the system
ring buffer with 0x10 entries.
This function simply copies the given size of data
from this buffer to the given address.
* One can determine, which entry in the buffer corresponds to
last system call, by value of eax, namely, it is the entry
(eax and 0xF) (at offset (eax and 0xF)*0x40).
* In the current implementation there can be the seldom
meeting problems of unsynchronization, when the information
on some calls becomes outdated.
* Under the system buffer one page, 4Kb, is allocated.
Size of an entry = 64 bytes. Why only 16 entries are used,
is not clearly.
* The value of esp at the moment of system call cannot
be determined by this function.
* The current implementation does not check edx for correctness.
 
======================================================================
========== Function 60 - Inter Process Communication (IPC). ==========
======================================================================
IPC is used for message dispatching from one process/thread to
3436,8 → 3402,10
* ebx = pointer to the image
* ecx = [size on axis x]*65536 + [size on axis y]
* edx = [coordinate on axis x]*65536 + [coordinate on axis y]
* esi = number of bits per pixel, must be 8
* edi = pointer to palette (256 colors 0x00RRGGBB)
* esi = number of bits per pixel, must be 8, 24 or 32
* edi = pointer to palette (256 colors 0x00RRGGBB);
ignored when esi = 24 and 32
* ebp = offset of next row data relative to previous row data
Returned value:
* function does not return value
Remarks:
3447,6 → 3415,8
* Each byte of image is index in the palette.
* If the image uses less than 256 colors, palette size may be
less than 256 too.
* The call to function 7 is equivalent to call to this function
with esi=24, ebp=0.
 
======================================================================
================== Function 66 - work with keyboard. =================
/kernel/trunk/kernel.asm
231,7 → 231,7
char2 db 'FONTS/CHAR2.MT',0
bootpath db '/KOLIBRI '
bootpath2 db 0
vmode db 'VMODE MDR'
vmode db 'VMODE.MDR',0
vrr_m db '/rd/1/VRR_M',0
endg
 
3977,7 → 3977,7
add dx,word[edi+0x80000+APPDATA.wnd_clientbox.left]
rol edx,16
.forced:
push esi ebp
push ebp esi 0
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
sys_putimage_bpp:
3996,7 → 3996,7
inc [mouse_pause]
call eax
dec [mouse_pause]
pop ebp esi
pop ebp esi ebp
jmp [draw_pointer]
 
syscall_putimage_palette:
4009,8 → 4009,9
; ebx = pointer to image
; ecx = [xsize]*65536 + [ysize]
; edx = [xstart]*65536 + [ystart]
; esi = number of bits per pixel, must be 8
; esi = number of bits per pixel, must be 8, 24 or 32
; edi = pointer to palette
; ebp = row delta
mov eax, [0x3000]
shl eax, 8
add dx, word [eax+0x80000+APPDATA.wnd_clientbox.top]
4018,10 → 4019,27
add dx, word [eax+0x80000+APPDATA.wnd_clientbox.left]
rol edx, 16
.forced:
push esi ebp
push ebp esi ebp
cmp esi, 8
jnz @f
mov ebp, putimage_get8bpp
mov esi, putimage_init8bpp
jmp sys_putimage_bpp
@@:
cmp esi, 24
jnz @f
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
jmp sys_putimage_bpp
@@:
cmp esi, 32
jnz @f
mov ebp, putimage_get32bpp
mov esi, putimage_init32bpp
jmp sys_putimage_bpp
@@:
pop ebp esi
ret
 
putimage_init24bpp:
lea eax, [eax*3]
4041,6 → 4059,13
inc esi
ret 4
 
putimage_init32bpp:
shl eax, 2
ret
putimage_get32bpp:
lodsd
ret 4
 
; eax x beginning
; ebx y beginning
; ecx x end
4417,28 → 4442,6
 
 
 
sys_trace:
 
test eax, eax ; get event data
jnz no_get_sys_events
 
mov esi,save_syscall_data ; data
mov edi,[0x3010]
mov edi,[edi+TASKDATA.mem_start]
add edi,ebx
cld
rep movsb
 
mov [esp+24],dword 0
mov eax,[save_syscall_count] ; count
mov [esp+36],eax
ret
 
no_get_sys_events:
 
ret
 
 
sys_process_def:
mov edi, [0x3000]
 
/kernel/trunk/memmap.inc
54,8 → 54,7
; 3c dword cpu usage in cpu timer tics
;
;
; 5000 -> 5FFF save_syscall_data - syscall trace
; 6000 -> 68FF free
; 5000 -> 68FF free
; 6900 -> 6EFF saved picture under mouse pointer
;
; 6F00 -> 6FFF free
/kernel/trunk/video/vesa12.inc
844,6 → 844,7
pop edi
 
add edi,[0xfe08]
add esi,[esp+32]
dec ebx
jnz newpi12
 
/kernel/trunk/video/vesa20.inc
82,6 → 82,13
.edi dd ?
.esi dd ?
.ebp dd ?
.esp dd ?
.ebx dd ?
.edx dd ?
.ecx dd ?
.eax dd ?
.ret_addr dd ?
.arg_0 dd ?
end virtual
 
align 16
164,6 → 171,7
;; imul eax, [putimg.source_bpp]
; lea eax, [eax + eax * 2]
call esi
add eax, [putimg.arg_0]
mov [putimg.line_increment], eax
 
; winmap new line increment
/kernel/trunk/vmodeld.inc
10,9 → 10,6
;
 
 
;vmode db 'VMODE MDR' ; MDR - Menuet Driver
; must be located after fonts filenames in kernel.asm
 
; LOAD VIDEOMODE DRIVER
; If vmode.mdr file not found
or eax,-1 ; Driver ID = -1 (not present in system)
19,9 → 16,8
mov [0x760000],eax ;
mov [0x760100],byte 0xC3 ; Instruction RETN - driver loop
 
mov eax,vmode ; File name of driver
mov esi,12
mov ebx,0
mov ecx,26000
mov esi, vmode
xor ebx, ebx
mov ecx, 0x8000 ; size of memory area for driver
mov edx,0x760000 ; Memory position of driver
call fileread
call fs_RamdiskRead