kolibri_pe: the latest 32-bit version

git-svn-id: svn://kolibrios.org@2971 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2012-09-04 22:16:57 +00:00
parent 7a5bca6402
commit a20b1c888d
56 changed files with 2145 additions and 1403 deletions

View File

@ -14,7 +14,7 @@ $Revision$
; Автор части исходного текста Кулаков Владимир Геннадьевич ; Автор части исходного текста Кулаков Владимир Геннадьевич
; Адаптация, доработка и разработка Mario79 ; Адаптация, доработка и разработка Mario79
; Максимальное количество повторений операции чтени ; Максимальное количество повторений операции чтения
MaxRetr equ 10 MaxRetr equ 10
; Предельное время ожидания готовности к приему команды ; Предельное время ожидания готовности к приему команды
; (в тиках) ; (в тиках)
@ -38,7 +38,7 @@ ReadCD:
mov [CDBlockSize],2048 ;2352 mov [CDBlockSize],2048 ;2352
; Очистить буфер пакетной команды ; Очистить буфер пакетной команды
call clear_packet_buffer call clear_packet_buffer
; Сформировать пакетную команду для считывани ; Сформировать пакетную команду для считывания
; сектора данных ; сектора данных
; Задать код команды Read CD ; Задать код команды Read CD
mov [PacketCommand],byte 0x28 ;0xBE mov [PacketCommand],byte 0x28 ;0xBE
@ -168,6 +168,7 @@ MaxCDWaitTime equ 1000 ;200 ;10
; Область памяти для формирования пакетной команды ; Область памяти для формирования пакетной команды
PacketCommand: rb 12 ;DB 12 DUP (?) PacketCommand: rb 12 ;DB 12 DUP (?)
; Область памяти для приема данных от дисковода ; Область памяти для приема данных от дисковода
;CDDataBuf DB 4096 DUP (0)
; Размер принимаемого блока данных в байтах ; Размер принимаемого блока данных в байтах
CDBlockSize DW ? CDBlockSize DW ?
; Адрес считываемого сектора данных ; Адрес считываемого сектора данных
@ -176,7 +177,7 @@ CDSectorAddress: DD ?
TickCounter_1 DD 0 TickCounter_1 DD 0
; Время начала ожидания готовности устройства ; Время начала ожидания готовности устройства
WURStartTime DD 0 WURStartTime DD 0
; указатель буфера для считывани ; указатель буфера для считывания
CDDataBuf_pointer dd 0 CDDataBuf_pointer dd 0
;**************************************************** ;****************************************************
@ -341,7 +342,7 @@ SendPacketNoDatCommand:
add DX,7 ;порт 1х7h add DX,7 ;порт 1х7h
@@WaitDevice0_1: @@WaitDevice0_1:
call change_task call change_task
; Проверить время ожидани ; Проверить время ожидания
mov EAX,[timer_ticks] mov EAX,[timer_ticks]
sub EAX,[TickCounter_1] sub EAX,[TickCounter_1]
cmp EAX,BSYWaitTime cmp EAX,BSYWaitTime
@ -463,12 +464,12 @@ SendCommandToHDD_1:
jmp .test jmp .test
@@: @@:
call change_task call change_task
; Проверить время ожидани ; Проверить время ожидания
mov eax,[timer_ticks] mov eax,[timer_ticks]
sub eax,[TickCounter_1] sub eax,[TickCounter_1]
cmp eax,BSYWaitTime ;300 ;ожидать 3 сек. cmp eax,BSYWaitTime ;300 ;ожидать 3 сек.
ja @@Err1_4 ;ошибка тайм-аута ja @@Err1_4 ;ошибка тайм-аута
; Прочитать регистр состояни ; Прочитать регистр состояния
.test: .test:
in AL,DX in AL,DX
; Проверить состояние сигнала BSY ; Проверить состояние сигнала BSY
@ -644,7 +645,7 @@ LoadMedium:
; Сформировать команду START/STOP UNIT ; Сформировать команду START/STOP UNIT
; Задать код команды ; Задать код команды
mov [PacketCommand],word 1Bh mov [PacketCommand],word 1Bh
; Задать операцию загрузки носител ; Задать операцию загрузки носителя
mov [PacketCommand+4],word 00000011b mov [PacketCommand+4],word 00000011b
; Подать команду ; Подать команду
call SendPacketNoDatCommand call SendPacketNoDatCommand
@ -665,7 +666,7 @@ EjectMedium:
; Сформировать команду START/STOP UNIT ; Сформировать команду START/STOP UNIT
; Задать код команды ; Задать код команды
mov [PacketCommand],word 1Bh mov [PacketCommand],word 1Bh
; Задать операцию извлечения носител ; Задать операцию извлечения носителя
mov [PacketCommand+4],word 00000010b mov [PacketCommand+4],word 00000010b
; Подать команду ; Подать команду
call SendPacketNoDatCommand call SendPacketNoDatCommand

View File

@ -858,6 +858,10 @@ rd_find_lfn:
mov [esp+8], eax mov [esp+8], eax
mov dword [esp+4], ramdisk_notroot_first mov dword [esp+4], ramdisk_notroot_first
mov dword [esp], ramdisk_notroot_next mov dword [esp], ramdisk_notroot_next
test eax, eax
jnz .loop
mov dword [esp+4], ramdisk_root_first
mov dword [esp], ramdisk_notroot_next
jmp .loop jmp .loop
.notfound: .notfound:
add esp, 12 add esp, 12
@ -891,7 +895,6 @@ rd_find_lfn:
; ;
;-------------------------------------------------------------- ;--------------------------------------------------------------
fs_RamdiskRead: fs_RamdiskRead:
cmp byte [esi], 0 cmp byte [esi], 0
jnz @f jnz @f
or ebx, -1 or ebx, -1

View File

@ -22,7 +22,7 @@ endg
sysfn_saveramdisk: ; 18.6 = SAVE FLOPPY IMAGE (HD version only) sysfn_saveramdisk: ; 18.6 = SAVE FLOPPY IMAGE (HD version only)
call restorefatchain call restorefatchain
mov eax, [_rd_base] mov eax, [_rd_base]
mov [saverd_fileinfo+4], eax mov [saverd_fileinfo+4*4], eax
mov eax, saverd_fileinfo mov eax, saverd_fileinfo
mov [saverd_fileinfo.name], ecx mov [saverd_fileinfo.name], ecx
pushad pushad

View File

@ -107,7 +107,7 @@ _rs db 186,'
_bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ',13,10,0 _bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ',13,10,0
remark1 db "Default values were selected to match most of configurations, but not all.",0 remark1 db "Default values were selected to match most of configurations, but not all.",0
remark2 db "If you have LCD-monitor, disable VRR in the item [c] - you do not need it.",0 remark2 db "If you have CRT-monitor, enable VRR in the item [c].",0
remark3 db "If the system does not boot, try to disable the item [b].",0 remark3 db "If the system does not boot, try to disable the item [b].",0
remarks dw remark1, remark2, remark3 remarks dw remark1, remark2, remark3
num_remarks = 3 num_remarks = 3

View File

@ -109,7 +109,7 @@ save_quest db "J
loader_block_error db "Alglaaduri andmed vigased, ei saa jätkata. Peatatud.",0 loader_block_error db "Alglaaduri andmed vigased, ei saa jätkata. Peatatud.",0
remark1 db "Default values were selected to match most of configurations, but not all.",0 remark1 db "Default values were selected to match most of configurations, but not all.",0
remark2 db "If you have LCD-monitor, disable VRR in the item [c] - you do not need it.",0 remark2 db "If you have CRT-monitor, enable VRR in the item [c].",0
remark3 db "If the system does not boot, try to disable the item [b].",0 remark3 db "If the system does not boot, try to disable the item [b].",0
remarks dw remark1, remark2, remark3 remarks dw remark1, remark2, remark3
num_remarks = 3 num_remarks = 3

View File

@ -114,7 +114,7 @@ save_quest db "Aktuelle Einstellungen speichern? [y/n]: ",0
loader_block_error db "Bootloader Daten ungueltig, Kann nicht fortfahren. Angehalten.",0 loader_block_error db "Bootloader Daten ungueltig, Kann nicht fortfahren. Angehalten.",0
remark1 db "Default values were selected to match most of configurations, but not all.",0 remark1 db "Default values were selected to match most of configurations, but not all.",0
remark2 db "If you have LCD-monitor, disable VRR in the item [c] - you do not need it.",0 remark2 db "If you have CRT-monitor, enable VRR in the item [c].",0
remark3 db "If the system does not boot, try to disable the item [b].",0 remark3 db "If the system does not boot, try to disable the item [b].",0
remarks dw remark1, remark2, remark3 remarks dw remark1, remark2, remark3
num_remarks = 3 num_remarks = 3

View File

@ -84,7 +84,7 @@ _bt db 186,'
remark1 db "‡­ ç¥­¨ï ¯® 㬮«ç ­¨î ¢ë¡à ­ë ¤«ï 㤮¡á⢠ ¡®«ì設á⢠, ­® ­¥ ¢á¥å.",0 remark1 db "‡­ ç¥­¨ï ¯® 㬮«ç ­¨î ¢ë¡à ­ë ¤«ï 㤮¡á⢠ ¡®«ì設á⢠, ­® ­¥ ¢á¥å.",0
remark2 db "…᫨ ã ‚ á LCD-¬®­¨â®à, ®âª«îç¨â¥ VRR ¢ ¯ã­ªâ¥ [c] - ®­ ‚ ¬ ­¥ ­ã¦¥­.",0 remark2 db "…᫨ ã ‚ á <EFBFBD>-¬®­¨â®à, ¢ª«îç¨â¥ VRR ¢ ¯ã­ªâ¥ [c].",0
remark3 db "…᫨ ã ‚ á ­¥ £à㧨âáï á¨á⥬ , ¯®¯à®¡ã©â¥ ®âª«îç¨âì ¯ã­ªâ [b].",0 remark3 db "…᫨ ã ‚ á ­¥ £à㧨âáï á¨á⥬ , ¯®¯à®¡ã©â¥ ®âª«îç¨âì ¯ã­ªâ [b].",0
remarks dw remark1, remark2, remark3 remarks dw remark1, remark2, remark3
num_remarks = 3 num_remarks = 3

View File

@ -217,14 +217,14 @@ calc_vmodes_table:
; cmp [es:mi.BitsPerPixel], 24 ; cmp [es:mi.BitsPerPixel], 24
; jb @f ; jb @f
cmp [es:mi.BitsPerPixel],16 ; cmp [es:mi.BitsPerPixel],16
jne .l0 ; jne .l0
cmp [es:mi.GreenMaskSize],5 ; cmp [es:mi.GreenMaskSize],5
jne .l0 ; jne .l0
mov [es:mi.BitsPerPixel],15 ; mov [es:mi.BitsPerPixel],15
.l0: .l0:
cmp [es:mi.XRes],640 cmp [es:mi.XRes],640
jb @f jb @f
cmp [es:mi.YRes],480 cmp [es:mi.YRes],480
@ -243,10 +243,10 @@ calc_vmodes_table:
jb .lp1 jb .lp1
or cx,0x4000 ; use LFB or cx,0x4000 ; use LFB
.lp1: mov [es:bx+6],cx ; +6 : mode number .lp1: mov [es:bx+6],cx ; +6 : mode number
movzx ax,byte [es:mi.BitsPerPixel] movzx ax,byte [es:mi.BitsPerPixel]
mov word [es:bx+8],ax ; +8 : bits per pixel mov word [es:bx+8],ax ; +8 : bits per pixel
add bx,size_of_step add bx,size_of_step ; size of record
@@: @@:
add si,2 add si,2
@ -413,9 +413,17 @@ check_first_parm:
mov ax,modes_table mov ax,modes_table
@@: @@:
mov word[home_cursor],ax mov word [home_cursor],ax
push word [preboot_graph] mov si,[preboot_graph]
pop word [cursor_pos] mov word [cursor_pos],si
push word [es:si]
pop word [x_save]
push word [es:si+2]
pop word [y_save]
push word [es:si+6]
pop word [number_vm]
ret ret
;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;
.loops: .loops:
@ -432,7 +440,9 @@ check_first_parm:
je .exit je .exit
jmp .loops jmp .loops
.ok: xor ax,ax .ok: xor ax,ax
.exit: ret ret
.exit: or ax,-1
ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -531,14 +541,15 @@ draw_vmodes_table:
mov bp,long_v_table ;show rows mov bp,long_v_table ;show rows
.@@_next_bit: .@@_next_bit:
;clear cursor ;clear cursor
mov word[ds:_r1+21],' ' mov ax,' '
mov word[ds:_r1+50],' ' mov word[ds:_r1+21],ax
mov word[ds:_r1+50],ax
mov word[ds:_r2+21],' ' mov word[ds:_r2+21],ax
mov word[ds:_r2+45],' ' mov word[ds:_r2+45],ax
mov word[ds:_rs+21],' ' mov word[ds:_rs+21],ax
mov word[ds:_rs+46],' ' mov word[ds:_rs+46],ax
; draw string ; draw string
cmp word [es:si+6],0x12 cmp word [es:si+6],0x12
je .show_0x12 je .show_0x12
@ -649,7 +660,7 @@ clear_vmodes_table:
rep stosw rep stosw
mov cx,70 mov cx,70
add di,20 add di,20
dec bp ; 㬥­ìè¨âì DX, dec bp
jns .loop_start jns .loop_start
pop es pop es
popa popa

View File

@ -187,57 +187,22 @@ end virtual
TSS_SIZE equ (128+8192) TSS_SIZE equ (128+8192)
HEAP_BASE equ 0x80000000 page_tabs equ 0xFF800000
;app_page_tabs equ 0xDD800000
HEAP_MIN_SIZE equ 0x01000000 ;shared_tabs equ 0xDDC00000
page_tabs equ 0xDD800000 ;heap_tabs equ (page_tabs+ (HEAP_BASE shr 9))
app_page_tabs equ 0xDD800000 kernel_tabs equ page_tabs)
master_tab equ (page_tabs+ (page_tabs shr 9))
shared_tabs equ 0xDDC00000
heap_tabs equ (page_tabs+ (HEAP_BASE shr 10))
kernel_tabs equ (page_tabs+ (OS_BASE shr 10))
master_tab equ (page_tabs+ (page_tabs shr 10))
LFB_BASE equ 0xDE000000
SHADOWFB equ 0 ;0xDE800000
TEXT_BASE equ 0xDFC00000
_16BIT_BASE equ 0x00010000 _16BIT_BASE equ 0x00010000
LOAD_BASE equ 0x00100000 LOAD_BASE equ 0x00100000
OS_BASE equ 0xE0000000 IMAGE_BASE equ LOAD_BASE
IMAGE_BASE equ (OS_BASE+LOAD_BASE)
BOOT_VAR equ OS_BASE
SB16Buffer equ (OS_BASE+0x10000)
TASK_COUNT equ (CURRENT_TASK+0x04)
TASK_BASE equ (CURRENT_TASK+0x10)
TASK_DATA equ (CURRENT_TASK+0x20)
TASK_EVENT equ (CURRENT_TASK+0x20)
FDD_BUFF equ (OS_BASE+0x000D000)
VGABasePtr equ (OS_BASE+0x00A0000)
IRQ_SAVE equ (OS_BASE+0x0190000)
stack_data_start equ (OS_BASE+0x01A0000)
eth_data_start equ (OS_BASE+0x01A0000)
stack_data equ (OS_BASE+0x01A4000)
stack_data_end equ (OS_BASE+0x01Bffff)
resendQ equ (OS_BASE+0x01C0000)
virtual at (OS_BASE+0x01C8F80)
tss TSS
end virtual
LAST_PAGE equ 0x01CB000 LAST_PAGE equ 0x01CB000
twdw equ (CURRENT_TASK-window_data) NCPU equ 8
RING0_STACK_SIZE equ (0x2000 - 512) ;512 áàéò äëÿ êîíòåêñòà FPU RING0_STACK_SIZE equ (0x2000 - 512) ;512 áàéò äëÿ êîíòåêñòà FPU
@ -386,6 +351,40 @@ virtual at 0
end virtual end virtual
struc SMEM
{
.bk dd ?
.fd dd ? ;+4
.base dd ? ;+8
.size dd ? ;+12
.access dd ? ;+16
.refcount dd ? ;+20
.name rb 32 ;+24
.sizeof:
}
struc SMAP
{
.magic dd ? ; SMAP
.destroy dd ? ;internal destructor
.fd dd ? ;next object in list
.bk dd ? ;prev object in list
.pid dd ? ;owner id
.base dd ? ;mapped base
.parent dd ? ;SMEM
.sizeof:
}
virtual at 0
SMEM SMEM
end virtual
virtual at 0
SMAP SMAP
end virtual
struc HEAP_DATA struc HEAP_DATA
{ {
.mutex rd 1 .mutex rd 1

View File

@ -235,12 +235,14 @@ int __stdcall pe_app_param(char *path, void *raw, addr_t ex_pg_dir,
int sys_exec(char *path, char *cmdline, u32_t flags) int sys_exec(char *path, char *cmdline, u32_t flags)
{ {
PIMAGE_DOS_HEADER dos; PIMAGE_DOS_HEADER dos;
PIMAGE_NT_HEADERS32 nt; PIMAGE_NT_HEADERS32 nt;
size_t img_size; size_t img_size;
count_t img_pages; count_t img_pages;
count_t img_tabs; count_t img_tabs;
addr_t ex_pg_dir; addr_t ex_pg_dir;
addr_t ex_stack_page; addr_t ex_stack_page;
addr_t ex_pl0_stack; addr_t ex_pl0_stack;
@ -588,6 +590,7 @@ bool link_pe(addr_t img_base)
exp_dll = find_dll(&core_dll.link, libname); exp_dll = find_dll(&core_dll.link, libname);
if(exp_dll == NULL) if(exp_dll == NULL)
{ {
exp_dll = find_dll(&current_slot->dll_list, libname); exp_dll = find_dll(&current_slot->dll_list, libname);
if(exp_dll == NULL) if(exp_dll == NULL)
{ {

View File

@ -17,6 +17,8 @@ PID_KERNEL equ 1 ;os_idle thread
align 4 align 4
proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
push ebx
mov ebx, [irq] ;irq num mov ebx, [irq] ;irq num
test ebx, ebx test ebx, ebx
jz .err jz .err
@ -41,9 +43,11 @@ proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
mov [irq_owner + 4 * ebx], PID_KERNEL ; all handlers belong to a kernel mov [irq_owner + 4 * ebx], PID_KERNEL ; all handlers belong to a kernel
stdcall enable_irq, [irq] stdcall enable_irq, [irq]
pop ebx
mov eax, 1 mov eax, 1
ret ret
.err: .err:
pop ebx
xor eax, eax xor eax, eax
ret ret
endp endp
@ -824,6 +828,8 @@ proc load_driver stdcall, driver_name:dword
mov dword [edx+8], 'vers' mov dword [edx+8], 'vers'
mov byte [edx+12], '/' mov byte [edx+12], '/'
mov esi, [driver_name] mov esi, [driver_name]
.redo:
lea edx, [file_name]
lea edi, [edx+13] lea edi, [edx+13]
mov ecx, 16 mov ecx, 16
@@: @@:

View File

@ -17,6 +17,7 @@
.ascii " -export:CreateRingBuffer" # stdcall .ascii " -export:CreateRingBuffer" # stdcall
.ascii " -export:CommitPages" # eax, ebx, ecx FIXME .ascii " -export:CommitPages" # eax, ebx, ecx FIXME
.ascii " -export:UnmapPages" # eax, ecx FIXME .ascii " -export:UnmapPages" # eax, ecx FIXME
.ascii " -export:CreateObject" # eax, ebx FIXME .ascii " -export:CreateObject" # eax, ebx FIXME
.ascii " -export:DestroyObject" # eax .ascii " -export:DestroyObject" # eax
@ -24,7 +25,6 @@
.ascii " -export:SysMsgBoardStr" # .ascii " -export:SysMsgBoardStr" #
.ascii " -export:SetScreen" # .ascii " -export:SetScreen" #
.ascii " -export:PciApi" # .ascii " -export:PciApi" #
.ascii " -export:PciRead8" # stdcall .ascii " -export:PciRead8" # stdcall
.ascii " -export:PciRead16" # stdcall .ascii " -export:PciRead16" # stdcall
@ -38,6 +38,10 @@
.ascii " -export:HwCursorRestore" # .ascii " -export:HwCursorRestore" #
.ascii " -export:HwCursorCreate" # .ascii " -export:HwCursorCreate" #
.ascii " -export:create_window" # cdecl
.ascii " -export:show_window" # cdecl
.ascii " -export:get_event" # cdecl
.ascii " -export:def_window_proc" # cdecl

View File

@ -180,7 +180,7 @@ e7: ;#NM exception handler
iglobal iglobal
fpu_owner dd 0 fpu_owner dd 0
endg endg
reg_eip equ ebp+4 reg_eip equ ebp+4
reg_cs equ ebp+8 reg_cs equ ebp+8

View File

@ -300,7 +300,7 @@ addr_t alloc_page(void)
list_remove(&slab->link); list_remove(&slab->link);
list_prepend(&slab->link, &page_cache.full_slabs); list_prepend(&slab->link, &page_cache.full_slabs);
page_cache.partial_count--; page_cache.partial_count--;
DBG("%s insert empty page slab\n"); DBG("%s insert empty page slab\n", __FUNCTION__);
}; };
spinlock_unlock(&page_cache.lock); spinlock_unlock(&page_cache.lock);
@ -396,9 +396,9 @@ size_t __fastcall frame_free(addr_t addr)
(slab->avail >= 4)) (slab->avail >= 4))
{ {
slab->state = 1; slab->state = 1;
// list_remove(&slab->link); list_remove(&slab->link);
// list_prepend(&slab->link, &page_cache.partial_slabs); list_prepend(&slab->link, &page_cache.partial_slabs);
// page_cache.partial_count++; page_cache.partial_count++;
DBG("%s: insert partial page slab\n", __FUNCTION__); DBG("%s: insert partial page slab\n", __FUNCTION__);
} }
@ -440,3 +440,6 @@ count_t get_free_mem()
return z_core.free_count; return z_core.free_count;
} }

View File

@ -1,4 +1,6 @@
#define ALLOC_FAST
#include <types.h> #include <types.h>
#include <core.h> #include <core.h>
#include <spinlock.h> #include <spinlock.h>
@ -294,10 +296,10 @@ addr_t __fastcall mem_alloc(size_t size, u32_t flags)
map = (mmap_t*)PA2KA(frame_alloc( (sizeof(mmap_t) + map = (mmap_t*)PA2KA(frame_alloc( (sizeof(mmap_t) +
sizeof(addr_t) * pages) >> PAGE_WIDTH)); sizeof(addr_t) * pages) >> PAGE_WIDTH));
map->size = size;
if ( map ) if ( map )
{ {
map->size = size;
order = size >> HF_WIDTH; order = size >> HF_WIDTH;
if( order ) if( order )
@ -313,7 +315,6 @@ addr_t __fastcall mem_alloc(size_t size, u32_t flags)
if( frame ) if( frame )
{ {
addr_t page = 0;
addr_t mem; addr_t mem;
z_heap.free_count -= (1 << order); z_heap.free_count -= (1 << order);
@ -342,36 +343,37 @@ addr_t __fastcall mem_alloc(size_t size, u32_t flags)
if( flags & PG_MAP ) if( flags & PG_MAP )
{ {
addr_t page_frame;
#ifdef ALLOC_IMM #ifdef ALLOC_FAST
while( pages ) while( pages )
{ {
u32_t order; u32_t order;
addr_t page_frame;
asm volatile ("bsr %0, %1":"=&r"(order):"r"(tmp):"cc"); asm volatile ("bsrl %1, %0":"=&r"(order):"r"(pages):"cc");
asm volatile ("btr %0, %1" :"=r"(tmp):"r"(order):"cc"); asm volatile ("btrl %1, %0" :"=&r"(pages):"r"(order):"cc");
page_frame = frame_alloc(1 << order) | (flags & 0xFFF); page_frame = frame_alloc(1 << order) | (flags & 0xFFF); /* FIXME check */
for(i = 0; i < 1 << order; i++) for(i = 0; i < 1 << order; i++)
{ {
*pte++ = 0; //page; *pte++ = 0;
*mpte++ = page; *mpte++ = page_frame;
asm volatile ( "invlpg (%0)" ::"r" (mem) ); asm volatile ( "invlpg (%0)" ::"r" (mem) );
mem+= 4096; mem+= 4096;
page_frame+= 4096;
}; };
} }
#else #else
page = PG_DEMAND | (flags & 0xFFF); page_frame = PG_DEMAND | (flags & 0xFFF);
while(pages--) while(pages--)
{ {
*pte++ = 0; *pte++ = 0;
*mpte++ = page; *mpte++ = page_frame;
asm volatile ( "invlpg (%0)" ::"r" (mem) ); asm volatile ( "invlpg (%0)" ::"r" (mem) );
mem+= 4096; mem+= 4096;
}; };
@ -381,7 +383,7 @@ addr_t __fastcall mem_alloc(size_t size, u32_t flags)
{ {
while(pages--) while(pages--)
{ {
*pte++ = 0; //page; *pte++ = 0;
*mpte++ = 0; *mpte++ = 0;
asm volatile ( "invlpg (%0)" ::"r" (mem) ); asm volatile ( "invlpg (%0)" ::"r" (mem) );
@ -389,7 +391,6 @@ addr_t __fastcall mem_alloc(size_t size, u32_t flags)
}; };
} }
#endif
DBG("%s %x size %d order %d\n", __FUNCTION__, heap, size, order); DBG("%s %x size %d order %d\n", __FUNCTION__, heap, size, order);
return heap; return heap;

View File

@ -23,7 +23,6 @@ HEAP_TOP equ 0x7FC00000
align 4 align 4
_init_user_heap: _init_user_heap:
init_heap: init_heap:
mov ebx,[current_slot] mov ebx,[current_slot]
mov eax, [ebx+APPDATA.heap_top] mov eax, [ebx+APPDATA.heap_top]
test eax, eax test eax, eax
@ -46,6 +45,7 @@ init_heap:
sub eax, 4096 sub eax, 4096
or ecx, FREE_BLOCK or ecx, FREE_BLOCK
mov [page_tabs+edx], ecx mov [page_tabs+edx], ecx
ret ret
align 4 align 4

View File

@ -230,7 +230,6 @@ core_init:
mov eax, cr3 mov eax, cr3
mov cr3, eax mov cr3, eax
jmp system_init jmp system_init
if 0 if 0

View File

@ -265,6 +265,7 @@ proc new_mem_resize stdcall, new_size:dword
pop edi pop edi
pop esi pop esi
@@: @@:
call _alloc_page call _alloc_page
test eax, eax test eax, eax
jz .exit jz .exit

View File

@ -207,7 +207,6 @@ void create_image(addr_t img_base, addr_t raw, bool force_clear)
u32_t sec_align; u32_t sec_align;
int i; int i;
/* assumed that image is valid */ /* assumed that image is valid */
dos = (PIMAGE_DOS_HEADER)raw; dos = (PIMAGE_DOS_HEADER)raw;
@ -314,8 +313,6 @@ bool link_image(addr_t img_base)
imp = MakePtr(PIMAGE_IMPORT_DESCRIPTOR, img_base, imp = MakePtr(PIMAGE_IMPORT_DESCRIPTOR, img_base,
nt->OptionalHeader.DataDirectory[1].VirtualAddress); nt->OptionalHeader.DataDirectory[1].VirtualAddress);
while ( 1 ) while ( 1 )
{ {
PIMAGE_THUNK_DATA32 thunk; PIMAGE_THUNK_DATA32 thunk;

View File

@ -240,7 +240,9 @@ slab_cache_t * slab_cache_create(
DBG("%s\n", __FUNCTION__); DBG("%s\n", __FUNCTION__);
cache = (slab_cache_t*)slab_cache_alloc(); cache = (slab_cache_t*)slab_cache_alloc();
_slab_cache_create(cache, size, align, constructor, destructor, flags); _slab_cache_create(cache, size, align, constructor, destructor, flags);
return cache; return cache;
} }

View File

@ -291,22 +291,13 @@ ready_for_next_irq_1:
ret ret
irqD: irqD:
save_ring3_context push eax
mov ax, sel_app_data
mov ds, ax
mov es, ax
mov dx,0xf0
mov al,0 mov al,0
out dx,al out 0xf0,al
mov dx,0xa0
mov al,0x20 mov al,0x20
out dx,al out 0xa0,al
mov dx,0x20 out 0x20,al
out dx,al pop eax
restore_ring3_context
iret iret
@ -459,7 +450,6 @@ terminate: ; terminate application
@@: @@:
;mov esi,process_terminating ;mov esi,process_terminating
;call sys_msg_board_str ;call sys_msg_board_str
DEBUGF 1,"%s",process_terminating
@@: @@:
cli cli
cmp [application_table_status],0 cmp [application_table_status],0
@ -603,11 +593,13 @@ term9:
xor eax, eax xor eax, eax
mov [window_data+esi+WDATA.box.left],eax mov [window_data+esi+WDATA.box.left],eax
mov [window_data+esi+WDATA.box.width],eax mov [window_data+esi+WDATA.box.width],eax
mov [window_data+esi+WDATA.box.top],eax mov [window_data+esi+WDATA.box.top],eax
mov [window_data+esi+WDATA.box.height],eax mov [window_data+esi+WDATA.box.height],eax
mov [window_data+esi+WDATA.cl_workarea],eax mov [window_data+esi+WDATA.cl_workarea],eax
mov [window_data+esi+WDATA.cl_titlebar],eax mov [window_data+esi+WDATA.cl_titlebar],eax
mov [window_data+esi+WDATA.cl_frames],eax mov [window_data+esi+WDATA.cl_frames],eax
mov dword [window_data+esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn mov dword [window_data+esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn
lea edi, [esi+draw_data] lea edi, [esi+draw_data]
@ -814,7 +806,6 @@ term9:
mov [application_table_status],0 mov [application_table_status],0
;mov esi,process_terminated ;mov esi,process_terminated
;call sys_msg_board_str ;call sys_msg_board_str
DEBUGF 1,"%s",process_terminated
add esp, 4 add esp, 4
ret ret
restore .slot restore .slot

View File

@ -4,6 +4,21 @@ format MS COFF
public _i40 public _i40
public _create_window
public _show_window
public _get_event
public _def_window_proc
public stb_create_window
public stb_show_window
public stb_get_event
public stb_def_window_proc
extrn _sys_create_window
extrn _sys_show_window
extrn _sys_get_event
extrn _sys_def_window_proc
section '.text' code readable align 16 section '.text' code readable align 16
align 16 align 16
@ -14,3 +29,74 @@ _i40:
int 0x41 int 0x41
iretd iretd
align 4
stb_create_window:
pushd [ecx+20]
pushd [ecx+16]
pushd [ecx+12]
pushd [ecx+8]
pushd [ecx+4]
pushd [ecx]
call _sys_create_window
add esp, 24
mov [esp + 32], eax
ret
align 4
stb_show_window:
pushd [ecx]
call _sys_show_window
add esp, 4
mov [esp + 32], eax
ret
align 4
stb_get_event:
pushd [ecx]
call _sys_get_event
add esp, 4
mov [esp + 32], eax
ret
align 4
stb_def_window_proc:
pushd [ecx]
call _sys_def_window_proc
add esp, 4
mov [esp + 32], eax
ret
align 4
_create_window:
lea ecx, [esp+4]
mov eax, 73
int 0x41
ret
align 4
_show_window:
lea ecx, [esp+4]
mov eax, 74
int 0x41
ret
align 4
_get_event:
lea ecx, [esp+4]
mov eax, 75
int 0x41
ret
align 4
_def_window_proc:
lea ecx, [esp+4]
mov eax, 76
int 0x41
ret

View File

@ -16,27 +16,11 @@ cross_order:
mov ecx, edx mov ecx, edx
mov edx, esi mov edx, esi
mov esi, edi mov esi, edi
mov edi, [esp+28 + 4] movzx edi, byte[esp+28 + 4]
and edi,0xff
call dword [servetable+edi*4] call dword [servetable+edi*4]
ret ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SYSTEM CALL ENTRY ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 16
i41:
pushad
cld
movzx eax, al
call dword [servetable2 + eax * 4]
popad
iretd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; SYSENTER ENTRY ;; ;; SYSENTER ENTRY ;;
@ -68,6 +52,21 @@ sysenter_entry:
pop edx pop edx
sysexit sysexit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SYSTEM CALL ENTRY ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 16
i40:
pushad
cld
movzx eax, al
call dword [servetable2 + eax * 4]
popad
iretd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; SYSCALL ENTRY ;; ;; SYSCALL ENTRY ;;
@ -256,6 +255,10 @@ iglobal
dd cross_order ; 70-Common file system interface, version 2 dd cross_order ; 70-Common file system interface, version 2
dd cross_order ; 71-Window settings dd cross_order ; 71-Window settings
dd cross_order ; 72-Send window message dd cross_order ; 72-Send window message
dd stb_create_window ; 73-create window
dd stb_show_window ; 74-show window
dd stb_get_event ; 75-get event
dd stb_def_window_proc
times 255 - ( ($-servetable2) /4 ) dd undefined_syscall times 255 - ( ($-servetable2) /4 ) dd undefined_syscall
dd sys_end ; -1-end application dd sys_end ; -1-end application

View File

@ -141,6 +141,7 @@ proc mnt_exec stdcall file_base:dword, file_size:dword, \
@@: @@:
cmp edi, ecx cmp edi, ecx
jae .bigfilename jae .bigfilename
lodsb lodsb
stosb stosb
test al, al test al, al
@ -172,7 +173,7 @@ proc mnt_exec stdcall file_base:dword, file_size:dword, \
test eax, eax test eax, eax
jz .err_hdr jz .err_hdr
DEBUGF 1,"%s",new_process_loading ; DEBUGF 1,"%s",new_process_loading
lea ebx, [application_table_status] lea ebx, [application_table_status]
call wait_mutex call wait_mutex
@ -226,8 +227,8 @@ proc mnt_exec stdcall file_base:dword, file_size:dword, \
mov [ebx+APPDATA.mem_size],ecx mov [ebx+APPDATA.mem_size],ecx
mov edi, [file_size] mov edi, [file_size]
; add edi, 4095 add edi, 4095
; and edi, not 4095 and edi, not 4095
sub ecx, edi sub ecx, edi
jna @F jna @F
@ -261,6 +262,7 @@ proc mnt_exec stdcall file_base:dword, file_size:dword, \
pop ebx pop ebx
mov eax, -ERROR_FILE_NOT_FOUND mov eax, -ERROR_FILE_NOT_FOUND
ret ret
.failed: .failed:
mov eax, [save_cr3] mov eax, [save_cr3]
call set_cr3 call set_cr3
@ -279,6 +281,7 @@ proc mnt_exec stdcall file_base:dword, file_size:dword, \
ret ret
endp endp
align 4 align 4
proc pe_app_param stdcall path:dword, raw:dword, ex_pg_dir:dword, ex_stack:dword proc pe_app_param stdcall path:dword, raw:dword, ex_pg_dir:dword, ex_stack:dword
@ -448,7 +451,6 @@ _pe_restart:
popad popad
iretd iretd
align 4 align 4
proc get_new_process_place proc get_new_process_place
;input: ;input:
@ -674,9 +676,10 @@ align 4
add esp, 16 add esp, 16
ret ret
align 4 align 4
set_cr3: set_cr3:
mov ebx, [current_slot] mov ebx, [current_slot]
mov [ebx+APPDATA.dir_table], eax mov [ebx+APPDATA.dir_table], eax
mov cr3, eax mov cr3, eax
@ -1045,9 +1048,8 @@ proc new_sys_threads
mov [app_eip], ebx mov [app_eip], ebx
mov [app_esp], ecx mov [app_esp], ecx
;mov esi,new_process_loading ;DEBUGF 1,"%s",new_process_loading
;call sys_msg_board_str
DEBUGF 1,"%s",new_process_loading
.wait_lock: .wait_lock:
cmp [application_table_status],0 cmp [application_table_status],0
je .get_lock je .get_lock
@ -1101,9 +1103,7 @@ proc new_sys_threads
stdcall set_app_params ,[slot],eax,dword 0,\ stdcall set_app_params ,[slot],eax,dword 0,\
dword 0,dword 0 dword 0,dword 0
;mov esi,new_process_running ; DEBUGF 1,"%s",new_process_running
;call sys_msg_board_str ;output information about succefull startup
DEBUGF 1,"%s",new_process_running
mov [application_table_status],0 ;unlock application_table_status mutex mov [application_table_status],0 ;unlock application_table_status mutex
mov eax,[process_number] ;set result mov eax,[process_number] ;set result

View File

@ -63,6 +63,7 @@ keymap_alt:
boot_setostask db 'Setting OS task',0 boot_setostask db 'Setting OS task',0
boot_allirqs db 'Unmasking all IRQs',0 boot_allirqs db 'Unmasking all IRQs',0
boot_tsc db 'Reading TSC',0 boot_tsc db 'Reading TSC',0
boot_cpufreq db 'CPU frequency is ',' ',' MHz',0
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0 boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0
boot_pal_vga db 'Setting VGA 640x480 palette',0 boot_pal_vga db 'Setting VGA 640x480 palette',0
boot_failed db 'Failed to start first app',0 boot_failed db 'Failed to start first app',0
@ -71,8 +72,8 @@ keymap_alt:
; boot_tasking db 'All set - press ESC to start',0 ; boot_tasking db 'All set - press ESC to start',0
;end if ;end if
new_process_loading db 'K : New Process - loading',13,10,0 ;new_process_loading db 'K : New Process - loading',13,10,0
new_process_running db 'K : New Process - done',13,10,0 ;new_process_running db 'K : New Process - done',13,10,0
start_not_enough_memory db 'K : New Process - not enough memory',13,10,0 start_not_enough_memory db 'K : New Process - not enough memory',13,10,0
msg_unresolved db 'unresolved ',0 msg_unresolved db 'unresolved ',0
@ -80,7 +81,10 @@ msg_module db 'in module ',0
msg_version db 'incompatible driver version',13,10,0 msg_version db 'incompatible driver version',13,10,0
msg_www db 'please visit www.kolibrios.org',13,10,0 msg_www db 'please visit www.kolibrios.org',13,10,0
msg_CR db 13,10,0 msg_CR db 13,10,0
aSis db 'SIS',0
intel_str db "GenuineIntel",0
AMD_str db "AuthenticAMD",0
;szSound db 'SOUND',0 ;szSound db 'SOUND',0
;szInfinity db 'INFINITY',0 ;szInfinity db 'INFINITY',0
@ -92,6 +96,8 @@ szAtiHW db '/rd/1/drivers/ati2d.drv',0
szSTART db 'START',0 szSTART db 'START',0
szEXPORTS db 'EXPORTS',0 szEXPORTS db 'EXPORTS',0
sz_EXPORTS db '_EXPORTS',0
szIMPORTS db 'IMPORTS',0 szIMPORTS db 'IMPORTS',0
read_firstapp db '/sys/' read_firstapp db '/sys/'
@ -107,7 +113,13 @@ vrr_m db 'VRR_M',0
kernel_file db 'KERNEL MNT' kernel_file db 'KERNEL MNT'
;supported videomodes align 4
shmem_list:
.bk dd shmem_list
.fd dd shmem_list
; supported videomodes
mode_1280_1024_32: mode_1280_1024_32:
dw 1280,1024,32,60 dw 1280,1024,32,60
mode_1280_1024_24: mode_1280_1024_24:
@ -129,13 +141,6 @@ mode_640_480_16:
mode_320_240_8: mode_320_240_8:
dw 320,240,8,60 dw 320,240,8,60
;bx_from_load: dw 'r1' ; ñòðóêòóðà äëÿ õðàíåíèÿ ïàðàìåòðîâ- îòêóäà ãàøðóçèëèñü, áåðåòñÿ íèæå èç bx ; {SPraid}[13.03.2007]
; ; a,b,c,d - âèí÷åñòåðû, r - ðàì äèñê
; ; # äèñêà... ñèìâîë, à íå áàéò. '1', à íå 1
; mike.dld { ; mike.dld {
db 0 db 0
dd servetable-0x10000 dd servetable-0x10000
@ -513,6 +518,11 @@ hdpos rd 1 ; for boot 0x1
fat32part rd 1 ; for boot 0x1 fat32part rd 1 ; for boot 0x1
cdpos rd 1 cdpos rd 1
;CPUID information
cpu_vendor rd 3
cpu_sign rd 1
cpu_info rd 1
cpu_caps rd 4
pg_data PG_DATA pg_data PG_DATA

View File

@ -1,4 +1,4 @@
ˆ…Œ<EFBFBD>… ”“<E2809D>Šˆˆ Ž<><EFBFBD>ˆŽ<CB86><C5BD>Ž‰ ‘ˆ‘’…Œ› Kolibri 0.7.1.0 ˆ…Œ<EFBFBD>… ”“<E2809D>Šˆˆ Ž<><EFBFBD>ˆŽ<CB86><C5BD>Ž‰ ‘ˆ‘’…Œ› Kolibri 0.7.5.0
<EFBFBD>®¬¥à ä㭪樨 ¯®¬¥é ¥âáï ¢ ॣ¨áâà eax. <EFBFBD>®¬¥à ä㭪樨 ¯®¬¥é ¥âáï ¢ ॣ¨áâà eax.
‚맮¢ á¨á⥬­®© ä㭪樨 ®áãé¥á⢫ï¥âáï ª®¬ ­¤®© "int 0x40". ‚맮¢ á¨á⥬­®© ä㭪樨 ®áãé¥á⢫ï¥âáï ª®¬ ­¤®© "int 0x40".
@ -223,9 +223,6 @@
âॡã¥âáï ¯¥à¥¤ âì ã¯à ¢«¥­¨¥ á«¥¤ãî饬㠯à®æ¥ááã âॡã¥âáï ¯¥à¥¤ âì ã¯à ¢«¥­¨¥ á«¥¤ãî饬㠯à®æ¥ááã
(§ ª®­ç¨âì ⥪ã騩 ª¢ ­â ¢à¥¬¥­¨), ¨á¯®«ì§ã©â¥ ¯®¤äã­ªæ¨î 1 (§ ª®­ç¨âì ⥪ã騩 ª¢ ­â ¢à¥¬¥­¨), ¨á¯®«ì§ã©â¥ ¯®¤äã­ªæ¨î 1
ä㭪樨 68. ä㭪樨 68.
* <20>ਠ⥪ã饩 ॠ«¨§ æ¨¨ ¯à®¨§®©¤¥â ­¥¬¥¤«¥­­ë© ¢®§¢à â ¨§ ä㭪樨,
¥á«¨ á«®¦¥­¨¥ ebx á ⥪ã騬 §­ ç¥­¨¥¬ áç¥â稪  ¢à¥¬¥­¨ ¢ë§®¢¥â
32-¡¨â­®¥ ¯¥à¥¯®«­¥­¨¥.
====================================================================== ======================================================================
=============== ”ã­ªæ¨ï 6 - ¯à®ç¨â âì ä ©« á à ¬¤¨áª . =============== =============== ”ã­ªæ¨ï 6 - ¯à®ç¨â âì ä ©« á à ¬¤¨áª . ===============
@ -621,16 +618,22 @@
* eax = 17 - ­®¬¥à ä㭪樨 * eax = 17 - ­®¬¥à ä㭪樨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* ¥á«¨ ¡ãä¥à ¯ãáâ, ¢®§¢à é ¥âáï eax=1 * ¥á«¨ ¡ãä¥à ¯ãáâ, ¢®§¢à é ¥âáï eax=1
* ¥á«¨ ¡ãä¥à ­¥ ¯ãáâ, ⮣¤  ¢®§¢à é ¥âáï: áâ à訥 24 ¡¨â  eax * ¥á«¨ ¡ãä¥à ­¥¯ãáâ:
ᮤ¥à¦ â ¨¤¥­â¨ä¨ª â®à ª­®¯ª¨ (¢ ç áâ­®áâ¨, ¢ ah ®ª §ë¢ ¥âáï * áâ à訥 24 ¡¨â  eax ᮤ¥à¦ â ¨¤¥­â¨ä¨ª â®à ª­®¯ª¨
¬« ¤è¨© ¡ ©â ¨¤¥­â¨ä¨ª â®à ; ¥á«¨ ¢á¥ ª­®¯ª¨ ¨¬¥îâ ¨¤¥­â¨ä¨ª â®à, (¢ ç áâ­®áâ¨, ¢ ah ®ª §ë¢ ¥âáï ¬« ¤è¨© ¡ ©â ¨¤¥­â¨ä¨ª â®à ;
¬¥­ì訩 256, â® ¤«ï à §«¨ç¥­¨ï ¤®áâ â®ç­® ah), ¥á«¨ ¢á¥ ª­®¯ª¨ ¨¬¥îâ ¨¤¥­â¨ä¨ª â®à, ¬¥­ì訩 256,
  ¢ al ¢®§¢à é ¥âáï 0 - ¥á«¨ ¨á¯®«ì§®¢ « áì «¥¢ ï ª­®¯ª  ¬ëè¨, ¨«¨ ¡¨â ⮩ ª­®¯ª¨ ¬ëè¨, ª®â®à ï ¨á¯®«ì§®¢ « áì. â® ¤«ï à §«¨ç¥­¨ï ¤®áâ â®ç­® ah)
* al = 0 - ª­®¯ª  ¡ë«  ­ ¦ â  «¥¢®© ª­®¯ª®© ¬ëè¨
* al = ¡¨â, ᮮ⢥âáâ¢ãî騩 ­ ¦ ¢è¥© ª­®¯ª¥ ¬ëè¨, ¥á«¨ ­¥ «¥¢®©
‡ ¬¥ç ­¨ï: ‡ ¬¥ç ­¨ï:
* "<22>ãä¥à" åà ­¨â ⮫쪮 ®¤­ã ª­®¯ªã, ¯à¨ ­ ¦ â¨¨ ­®¢®© ª­®¯ª¨ * "<22>ãä¥à" åà ­¨â ⮫쪮 ®¤­ã ª­®¯ªã, ¯à¨ ­ ¦ â¨¨ ­®¢®© ª­®¯ª¨
¨­ä®à¬ æ¨ï ® áâ à®© â¥àï¥âáï. ¨­ä®à¬ æ¨ï ® áâ à®© â¥àï¥âáï.
* <20>ਠ¢ë§®¢¥ í⮩ ä㭪樨 ¯à¨«®¦¥­¨¥¬ á ­¥ ªâ¨¢­ë¬ ®ª­®¬ * <20>ਠ¢ë§®¢¥ í⮩ ä㭪樨 ¯à¨«®¦¥­¨¥¬ á ­¥ ªâ¨¢­ë¬ ®ª­®¬
¢®§¢à é ¥âáï ®â¢¥â "¡ãä¥à ¯ãáâ". ¢®§¢à é ¥âáï ®â¢¥â "¡ãä¥à ¯ãáâ".
* ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥ al ᮮ⢥âáâ¢ã¥â á®áâ®ï­¨î ª­®¯®ª ¬ëè¨
¢ ä®à¬ â¥ ¯®¤ä㭪樨 2 ä㭪樨 37 ¢ ¬®¬¥­â ­ ç «  ­ ¦ â¨ï
­  ª­®¯ªã, §  ¨áª«î祭¨¥¬ ¬« ¤è¥£® ¡¨â  (ᮮ⢥âáâ¢ãî饣® «¥¢®©
ª­®¯ª¥ ¬ëè¨), ª®â®àë© á¡à á뢠¥âáï.
====================================================================== ======================================================================
==== ”ã­ªæ¨ï 18, ¯®¤äã­ªæ¨ï 2 - § ¢¥àè¨âì ¯à®æ¥áá/¯®â®ª ¯® á«®âã. ==== ==== ”ã­ªæ¨ï 18, ¯®¤äã­ªæ¨ï 2 - § ¢¥àè¨âì ¯à®æ¥áá/¯®â®ª ¯® á«®âã. ====
@ -735,7 +738,7 @@
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï * äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
====================================================================== ======================================================================
======= ”ã­ªæ¨ï 18, ¯®¤äã­ªæ¨ï 9 - § ¢¥à襭¨¥ à ¡®âë á¨á⥬ë ======== = ”ã­ªæ¨ï 18, ¯®¤äã­ªæ¨ï 9 - § ¢¥à襭¨¥ à ¡®âë á¨á⥬ë á ¯ à ¬¥â஬. =
====================================================================== ======================================================================
<EFBFBD> à ¬¥âàë: <EFBFBD> à ¬¥âàë:
* eax = 18 - ­®¬¥à ä㭪樨 * eax = 18 - ­®¬¥à ä㭪樨
@ -750,8 +753,7 @@
‡ ¬¥ç ­¨ï: ‡ ¬¥ç ­¨ï:
* <20>¥ á«¥¤ã¥â ¯®« £ âìáï ­  ¢®§¢à é ¥¬®¥ §­ ç¥­¨¥ ¯à¨ ­¥¢¥à­®¬ * <20>¥ á«¥¤ã¥â ¯®« £ âìáï ­  ¢®§¢à é ¥¬®¥ §­ ç¥­¨¥ ¯à¨ ­¥¢¥à­®¬
¢ë§®¢¥, ®­® ¬®¦¥â ¨§¬¥­¨âìáï ¢ ¯®á«¥¤ãîé¨å ¢¥àá¨ïå ï¤à . ¢ë§®¢¥, ®­® ¬®¦¥â ¨§¬¥­¨âìáï ¢ ¯®á«¥¤ãîé¨å ¢¥àá¨ïå ï¤à .
* Œ®¦­® ¨á¯®«ì§®¢ âì ¯®¤äã­ªæ¨î 1, çâ®¡ë ­  ¯®á«¥¤­¥¬ è £¥
§ ¢¥à襭¨ï à ¡®âë ¯®«ì§®¢ â¥«ì á ¬ à¥è «, çâ® ¥¬ã ­ã¦­®.
====================================================================== ======================================================================
======== ”ã­ªæ¨ï 18, ¯®¤äã­ªæ¨ï 10 - ᢥà­ãâì ®ª­® ¯à¨«®¦¥­¨ï. ======= ======== ”ã­ªæ¨ï 18, ¯®¤äã­ªæ¨ï 10 - ᢥà­ãâì ®ª­® ¯à¨«®¦¥­¨ï. =======
====================================================================== ======================================================================
@ -1131,11 +1133,6 @@ dd 638
* <20>®«ãç¨âì ãáâ ­®¢«¥­­ãî ¡ §ã CD ¬®¦­® ¢ë§®¢®¬ * <20>®«ãç¨âì ãáâ ­®¢«¥­­ãî ¡ §ã CD ¬®¦­® ¢ë§®¢®¬
¯®¤ä㭪樨 3 ä㭪樨 26. ¯®¤ä㭪樨 3 ä㭪樨 26.
======================================================================
== ”ã­ªæ¨ï 21, ¯®¤äã­ªæ¨ï 4 - ãáâ ­®¢¨âì ¡ §®¢ë© ¯®àâ Sound Blaster. =
======================================================================
“¤ «¥­ 
====================================================================== ======================================================================
========= ”ã­ªæ¨ï 21, ¯®¤äã­ªæ¨ï 5 - ãáâ ­®¢¨âì ï§ëª á¨á⥬ë. ======== ========= ”ã­ªæ¨ï 21, ¯®¤äã­ªæ¨ï 5 - ãáâ ­®¢¨âì ï§ëª á¨á⥬ë. ========
====================================================================== ======================================================================
@ -1199,11 +1196,6 @@ dd 638
* ‘«¥¤ã¥â â ª¦¥ ®¯à¥¤¥«¨âì ¨á¯®«ì§ã¥¬ãî ¡ §ã ¦ñá⪮£® ¤¨áª  * ‘«¥¤ã¥â â ª¦¥ ®¯à¥¤¥«¨âì ¨á¯®«ì§ã¥¬ãî ¡ §ã ¦ñá⪮£® ¤¨áª 
¯®¤ä㭪樥© 7. ¯®¤ä㭪樥© 7.
======================================================================
===== ”ã­ªæ¨ï 21, ¯®¤äã­ªæ¨ï 10 - ãáâ ­®¢¨âì ª ­ « DMA ¤«ï §¢ãª . ====
======================================================================
“¤ «¥­ :
====================================================================== ======================================================================
====================== ”ã­ªæ¨ï 21, ¯®¤äã­ªæ¨ï 11 ===================== ====================== ”ã­ªæ¨ï 21, ¯®¤äã­ªæ¨ï 11 =====================
=========== <20> §à¥è¨âì/§ ¯à¥â¨âì ­¨§ª®ã஢­¥¢ë© ¤®áâ㯠ª HD. ========== =========== <20> §à¥è¨âì/§ ¯à¥â¨âì ­¨§ª®ã஢­¥¢ë© ¤®áâ㯠ª HD. ==========
@ -1497,11 +1489,6 @@ dd 638
* ”ã­ªæ¨ï ¯®¤¤¥à¦¨¢ ¥âáï ⮫쪮 ¤«ï ATAPI-ãáâனá⢠(CD ¨ DVD). * ”ã­ªæ¨ï ¯®¤¤¥à¦¨¢ ¥âáï ⮫쪮 ¤«ï ATAPI-ãáâனá⢠(CD ¨ DVD).
* <20>ਬ¥à®¬ ¨á¯®«ì§®¢ ­¨ï ä㭪樨 ï¥âáï ¯à¨«®¦¥­¨¥ CD_tray. * <20>ਬ¥à®¬ ¨á¯®«ì§®¢ ­¨ï ä㭪樨 ï¥âáï ¯à¨«®¦¥­¨¥ CD_tray.
======================================================================
============== ”ã­ªæ¨ï 25 - ãáâ ­®¢¨âì £à®¬ª®áâì SBPro. ==============
======================================================================
“¤ «¥­ 
====================================================================== ======================================================================
===== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 1 - ¯®«ãç¨âì ¡ §®¢ë© ¯®àâ MPU MIDI. ===== ===== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 1 - ¯®«ãç¨âì ¡ §®¢ë© ¯®àâ MPU MIDI. =====
====================================================================== ======================================================================
@ -1564,11 +1551,6 @@ dd 638
* <20> §  CD ¨á¯®«ì§ã¥âáï ä㭪樥© 24. * <20> §  CD ¨á¯®«ì§ã¥âáï ä㭪樥© 24.
* “áâ ­®¢¨âì ¡ §ã CD ¬®¦­® ¢ë§®¢®¬ ¯®¤ä㭪樨 3 ä㭪樨 21. * “áâ ­®¢¨âì ¡ §ã CD ¬®¦­® ¢ë§®¢®¬ ¯®¤ä㭪樨 3 ä㭪樨 21.
======================================================================
=== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 4 - ¯®«ãç¨âì ¡ §®¢ë© ¯®àâ Sound Blaster. ==
======================================================================
“¤ «¥­ 
====================================================================== ======================================================================
========== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 5 - ¯®«ãç¨âì ï§ëª á¨á⥬ë. ========= ========== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 5 - ¯®«ãç¨âì ï§ëª á¨á⥬ë. =========
====================================================================== ======================================================================
@ -1633,11 +1615,6 @@ dd 638
497 áã⮪. 497 áã⮪.
* ‘¨á⥬­®¥ ¢à¥¬ï ¬®¦­® ¯®«ãç¨âì ä㭪樥© 3. * ‘¨á⥬­®¥ ¢à¥¬ï ¬®¦­® ¯®«ãç¨âì ä㭪樥© 3.
======================================================================
====== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 10 - ¯®«ãç¨âì ª ­ « DMA ¤«ï §¢ãª . =====
======================================================================
“¤ «¥­ 
====================================================================== ======================================================================
====================== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 11 ===================== ====================== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 11 =====================
=========== “§­ âì, à §à¥èñ­ «¨ ­¨§ª®ã஢­¥¢ë© ¤®áâ㯠ª HD. ========== =========== “§­ âì, à §à¥èñ­ «¨ ­¨§ª®ã஢­¥¢ë© ¤®áâ㯠ª HD. ==========
@ -1667,11 +1644,6 @@ dd 638
* “áâ ­®¢¨âì ⥪ã饥 á®áâ®ï­¨¥ ¬®¦­® ¢ë§®¢®¬ * “áâ ­®¢¨âì ⥪ã饥 á®áâ®ï­¨¥ ¬®¦­® ¢ë§®¢®¬
¯®¤ä㭪樨 12 ä㭪樨 21. ¯®¤ä㭪樨 12 ä㭪樨 21.
======================================================================
=============== ”ã­ªæ¨ï 28 - ãáâ ­®¢¨âì £à®¬ª®áâì SB16. ==============
======================================================================
“¤ «¥­ 
====================================================================== ======================================================================
================ ”ã­ªæ¨ï 29 - ¯®«ãç¨âì á¨á⥬­ãî ¤ âã. =============== ================ ”ã­ªæ¨ï 29 - ¯®«ãç¨âì á¨á⥬­ãî ¤ âã. ===============
====================================================================== ======================================================================
@ -1711,6 +1683,56 @@ dd 638
ª®¯¨àãîâáï ⮫쪮 ¯¥à¢ë¥ (edx-1) ¡ ©â ª®¯¨àãîâáï ⮫쪮 ¯¥à¢ë¥ (edx-1) ¡ ©â
¨ ¢ ª®­æ¥ áâ ¢¨âáï § ¢¥àè î騩 0. ¨ ¢ ª®­æ¥ áâ ¢¨âáï § ¢¥àè î騩 0.
======================================================================
================ ”ã­ªæ¨ï 32 - 㤠«¨âì ä ©« á à ¬¤¨áª . ===============
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 32 - ­®¬¥à ä㭪樨
* ebx = 㪠§ â¥«ì ­  ¨¬ï ä ©« 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮; ¨­ ç¥ ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
‡ ¬¥ç ­¨ï:
* <20>â  äã­ªæ¨ï ãáâ à¥« ; äã­ªæ¨ï 58 ¯®§¢®«ï¥â ¢ë¯®«­ïâì
⥠¦¥ ¤¥©á⢨ï á à áè¨à¥­­ë¬¨ ¢®§¬®¦­®áâﬨ.
* ’¥ªãé ï ॠ«¨§ æ¨ï ¢®§¢à é ¥â ⮫쪮 §­ ç¥­¨ï 0(ãᯥå) ¨
5(ä ©« ­¥ ­ ©¤¥­).
* ˆ¬ï ä ©«  ¤®«¦­® ¡ëâì «¨¡® ¢ ä®à¬ â¥ 8+3 ᨬ¢®«®¢ (¯¥à¢ë¥
8 ᨬ¢®«®¢ - ᮡá⢥­­® ¨¬ï, ¯®á«¥¤­¨¥ 3 - à áè¨à¥­¨¥,
ª®à®âª¨¥ ¨¬¥­  ¨ à áè¨à¥­¨ï ¤®¯®«­ïîâáï ¯à®¡¥« ¬¨),
«¨¡® ¢ ä®à¬ â¥ 8.3 ᨬ¢®«®¢ "FILE.EXT"/"FILE.EX "
(¨¬ï ­¥ ¡®«¥¥ 8 ᨬ¢®«®¢, â®çª , à áè¨à¥­¨¥ 3 ᨬ¢®« ,
¤®¯®«­¥­­®¥ ¯à¨ ­¥®¡å®¤¨¬®á⨠¯à®¡¥« ¬¨).
ˆ¬ï ä ©«  ¤®«¦­® ¡ëâì § ¯¨á ­® § £« ¢­ë¬¨ ¡ãª¢ ¬¨.
‡ ¢¥àè î騩 ᨬ¢®« á ª®¤®¬ 0 ­¥ ­ã¦¥­ (­¥ ASCIIZ-áâப ).
* <20>â  äã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥â ¯ ¯®ª ­  à ¬¤¨áª¥.
======================================================================
=============== ”ã­ªæ¨ï 33 - § ¯¨á âì ä ©« ­  à ¬¤¨áª. ===============
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 33 - ­®¬¥à ä㭪樨
* ebx = 㪠§ â¥«ì ­  ¨¬ï ä ©« 
* ecx = 㪠§ â¥«ì ­  ¤ ­­ë¥ ¤«ï § ¯¨á¨
* edx = ç¨á«® ¡ ©â ¤«ï § ¯¨á¨
* á«¥¤ã¥â ãáâ ­ ¢«¨¢ âì esi=0
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮, ¨­ ç¥ ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
‡ ¬¥ç ­¨ï:
* <20>â  äã­ªæ¨ï ãáâ à¥« ; äã­ªæ¨ï 70 ¯®§¢®«ï¥â ¢ë¯®«­ïâì
⥠¦¥ ¤¥©á⢨ï á à áè¨à¥­­ë¬¨ ¢®§¬®¦­®áâﬨ.
* …᫨ 㪠§ âì ­¥­ã«¥¢®¥ §­ ç¥­¨¥ ¢ esi ¨ ­  à ¬¤¨áª¥ 㦥 ¥áâì
㪠§ ­­ë© ä ©«, â® ¡ã¤¥â ᮧ¤ ­ ¥éñ ®¤¨­ ä ©« á ⥬ ¦¥ ¨¬¥­¥¬.
* ¯à®â¨¢­®¬ á«ãç ¥ ä ©« ¯¥à¥§ ¯¨á뢠¥âáï.
* ˆ¬ï ä ©«  ¤®«¦­® ¡ëâì «¨¡® ¢ ä®à¬ â¥ 8+3 ᨬ¢®«®¢
(¯¥à¢ë¥ 8 ᨬ¢®«®¢ - ᮡá⢥­­® ¨¬ï, ¯®á«¥¤­¨¥ 3 - à áè¨à¥­¨¥,
ª®à®âª¨¥ ¨¬¥­  ¨ à áè¨à¥­¨ï ¤®¯®«­ïîâáï ¯à®¡¥« ¬¨),
«¨¡® ¢ ä®à¬ â¥ 8.3 ᨬ¢®«®¢ "FILE.EXT"/"FILE.EX "
(¨¬ï ­¥ ¡®«¥¥ 8 ᨬ¢®«®¢, â®çª , à áè¨à¥­¨¥ 3 ᨬ¢®« ,
¤®¯®«­¥­­®¥ ¯à¨ ­¥®¡å®¤¨¬®á⨠¯à®¡¥« ¬¨).
ˆ¬ï ä ©«  ¤®«¦­® ¡ëâì § ¯¨á ­® § £« ¢­ë¬¨ ¡ãª¢ ¬¨.
‡ ¢¥àè î騩 ᨬ¢®« á ª®¤®¬ 0 ­¥ ­ã¦¥­ (­¥ ASCIIZ-áâப ).
* <20>â  äã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥â ¯ ¯®ª ­  à ¬¤¨áª¥.
====================================================================== ======================================================================
============ ”ã­ªæ¨ï 35 - ¯à®ç¨â âì 梥â â®çª¨ ­  íªà ­¥. ============ ============ ”ã­ªæ¨ï 35 - ¯à®ç¨â âì 梥â â®çª¨ ­  íªà ­¥. ============
====================================================================== ======================================================================
@ -1728,6 +1750,22 @@ dd 638
ä㭪権) ç¥à¥§ ᥫ¥ªâ®à gs. <20> à ¬¥âàë ⥪ã饣® ¢¨¤¥®à¥¦¨¬  ä㭪権) ç¥à¥§ ᥫ¥ªâ®à gs. <20> à ¬¥âàë ⥪ã饣® ¢¨¤¥®à¥¦¨¬ 
¬®¦­® ¯®«ãç¨âì ä㭪樥© 61. ¬®¦­® ¯®«ãç¨âì ä㭪樥© 61.
======================================================================
=============== ”ã­ªæ¨ï 36 - ¯à®ç¨â âì ®¡« áâì íªà ­ . ===============
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 36 - ­®¬¥à ä㭪樨
* ebx = 㪠§ â¥«ì ­  ¯à¥¤¢ à¨â¥«ì­® ¢ë¤¥«¥­­ãî ®¡« áâì ¯ ¬ïâ¨,
ªã¤  ¡ã¤¥â ¯®¬¥é¥­® ¨§®¡à ¦¥­¨¥ ¢ ä®à¬ â¥ BBGGRRBBGGRR...
* ecx = [à §¬¥à ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ y]
* edx = [ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [ª®®à¤¨­ â  ¯® ®á¨ y]
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
‡ ¬¥ç ­¨ï:
* Š®®à¤¨­ âë ®¡« á⨠- íâ® ª®®à¤¨­ âë ¢¥àå­¥£® «¥¢®£® 㣫 
®¡« á⨠®â­®á¨â¥«ì­® íªà ­ .
* <20> §¬¥à ¨§®¡à ¦¥­¨ï ¢ ¡ ©â å ¥áâì 3*xsize*ysize.
====================================================================== ======================================================================
==================== ”ã­ªæ¨ï 37 - à ¡®â  á ¬ëèìî. ==================== ==================== ”ã­ªæ¨ï 37 - à ¡®â  á ¬ëèìî. ====================
====================================================================== ======================================================================
@ -1921,43 +1959,35 @@ dd 638
* eax = -1 ¤«ï ­¥ª®à४⭮£® ebx * eax = -1 ¤«ï ­¥ª®à४⭮£® ebx
====================================================================== ======================================================================
========== ”ã­ªæ¨ï 42 - à ¡®â  á ¤ ­­ë¬¨, ¯®«ã祭­ë¬¨ ¯® IRQ. ======= ========= ”ã­ªæ¨ï 42 - à ¡®â  á ¤ ­­ë¬¨, ¯®«ã祭­ë¬¨ ¯® IRQ. =========
====================================================================== ======================================================================
------------------------ —⥭¨¥ ¤ ­­ëå -------------------------------
<EFBFBD>ਠ¢®§­¨ª­®¢¥­¨¨ IRQ á¨á⥬  ¬®¦¥â áç¨â뢠âì ¤ ­­ë¥ ¨§ 㪠§ ­­ëå <EFBFBD>ਠ¢®§­¨ª­®¢¥­¨¨ IRQ á¨á⥬  ¬®¦¥â áç¨â뢠âì ¤ ­­ë¥ ¨§ 㪠§ ­­ëå
à ­¥¥ ä㭪樥© 44 ¯®à⮢ ¨ § ¯¨á뢠âì í⨠¤ ­­ë¥ ¢ ¡ãä¥à. à ­¥¥ ä㭪樥© 44 ¯®à⮢ ¨ § ¯¨á뢠âì í⨠¤ ­­ë¥ ¢ ¡ãä¥à.
Ž¯¨á뢠¥¬ ï äã­ªæ¨ï áç¨â뢠¥â ¤ ­­ë¥ ¨§ í⮣® ¡ãä¥à  ¢ ¡ãä¥à
㪠§ ­­ë© ¢ ª ç¥á⢥ ¯ à ¬¥âà . -------------------- <20>®¤äã­ªæ¨ï 0 - ç⥭¨¥ ¤ ­­ëå --------------------
<EFBFBD> à ¬¥âàë: <EFBFBD> à ¬¥âàë:
* eax = 42 - ­®¬¥à ä㭪樨 * eax = 42 - ­®¬¥à ä㭪樨
* bl = ­®¬¥à IRQ, 0..15 * bl = ­®¬¥à IRQ, 0..15
* bh = ­®¬¥à ¯®¤ä㭪樨, 0 * bh = 0 - ­®¬¥à ¯®¤ä㭪樨
Žáâ «ì­ ï ç áâì ॣ¨áâà  ebx ¤®«¦­  ¡ëâì ®¡­ã«¥­ . * ®áâ «ì­ ï ç áâì ॣ¨áâà  ebx ¤®«¦­  ¡ëâì ®¡­ã«¥­ 
* ecx = 㪠§ â¥«ì ­  ¡ãä¥à, ªã¤  ¡ã¤ã⠯ਭ¨¬ âìáï ¤ ­­ë¥ * ecx = 㪠§ â¥«ì ­  ¡ãä¥à à §¬¥à®¬ ­¥ ¬¥­¥¥ 4000 ¡ ©â
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: (á¨âã æ¨î ¬®¦­® à §«¨ç¨âì ¯® §­ ç¥­¨î eax) ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: (á¨âã æ¨î ¬®¦­® à §«¨ç¨âì ¯® §­ ç¥­¨î eax)
* ¥á«¨ ¯®â®ª ­¥ ï¥âáï ¢« ¤¥«ì楬 IRQ * ¥á«¨ ¯®â®ª ­¥ ï¥âáï ¢« ¤¥«ì楬 IRQ
(¨«¨ ­®¬¥à IRQ § ¤ ­ ­¥¢¥à­®): (¨«¨ ­®¬¥à IRQ § ¤ ­ ­¥¢¥à­®): eax = -1
* eax = -1 * ¥á«¨ ¤ ­­ëå ­¥â: eax = 0
* ¥á«¨ ¤ ­­ëå ­¥â:
* eax = 0
* ¥á«¨ ¢áñ ¢ ¯®à浪¥ ¨ ¤ ­­ë¥ ¡ë«¨: * ¥á«¨ ¢áñ ¢ ¯®à浪¥ ¨ ¤ ­­ë¥ ¡ë«¨:
* eax = à §¬¥à ¤ ­­ëå, ¯à®ç¨â ­­ëå ¨§ ¡ãä¥à  (¢ ¡ ©â å) eax = à §¬¥à ¤ ­­ëå, ¯à®ç¨â ­­ëå ¨§ ¡ãä¥à  (¢ ¡ ©â å)
‘¬®âà¨â¥ § ¬¥ç ­¨ï ­¨¦¥. ------------ <20>®¤äã­ªæ¨ï 1 - 㧭 âì à §¬¥à ¤ ­­ëå ¢ ¡ãä¥à¥ ------------
------------------------ “§­ âì à §¬¥à ¤ ­­ëå ¢ ¡ãä¥à¥ ---------------
<EFBFBD> à ¬¥âàë: <EFBFBD> à ¬¥âàë:
* eax = 42 - ­®¬¥à ä㭪樨 * eax = 42 - ­®¬¥à ä㭪樨
* bl = ­®¬¥à IRQ, 0..15 * bl = ­®¬¥à IRQ, 0..15
* bh = ­®¬¥à ¯®¤ä㭪樨, 1 * bh = 1 - ­®¬¥à ¯®¤ä㭪樨
Žáâ «ì­ ï ç áâì ॣ¨áâà  ebx ¤®«¦­  ¡ëâì ®¡­ã«¥­ . * ®áâ «ì­ ï ç áâì ॣ¨áâà  ebx ¤®«¦­  ¡ëâì ®¡­ã«¥­ 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: (á¨âã æ¨î ¬®¦­® à §«¨ç¨âì ¯® §­ ç¥­¨î eax) ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* ¥á«¨ ¯®â®ª ­¥ ï¥âáï ¢« ¤¥«ì楬 IRQ * ¥á«¨ ¯®â®ª ­¥ ï¥âáï ¢« ¤¥«ì楬 IRQ
(¨«¨ ­®¬¥à IRQ § ¤ ­ ­¥¢¥à­®): (¨«¨ ­®¬¥à IRQ § ¤ ­ ­¥¢¥à­®): eax = -1
* eax = -1 * ¨­ ç¥ eax = à §¬¥à ¤ ­­ëå ¢ ¡ãä¥à¥
* ¥á«¨ ¢áñ ¢ ¯®à浪¥, ¢ eax à §¬¥à ¤ ­­ëå
‡ ¬¥ç ­¨ï: ‡ ¬¥ç ­¨ï:
* <20>।¢ à¨â¥«ì­® ¯®â®ª ¤®«¦¥­ § à¥§¥à¢¨à®¢ âì ¤«ï ᥡï 㪠§ ­­ë© IRQ * <20>।¢ à¨â¥«ì­® ¯®â®ª ¤®«¦¥­ § à¥§¥à¢¨à®¢ âì ¤«ï ᥡï 㪠§ ­­ë© IRQ
ä㭪樥© 45. ä㭪樥© 45.
@ -2581,9 +2611,6 @@ dword-
* ’¥ªãé ï ॠ«¨§ æ¨ï ­¥ § ªà뢠¥â  ¢â®¬ â¨ç¥áª¨ ¢á¥ ᮪¥âë ¯®â®ª  * ’¥ªãé ï ॠ«¨§ æ¨ï ­¥ § ªà뢠¥â  ¢â®¬ â¨ç¥áª¨ ¢á¥ ᮪¥âë ¯®â®ª 
¯à¨ ¥£® § ¢¥à襭¨¨. ç áâ­®áâ¨, ­¥ á«¥¤ã¥â ¯à¨¡¨¢ âì ¯®â®ª ¯à¨ ¥£® § ¢¥à襭¨¨. ç áâ­®áâ¨, ­¥ á«¥¤ã¥â ¯à¨¡¨¢ âì ¯®â®ª
á ªã祩 ®âªàëâëå ᮪¥â®¢ - ¡ã¤¥â ãâ¥çª  à¥áãàᮢ. á ªã祩 ®âªàëâëå ᮪¥â®¢ - ¡ã¤¥â ãâ¥çª  à¥áãàᮢ.
* ’¥ªãé ï ॠ«¨§ æ¨ï ­¥ ¤¥« ¥â ¯à®¢¥à®ª ­  ª®à४⭮áâì
(¥¤¨­á⢥­­®¥, ­  çâ® ¢®§¢à é ¥âáï ®è¨¡ª , - ¯®¯ë⪠ § ªàëâì
­¥®âªàëâë© á®ª¥â á ª®à४â­ë¬ åí­¤«®¬).
====================================================================== ======================================================================
============== ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 2 - ®¯à®á ᮪¥â . ============== ============== ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 2 - ®¯à®á ᮪¥â . ==============
@ -2593,10 +2620,8 @@ dword-
* ebx = 2 - ­®¬¥à ¯®¤ä㭪樨 * ebx = 2 - ­®¬¥à ¯®¤ä㭪樨
* ecx = åí­¤« ᮪¥â  * ecx = åí­¤« ᮪¥â 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = ç¨á«® ¯®«ã祭­ëå ¡ ©â * eax = ç¨á«® ¯®«ã祭­ëå ¡ ©â, 0 ¤«ï ­¥¢¥à­®£® åí­¤« 
* ebx à §àãè ¥âáï * ebx à §àãè ¥âáï
‡ ¬¥ç ­¨ï:
* <20>஢¥àª¨ ª®à४⭮á⨠­¥ ¤¥« ¥âáï.
====================================================================== ======================================================================
======== ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 3 - ¯à®ç¨â âì ¡ ©â ¨§ ᮪¥â . ======== ======== ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 3 - ¯à®ç¨â âì ¡ ©â ¨§ ᮪¥â . ========
@ -2606,12 +2631,10 @@ dword-
* ebx = 3 - ­®¬¥à ¯®¤ä㭪樨 * ebx = 3 - ­®¬¥à ¯®¤ä㭪樨
* ecx = åí­¤« ᮪¥â  * ecx = åí­¤« ᮪¥â 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* ¥á«¨ ­¥â ¯à¨­ïâëå ¤ ­­ëå: eax=0, bl=0, * ¥á«¨ ­¥â ¯à¨­ïâëå ¤ ­­ëå ¨«¨ 㪠§ ­ ­¥¢¥à­ë© åí­¤«:
¯à®ç¨¥ ¡ ©âë ebx à §àãè îâáï eax=0, bl=0, ¯à®ç¨¥ ¡ ©âë ebx à §àãè îâáï
* ¥á«¨ ¡ë«¨ ¯à¨­ïâë¥ ¤ ­­ë¥: eax=ç¨á«® ®áâ ¢è¨åáï ¡ ©â * ¥á«¨ ¡ë«¨ ¯à¨­ïâë¥ ¤ ­­ë¥: eax=ç¨á«® ®áâ ¢è¨åáï ¡ ©â
(¢®§¬®¦­®, 0), bl=¯à®ç¨â ­­ë© ¡ ©â, ¯à®ç¨¥ ¡ ©âë ebx à §àãè îâáï (¢®§¬®¦­®, 0), bl=¯à®ç¨â ­­ë© ¡ ©â, ¯à®ç¨¥ ¡ ©âë ebx à §àãè îâáï
‡ ¬¥ç ­¨ï:
* <20>஢¥àª¨ ª®à४⭮á⨠­¥ ¯à®¨§¢®¤¨âáï.
====================================================================== ======================================================================
========== ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 4 - § ¯¨á âì ¢ UDP-᮪¥â. ========== ========== ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 4 - § ¯¨á âì ¢ UDP-᮪¥â. ==========
@ -2623,13 +2646,10 @@ dword-
* edx = ç¨á«® ¡ ©â ¤«ï § ¯¨á¨ * edx = ç¨á«® ¡ ©â ¤«ï § ¯¨á¨
* esi = 㪠§ â¥«ì ­  ¤ ­­ë¥ ¤«ï § ¯¨á¨ * esi = 㪠§ â¥«ì ­  ¤ ­­ë¥ ¤«ï § ¯¨á¨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0xffffffff - ­¥¢¥à­ë© åí­¤« * eax = 0xffffffff - ®è¨¡ª  (­¥¢¥à­ë© åí­¤« ¨«¨ ­¥¤®áâ â®ç­® ¯ ¬ïâ¨)
* eax = 0xffff - ­¥¤®áâ â®ç­® ¯ ¬ïâ¨
* eax = 0 - ãᯥ譮 * eax = 0 - ãᯥ譮
* ebx à §àãè ¥âáï * ebx à §àãè ¥âáï
‡ ¬¥ç ­¨ï: ‡ ¬¥ç ­¨ï:
* <20>஢¥àª  ­  ¯à ¢¨«ì­®áâì åí­¤«  ¬¨­¨¬ «ì­  - ¨áª«îç îâáï ⮫쪮
­¥ ®ç¥­ì ­¥¯à ¢¨«ì­ë¥ ­¥®âªàëâë¥ åí­¤«ë.
* —¨á«® ¡ ©â ¤«ï § ¯¨á¨ ­¥ ¬®¦¥â ¯à¥¢ëè âì 1500-28, å®âï * —¨á«® ¡ ©â ¤«ï § ¯¨á¨ ­¥ ¬®¦¥â ¯à¥¢ëè âì 1500-28, å®âï
ᮮ⢥âáâ¢ãî饩 ¯à®¢¥àª¨ ­¥ ¤¥« ¥âáï. ᮮ⢥âáâ¢ãî饩 ¯à®¢¥àª¨ ­¥ ¤¥« ¥âáï.
@ -2657,7 +2677,7 @@ dword-
* ebx = 6 - ­®¬¥à ¯®¤ä㭪樨 * ebx = 6 - ­®¬¥à ¯®¤ä㭪樨
* ecx = åí­¤« ᮪¥â  * ecx = åí­¤« ᮪¥â 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = áâ âãá ᮪¥â : ®¤­® ¨§ * eax = 0 ¤«ï ­¥¢¥à­®£® ᮪¥â  ¨«¨ áâ âãá: ®¤­® ¨§
* TCB_LISTEN = 1 * TCB_LISTEN = 1
* TCB_SYN_SENT = 2 * TCB_SYN_SENT = 2
* TCB_SYN_RECEIVED = 3 * TCB_SYN_RECEIVED = 3
@ -2670,8 +2690,6 @@ dword-
* TCB_TIME_WAIT = 10 * TCB_TIME_WAIT = 10
* TCB_CLOSED = 11 * TCB_CLOSED = 11
* ebx à §àãè ¥âáï * ebx à §àãè ¥âáï
‡ ¬¥ç ­¨ï:
* <20>஢¥à®ª ª®à४⭮á⨠­¥ ¯à®¨§¢®¤¨âáï.
====================================================================== ======================================================================
========== ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 7 - § ¯¨á âì ¢ TCP-᮪¥â. ========== ========== ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 7 - § ¯¨á âì ¢ TCP-᮪¥â. ==========
@ -2683,13 +2701,10 @@ dword-
* edx = ç¨á«® ¡ ©â ¤«ï § ¯¨á¨ * edx = ç¨á«® ¡ ©â ¤«ï § ¯¨á¨
* esi = 㪠§ â¥«ì ­  ¤ ­­ë¥ ¤«ï § ¯¨á¨ * esi = 㪠§ â¥«ì ­  ¤ ­­ë¥ ¤«ï § ¯¨á¨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0xffffffff - ®è¨¡ª  * eax = 0xffffffff - ®è¨¡ª  (­¥¢¥à­ë© åí­¤« ¨«¨ ­¥¤®áâ â®ç­® ¯ ¬ïâ¨)
* eax = 0xffff - ­¥¤®áâ â®ç­® ¯ ¬ïâ¨
* eax = 0 - ãᯥ譮 * eax = 0 - ãᯥ譮
* ebx à §àãè ¥âáï * ebx à §àãè ¥âáï
‡ ¬¥ç ­¨ï: ‡ ¬¥ç ­¨ï:
* <20>஢¥àª  ­  ¯à ¢¨«ì­®áâì åí­¤«  ¬¨­¨¬ «ì­  - ¨áª«îç îâáï ⮫쪮
­¥ ®ç¥­ì ­¥¯à ¢¨«ì­ë¥ ­¥®âªàëâë¥ åí­¤«ë.
* —¨á«® ¡ ©â ¤«ï § ¯¨á¨ ­¥ ¬®¦¥â ¯à¥¢ëè âì 1500-40, * —¨á«® ¡ ©â ¤«ï § ¯¨á¨ ­¥ ¬®¦¥â ¯à¥¢ëè âì 1500-40,
å®âï ᮮ⢥âáâ¢ãî饩 ¯à®¢¥àª¨ ­¥ ¤¥« ¥âáï. å®âï ᮮ⢥âáâ¢ãî饩 ¯à®¢¥àª¨ ­¥ ¤¥« ¥âáï.
@ -2701,19 +2716,14 @@ dword-
* ebx = 8 - ­®¬¥à ¯®¤ä㭪樨 * ebx = 8 - ­®¬¥à ¯®¤ä㭪樨
* ecx = åí­¤« ᮪¥â  * ecx = åí­¤« ᮪¥â 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = -1 - ­¥¢¥à­ë© åí­¤« * eax = -1 - ®è¨¡ª  (­¥¢¥à­ë© åí­¤« ¨«¨
* eax = 0xffff - ­¥¤®áâ â®ç­® ¯ ¬ï⨠¤«ï ¯ ª¥â  § ªàëâ¨ï ᮪¥â  ­¥¤®áâ â®ç­® ¯ ¬ï⨠¤«ï ¯ ª¥â  § ªàëâ¨ï ᮪¥â )
* eax = 0 - ãᯥ譮 * eax = 0 - ãᯥ譮
* ¢® ¬­®£¨å á«ãç ïå eax à §àãè ¥âáï (¢®§¢à é ¥âáï १ã«ìâ â ä㭪樨
queue) - ¢¨¤¨¬®, íâ® ¡ £, ª®â®àë© ¡ã¤¥â ¨á¯à ¢«¥­
* ebx à §àãè ¥âáï * ebx à §àãè ¥âáï
‡ ¬¥ç ­¨ï: ‡ ¬¥ç ­¨ï:
* ’¥ªãé ï ॠ«¨§ æ¨ï ­¥ § ªà뢠¥â  ¢â®¬ â¨ç¥áª¨ ¢á¥ ᮪¥âë ¯®â®ª  * ’¥ªãé ï ॠ«¨§ æ¨ï ­¥ § ªà뢠¥â  ¢â®¬ â¨ç¥áª¨ ¢á¥ ᮪¥âë ¯®â®ª 
¯à¨ ¥£® § ¢¥à襭¨¨. ç áâ­®áâ¨, ­¥ á«¥¤ã¥â ¯à¨¡¨¢ âì ¯®â®ª ¯à¨ ¥£® § ¢¥à襭¨¨. ç áâ­®áâ¨, ­¥ á«¥¤ã¥â ¯à¨¡¨¢ âì ¯®â®ª
á ªã祩 ®âªàëâëå ᮪¥â®¢ - ¡ã¤¥â ãâ¥çª  à¥áãàᮢ. á ªã祩 ®âªàëâëå ᮪¥â®¢ - ¡ã¤¥â ãâ¥çª  à¥áãàᮢ.
* ’¥ªãé ï ॠ«¨§ æ¨ï ­¥ ¤¥« ¥â ¯à®¢¥à®ª ­  ª®à४⭮áâì
(¥¤¨­á⢥­­®¥, ­  çâ® ¢®§¢à é ¥âáï ®è¨¡ª , - ¯®¯ë⪠ § ªàëâì
­¥®âªàëâë© á®ª¥â á ª®à४â­ë¬ åí­¤«®¬).
====================================================================== ======================================================================
== ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 9 - ¯à®¢¥à¨âì, ᢮¡®¤¥­ «¨ «®ª «ì­ë© ¯®àâ. = == ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 9 - ¯à®¢¥à¨âì, ᢮¡®¤¥­ «¨ «®ª «ì­ë© ¯®àâ. =
@ -2754,10 +2764,8 @@ dword-
* esi = ç¨á«® ¡ ©â ¤«ï ç⥭¨ï; * esi = ç¨á«® ¡ ©â ¤«ï ç⥭¨ï;
* esi = 0 - ç¨â âì ¢á¥ ¤ ­­ë¥ (¬ ªá¨¬ã¬ 4096 ¡ ©â) * esi = 0 - ç¨â âì ¢á¥ ¤ ­­ë¥ (¬ ªá¨¬ã¬ 4096 ¡ ©â)
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â * eax = ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â (0 ¯à¨ ­¥¢¥à­®¬ åí­¤«¥)
* ebx à §àãè ¥âáï * ebx à §àãè ¥âáï
‡ ¬¥ç ­¨ï:
* <20>஢¥àª¨ ­  ¯à ¢¨«ì­®áâì åí­¤«  ­¥ ¤¥« ¥âáï.
====================================================================== ======================================================================
”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 255 - ®â« ¤®ç­ ï ¨­ä®à¬ æ¨ï á¥â¥¢®£® ¤à ©¢¥à . ”ã­ªæ¨ï 53, ¯®¤äã­ªæ¨ï 255 - ®â« ¤®ç­ ï ¨­ä®à¬ æ¨ï á¥â¥¢®£® ¤à ©¢¥à .
@ -2791,59 +2799,6 @@ dword-
* 6: áâ âãá ¤à ©¢¥à  ¯ ª¥â®¢, 0=­¥ ªâ¨¢¥­, * 6: áâ âãá ¤à ©¢¥à  ¯ ª¥â®¢, 0=­¥ ªâ¨¢¥­,
­¥­ã«¥¢®¥ §­ ç¥­¨¥= ªâ¨¢¥­ ­¥­ã«¥¢®¥ §­ ç¥­¨¥= ªâ¨¢¥­
======================================================================
======== ”ã­ªæ¨ï 55, ¯®¤äã­ªæ¨ï 0 - § £à㧨âì ¤ ­­ë¥ ¤«ï SB16. =======
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 55 - ­®¬¥à ä㭪樨
* ebx = 0 - ­®¬¥à ¯®¤ä㭪樨
* ecx = 㪠§ â¥«ì ­  ¤ ­­ë¥ (ª®¯¨àã¥âáï 64 ª¨«®¡ ©â , ¨á¯®«ì§ã¥âáï
á⮫쪮, ᪮«ìª® ãáâ ­®¢«¥­® ¯®¤ä㭪樥© 2)
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
‡ ¬¥ç ­¨ï:
* ”®à¬ â ¨ à §¬¥à ¤ ­­ëå ãáâ ­ ¢«¨¢ îâáï ¯®¤ä㭪樥© 2.
======================================================================
==== ”ã­ªæ¨ï 55, ¯®¤äã­ªæ¨ï 1 - ­ ç âì ¯à®¨£à뢠âì ¤ ­­ë¥ ­  SB16. ===
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 55 - ­®¬¥à ä㭪樨
* ebx = 1 - ­®¬¥à ¯®¤ä㭪樨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
‡ ¬¥ç ­¨ï:
* <20>।¢ à¨â¥«ì­® ¤ ­­ë¥ ¤®«¦­ë ¡ëâì § £à㦥­ë ¯®¤ä㭪樥© 0 ¨
®¯à¥¤¥«ñ­ ¨å ä®à¬ â ¯®¤ä㭪樥© 2.
* ”ã­ªæ¨ï ¢®§¢à é ¥â ã¯à ¢«¥­¨¥, ª®£¤  ­ ç «®áì ¯à®¨£à뢠­¨¥ ¤ ­­ëå;
¯®á«¥ í⮣® ¯à®¨£à뢠­¨¥ ¨¤ñâ ­¥§ ¢¨á¨¬® ®â ¯à¨«®¦¥­¨ï (¨ ¢®®¡é¥
­¥ âॡã¥â § £à㧪¨ ¯à®æ¥áá®à ).
* <20>।¢ à¨â¥«ì­® ¤®«¦­ë ¡ëâì ®¯à¥¤¥«¥­ë ¡ §®¢ë© ¯®àâ SB16
(¯®¤ä㭪樥© 4 ä㭪樨 21) ¨ ª ­ « DMA
(¯®¤ä㭪樥© 10 ä㭪樨 21).
======================================================================
====== ”ã­ªæ¨ï 55, ¯®¤äã­ªæ¨ï 2 - ãáâ ­®¢¨âì ä®à¬ â ¤ ­­ëå SB16. =====
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 55 - ­®¬¥à ä㭪樨
* ebx = 2 - ­®¬¥à ¯®¤ä㭪樨
* ecx = 0 - ãáâ ­®¢¨âì à §à來®áâì
* edx = 1 - 8¡¨â ¬®­®
* edx = 2 - 8¡¨â áâ¥à¥®
* ecx = 1 - ãáâ ­®¢¨âì à §¬¥à ¤ ­­ëå
* edx = à §¬¥à ¢ ¡ ©â å
* ecx = 2 - ãáâ ­®¢¨âì ç áâ®â㠯ந£à뢠­¨ï
* edx = ç áâ®â 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
‡ ¬¥ç ­¨ï:
* <20>ਠ§ £à㧪¥ á¨á⥬ë ãáâ ­ ¢«¨¢ îâáï á«¥¤ãî騥 ¯ à ¬¥âàë
¯® 㬮«ç ­¨î: à §à來®áâì - 8 ¡¨â ¬®­®, à §¬¥à - 64 Š¡,
ç áâ®â  44100 ƒæ. ’¥¬ ­¥ ¬¥­¥¥ ४®¬¥­¤ã¥âáï ® ãáâ ­ ¢«¨¢ âì
­¥®¡å®¤¨¬ë¥ §­ ç¥­¨ï, ¯®áª®«ìªã ®­¨ ¬®£«¨ ¡ëâì ¯¥à¥ãáâ ­®¢«¥­ë
ª ª®©-­¨¡ã¤ì ¯à®£à ¬¬®©.
====================================================================== ======================================================================
====================== ”ã­ªæ¨ï 55, ¯®¤äã­ªæ¨ï 55 ===================== ====================== ”ã­ªæ¨ï 55, ¯®¤äã­ªæ¨ï 55 =====================
========== <20> ç âì ¯à®¨£à뢠âì ¤ ­­ë¥ ­  ¢áâ஥­­®¬ ᯨª¥à¥. ========== ========== <20> ç âì ¯à®¨£à뢠âì ¤ ­­ë¥ ­  ¢áâ஥­­®¬ ᯨª¥à¥. ==========
@ -3402,7 +3357,7 @@ IPC
* ebx = 㪠§ â¥«ì ­  ¨§®¡à ¦¥­¨¥ * ebx = 㪠§ â¥«ì ­  ¨§®¡à ¦¥­¨¥
* ecx = [à §¬¥à ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ y] * ecx = [à §¬¥à ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ y]
* edx = [ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [ª®®à¤¨­ â  ¯® ®á¨ y] * edx = [ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [ª®®à¤¨­ â  ¯® ®á¨ y]
* esi = ç¨á«® ¡¨â ­  ¯¨ªá¥«ì, ¤®«¦­® ¡ëâì 1, 4, 8, 15, 16, 24 ¨«¨ 32 * esi = ç¨á«® ¡¨â ­  ¯¨ªá¥«ì, ¤®«¦­® ¡ëâì 1,2,4,8,15,16,24 ¨«¨ 32
* edi = 㪠§ â¥«ì ­  ¯ «¨âàã (2 ¢ á⥯¥­¨ esi 梥⮢ 0x00RRGGBB); * edi = 㪠§ â¥«ì ­  ¯ «¨âàã (2 ¢ á⥯¥­¨ esi 梥⮢ 0x00RRGGBB);
¨£­®à¨àã¥âáï ¯à¨ esi > 8 ¨£­®à¨àã¥âáï ¯à¨ esi > 8
* ebp = ᬥ饭¨¥ ¤ ­­ëå ª ¦¤®© á«¥¤ãî饩 áâப¨ ¨§®¡à ¦¥­¨ï * ebp = ᬥ饭¨¥ ¤ ­­ëå ª ¦¤®© á«¥¤ãî饩 áâப¨ ¨§®¡à ¦¥­¨ï
@ -3412,27 +3367,28 @@ IPC
‡ ¬¥ç ­¨ï: ‡ ¬¥ç ­¨ï:
* Š®®à¤¨­ âë ¨§®¡à ¦¥­¨ï - íâ® ª®®à¤¨­ âë ¢¥àå­¥£® «¥¢®£® 㣫  * Š®®à¤¨­ âë ¨§®¡à ¦¥­¨ï - íâ® ª®®à¤¨­ âë ¢¥àå­¥£® «¥¢®£® 㣫 
¨§®¡à ¦¥­¨ï ®â­®á¨â¥«ì­® ®ª­ . ¨§®¡à ¦¥­¨ï ®â­®á¨â¥«ì­® ®ª­ .
* <20> §¬¥à ¨§®¡à ¦¥­¨ï ¢ ¡ ©â å ¥áâì xsize*ysize.
* ”®à¬ â ¨§®¡à ¦¥­¨ï á 1 ¡¨â®¬ ­  ¯¨ªá¥«ì: ª ¦¤ë© ¡ ©â ¨§®¡à ¦¥­¨ï, * ”®à¬ â ¨§®¡à ¦¥­¨ï á 1 ¡¨â®¬ ­  ¯¨ªá¥«ì: ª ¦¤ë© ¡ ©â ¨§®¡à ¦¥­¨ï,
§  ¨áª«î祭¨¥¬, ¡ëâì ¬®¦¥â, ¯®á«¥¤­¨å ¡ ©â®¢ áâப, ᮤ¥à¦¨â §  ¨áª«î祭¨¥¬, ¡ëâì ¬®¦¥â, ¯®á«¥¤­¨å ¡ ©â®¢ áâப, ᮤ¥à¦¨â
¨­ä®à¬ æ¨î ® 梥⥠8 ¯¨ªá¥«¥©, áâ à訩 ¡¨â ᮮ⢥âáâ¢ã¥â ¯¥à¢®¬ã ¨­ä®à¬ æ¨î ® 梥⥠8 ¯¨ªá¥«¥©, áâ à訩 ¡¨â ᮮ⢥âáâ¢ã¥â ¯¥à¢®¬ã
¯¨ªá¥«î. ¯¨ªá¥«î.
* ”®à¬ â ¨§®¡à ¦¥­¨ï á 2 ¡¨â ¬¨ ­  ¯¨ªá¥«ì: ª ¦¤ë© ¡ ©â ¨§®¡à ¦¥­¨ï,
§  ¨áª«î祭¨¥¬, ¡ëâì ¬®¦¥â, ¯®á«¥¤­¨å ¡ ©â®¢ áâப, ᮤ¥à¦¨â
¨­ä®à¬ æ¨î ® 梥⥠4 ¯¨ªá¥«¥©, áâ à訥 ¤¢  ¡¨â  ᮮ⢥âáâ¢ãîâ
¯¥à¢®¬ã ¯¨ªá¥«î.
* ”®à¬ â ¨§®¡à ¦¥­¨ï á 4 ¡¨â ¬¨ ­  ¯¨ªá¥«ì: ª ¦¤ë© ¡ ©â ¨§®¡à ¦¥­¨ï, * ”®à¬ â ¨§®¡à ¦¥­¨ï á 4 ¡¨â ¬¨ ­  ¯¨ªá¥«ì: ª ¦¤ë© ¡ ©â ¨§®¡à ¦¥­¨ï,
§  ¨áª«î祭¨¥¬ ¯®á«¥¤­¨å ¡ ©â®¢ áâப (¥á«¨ è¨à¨­  ¨§®¡à ¦¥­¨ï §  ¨áª«î祭¨¥¬ ¯®á«¥¤­¨å ¡ ©â®¢ áâப (¥á«¨ è¨à¨­  ¨§®¡à ¦¥­¨ï
­¥çñâ­ ), ᮤ¥à¦¨â ¨­ä®à¬ æ¨î ® 梥⥠2 ¯¨ªá¥«¥©, áâ àè ï â¥âà ¤  ­¥çñâ­ ), ᮤ¥à¦¨â ¨­ä®à¬ æ¨î ® 梥⥠2 ¯¨ªá¥«¥©, áâ àè ï â¥âà ¤ 
ᮮ⢥âáâ¢ã¥â ¯¥à¢®¬ã ¯¨ªá¥«î. ᮮ⢥âáâ¢ã¥â ¯¥à¢®¬ã ¯¨ªá¥«î.
* ”®à¬ â ¨§®¡à ¦¥­¨ï á 8 ¡¨â ¬¨ ­  ¯¨ªá¥«ì: ª ¦¤ë© ¡ ©â ¨§®¡à ¦¥­¨ï * ”®à¬ â ¨§®¡à ¦¥­¨ï á 8 ¡¨â ¬¨ ­  ¯¨ªá¥«ì: ª ¦¤ë© ¡ ©â ¨§®¡à ¦¥­¨ï
à áᬠâਢ ¥âáï ª ª ¨­¤¥ªá ¢ ¯ «¨âà¥. à áᬠâਢ ¥âáï ª ª ¨­¤¥ªá ¢ ¯ «¨âà¥.
* …᫨ ¨§®¡à ¦¥­¨¥ ¨á¯®«ì§ã¥â ­¥ ¢á¥ 256 梥⮢,   ¬¥­ìè¥,
à §¬¥à ¯ «¨âàë ¬®¦¥â ¡ëâì ¬¥­ìè¥ 256.
* ”®à¬ â ¨§®¡à ¦¥­¨ï á 15 ¡¨â ¬¨ ­  ¯¨ªá¥«ì: 梥⠪ ¦¤®£® ¯¨ªá¥«ï * ”®à¬ â ¨§®¡à ¦¥­¨ï á 15 ¡¨â ¬¨ ­  ¯¨ªá¥«ì: 梥⠪ ¦¤®£® ¯¨ªá¥«ï
ª®¤¨àã¥âáï ª ª (¢ ¡¨â®¢®¬ ¯à¥¤áâ ¢«¥­¨¨) 0RRRRRGGGGGBBBBB - ª®¤¨àã¥âáï ª ª (¢ ¡¨â®¢®¬ ¯à¥¤áâ ¢«¥­¨¨) 0RRRRRGGGGGBBBBB -
¯® 5 ¯¨ªá¥«¥© ­  ª ¦¤ë© 梥â. ¯® 5 ¯¨ªá¥«¥© ­  ª ¦¤ë© 梥â.
* ”®à¬ â ¨§®¡à ¦¥­¨ï á 16 ¡¨â ¬¨ ­  ¯¨ªá¥«ì: 梥⠪ ¦¤®£® ¯¨ªá¥«ï * ”®à¬ â ¨§®¡à ¦¥­¨ï á 16 ¡¨â ¬¨ ­  ¯¨ªá¥«ì: 梥⠪ ¦¤®£® ¯¨ªá¥«ï
ª®¤¨àã¥âáï ª ª RRRRRGGGGGGBBBBB (á奬  5+6+5). ª®¤¨àã¥âáï ª ª RRRRRGGGGGGBBBBB (á奬  5+6+5).
* ”®à¬ â ¨§®¡à ¦¥­¨ï á 24 ¡¨â ¬¨ ­  ¯¨ªá¥«ì: 梥⠪ ¦¤®£® ¯¨ªá¥«ï * ”®à¬ â ¨§®¡à ¦¥­¨ï á 24 ¡¨â ¬¨ ­  ¯¨ªá¥«ì: 梥⠪ ¦¤®£® ¯¨ªá¥«ï
ª®¤¨àã¥âáï âà¥¬ï ¡ ©â ¬¨ - ¯®á«¥¤®¢ â¥«ì­® ᨭïï, §¥«ñ­ ï, ª®¤¨àã¥âáï âà¥¬ï ¡ ©â ¬¨ - ¯®á«¥¤®¢ â¥«ì­® ᨭïï, §¥«ñ­ ï, ªà á­ ï
ªà á­ ï á®áâ ¢«ïî騥 梥â . á®áâ ¢«ïî騥 梥â .
* ”®à¬ â ¨§®¡à ¦¥­¨ï á 32 ¡¨â ¬¨ ­  ¯¨ªá¥«ì:  ­ «®£¨ç­® 24, ⮫쪮 * ”®à¬ â ¨§®¡à ¦¥­¨ï á 32 ¡¨â ¬¨ ­  ¯¨ªá¥«ì:  ­ «®£¨ç­® 24, ⮫쪮
¥áâì ¥éñ ¨£­®à¨àã¥¬ë© ç¥â¢ñàâë© ¡ ©â. ¥áâì ¥éñ ¨£­®à¨àã¥¬ë© ç¥â¢ñàâë© ¡ ©â.
* ‚맮¢ ä㭪樨 7 íª¢¨¢ «¥­â¥­ ¢ë§®¢ã í⮩ ä㭪樨 á ¯ à ¬¥âà ¬¨ * ‚맮¢ ä㭪樨 7 íª¢¨¢ «¥­â¥­ ¢ë§®¢ã í⮩ ä㭪樨 á ¯ à ¬¥âà ¬¨
@ -3685,30 +3641,24 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
¨«¨ ¯®¤ä㭪樥© 20. ¨«¨ ¯®¤ä㭪樥© 20.
====================================================================== ======================================================================
===== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 14 - ®¦¨¤ âì ¨§¢¥é¥­¨ï ®â ¤à ©¢¥à . ===== ==================== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 14 =======================
===== Ž¦¨¤ âì ¯®«ã祭¨ï ᨣ­ « , ®â ¤àã£¨å ¯à¨«®¦¥­¨©/¤à ©¢¥à®¢. =====
====================================================================== ======================================================================
<EFBFBD> à ¬¥âàë: <EFBFBD> à ¬¥âàë:
* eax = 68 - ­®¬¥à ä㭪樨 * eax = 68 - ­®¬¥à ä㭪樨
* ebx = 14 - ­®¬¥à ¯®¤ä㭪樨 * ebx = 14 - ­®¬¥à ¯®¤ä㭪樨
* ecx = 㪠§ â¥«ì ­  ¡ãä¥à ¤«ï ¨­ä®à¬ æ¨¨ (8 ¡ ©â) * ecx = 㪠§ â¥«ì ­  ¡ãä¥à ¤«ï ¨­ä®à¬ æ¨¨ (24 ¡ ©â )
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* ¡ãä¥à, ­  ª®â®àë© ãª §ë¢ ¥â ecx, ᮤ¥à¦¨â á«¥¤ãîéãî ¨­ä®à¬ æ¨î: * ¡ãä¥à, ­  ª®â®àë© ãª §ë¢ ¥â ecx, ᮤ¥à¦¨â á«¥¤ãîéãî ¨­ä®à¬ æ¨î:
* +0: dword: ª®­áâ ­â  EV_INTR = 1 * +0: dword: ¨¤¥­â¨ä¨ª â®à ¯®á«¥¤ãîé¨å ¤ ­­ëå ᨣ­ « 
* +4: dword: ¤ ­­ë¥ ¤à ©¢¥à  * +4: ¤ ­­ë¥ ¯à¨­ï⮣® ᨣ­ «  (20 ¡ ©â), ä®à¬ â ª®â®àëå
‡ ¬¥ç ­¨ï: ®¯à¥¤¥«ï¥âáï ¯¥à¢ë¬ dword-®¬
* ’¥ªãé ï ॠ«¨§ æ¨ï ¢® ¢à¥¬ï ®¦¨¤ ­¨ï âॡã¥â ¤®¢®«ì­® "âï¦ñ«ëå"
®¯¥à æ¨© ¯¥à¥ª«î祭¨ï ª®­â¥ªáâ .
====================================================================== ======================================================================
== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 15 - ãáâ ­®¢¨âì ®¡à ¡®â稪 ¨áª«î祭¨© FPU. = == ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 15 - ãáâ ­®¢¨âì ®¡à ¡®â稪 ¨áª«î祭¨© FPU. =
====================================================================== ======================================================================
<EFBFBD> à ¬¥âàë: “¤ «¥­  (¢ ⥪ã饩 ॠ«¨§ æ¨¨ ¯à®áâ® ¢®§¢à é ¥â 0)
* eax = 68 - ­®¬¥à ä㭪樨 ˆá¯®«ì§®¢ âì ¯®¤ä㭪樨 24, 25
* ebx = 15 - ­®¬¥à ¯®¤ä㭪樨
* ecx =  ¤à¥á ­®¢®£® ®¡à ¡®â稪  ¨áª«î祭¨©
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax =  ¤à¥á áâ à®£® ®¡à ¡®â稪  ¨áª«î祭¨©
(0, ¥á«¨ ®­ ­¥ ¡ë« ãáâ ­®¢«¥­)
====================================================================== ======================================================================
=========== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 16 - § £à㧨âì ¤à ©¢¥à. =========== =========== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 16 - § £à㧨âì ¤à ©¢¥à. ===========
@ -3751,13 +3701,8 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
====================================================================== ======================================================================
== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 18 - ãáâ ­®¢¨âì ®¡à ¡®â稪 ¨áª«î祭¨© SSE. = == ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 18 - ãáâ ­®¢¨âì ®¡à ¡®â稪 ¨áª«î祭¨© SSE. =
====================================================================== ======================================================================
<EFBFBD> à ¬¥âàë: “¤ «¥­  (¢ ⥪ã饩 ॠ«¨§ æ¨¨ ¯à®áâ® ¢®§¢à é ¥â 0)
* eax = 68 - ­®¬¥à ä㭪樨 ˆá¯®«ì§®¢ âì ¯®¤ä㭪樨 24, 25
* ebx = 18 - ­®¬¥à ¯®¤ä㭪樨
* ecx =  ¤à¥á ­®¢®£® ®¡à ¡®â稪  ¨áª«î祭¨©
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax =  ¤à¥á áâ à®£® ®¡à ¡®â稪  ¨áª«î祭¨©
(0, ¥á«¨ ®­ ­¥ ¡ë« ãáâ ­®¢«¥­)
====================================================================== ======================================================================
============= ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 19 - § £à㧨âì DLL. ============= ============= ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 19 - § £à㧨âì DLL. =============
@ -3798,6 +3743,104 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* ‘®¤¥à¦¨¬®¥ ¯ ¬ï⨠¢¯«®âì ¤® ­ ¨¬¥­ì襣® ¨§ áâ à®£® ¨ ­®¢®£® * ‘®¤¥à¦¨¬®¥ ¯ ¬ï⨠¢¯«®âì ¤® ­ ¨¬¥­ì襣® ¨§ áâ à®£® ¨ ­®¢®£®
à §¬¥à®¢ á®åà ­ï¥âáï. à §¬¥à®¢ á®åà ­ï¥âáï.
======================================================================
=== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 22 - ®âªàëâì ¨¬¥­®¢ ­­ãî ®¡« áâì ¯ ¬ïâ¨. ==
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 68 - ­®¬¥à ä㭪樨
* ebx = 22 - ­®¬¥à ¯®¤ä㭪樨
* ecx = ¨¬ï ®¡« áâ¨. Œ ªá¨¬ã¬ 31 ᨬ¢®«, ¢ª«îç ï § ¢¥àè î騩 ­®«ì
* edx = à §¬¥à ®¡« á⨠¢ ¡ ©â å ¤«ï SHM_CREATE ¨ SHM_OPEN_ALWAYS
* esi = ä« £¨ ®âªàëâ¨ï ¨ ¤®áâ㯠:
* SHM_OPEN = 0x00 - ®âªàëâì áãé¥áâ¢ãîéãî ®¡« áâì ¯ ¬ïâ¨.
…᫨ ®¡« áâì á â ª¨¬ ¨¬¥­¥¬ ­¥ áãé¥áâ¢ã¥â,
äã­ªæ¨ï ¢¥à­ñâ ª®¤ ®è¨¡ª¨ 5.
* SHM_OPEN_ALWAYS = 0x04 - ®âªàëâì áãé¥áâ¢ãîéãî ¨«¨ ᮧ¤ âì ­®¢ãî
®¡« áâì ¯ ¬ïâ¨.
* SHM_CREATE = 0x08 - ᮧ¤ âì ­®¢ãî ®¡« áâì ¯ ¬ïâ¨.
…᫨ ®¡« áâì á â ª¨¬ ¨¬¥­¥¬ 㦥 áãé¥áâ¢ã¥â,
äã­ªæ¨ï ¢¥à­ñâ ª®¤ ®è¨¡ª¨ 10.
* SHM_READ = 0x00 - ¤®áâ㯠⮫쪮 ­  ç⥭¨¥
* SHM_WRITE = 0x01 - ¤®áâ㯠­  ç⥭¨¥ ¨ § ¯¨áì
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 㪠§ â¥«ì ­  ®¡« áâì ¯ ¬ïâ¨, 0 ¯à¨ ®è¨¡ª¥
* ¯à¨ ᮧ¤ ­¨¨ ­®¢®© ®¡« á⨠(SHM_CREATE ¨«¨ SHM_OPEN_ALWAYS):
edx = 0 - ãᯥå, ¨­ ç¥ - ª®¤ ®è¨¡ª¨
* ¯à¨ ®âªàë⨨ áãé¥áâ¢ãî饩 ®¡« á⨠(SHM_OPEN ¨«¨ SHM_OPEN_ALWAYS):
edx = ª®¤ ®è¨¡ª¨ (¯à¨ eax=0) ¨«¨ à §¬¥à ®¡« á⨠¢ ¡ ©â å
Š®¤ë ®è¨¡®ª:
* E_NOTFOUND = 5
* E_ACCESS = 10
* E_NOMEM = 30
* E_PARAM = 33
‡ ¬¥ç ­¨ï:
* …᫨ ᮧ¤ ñâáï ­®¢ ï ®¡« áâì, â® ä« £¨ ¤®áâ㯠 ãáâ ­ ¢«¨¢ îâ
¬ ªá¨¬ «ì­ë¥ ¯à ¢  ¤®áâ㯠 ¤«ï ®áâ «ì­ëå ¯à®æ¥áᮢ. <20>®¯ë⪠
®âªàëâ¨ï ¤à㣨¬ ¯®â®ª®¬ á ­¥à §à¥èñ­­ë¬¨ ¯à ¢ ¬¨ ¯à®¢ «¨âáï
á ª®¤®¬ ®è¨¡ª¨ E_ACCESS.
* <20>à®æ¥áá, ᮧ¤ ¢è¨© ®¡« áâì, ¢á¥£¤  ¨¬¥¥â ¤®áâ㯠­  § ¯¨áì.
======================================================================
=== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 23 - § ªàëâì ¨¬¥­®¢ ­­ãî ®¡« áâì ¯ ¬ïâ¨. ==
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 68 - ­®¬¥à ä㭪樨
* ebx = 23 - ­®¬¥à ¯®¤ä㭪樨
* ecx = ¨¬ï ®¡« áâ¨. Œ ªá¨¬ã¬ 31 ᨬ¢®«, ¢ª«îç ï § ¢¥àè î騩 ­®«ì
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax à §àãè ¥âáï
‡ ¬¥ç ­¨ï:
* Ž¡« áâì ¯ ¬ï⨠䨧¨ç¥áª¨ ®á¢®¡®¦¤ ¥âáï (á § ¡ë¢ ­¨¥¬ ¢á¥å ¤ ­­ëå
¨ ¢ë᢮¡®¦¤¥­¨¥¬ 䨧¨ç¥áª®© ¯ ¬ïâ¨), ª®£¤  ¥ñ § ªà®îâ
¢á¥ ®âªàë¢è¨¥ ¯®â®ª¨.
* <20>ਠ§ ¢¥à襭¨¨ ¯®â®ª  ®á¢®¡®¦¤ îâáï ¢á¥ ®âªàëâë¥ ¨¬
®¡« á⨠¯ ¬ïâ¨.
======================================================================
==== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 24 - ãáâ ­®¢¨âì ®¡à ¡®â稪 ¨áª«î祭¨© ===
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 68 - ­®¬¥à ä㭪樨
* ebx = 24 - ­®¬¥à ¯®¤ä㭪樨
* ecx =  ¤à¥á ­®¢®£® ®¡à ¡®â稪  ¨áª«î祭¨©
* edx = ¬ áª  ®¡à ¡ â뢠¥¬ëå ¨áª«î祭¨©
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax =  ¤à¥á áâ à®£® ®¡à ¡®â稪  ¨áª«î祭¨© (0, ¥á«¨ ­¥ ãáâ ­®¢«¥­)
* ebx = ¬ áª  áâ à®£® ®¡à ¡®â稪  ¨áª«î祭¨©
‡ ¬¥ç ­¨ï:
* <20>®¬¥à ¡¨â  ¢ ¬ áª¥ ¨áª«î祭¨© ᮮ⢥âáâ¢ãîâ ­®¬¥à㠨᪫î祭¨ï ¯®
ᯥæ¨ä¨ª æ¨¨ ­  ¯à®æ¥áá®à (Intel-PC). ’ ª ­ ¯à¨¬¥à, ¨áª«î祭¨ï FPU
¨¬¥îâ ­®¬¥à 16 (#MF),   SSE - 19 (#XF).
* ¤ ­­®© ॠ«¨§ æ¨¨ ¨£­®à¨àã¥âáï § ¯à®á ­  ¯¥à¥å¢ â ¨áª«î祭¨ï 7
- á¨á⥬  ®¡à ¡ â뢠¥â #NM á ¬®áâ®ï⥫쭮.
* <20>®«ì§®¢ â¥«ì᪨© ®¡à ¡®â稪 ¯®«ã砥⠭®¬¥à ¨áª«î祭¨ï ¯ à ¬¥â஬
¢ á⥪¥. <20>®í⮬㠯ࠢ¨«ì­ë© ¢ë室 ¨§ ®¡à ¡®â稪 : RET 4. ‚®§¢à â
¯à¨ í⮬ ¯à®¨§¢®¤¨âáï ­  ª®¬ ­¤ã, ¢ë§¢ ¢èãî ¨áª«î祭¨¥.
* <20>ਠ¯¥à¥¤ ç¥ ã¯à ¢«¥­¨ï ®¡à ¡®â稪㠨᪫î祭¨©, á¡à á뢠¥âáï
ᮮ⢥âáâ¢ãî騩 ¡¨â ¢ ¬ áª¥ ¨áª«î祭¨©. ‚®§­¨ª­®¢¥­¨¥ í⮣® ¦¥
¨áª«î祭¨ï ¢ ¯®á«¥¤á⢨¨ - ¯à¨¢¥¤¥â ª default-®¡à ¡®âª¥ â ª®¢®£®.
€ ¨¬¥­­®: ª § ¢¥à襭¨î à ¡®âë ¯à¨«®¦¥­¨ï, ¨«¨ ¯à¨®áâ ­®¢ª¥ á
­®â¨ä¨ª æ¨¥© ®â« ¦¨¢ î饬㠯ਫ®¦¥­¨î.
* <20>®á«¥ § ¢¥à襭¨ï ªà¨â¨ç¥áª¨å ¤¥©á⢨© ¢ ®¡à ¡®â稪¥ ¯®«ì§®¢ â¥«ï,
¢®ááâ ­®¢«¥­¨¥ ¡¨â  ¬ áª¨ ¤ ­­®£® ¨áª«î祭¨ï ¬®¦­® ᤥ« âì
¯®¤ä㭪樥© 25. ‘¡à®á ä« £®¢ ¨áª«î祭¨© ¢ ¬®¤ã«ïå FPU ¨ XMM -
â ª¦¥ ¢®§« £ ¥âáï ­  ®¡à ¡®â稪 ¯®«ì§®¢ â¥«ï.
======================================================================
= ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 25 - ¨§¬¥­¥­¨¥ á®áâ®ï­¨ï  ªâ¨¢­®á⨠ᨣ­ «  =
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 68 - ­®¬¥à ä㭪樨
* ebx = 25 - ­®¬¥à ¯®¤ä㭪樨
* ecx = ­®¬¥à ᨣ­ « 
* edx = §­ ç¥­¨¥ ãáâ ­ ¢«¨¢ ¥¬®©  ªâ¨¢­®á⨠(0/1)
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = áâ à®¥ §­ ç¥­¨¥  ªâ¨¢­®á⨠ᨣ­ «  (0/1)
‡ ¬¥ç ­¨ï:
* ⥪ã饩 ॠ«¨§ æ¨¨ ¨§¬¥­ï¥âáï ⮫쪮 ¬ áª  ¯®«ì§®¢ â¥«ì᪮£®
®¡à ¡®â稪  ¨áª«î祭¨©, ãáâ ­®¢«¥­­®£® ¯®¤ä㭪樥© 24. <20>ਠí⮬,
­®¬¥à ᨣ­ «  ᮮ⢥âáâ¢ã¥â ­®¬¥à㠨᪫î祭¨ï.
====================================================================== ======================================================================
======================== ”ã­ªæ¨ï 69 - ®â« ¤ª . ======================= ======================== ”ã­ªæ¨ï 69 - ®â« ¤ª . =======================
====================================================================== ======================================================================
@ -3831,8 +3874,8 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
…᫨ ®â« ¤ç¨ª í⮣® ­¥ å®ç¥â, ®­ ¤®«¦¥­ ¯à¥¤¢ à¨â¥«ì­® ®âª«îç¨âìáï …á«¨ ®â« ¤ç¨ª í⮣® ­¥ å®ç¥â, ®­ ¤®«¦¥­ ¯à¥¤¢ à¨â¥«ì­® ®âª«îç¨âìáï
¯®¤ä㭪樥© 3. ¯®¤ä㭪樥© 3.
‚ᥠ¯®¤ä㭪樨, ªà®¬¥ 4 ¨ 5, ¯à¨¬¥­¨¬ë ⮫쪮 ª ¯à®æ¥áá ¬/¯®â®ª ¬, ‚ᥠ¯®¤ä㭪樨 ¯à¨¬¥­¨¬ë ⮫쪮 ª ¯à®æ¥áá ¬/¯®â®ª ¬, § ¯ã饭­ë¬
§ ¯ã饭­ë¬ ¨§ ⥪ã饣® ä㭪樥© 70 á ãáâ ­®¢«¥­­ë¬ ä« £®¬ ®â« ¤ª¨. ¨§ ⥪ã饣® ä㭪樥© 70 á ãáâ ­®¢«¥­­ë¬ ä« £®¬ ®â« ¤ª¨.
Žâ« ¤ª  ¬­®£®¯®â®ç­ëå ¯à®£à ¬¬ ¯®ª  ­¥ ¯®¤¤¥à¦¨¢ ¥âáï. Žâ« ¤ª  ¬­®£®¯®â®ç­ëå ¯à®£à ¬¬ ¯®ª  ­¥ ¯®¤¤¥à¦¨¢ ¥âáï.
<EFBFBD>®«­ë© ᯨ᮪ ¯®¤ä㭪権: <EFBFBD>®«­ë© ᯨ᮪ ¯®¤ä㭪権:
* ¯®¤äã­ªæ¨ï 0 - ®¯à¥¤¥«¨âì ®¡« áâì ¤ ­­ëå ¤«ï ®â« ¤®ç­ëå á®®¡é¥­¨© * ¯®¤äã­ªæ¨ï 0 - ®¯à¥¤¥«¨âì ®¡« áâì ¤ ­­ëå ¤«ï ®â« ¤®ç­ëå á®®¡é¥­¨©
@ -3930,7 +3973,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* …᫨ ¯à®æ¥áá ¡ë« ¯à¨®áâ ­®¢«¥­, ®­ ¢®§®¡­®¢«ï¥â ¢ë¯®«­¥­¨¥. * …᫨ ¯à®æ¥áá ¡ë« ¯à¨®áâ ­®¢«¥­, ®­ ¢®§®¡­®¢«ï¥â ¢ë¯®«­¥­¨¥.
====================================================================== ======================================================================
=========== ”ã­ªæ¨ï 69, ¯®¤äã­ªæ¨ï 4 - ¯à¨®áâ ­®¢¨âì ¯®â®ª. ========== ==== ”ã­ªæ¨ï 69, ¯®¤äã­ªæ¨ï 4 - ¯à¨®áâ ­®¢¨âì ®â« ¦¨¢ ¥¬ë© ¯®â®ª. ====
====================================================================== ======================================================================
<EFBFBD> à ¬¥âàë: <EFBFBD> à ¬¥âàë:
* eax = 69 - ­®¬¥à ¯à®æ¥áá  * eax = 69 - ­®¬¥à ¯à®æ¥áá 
@ -3938,10 +3981,13 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* ecx = ¨¤¥­â¨ä¨ª â®à * ecx = ¨¤¥­â¨ä¨ª â®à
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï * äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
‡ ¬¥ç ­¨ï:
* <20>à®æ¥áá ¤®«¦¥­ ¡ëâì § £à㦥­ ¤«ï ®â« ¤ª¨ (ª ª 㪠§ ­® ¢
®¡é¥¬ ®¯¨á ­¨¨).
====================================================================== ======================================================================
====================== ”ã­ªæ¨ï 69, ¯®¤äã­ªæ¨ï 5 ====================== ====================== ”ã­ªæ¨ï 69, ¯®¤äã­ªæ¨ï 5 ======================
=================== ‚®§®¡­®¢¨âì ¢ë¯®«­¥­¨¥ ¯®â®ª . =================== ============ ‚®§®¡­®¢¨âì ¢ë¯®«­¥­¨¥ ®â« ¦¨¢ ¥¬®£® ¯®â®ª . ============
====================================================================== ======================================================================
<EFBFBD> à ¬¥âàë: <EFBFBD> à ¬¥âàë:
* eax = 69 - ­®¬¥à ä㭪樨 * eax = 69 - ­®¬¥à ä㭪樨
@ -3949,6 +3995,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* ecx = ¨¤¥­â¨ä¨ª â®à * ecx = ¨¤¥­â¨ä¨ª â®à
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï * äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
‡ ¬¥ç ­¨ï:
* <20>à®æ¥áá ¤®«¦¥­ ¡ëâì § £à㦥­ ¤«ï ®â« ¤ª¨ (ª ª 㪠§ ­® ¢
®¡é¥¬ ®¯¨á ­¨¨).
====================================================================== ======================================================================
====================== ”ã­ªæ¨ï 69, ¯®¤äã­ªæ¨ï 6 ====================== ====================== ”ã­ªæ¨ï 69, ¯®¤äã­ªæ¨ï 6 ======================

View File

@ -1,4 +1,4 @@
SYSTEM FUNCTIONS of OS Kolibri 0.7.1.0 SYSTEM FUNCTIONS of OS Kolibri 0.7.5.0
Number of the function is located in the register eax. Number of the function is located in the register eax.
The call of the system function is executed by "int 0x40" command. The call of the system function is executed by "int 0x40" command.
@ -219,9 +219,6 @@ Remarks:
and does not make any operations at all. If it is really required and does not make any operations at all. If it is really required
to transfer control to the next process (to complete a current to transfer control to the next process (to complete a current
time slice), use subfunction 1 of function 68. time slice), use subfunction 1 of function 68.
* At current implementation there will be an immediate return from
the function, if the addition of ebx with current value of
time counter will call 32-bit overflow.
====================================================================== ======================================================================
============== Function 6 - read the file from ramdisk. ============== ============== Function 6 - read the file from ramdisk. ==============
@ -613,16 +610,20 @@ Parameters:
* eax = 17 - function number * eax = 17 - function number
Returned value: Returned value:
* if the buffer is empty, function returns eax=1 * if the buffer is empty, function returns eax=1
* if the buffer is not empty, function returns: * if the buffer is not empty:
high 24 bits of eax contain button identifier (in particular, ah * high 24 bits of eax contain button identifier (in particular,
contains low byte of the identifier; if all buttons have ah contains low byte of the identifier; if all buttons have
the identifier less than 256, ah is enough to distinguish), the identifier less than 256, ah is enough to distinguish)
and al contain 0 - if used left mouse button or bit of the used another mouse button * al = 0 - the button was pressed with left mouse button
* al = bit corresponding to used mouse button otherwise
Remarks: Remarks:
* "Buffer" keeps only one button, at pressing the new button the * "Buffer" keeps only one button, at pressing the new button the
information about old is lost. information about old is lost.
* The call of this function by an application with inactive window * The call of this function by an application with inactive window
will return answer "buffer is empty". will return answer "buffer is empty".
* Returned value for al corresponds to the state of mouse buttons
as in subfunction 2 of function 37 at the beginning
of button press, excluding lower bit, which is cleared.
====================================================================== ======================================================================
= Function 18, subfunction 2 - terminate process/thread by the slot. = = Function 18, subfunction 2 - terminate process/thread by the slot. =
@ -731,7 +732,7 @@ Returned value:
* function does not return value * function does not return value
====================================================================== ======================================================================
============ Function 18, subfunction 9 - system shutdown. =========== == Function 18, subfunction 9 - system shutdown with the parameter. ==
====================================================================== ======================================================================
Parameters: Parameters:
* eax = 18 - function number * eax = 18 - function number
@ -747,8 +748,7 @@ Returned value:
Remarks: Remarks:
* Do not rely on returned value by incorrect call, it can be * Do not rely on returned value by incorrect call, it can be
changed in future versions of the kernel. changed in future versions of the kernel.
* It is possible to use subfunction 1, that on the last step
the user makes choice himself.
====================================================================== ======================================================================
===== Function 18, subfunction 10 - minimize application window. ===== ===== Function 18, subfunction 10 - minimize application window. =====
====================================================================== ======================================================================
@ -1126,11 +1126,6 @@ Remarks:
* CD base is used by function 24. * CD base is used by function 24.
* To get CD base use subfunction 3 of function 26. * To get CD base use subfunction 3 of function 26.
======================================================================
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
======================================================================
Removed
====================================================================== ======================================================================
========== Function 21, subfunction 5 - set system language. ========= ========== Function 21, subfunction 5 - set system language. =========
====================================================================== ======================================================================
@ -1191,11 +1186,6 @@ Remarks:
subfunction 11 of function 18. subfunction 11 of function 18.
* It is also necessary to define used HD base by subfunction 7. * It is also necessary to define used HD base by subfunction 7.
======================================================================
======== Function 21, subfunction 10 - set sound DMA channel. ========
======================================================================
Removed
====================================================================== ======================================================================
Function 21, subfunction 11 - enable/disable low-level access to HD. Function 21, subfunction 11 - enable/disable low-level access to HD.
====================================================================== ======================================================================
@ -1483,11 +1473,6 @@ Remarks:
* The function is supported only for ATAPI devices (CD and DVD). * The function is supported only for ATAPI devices (CD and DVD).
* An example of usage of the function is the application CD_tray. * An example of usage of the function is the application CD_tray.
======================================================================
=================== Function 25 - set SBPro volume. ==================
======================================================================
Removed
====================================================================== ======================================================================
======== Function 26, subfunction 1 - get MPU MIDI base port. ======== ======== Function 26, subfunction 1 - get MPU MIDI base port. ========
====================================================================== ======================================================================
@ -1547,11 +1532,6 @@ Remarks:
* CD base is used by function 24. * CD base is used by function 24.
* To set CD base use subfunction 3 of function 21. * To set CD base use subfunction 3 of function 21.
======================================================================
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
======================================================================
Removed
====================================================================== ======================================================================
========== Function 26, subfunction 5 - get system language. ========= ========== Function 26, subfunction 5 - get system language. =========
====================================================================== ======================================================================
@ -1614,11 +1594,6 @@ Remarks:
than 497 days. than 497 days.
* To get system time use function 3. * To get system time use function 3.
======================================================================
======== Function 26, subfunction 10 - get sound DMA channel. ========
======================================================================
Removed
====================================================================== ======================================================================
===================== Function 26, subfunction 11 ==================== ===================== Function 26, subfunction 11 ====================
========== Find out whether low-level HD access is enabled. ========== ========== Find out whether low-level HD access is enabled. ==========
@ -1646,11 +1621,6 @@ Remarks:
* The current implementation uses only low bit of ecx. * The current implementation uses only low bit of ecx.
* To set the current state use subfunction 12 of function 21. * To set the current state use subfunction 12 of function 21.
======================================================================
=================== Function 28 - set SB16 volume. ===================
======================================================================
Removed
====================================================================== ======================================================================
=================== Function 29 - get system date. =================== =================== Function 29 - get system date. ===================
====================================================================== ======================================================================
@ -1689,6 +1659,56 @@ Remarks:
* If the buffer is too small to hold all data, only first (edx-1) * If the buffer is too small to hold all data, only first (edx-1)
bytes are copied and than terminating 0 is inserted. bytes are copied and than terminating 0 is inserted.
======================================================================
=============== Function 32 - delete file from ramdisk. ==============
======================================================================
Parameters:
* eax = 32 - function number
* ebx = pointer to the filename
Returned value:
* eax = 0 - success; otherwise file system error code
Remarks:
* This function is obsolete; function 58 allows to fulfill
the same operations with the extended possibilities.
* The current implementation returns only values 0(success) and
5(file not found).
* The filename must be either in the format 8+3 characters
(first 8 characters - name itself, last 3 - extension,
the short names and extensions are supplemented with spaces),
or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
(name no more than 8 characters, dot, extension 3 characters
supplemented if necessary by spaces).
The filename must be written with capital letters. The terminating
character with code 0 is not necessary (not ASCIIZ-string).
* This function does not support folders on the ramdisk.
======================================================================
================ Function 33 - write file to ramdisk. ================
======================================================================
Parameters:
* eax = 33 - function number
* ebx = pointer to the filename
* ecx = pointer to data for writing
* edx = number of bytes for writing
* should be set esi=0
Returned value:
* eax = 0 - success, otherwise file system error code
Remarks:
* This function is obsolete; function 70 allows to fulfil
the same operations with extended possibilities.
* If esi contains non-zero value and selected file already exists,
one more file with the same name will be created.
* Otherwise file will be overwritten.
* The filename must be either in the format 8+3 characters
(first 8 characters - name itself, last 3 - extension,
the short names and extensions are supplemented with spaces),
or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
(name no more than 8 characters, dot, extension 3 characters
supplemented if necessary by spaces).
The filename must be written with capital letters. The terminating
character with code 0 is not necessary (not ASCIIZ-string).
* This function does not support folders on the ramdisk.
====================================================================== ======================================================================
======= Function 35 - read the color of a pixel on the screen. ======= ======= Function 35 - read the color of a pixel on the screen. =======
====================================================================== ======================================================================
@ -1706,6 +1726,22 @@ Remarks:
to videomemory through the selector gs. To get parameters of to videomemory through the selector gs. To get parameters of
the current videomode, use function 61. the current videomode, use function 61.
======================================================================
=================== Function 36 - read screen area. ==================
======================================================================
Paramters:
* eax = 36 - function number
* ebx = pointer to the previously allocated memory area,
where will be placed the image in the format BBGGRRBBGGRR...
* ecx = [size on axis x]*65536 + [size on axis y]
* edx = [coordinate on axis x]*65536 + [coordinate on axis y]
Returned value:
* function does not return value
Remarks:
* Coordinates of the image are coordinates of the upper left corner
of the image relative to the screen.
* Size of the image in bytes is 3*xsize*ysize.
====================================================================== ======================================================================
=================== Function 37 - work with mouse. =================== =================== Function 37 - work with mouse. ===================
====================================================================== ======================================================================
@ -1899,45 +1935,36 @@ Returned value:
* eax = -1 for incorrect ebx * eax = -1 for incorrect ebx
====================================================================== ======================================================================
==================== Function 42 - work with IRQ data. =============== ================== Function 42 - work with IRQ data. =================
====================================================================== ======================================================================
------------------------ Reading data --------------------------------
When an IRQ occurs, the system reads data from ports indicated When an IRQ occurs, the system reads data from ports indicated
earlier by function 44 and writes this data to earlier by function 44 and writes this data to
internal buffer. This function reads out data from that buffer internal buffer. This function reads out data from that buffer.
to the buffer specified as parameter.
--------------------- Subfunction 0 - read data ----------------------
Parameters: Parameters:
* eax = 42 - function number * eax = 42 - function number
* bl = IRQ number, 0..15 * bl = IRQ number, 0..15
* bh = subfunction number, 0 * bh = 0 - subfunction number
Other part of register ebx, must be zero. * rest of ebx must be zeroed
* ecx = pointer to the receive buffer * ecx = pointer to a buffer with size not less than 4000 bytes
Returned value: (use value of eax to distinguish) Returned value: (use value of eax to distinguish)
* if the thread is not IRQ owner (or IRQ number is incorrect): * if the thread is not IRQ owner
* eax = -1 (or IRQ number is incorrect): eax = -1
* if there is no data: * if there is no data: eax = 0
* eax = 0
* if all is ok: * if all is ok:
* eax = byte size of data, read from buffer eax = size of data read (in bytes)
See remarks below.
------------------------ Get data size -------------------------------
------------- Subfunction 1 - get size of data in buffer -------------
Parameters: Parameters:
* eax = 42 - function number * eax = 42 - function number
* bl = IRQ number, 0..15 * bl = IRQ number, 0..15
* bh = subfunction number, 0 * bh = 0 - subfunction number
Other part of register ebx, must be zero. * rest of ebx must be zeroed
* ecx = pointer to receive buffer Returned value:
Returned value: (use value of eax to distinguish) * if the thread is not IRQ owner
* if the thread is not IRQ owner (or IRQ number is incorrect): (or IRQ number is incorrect): eax = -1
* eax = -1 * otherwise eax = size of data in buffer
* if all is ok:
* eax = byte size of data in buffer
Remarks: Remarks:
* Previously the thread must reserve indicated IRQ for itself * Previously the thread must reserve indicated IRQ for itself
by function 45. by function 45.
@ -2562,9 +2589,6 @@ Remarks:
sockets of a thread at termination. In particular, one should not sockets of a thread at termination. In particular, one should not
kill a thread with many opened sockets - there will be an outflow kill a thread with many opened sockets - there will be an outflow
of resources. of resources.
* The current implementation does no checks on correctness
(function returns error only if thread tries to close not opened
socket with correct handle).
====================================================================== ======================================================================
============== Function 53, subfunction 2 - poll socket. ============= ============== Function 53, subfunction 2 - poll socket. =============
@ -2574,10 +2598,8 @@ Parameters:
* ebx = 2 - subfunction number * ebx = 2 - subfunction number
* ecx = socket handle * ecx = socket handle
Returned value: Returned value:
* eax = number of read bytes * eax = number of read bytes, 0 for incorrect handle
* ebx destroyed * ebx destroyed
Remarks:
* There is no checks for correctness.
====================================================================== ======================================================================
========= Function 53, subfunction 3 - read byte from socket. ======== ========= Function 53, subfunction 3 - read byte from socket. ========
@ -2587,12 +2609,10 @@ Parameters:
* ebx = 3 - subfunction number * ebx = 3 - subfunction number
* ecx = socket handle * ecx = socket handle
Returned value: Returned value:
* if there is no read data: eax=0, bl=0, * if there is no read data or handle is incorrect: eax=0, bl=0,
other bytes of ebx are destroyed other bytes of ebx are destroyed
* if there are read data: eax=number of rest bytes * if there are read data: eax=number of rest bytes
(possibly 0), bl=read byte, other bytes of ebx are destroyed (possibly 0), bl=read byte, other bytes of ebx are destroyed
Remarks:
* There is no checks for correctness.
====================================================================== ======================================================================
========== Function 53, subfunction 4 - write to UDP-socket. ========= ========== Function 53, subfunction 4 - write to UDP-socket. =========
@ -2604,13 +2624,10 @@ Parameters:
* edx = number of bytes to write * edx = number of bytes to write
* esi = pointer to data to write * esi = pointer to data to write
Returned value: Returned value:
* eax = 0xffffffff - invalid handle * eax = 0xffffffff - error (invalid handle or not enough memory)
* eax = 0xffff - not enough memory
* eax = 0 - success * eax = 0 - success
* ebx destroyed * ebx destroyed
Remarks: Remarks:
* Check on validity of handle is minimal - only not very incorrect
not opened handles are eliminated.
* Number of bytes to write must not exceed 1500-28, though * Number of bytes to write must not exceed 1500-28, though
the appropriate check is not made. the appropriate check is not made.
@ -2638,7 +2655,7 @@ Parameters:
* ebx = 6 - subfunction number * ebx = 6 - subfunction number
* ecx = socket handle * ecx = socket handle
Returned value: Returned value:
* eax = socket status: one of * eax = 0 for incorrect handle or socket status: one of
* TCB_LISTEN = 1 * TCB_LISTEN = 1
* TCB_SYN_SENT = 2 * TCB_SYN_SENT = 2
* TCB_SYN_RECEIVED = 3 * TCB_SYN_RECEIVED = 3
@ -2650,9 +2667,7 @@ Returned value:
* TCB_LAST_ASK = 9 * TCB_LAST_ASK = 9
* TCB_TIME_WAIT = 10 * TCB_TIME_WAIT = 10
* TCB_CLOSED = 11 * TCB_CLOSED = 11
* ebx destroys * ebx destroyed
Remarks:
* There is no checks for correctness.
====================================================================== ======================================================================
========== Function 53, subfunction 7 - write to TCP-socket. ========= ========== Function 53, subfunction 7 - write to TCP-socket. =========
@ -2664,13 +2679,10 @@ Parameters:
* edx = number of bytes to write * edx = number of bytes to write
* esi = pointer to data to write * esi = pointer to data to write
Returned value: Returned value:
* eax = 0xffffffff - error * eax = 0xffffffff - error (invalid handle or not enough memory)
* eax = 0xffff - not enough memory
* eax = 0 - success * eax = 0 - success
* ebx destroyed * ebx destroyed
Remarks: Remarks:
* Check on validity of handle is minimal - only not very incorrect
not opened handles are eliminated.
* Number of bytes to write must not exceed 1500-40, though * Number of bytes to write must not exceed 1500-40, though
the appropriate check is not made. the appropriate check is not made.
@ -2682,20 +2694,15 @@ Parameters:
* ebx = 8 - subfunction number * ebx = 8 - subfunction number
* ecx = socket handle * ecx = socket handle
Returned value: Returned value:
* eax = -1 - invalid handle * eax = -1 - error (invalid handle or
* eax = 0xffff - not enough memory for socket close packet not enough memory for socket close packet)
* eax = 0 - success * eax = 0 - success
* in many cases eax is destroyed (the result of function 'queue'
is returned) - probably this is bug, which will be corrected
* ebx destroyed * ebx destroyed
Remarks: Remarks:
* The current implementation does not close automatically all * The current implementation does not close automatically all
sockets of a thread at termination. In particular, one should not sockets of a thread at termination. In particular, one should not
kill a thread with many opened sockets - there will be an outflow kill a thread with many opened sockets - there will be an outflow
of resources. of resources.
* The current implementation does no checks on correctness
(function returns error only if thread tries to close not opened
socket with correct handle).
====================================================================== ======================================================================
=== Function 53, subfunction 9 - check whether local port is free. === === Function 53, subfunction 9 - check whether local port is free. ===
@ -2736,10 +2743,8 @@ Paramters:
* esi = number of bytes to read; * esi = number of bytes to read;
* esi = 0 - read all data (maximum 4096 bytes) * esi = 0 - read all data (maximum 4096 bytes)
Returned value: Returned value:
* eax = number of bytes read * eax = number of bytes read (0 for incorrect handle)
* ebx destroyed * ebx destroyed
Remakrs:
* There is no check on handle correctness.
====================================================================== ======================================================================
= Function 53, subfunction 255 - debug information of network driver. = Function 53, subfunction 255 - debug information of network driver.
@ -2772,58 +2777,6 @@ Possible values for ecx:
* 5: total number of received ARP-packets * 5: total number of received ARP-packets
* 6: status of packet driver, 0=inactive, nonzero=active * 6: status of packet driver, 0=inactive, nonzero=active
======================================================================
========== Function 55, subfunction 0 - load data for SB16. ==========
======================================================================
Parameters:
* eax = 55 - function number
* ebx = 0 - subfunction number
* ecx = pointer to data (is copied 64 kilobytes, is used as much as
set by subfunction 2)
Returned value:
* function does not return value
Remarks:
* Format and size of data are set by subfunction 2.
======================================================================
======== Function 55, subfunction 1 - begin play data on SB16. =======
======================================================================
Parameters:
* eax = 55 - function number
* ebx = 1 - subfunction number
Returned value:
* function does not return value
Remarks:
* Previously data must be loaded by subfunction 0 and
their format must be defined by subfunction 2.
* Function returns control, when playing of data began; after that
play goes independently from application (and does not use
processor time at all).
* Previously must be defined SB16 base port
(by subfunction 4 of function 21) and DMA channel
(by subfunction 10 of function 21).
======================================================================
======== Function 55, subfunction 2 - set format of SB16 data. =======
======================================================================
Parameters:
* eax = 55 - function number
* ebx = 2 - subfunction number
* ecx = 0 - set digit capacity
* edx = 1 - 8bit mono
* edx = 2 - 8bit stereo
* ecx = 1 - set data size
* edx = size in bytes
* ecx = 2 - set play frequency
* edx = frequency
Returned value:
* function does not return value
Remarks:
* When the system boots, it sets following default parameters:
digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz.
Nevertheless it is recommended to set necessary values obviously
as they could be reset by some application.
====================================================================== ======================================================================
Function 55, subfunction 55 - begin to play data on built-in speaker. Function 55, subfunction 55 - begin to play data on built-in speaker.
====================================================================== ======================================================================
@ -3375,19 +3328,36 @@ Parameters:
* ebx = pointer to the image * ebx = pointer to the image
* ecx = [size on axis x]*65536 + [size on axis y] * ecx = [size on axis x]*65536 + [size on axis y]
* edx = [coordinate on axis x]*65536 + [coordinate on axis y] * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
* esi = number of bits per pixel, must be 8, 24 or 32 * esi = number of bits per pixel, must be 1,2,4,8,15,16,24 or 32
* edi = pointer to palette (256 colors 0x00RRGGBB); * edi = pointer to palette (2 to the power esi colors 0x00RRGGBB);
ignored when esi = 24 and 32 ignored when esi > 8
* ebp = offset of next row data relative to previous row data * ebp = offset of next row data relative to previous row data
Returned value: Returned value:
* function does not return value * function does not return value
Remarks: Remarks:
* Coordinates of the image are coordinates of the upper left corner * Coordinates of the image are coordinates of the upper left corner
of the image relative to the window. of the image relative to the window.
* Size of the image in bytes is xsize*ysize. * Format of image with 1 bit per pixel: each byte of image
* Each byte of image is index in the palette. (possibly excluding last bytes in rows), contains information on
* If the image uses less than 256 colors, palette size may be the color of 8 pixels, MSB corresponds to first pixel.
less than 256 too. * Format of image with 2 bits per pixel: each byte of image
(possibly excluding last bytes in rows), contains information on
the color of 4 pixels, two MSBs correspond to first pixel.
* Format of image with 4 bits per pixel: each byte of image
excluding last bytes in rows (if width is odd) contains
information on the color of 2 pixels, high-order tetrad
corresponds to first pixel.
* Format of image with 8 bits per pixel: each byte of image is
index in the palette.
* Format of image with 15 bits per pixel: the color of each pixel
is coded as (bit representation) 0RRRRRGGGGGBBBBB - 5 bits per
each color.
* Format of image with 16 bits per pixel: the color of each pixel
is coded as RRRRRGGGGGGBBBBB (5+6+5).
* Format of image with 24 bits per pixel: the color of each pixel
is coded as 3 bytes - sequentially blue, green, red components.
* Format of image with 32 bits per pixel: similar to 24, but
one additional ignored byte is present.
* The call to function 7 is equivalent to call to this function * The call to function 7 is equivalent to call to this function
with esi=24, ebp=0. with esi=24, ebp=0.
@ -3643,29 +3613,24 @@ Remarks:
or subfunction 20. or subfunction 20.
====================================================================== ======================================================================
======== Function 68, subfunction 14 - wait for driver notify. ======= ===================== Function 68, subfunction 14 ====================
====== Waiting delivering of signal from another program/driver ======
====================================================================== ======================================================================
Parameters: Parameters:
* eax = 68 - function number * eax = 68 - function number
* ebx = 14 - subfunction number * ebx = 14 - subfunction number
* ecx = pointer to the buffer for information (8 bytes) * ecx = pointer to the buffer for information (24 bytes)
Returned value: Returned value:
* buffer pointed to by ecx contains the following information: * buffer pointed to by ecx contains the following information:
* +0: dword: constant EV_INTR = 1 * +0: dword: identifier for underlying data of signal
* +4: dword: driver data * +4: data of signal (20 bytes), format of which is defining by
Remarks: first dword
* The current implementation at wait time uses "heavy" operations
of task switch.
====================================================================== ======================================================================
====== Function 68, subfunction 15 - set FPU exception handler. ====== ====== Function 68, subfunction 15 - set FPU exception handler. ======
====================================================================== ======================================================================
Parameters: Deleted (in current implementation only 0 is returned).
* eax = 68 - function number Using subfunctions 24, 25 is true.
* ebx = 15 - subfunction number
* ecx = address of the new exception handler
Returned value:
* eax = address of the old exception handler (0, if it was not set)
====================================================================== ======================================================================
============= Function 68, subfunction 16 - load driver. ============= ============= Function 68, subfunction 16 - load driver. =============
@ -3699,7 +3664,11 @@ Parameters:
* +16 = +0x10: dword: pointer to output data * +16 = +0x10: dword: pointer to output data
* +20 = +0x14: dword: size of output data * +20 = +0x14: dword: size of output data
Returned value: Returned value:
* eax = determined by driver * eax = error code
0 - successful call
-1 - any error.
-2, -3, -4, etc. reserved for kernel error codes
1, 2, 3, etc driver specific error codes
Remarks: Remarks:
* Function codes and the structure of input/output data * Function codes and the structure of input/output data
are defined by driver. are defined by driver.
@ -3708,12 +3677,8 @@ Remarks:
====================================================================== ======================================================================
====== Function 68, subfunction 18 - set SSE exception handler. ====== ====== Function 68, subfunction 18 - set SSE exception handler. ======
====================================================================== ======================================================================
Parameters: Deleted (in current implementation only 0 is returned).
* eax = 68 - function number Using subfunctions 24, 25 is true.
* ebx = 15 - subfunction number
* ecx = address of the new exception handler
Returned value:
* eax = address of the old exception handler (0, if it was not set)
====================================================================== ======================================================================
=============== Function 68, subfunction 19 - load DLL. ============== =============== Function 68, subfunction 19 - load DLL. ==============
@ -3753,6 +3718,50 @@ Remarks:
* The contents of the block are unchanged up to the shorter of * The contents of the block are unchanged up to the shorter of
the new and old sizes. the new and old sizes.
======================================================================
====== Function 68, subfunction 24 - set new exceptions handler ======
======================================================================
Parameters:
* eax = 68 - function number
* ebx = 24 - subfunction number
* ecx = address of the new exception handler
* edx = the mask of processing exceptions
Returned value:
* eax = address of the old exception handler (0, if it was not set)
* ebx = the old mask of exception handler
Remarks:
* Bit number in mask of exceptions is correspond to exception number
by CPU-specification (Intel-PC). For example, FPU-exception have
number 16 (#MF), and SSE-exception - 19 (#XF)
* The current implementation ignore the inquiry for hook of 7
exception - system process #NM by one's own.
* User handler get exception number in stack parameter. So, correct
exit from handler is: RET 4. Return from handler is to the same
instruction, that was cause the exception
* When control is transfering to user handler, corresponding bit in
exception mask is clearing. Rising this exception in consequence
- reduce to default-handling. Exactly: terminating the application,
or suspending with debug-notify to owner.
* After completion of critical operations in user handler, it may be
rising corresponding bit in exception mask by using subfunction 25
Clearing exceptions flags in FPU and/or XMM modules - is
responsibility of user handler too.
======================================================================
==== Function 68, subfunction 25 - change state of signal activity ===
======================================================================
Parameters:
* eax = 68 - function number
* ebx = 25 - subfunction number
* ecx = signal number
* edx = value of activity (0/1)
Returned value:
* eax = value of old activity for this signal (0/1)
Remarks:
* In current implementation, it is changed only exception mask for
user exception handler, wich was previously set by subfunction 24.
At that, number of signal correspond to exception number.
====================================================================== ======================================================================
====================== Fucntion 69 - debugging. ====================== ====================== Fucntion 69 - debugging. ======================
====================================================================== ======================================================================
@ -3784,9 +3793,8 @@ When debugger terminates, all debugged processes are killed.
If debugger does not want this, it must previously detach by If debugger does not want this, it must previously detach by
subfunction 3. subfunction 3.
All subfunctions except 4 and 5 are applicable only to All subfunctions are applicable only to processes/threads started
processes/threads started from the current by function 70 from the current by function 70 with set debugging flag.
with set debugging flag.
Debugging of multithreaded programs is not supported yet. Debugging of multithreaded programs is not supported yet.
The full list of subfunctions: The full list of subfunctions:
* subfunction 0 - define data area for debug messages * subfunction 0 - define data area for debug messages
@ -3884,7 +3892,7 @@ Remarks:
* If the process was suspended, it resumes execution. * If the process was suspended, it resumes execution.
====================================================================== ======================================================================
============= Function 69, subfunction 4 - suspend thread. =========== ======== Function 69, subfunction 4 - suspend debugged thread. =======
====================================================================== ======================================================================
Parameters: Parameters:
* eax = 69 - function number * eax = 69 - function number
@ -3892,9 +3900,12 @@ Parameters:
* ecx = thread identifier * ecx = thread identifier
Returned value: Returned value:
* function does not return value * function does not return value
Remarks:
* Process must be loaded for debugging (as is shown in
general description).
====================================================================== ======================================================================
============= Function 69, subfunction 5 - resume thread. ============ ======== Function 69, subfunction 5 - resume debugged thread. ========
====================================================================== ======================================================================
Parameters: Parameters:
* eax = 69 - function number * eax = 69 - function number
@ -3902,6 +3913,9 @@ Parameters:
* ecx = thread identifier * ecx = thread identifier
Returned value: Returned value:
* function does not return value * function does not return value
Remarks:
* Process must be loaded for debugging (as is shown in
general description).
====================================================================== ======================================================================
= Fucntion 69, subfunction 6 - read from memory of debugged process. = = Fucntion 69, subfunction 6 - read from memory of debugged process. =

View File

@ -20,7 +20,7 @@ sb_dma_num equ 5 ;default values for SB16, may be overrided by autodetect
small_buffer equ 32768 small_buffer equ 32768
full_buffer equ 65536 full_buffer equ 65536
sb_buffer_size equ full_buffer sb_buffer_size equ small_buffer ; FIX ring buffer overlapped events issue; full_buffer
__supported_buffer_sizes fix <small_buffer, full_buffer> __supported_buffer_sizes fix <small_buffer, full_buffer>

View File

@ -201,7 +201,6 @@ macro DEBUGH_N _sign,_num,_hex {
if ~_hex eq ax if ~_hex eq ax
movzx eax,_hex movzx eax,_hex
end if end if
shl eax,16
if (_num eq) if (_num eq)
mov edx,4 mov edx,4
end if end if
@ -209,7 +208,6 @@ macro DEBUGH_N _sign,_num,_hex {
if ~_hex eq al if ~_hex eq al
movzx eax,_hex movzx eax,_hex
end if end if
shl eax,24
if (_num eq) if (_num eq)
mov edx,2 mov edx,2
end if end if

View File

@ -1069,14 +1069,6 @@ fs_HdRead:
mov eax, ERROR_ACCESS_DENIED mov eax, ERROR_ACCESS_DENIED
ret ret
.noaccess_3:
add esp,4
.noaccess_1:
add esp,4
.noaccess_4:
add esp,4*5
jmp .noaccess_2
@@: @@:
call hd_find_lfn call hd_find_lfn
jnc .found jnc .found
@ -1140,9 +1132,9 @@ fs_HdRead:
push ebx push ebx
mov ebx, edx mov ebx, edx
call hd_read call hd_read
pop ebx
cmp [hd_error],0 cmp [hd_error],0
jne .noaccess_1 jne .noaccess_1
pop ebx
add edx, 512 add edx, 512
sub ecx, 512 sub ecx, 512
jmp .skip jmp .skip
@ -1151,11 +1143,11 @@ fs_HdRead:
push eax ebx push eax ebx
mov ebx, buffer mov ebx, buffer
call hd_read call hd_read
cmp [hd_error],0
jne .noaccess_3
mov eax, ebx mov eax, ebx
pop ebx pop ebx
cmp [hd_error],0
jne .noaccess_3
add eax, ebx add eax, ebx
push ecx push ecx
add ecx, ebx add ecx, ebx
@ -1178,9 +1170,14 @@ fs_HdRead:
mov eax, [cluster_tmp] mov eax, [cluster_tmp]
call get_FAT call get_FAT
cmp [hd_error],0 cmp [hd_error],0
jne .noaccess_4 jne .noaccess_1
jmp .new_cluster jmp .new_cluster
.noaccess_3:
pop eax
.noaccess_1:
pop eax
push 11
.done: .done:
mov ebx, edx mov ebx, edx
pop eax edx ecx edi pop eax edx ecx edi

View File

@ -764,17 +764,17 @@ i1:
; ja err ; ja err
sub al,48 sub al,48
shl cx,1 shl cx,1
jc err jc error
mov bx,cx mov bx,cx
shl cx,1 shl cx,1
jc err jc error
shl cx,1 shl cx,1
jc err jc error
add cx,bx add cx,bx
jc err jc error
cbw cbw
add cx,ax add cx,ax
jc err jc error
i3: i3:
inc edi inc edi
jmp i1 jmp i1
@ -789,7 +789,7 @@ i4:
pop bx pop bx
ret ret
err: error:
stc stc
jmp i4 jmp i4

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -0,0 +1,204 @@
#include <types.h>
#include <core.h>
#include <spinlock.h>
#include <link.h>
#include <mm.h>
#include <slab.h>
slab_cache_t *win_slab;
link_t win_list;
window_t *win_slot[256];
extern int current_task;
void fill_disp_data(int left, int top, int right,
int bottom, int slot);
void update_disp_data(window_t *win)
{
do{
// fill_disp_data(win->wrect.left, win->wrect.top,
// win->wrect.right,win->wrect.bottom,
// win->slot);
__asm__ __volatile__ (
"call _set_screen \n\t"
:
:"b" (win->wrect.left),
"a" (win->wrect.top),
"c" (win->wrect.right-win->wrect.left+1),
"d" (win->wrect.bottom-win->wrect.top+1),
"S" (win->slot)
:"edi");
__asm__ __volatile__ (
""
:::"eax", "ebx", "ecx", "edx", "esi");
win = (window_t*)win->link.prev;
} while(&win->link != &win_list);
}
void insert_window(window_t *win)
{
if( list_empty(&win_list))
list_prepend(&win->link, &win_list);
else
{
window_t *tmp;
tmp = (window_t*)win_list.next;
while( &tmp->link != &win_list)
{
if(win->style <= tmp->style)
break;
tmp = (window_t*)tmp->link.next;
}
list_insert(&win->link, &tmp->link);
};
update_disp_data(win);
};
u32_t sys_create_window(char *caption, u32_t style,
int x, int y, int width, int height)
{
window_t *win;
int r, b;
DBG("\ncreate window %s, x %d y %d\n"
"width %d height %d\n",caption, x,y, width, height);
win = (window_t*)slab_alloc(win_slab,0);
link_initialize(&win->link);
r = x+width-1;
b = y+height-1;
win->wrect.left = x;
win->wrect.top = y;
win->wrect.right = r;
win->wrect.bottom = b;
win->crect.left = x;
win->crect.top = y;
win->crect.right = r;
win->crect.bottom = b;
win->style = style;
win->slot = current_task;
list_initialize(&win->queue);
win->qflags = 0;
win->caption = caption;
win_slot[current_task] = win;
return current_task;
}
#define QS_PAINT 1
bool sys_show_window(u32_t handle)
{
window_t *win;
win = win_slot[current_task];
insert_window(win);
win->qflags |= QS_PAINT;
return true;
};
void sys_get_event(event_t *ev)
{
window_t *win;
win = win_slot[current_task];
if(win->qflags & QS_PAINT)
{
ev->code = 1;
ev->win = win->slot;
ev->val1 = 0;
ev->val2 = 0;
ev->x = 0;
ev->y = 0;
win->qflags&= ~QS_PAINT;
};
}
static inline draw_bar(int x, int y, int w, int h, u32_t color)
{
int_draw_bar(x, y, w, h, color);
__asm__ __volatile__ (
""
:::"ebx", "esi", "edi");
};
static inline hline(int x, int y, int w, color_t color)
{
int_hline(x, y, w, color);
__asm__ __volatile__ (
""
:::"esi", "edi");
};
static inline vline(int x, int y, int h, color_t color)
{
int_vline(x, y, h, color);
__asm__ __volatile__ (
""
:::"esi", "edi");
};
static inline rectangle(int x, int y, int w, int h, color_t color)
{
int_rectangle(x, y, w, h, color);
__asm__ __volatile__ (
""
:::"esi", "edi");
};
extern color_t skin_active;
void sys_def_window_proc(event_t *ev)
{
window_t *win;
win = win_slot[current_task];
if(ev->code =1)
{
int w, h;
color_t *skin = &skin_active;
w = win->wrect.right-win->wrect.left+1;
h = win->wrect.bottom - win->wrect.top+1;
rectangle(win->wrect.left, win->wrect.top,
w, h, skin[1]);
rectangle(win->wrect.left+1, win->wrect.top+1,
w-2, h-2, skin[2]);
rectangle(win->wrect.left+2, win->wrect.top+2,
w-4, h-4, skin[2]);
rectangle(win->wrect.left+3, win->wrect.top+3,
w-6, h-6, skin[2]);
rectangle(win->wrect.left+4, win->wrect.top+4,
w-8, h-8, skin[0]);
// draw_bar(win->wrect.left+4, win->wrect.top+4,
// w-8, h-8, skin[1]);
};
};

View File

@ -22,7 +22,7 @@ get_rolledup_height: ; edi = window draw_data pointer
mov al,[edi+WDATA.fl_wstyle] mov al,[edi+WDATA.fl_wstyle]
and al,0x0F and al,0x0F
cmp al,0x03 cmp al,0x03
jne @f jb @f
mov eax,[_skinh] mov eax,[_skinh]
add eax,3 add eax,3
ret ret
@ -557,7 +557,6 @@ endg
check_window_position: check_window_position:
pushad ; window inside screen ? pushad ; window inside screen ?
@ -862,7 +861,6 @@ dw3l:
jnz noinside2 jnz noinside2
call [drawbar] call [drawbar]
noinside2: noinside2:
popad popad
ret ret
@ -1130,12 +1128,10 @@ restore_minimized_window:
ret ret
iglobal ;iglobal
window_moving db 'K : Window - move/resize',13,10,0 ; window_moving db 'K : Window - move/resize',13,10,0
window_moved db 'K : Window - done',13,10,0 ; window_moved db 'K : Window - done',13,10,0
endg ;endg
bPressedMouseXY_W db 0x0
; check window touch ; check window touch
align 4 align 4
@ -1164,33 +1160,59 @@ checkwindows:
popad popad
ret ret
.mouse_buttons_pressed: .mouse_buttons_pressed:
;..................................... start 2/4 : modified by vhanla .................
uglobal
bPressedMouseXY_W db 0x0
endg
;..................................... end 2/4 : modified by vhanla ...................
mov esi,[TASK_COUNT] mov esi,[TASK_COUNT]
inc esi inc esi
;..................................... start 3/4 : modified by vhanla ................. ;..................................... start 3/4 : modified by vhanla .................
cmp [bPressedMouseXY_W],0 cmp [bPressedMouseXY_W],1
jnz @f ja @f
mov [bPressedMouseXY_W],1 inc [bPressedMouseXY_W]
@@: jnc @f
;mov ax,[MOUSE_X]
;mov [mx],ax
;mov ax,[MOUSE_Y]
;mov [my],ax
mov eax,dword[MOUSE_X]
mov dword[mx],eax
@@:
;..................................... end 3/4 : modified by vhanla ................... ;..................................... end 3/4 : modified by vhanla ...................
movzx eax,word [MOUSE_Y] cwloop:
movzx ebx,word [MOUSE_X] cmp esi,2
mov ecx, [Screen_Max_X] jb .exit
add ebx, [_display_data]
inc ecx
mul ecx
movzx edi, byte [ebx+eax]
cwloop:
movzx esi, word [WIN_STACK + edi * 2]
dec esi
movzx edi, word [WIN_POS + esi * 2] ; ebx
shl edi, 5 shl edi, 5
add edi, window_data add edi, window_data
; mov edi, ebx
mov ecx, [edi + WDATA.box.left]
mov edx, [edi + WDATA.box.top]
movzx eax,word [MOUSE_X] mov eax,ecx
movzx ebx,word [MOUSE_Y] mov ebx,edx
test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED
jnz cwloop
;..................................... start 4/4 : modified by vhanla .................
movzx eax, word [mx]; movzx eax,word[MOUSE_X]
movzx ebx, word [my]; movzx ebx,word[MOUSE_Y]
;..................................... endt 4/4 : modified by vhanla ..................
cmp ecx, eax
jae cwloop
cmp edx, ebx
jae cwloop
add ecx, [edi + WDATA.box.width]
add edx, [edi + WDATA.box.height]
cmp eax, ecx
jae cwloop
cmp ebx, edx
jae cwloop
pushad pushad
mov eax, esi mov eax, esi
@ -1198,10 +1220,14 @@ cwloop:
cmp eax, ebx ; is this window active? cmp eax, ebx ; is this window active?
jz .move_resize_window jz .move_resize_window
cmp [bPressedMouseXY_W], 1
ja .exit_popa
; eax = position in windowing stack ; eax = position in windowing stack
; redraw must ? ; redraw must ?
lea esi, [WIN_POS + esi * 2] lea esi, [WIN_POS + esi * 2]
call waredraw call waredraw
.exit_popa:
add esp, 32 add esp, 32
.exit: .exit:
@ -1252,10 +1278,10 @@ cwloop:
.continue: .continue:
push esi ; push esi
mov esi, window_moving ; mov esi, window_moving
call sys_msg_board_str ; call sys_msg_board_str
pop esi ; pop esi
mov ecx, [timer_ticks] ; double-click ? mov ecx, [timer_ticks] ; double-click ?
mov edx, ecx mov edx, ecx
@ -1311,6 +1337,7 @@ cwloop:
call drawwindowframes call drawwindowframes
mov [reposition],0 mov [reposition],0
mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down
; move window ; move window
@ -1320,6 +1347,7 @@ newchm:
call checkVga_N13 call checkVga_N13
mov [MOUSE_BACKGROUND],byte 0
call [draw_pointer] call [draw_pointer]
@ -1328,7 +1356,7 @@ newchm:
popad popad
mov esi,[WIN_TEMP_XY] mov esi,[WIN_TEMP_XY]
cmp esi, dword [MOUSE_X] cmp esi,[MOUSE_X]
je cwb je cwb
mov cx,[MOUSE_X] mov cx,[MOUSE_X]
@ -1409,7 +1437,7 @@ newchm:
mov [reposition],1 mov [reposition],1
popad popad
norepos_size: norepos_size:
pop bx pop bx
pop ax pop ax
@ -1608,8 +1636,8 @@ waitre2:
retwm: retwm:
mov esi,window_moved ; mov esi,window_moved
call sys_msg_board_str ; call sys_msg_board_str
popad popad
@ -1745,3 +1773,405 @@ rsw_no_scale:
ret ret
;ebx x
;eax y
;ecx width
;edx height
;esi slot
align 4
_set_screen:
push edx
add ebx, [_display_data]
mul [_screen_width]
lea ebx, [eax+ebx]
mov eax, esi
mov ah, al
mov esi, eax
shl eax, 16
or eax, esi
pop edx
mov esi, ecx
.row:
mov edi, ebx
add ebx, [_screen_width]
mov ecx, esi
dec edx
js .done
.16:
cmp ecx, 16
jb .8
mov [edi], eax
mov [edi+4], eax
mov [edi+8], eax
mov [edi+12], eax
add edi, 16
sub ecx, 16
jmp .16
.8:
shr ecx, 2
rep stosd
mov ecx, esi
and ecx, 3
rep stosb
jmp .row
.done:
ret
;[esp+4] ebp
;[esp+8] x
;[esp+12] y
;[esp+16] w
;[esp+20] h
;[esp+24] color
;ebx disp data
;edx dest
public _int_draw_bar
align 4
_int_draw_bar:
lea ecx, [esp+4]
call lock_cursor
sub esp, 4
mov [esp], ebp
mov ebx, [esp+8]
mov eax, [esp+12]
mul [_screen_width]
add ebx, [_display_data]
lea ebx, [eax+ebx]
mov edi, [esp+8]
mov eax, [esp+12]
mul [BytesPerScanLine]
cmp byte [ScreenBPP], 24
je .24
lea ecx, [LFB_BASE+eax+edi*4]
mov eax, [esp+24]
mov edx, [CURRENT_TASK]
.row32:
mov edi, ecx
mov esi, ebx
add ecx, [BytesPerScanLine]
add ebx, [_screen_width]
dec dword [esp+20]
js .done
mov ebp, [esp+16]
align 16
.draw32:
cmp dl, byte [esi]
jne @f
stosd
@@:
inc esi
dec ebp
jnz .draw32
jmp .row32
.done:
call unlock_cursor
mov ebp, [esp]
add esp, 4
ret
.24:
lea ecx, [LFB_BASE+edi*3]
add ecx, eax
mov eax, [esp+24]
mov edx, eax
shr edx, 8
mov dl, [CURRENT_TASK]
.row24:
mov edi, ecx
mov esi, ebx
add ecx, [BytesPerScanLine]
add ebx, [_screen_width]
dec dword [esp+20]
js .done
mov ebp, [esp+16]
align 16
.draw24:
cmp dl, byte [esi]
jne @f
mov [edi], ax
mov [edi+2], dh
@@:
add edi, 3
inc esi
dec ebp
jnz .draw24
jmp .row24
;[esp+4] x
;[esp+8] y
;[esp+12] w
;[esp+16] color
;esi disp data
;edi dest
public _int_hline
align 4
_int_hline:
mov esi, [esp+4]
mov eax, [esp+8]
mov ecx, [esp+12]
mul [_screen_width]
add esi, [_display_data]
add esi, eax
mov edi, [esp+4]
mov eax, [esp+8]
mul [BytesPerScanLine]
cmp byte [ScreenBPP], 24
je .24
lea edi, [LFB_BASE+eax+edi*4]
mov eax, [esp+16]
.32_kernel:
mov edx, [CURRENT_TASK]
align 16
.draw32:
cmp dl, byte [esi]
jne @f
stosd
@@:
inc esi
dec ecx
jnz .draw32
ret
.24:
lea edi, [LFB_BASE+edi*3]
add edi, eax
mov eax, [esp+16]
.24_kernel:
mov edx, eax
shr edx, 8
mov dl, [CURRENT_TASK]
align 16
.draw24:
cmp dl, byte [esi]
jne @f
mov [edi], ax
mov [edi+2], dh
@@:
add edi, 3
inc esi
dec ecx
jnz .draw24
ret
;[esp+4] x
;[esp+8] y
;[esp+12] h
;[esp+16] color
;esi disp data
;edi dest
public _int_vline
align 4
_int_vline:
mov esi, [esp+4]
mov eax, [esp+8]
mov ecx, [esp+12]
mul [_screen_width]
add esi, [_display_data]
add esi, eax
mov edi, [esp+4]
mov eax, [esp+8]
mul [BytesPerScanLine]
cmp byte [ScreenBPP], 24
je .24
lea edi, [LFB_BASE+eax+edi*4]
mov eax, [esp+16]
.32_kernel:
mov edx, [CURRENT_TASK]
align 16
.draw32:
cmp dl, byte [esi]
jne @f
mov [edi], eax
@@:
add esi, [_screen_width]
add edi, [BytesPerScanLine]
dec ecx
jnz .draw32
ret
.24:
lea edi, [LFB_BASE+edi*3]
add edi, eax
mov eax, [esp+16]
.24_kernel:
mov edx, eax
shr edx, 8
mov dl, [CURRENT_TASK]
align 16
.draw24:
cmp dl, byte [esi]
jne @f
mov [edi], ax
mov [edi+2], dh
@@:
add esi, [_screen_width]
add edi, [BytesPerScanLine]
dec ecx
jnz .draw24
ret
;[esp] dst
;[esp+4] mask
;[esp+12] x
;[esp+16] y
;[esp+20] w
;[esp+24] h
;[esp+32] color
public _int_rectangle
align 4
_int_rectangle:
.dst equ (esp)
.mask equ (esp+4)
.x equ (esp+12)
.y equ (esp+16)
.w equ (esp+20)
.h equ (esp+24)
.color equ (esp+28)
sub esp, 8
mov esi, [.x]
mov eax, [.y]
mul [_screen_width]
add esi, [_display_data]
add esi, eax
mov [.mask], esi
mov edi, [.x]
mov eax, [.y]
mul [BytesPerScanLine]
cmp byte [ScreenBPP], 24
je .24
lea edi, [LFB_BASE+eax+edi*4]
mov [.dst], edi
mov ecx, [.w]
mov eax, [.color]
call _int_hline.32_kernel
sub edi, 4
dec esi
mov ecx, [.h]
call _int_vline.32_kernel
mov edi, [.dst]
mov esi, [.mask]
mov ecx, [.h]
call _int_vline.32_kernel
mov ecx, [.w]
sub esi, [_screen_width]
sub edi, [BytesPerScanLine]
call _int_hline.32_kernel
add esp, 8
ret
.24:
lea edi, [LFB_BASE+edi*3]
add edi, eax
mov [.dst], edi
mov ecx, [.w]
mov eax, [.color]
call _int_hline.24_kernel
sub edi, 3
dec esi
mov ecx, [.h]
call _int_vline.24_kernel
mov edi, [.dst]
mov esi, [.mask]
mov ecx, [.h]
call _int_vline.24_kernel
mov ecx, [.w]
sub esi, [_screen_width]
sub edi, [BytesPerScanLine]
call _int_hline.24_kernel
restore .dst
restore .mask
restore .x
restore .y
restore .w
restore .h
restore .color
add esp, 8
ret

View File

@ -1,4 +1,5 @@
#define OS_BASE 0xE0000000 #define OS_BASE 0xE0000000
#define IMAGE_BASE 0xE0100000 #define IMAGE_BASE 0xE0100000
#define LOAD_BASE 0x00100000 #define LOAD_BASE 0x00100000

View File

@ -17,6 +17,7 @@ typedef struct
void *parent; /**< If allocated by slab, this points there */ void *parent; /**< If allocated by slab, this points there */
} frame_t; } frame_t;
typedef struct typedef struct
{ {
SPINLOCK_DECLARE(lock); /**< this lock protects everything below */ SPINLOCK_DECLARE(lock); /**< this lock protects everything below */
@ -53,7 +54,6 @@ typedef struct
#define PG_UW 7 #define PG_UW 7
#define PAGE_SIZE 4096 #define PAGE_SIZE 4096
#define PAGE_WIDTH 12 #define PAGE_WIDTH 12

View File

@ -198,8 +198,8 @@ extern dll_t core_dll;
bool validate_pe(void *raw, size_t raw_size, bool is_exec); bool validate_pe(void *raw, size_t raw_size, bool is_exec);
dll_t * find_dll(link_t *list, const char *name);
dll_t * find_dll(link_t *list, const char *name);
addr_t __fastcall load_image(const char *path); addr_t __fastcall load_image(const char *path);

View File

@ -80,3 +80,33 @@ slab_cache_t * slab_cache_create(
void* __fastcall slab_alloc(slab_cache_t *cache, int flags); void* __fastcall slab_alloc(slab_cache_t *cache, int flags);
void __fastcall slab_free(slab_cache_t *cache, void *obj); void __fastcall slab_free(slab_cache_t *cache, void *obj);
typedef struct
{
int left;
int top;
int right;
int bottom;
}rect_t;
typedef struct
{
link_t link;
rect_t wrect;
rect_t crect;
rect_t hrect;
color_t clr_workarea;
color_t clr_titlebar;
color_t clr_frames;
u32_t style;
u32_t state;
int slot;
link_t queue;
u32_t qflags;
char *caption;
}window_t;

View File

@ -20,6 +20,7 @@ format MS COFF
;; Sergey Semyonov (Serge) ;; Sergey Semyonov (Serge)
;; Johnny_B ;; Johnny_B
;; SPraid (simba) ;; SPraid (simba)
;; Hidnplayr
;; ;;
;; Data in this file was originally part of MenuetOS project which is ;; Data in this file was originally part of MenuetOS project which is
;; distributed under the terms of GNU GPL. It is modified and redistributed as ;; distributed under the terms of GNU GPL. It is modified and redistributed as
@ -246,6 +247,8 @@ extrn _bx_from_load
extrn _sys_app_entry extrn _sys_app_entry
public _set_screen
extrn _i40 extrn _i40
extrn test_cpu extrn test_cpu
@ -255,7 +258,10 @@ extrn cpu_sign
extrn cpu_info extrn cpu_info
extrn cpu_caps:dword extrn cpu_caps:dword
extrn stb_create_window
extrn stb_show_window
extrn stb_get_event
extrn stb_def_window_proc
section '.flat' code readable align 4096 section '.flat' code readable align 4096
@ -414,8 +420,9 @@ no_mode_0x12:
call @mem_alloc@8 call @mem_alloc@8
mov [_display_data], eax mov [_display_data], eax
mov ecx, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \ mov ecx, 4096 + (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \
(unpack.lc+unpack.lp)))*4 (unpack.lc+unpack.lp)))*4
mov edx, PG_SW mov edx, PG_SW
call @mem_alloc@8 call @mem_alloc@8
mov [unpack.p], eax mov [unpack.p], eax
@ -799,6 +806,7 @@ first_app_found:
setnz [dma_hdd] setnz [dma_hdd]
mov [timer_ticks_enable],1 ; for cd driver mov [timer_ticks_enable],1 ; for cd driver
;xchg bx, bx
sti sti
call change_task call change_task

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; KERNEL32.INC ;; ;; KERNEL32.INC ;;

View File

@ -40,6 +40,7 @@ PE_SRC:= \
dll.c \ dll.c \
spinlock.c \ spinlock.c \
thread.c \ thread.c \
win.c \
syscall.asm \ syscall.asm \
boot/boot.asm \ boot/boot.asm \
boot/start.asm boot/start.asm

View File

@ -1,14 +1,12 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; ARP.INC ;; ;; ARP.INC ;;
;; ;; ;; ;;
;; Address Resolution Protocol ;; ;; Address Resolution Protocol ;;
;; ;; ;; ;;
;; Last revision: 10.11.2006 ;;
;; ;;
;; This file contains the following: ;; ;; This file contains the following: ;;
;; arp_table_manager - Manages an ARPTable ;; ;; arp_table_manager - Manages an ARPTable ;;
;; arp_request - Sends an ARP request on the ethernet ;; ;; arp_request - Sends an ARP request on the ethernet ;;

View File

@ -1,14 +1,12 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; ETHERNET.INC ;; ;; ETHERNET.INC ;;
;; ;; ;; ;;
;; Ethernet network layer for Menuet OS ;; ;; Ethernet network layer for Menuet OS ;;
;; ;; ;; ;;
;; Version 0.4 22 September 2003 ;;
;; ;;
;; This file contains the following: ;; ;; This file contains the following: ;;
;; PCI bus scanning for valid devices ;; ;; PCI bus scanning for valid devices ;;
;; Table of supported ethernet drivers ;; ;; Table of supported ethernet drivers ;;
@ -353,9 +351,9 @@ endp
; All registers may be destroyed ; All registers may be destroyed
; ;
;*************************************************************************** ;***************************************************************************
uglobal ;uglobal
ether_IP_handler_cnt dd ? ; ether_IP_handler_cnt dd ?
endg ;endg
ether_IP_handler: ether_IP_handler:
mov eax, EMPTY_QUEUE mov eax, EMPTY_QUEUE
call dequeue call dequeue

View File

@ -223,7 +223,7 @@ local buffer_number dd ?
jmp .dump.x jmp .dump.x
.dump.4: .dump.4:
DEBUGF 1, "K : ip_rx - dumped (ihl: %u)\n", [ebx + IP_PACKET.TimeToLive] DEBUGF 1, "K : ip_rx - dumped (ttl: %u)\n", [ebx + IP_PACKET.TimeToLive]
jmp .dump.x jmp .dump.x
.dump.5: .dump.5:

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; ;; ;; ;;
@ -8,8 +8,6 @@
;; ;; ;; ;;
;; Buffer queue management for Menuet OS TCP/IP Stack ;; ;; Buffer queue management for Menuet OS TCP/IP Stack ;;
;; ;; ;; ;;
;; Version 0.3 29 August 2002 ;;
;; ;;
;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;; ;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;;
;; ;; ;; ;;
;; See file COPYING for details ;; ;; See file COPYING for details ;;
@ -43,9 +41,9 @@ $Revision$
; all other registers preserved ; all other registers preserved
; This always works, so no error returned ; This always works, so no error returned
;*************************************************************************** ;***************************************************************************
uglobal ;uglobal
freeBuff_cnt dd ? ; freeBuff_cnt dd ?
endg ;endg
freeBuff: freeBuff:
; inc [freeBuff_cnt] ; inc [freeBuff_cnt]
; DEBUGF 1, "K : freeBuff (%u)\n", [freeBuff_cnt] ; DEBUGF 1, "K : freeBuff (%u)\n", [freeBuff_cnt]
@ -106,9 +104,9 @@ qs_exit:
; all other registers preserved ; all other registers preserved
; This always works, so no error returned ; This always works, so no error returned
;*************************************************************************** ;***************************************************************************
uglobal ;uglobal
queue_cnt dd ? ; queue_cnt dd ?
endg ;endg
queue: queue:
; inc [queue_cnt] ; inc [queue_cnt]
; DEBUGF 1, "K : queue (%u)\n", [queue_cnt] ; DEBUGF 1, "K : queue (%u)\n", [queue_cnt]
@ -161,9 +159,9 @@ qu_exit:
; all other registers preserved ; all other registers preserved
; ;
;*************************************************************************** ;***************************************************************************
uglobal ;uglobal
dequeue_cnt dd ? ; dequeue_cnt dd ?
endg ;endg
dequeue: dequeue:
push ebx push ebx
shl eax, 1 shl eax, 1

View File

@ -1,14 +1,12 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; SOCKET.INC ;; ;; SOCKET.INC ;;
;; ;; ;; ;;
;; Sockets constants, structures and functions ;; ;; Sockets constants, structures and functions ;;
;; ;; ;; ;;
;; Last revision: 11.11.2006 ;;
;; ;;
;; This file contains the following: ;; ;; This file contains the following: ;;
;; is_localport_unused ;; ;; is_localport_unused ;;
;; get_free_socket ;; ;; get_free_socket ;;
@ -31,113 +29,59 @@
$Revision$ $Revision$
; socket data structure
; struct SOCKET
; Socket Descriptor + Buffer .PrevPtr dd ? ; pointer to previous socket in list
; .NextPtr dd ? ; pointer to next socket in list
; 0 1 2 3 .Number dd ? ; socket number (unique within single process)
; 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 .PID dd ? ; application process id
; .LocalIP dd ? ; local IP address
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ .LocalPort dw ? ; local port
; 0| Status ( of this buffer ) | .RemoteIP dd ? ; remote IP address
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ .RemotePort dw ? ; remote port
; 4| Application Process ID | .OrigRemoteIP dd ? ; original remote IP address (used to reset to LISTEN state)
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ .OrigRemotePort dw ? ; original remote port (used to reset to LISTEN state)
; 8| Local IP Address | .rxDataCount dd ? ; rx data count
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ .TCBState dd ? ; TCB state
; 12| Local IP Port | Unused ( set to 0 ) | .TCBTimer dd ? ; TCB timer (seconds)
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ .ISS dd ? ; initial send sequence
; 16| Remote IP Address | .IRS dd ? ; initial receive sequence
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ .SND_UNA dd ? ; sequence number of unack'ed sent packets
; 20| Remote IP Port | Unused ( set to 0 ) | .SND_NXT dd ? ; bext send sequence number to use
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ .SND_WND dd ? ; send window
; 24| Rx Data Count INTEL format| .RCV_NXT dd ? ; next receive sequence number to use
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ .RCV_WND dd ? ; receive window
; 28| TCB STATE INTEL format| .SEG_LEN dd ? ; segment length
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ .SEG_WND dd ? ; segment window
; 32| TCB Timer (seconds) INTEL format| .wndsizeTimer dd ? ; window size timer
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ .lock dd ? ; lock mutex
; 36| ISS (Inital Sequence # used by this connection ) INET format| .rxData dd ? ; receive data buffer here
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ends
; 40| IRS ( Inital Receive Sequence # ) INET format|
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
; 44| SND.UNA Seq # of unack'ed sent packets INET format|
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
; 48| SND.NXT Next send seq # to use INET format|
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
; 52| SND.WND Send window INET format|
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
; 56| RCV.NXT Next expected receive sequence # INET format|
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
; 60| RCV.WND Receive window INET format|
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
; 64| SEG.LEN Segment length INTEL format|
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
; 68| SEG.WND Segment window INTEL format|
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
; 72| Retransmit queue # NOW WINDOW SIZE TIMER INTEL format|
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
; 76| RX Data Buffer |
; +-+-+-.......... -+
; so, define struct
struc SOCKET
{
.PrevPtr dd ?
.NextPtr dd ?
.Status dd ? ;+00 - Status ( of this buffer )
.PID dd ? ;+04 - Application Process ID
.LocalIP dd ? ;+08 - Local IP Address
.LocalPort dw ? ;+12 - Local Port
.RemoteIP dd ? ;+16 - Remote IP Address
.RemotePort dw ? ;+20 - Remote Port
.OrigRemoteIP dd ?
.OrigRemotePort dw ?
.rxDataCount dd ? ;+24 - Rx Data Count
.TCBState dd ? ;+28 - TCB STATE
.TCBTimer dd ? ;+32 - TCB Timer (seconds)
.ISS dd ? ;+36 - Initial Send Sequence
.IRS dd ? ;+40 - Initial Receive Sequence
.SND_UNA dd ? ;+44 - Sequence number of unack'ed sent packets
.SND_NXT dd ? ;+48 - Next send sequence number to use
.SND_WND dd ? ;+52 - Send window
.RCV_NXT dd ? ;+56 - Next receive sequence number to use
.RCV_WND dd ? ;+60 - Receive window
.SEG_LEN dd ? ;+64 - Segment length
.SEG_WND dd ? ;+68 - Segment window
.wndsizeTimer dd ? ;+72 - Retransmit queue # NOW WINDOW SIZE TIMER
.rxData dd ? ;+76 - receive data buffer here
}
virtual at 0
SOCKET SOCKET
end virtual
; simple macro calcing real memory address of SOCKET struct by socket's
;macro Index2RealAddr reg
;{
; shl reg, 12
; add reg, sockets
;}
;Constants
; current socket statuses
SOCK_EMPTY = 0 ; socket not in use
SOCK_OPEN = 1 ; open issued, but no data sent
; TCP opening modes ; TCP opening modes
SOCKET_PASSIVE equ 0 SOCKET_PASSIVE = 0
SOCKET_ACTIVE equ 1 SOCKET_ACTIVE = 1
; socket types
SOCK_STREAM = 1
SOCK_DGRAM = 2
;; Allocate memory for socket data and put new socket into the list
; Newly created socket is initialized with calling PID and number and
; put into beginning of list (which is a fastest way).
;
; @return socket structure address in EAX
;;
proc net_socket_alloc stdcall uses ebx ecx edx edi proc net_socket_alloc stdcall uses ebx ecx edx edi
mov ecx, SOCKETBUFFSIZE mov ecx, SOCKETBUFFSIZE
mov edx, PG_SW mov edx, PG_SW
call @mem_alloc@8 call @mem_alloc@8
DEBUGF 1, "K : net_socket_alloc (0x%x)\n", eax DEBUGF 1, "K : net_socket_alloc (0x%x)\n", eax
; check if we can allocate needed amount of memory
or eax, eax or eax, eax
jz .exit jz .exit
; zero-initialize allocated memory
push eax push eax
mov edi, eax mov edi, eax
mov ecx, SOCKETBUFFSIZE / 4 mov ecx, SOCKETBUFFSIZE / 4
@ -146,6 +90,7 @@ proc net_socket_alloc stdcall uses ebx ecx edx edi
rep stosd rep stosd
pop eax pop eax
; add socket to the list by changing pointers
mov ebx, net_sockets mov ebx, net_sockets
push [ebx + SOCKET.NextPtr] push [ebx + SOCKET.NextPtr]
mov [ebx + SOCKET.NextPtr], eax mov [ebx + SOCKET.NextPtr], eax
@ -156,23 +101,50 @@ proc net_socket_alloc stdcall uses ebx ecx edx edi
jz @f jz @f
mov [ebx + SOCKET.PrevPtr], eax mov [ebx + SOCKET.PrevPtr], eax
@@: mov ebx, [TASK_BASE] @@: ; set socket owner PID to the one of calling process
mov ebx, [TASK_BASE]
mov ebx, [ebx + TASKDATA.pid] mov ebx, [ebx + TASKDATA.pid]
mov [eax + SOCKET.PID], ebx mov [eax + SOCKET.PID], ebx
; find first free socket number and use it
;mov edx, ebx
mov ebx, net_sockets
xor ecx, ecx
.next_socket_number:
inc ecx
.next_socket:
mov ebx, [ebx + SOCKET.NextPtr]
or ebx, ebx
jz .last_socket_number
cmp [ebx + SOCKET.Number], ecx
jne .next_socket
;cmp [ebx + SOCKET.PID], edx
;jne .next_socket
mov ebx, net_sockets
jmp .next_socket_number
.last_socket_number:
mov [eax + SOCKET.Number], ecx
.exit: .exit:
ret ret
endp endp
proc net_socket_free stdcall uses ebx ecx edx, sock:DWORD ;; Free socket data memory and pop socket off the list
mov eax, [sock] ;
; @param sockAddr is a socket structure address
;;
proc net_socket_free stdcall uses ebx ecx edx, sockAddr:DWORD
mov eax, [sockAddr]
DEBUGF 1, "K : net_socket_free (0x%x)\n", eax DEBUGF 1, "K : net_socket_free (0x%x)\n", eax
; check if we got something similar to socket structure address
or eax, eax or eax, eax
jz .error jz .error
; make sure sockAddr is one of the socket addresses in the list
mov ebx, net_sockets mov ebx, net_sockets
mov ecx, [TASK_BASE] ;mov ecx, [TASK_BASE]
mov ecx, [ecx + TASKDATA.pid] ;mov ecx, [ecx + TASKDATA.pid]
.next_socket: .next_socket:
mov ebx, [ebx + SOCKET.NextPtr] mov ebx, [ebx + SOCKET.NextPtr]
or ebx, ebx or ebx, ebx
@ -182,6 +154,8 @@ proc net_socket_free stdcall uses ebx ecx edx, sock:DWORD
;cmp [ebx + SOCKET.PID], ecx ;cmp [ebx + SOCKET.PID], ecx
;jne .next_socket ;jne .next_socket
; okay, we found the correct one
; remove it from the list first, changing pointers
mov ebx, [eax + SOCKET.NextPtr] mov ebx, [eax + SOCKET.NextPtr]
mov eax, [eax + SOCKET.PrevPtr] mov eax, [eax + SOCKET.PrevPtr]
mov [eax + SOCKET.NextPtr], ebx mov [eax + SOCKET.NextPtr], ebx
@ -199,12 +173,60 @@ proc net_socket_free stdcall uses ebx ecx edx, sock:DWORD
ret ret
endp endp
proc net_socket_num_to_addr stdcall uses ebx ecx, x:DWORD ;; Get socket structure address by its number
; FIXME: do real transform ; Scan through sockets list to find the socket with specified number.
mov eax, [x] ; This proc uses SOCKET.PID indirectly to check if socket is owned by
; calling process.
;
; @param sockNum is a socket number
; @return socket structure address or 0 (not found) in EAX
;;
proc net_socket_num_to_addr stdcall uses ebx ecx, sockNum:DWORD
mov eax, [sockNum]
; check if we got something similar to socket number
or eax, eax
jz .error
; scan through sockets list
mov ebx, net_sockets mov ebx, net_sockets
mov ecx, [TASK_BASE] ;mov ecx, [TASK_BASE]
mov ecx, [ecx + TASKDATA.pid] ;mov ecx, [ecx + TASKDATA.pid]
.next_socket:
mov ebx, [ebx + SOCKET.NextPtr]
or ebx, ebx
jz .error
cmp [ebx + SOCKET.Number], eax
jne .next_socket
;cmp [ebx + SOCKET.PID], ecx
;jne .next_socket
; okay, we found the correct one
mov eax, ebx
ret
.error:
xor eax, eax
ret
endp
;; Get socket number by its structure address
; Scan through sockets list to find the socket with specified address.
; This proc uses SOCKET.PID indirectly to check if socket is owned by
; calling process.
;
; @param sockAddr is a socket structure address
; @return socket number (SOCKET.Number) or 0 (not found) in EAX
;;
proc net_socket_addr_to_num stdcall uses ebx ecx, sockAddr:DWORD
mov eax, [sockAddr]
; check if we got something similar to socket structure address
or eax, eax
jz .error
; scan through sockets list
mov ebx, net_sockets
;mov ecx, [TASK_BASE]
;mov ecx, [ecx + TASKDATA.pid]
.next_socket: .next_socket:
mov ebx, [ebx + SOCKET.NextPtr] mov ebx, [ebx + SOCKET.NextPtr]
or ebx, ebx or ebx, ebx
@ -213,6 +235,9 @@ proc net_socket_num_to_addr stdcall uses ebx ecx, x:DWORD
jne .next_socket jne .next_socket
;cmp [ebx + SOCKET.PID], ecx ;cmp [ebx + SOCKET.PID], ecx
;jne .next_socket ;jne .next_socket
; okay, we found the correct one
mov eax, [ebx + SOCKET.Number]
ret ret
.error: .error:
@ -220,44 +245,22 @@ proc net_socket_num_to_addr stdcall uses ebx ecx, x:DWORD
ret ret
endp endp
proc net_socket_addr_to_num stdcall uses ebx ecx, x:DWORD ;; [53.9] Check if local port is used by any socket in the system.
; FIXME: do real transform ; Scan through sockets list, checking SOCKET.LocalPort.
mov eax, [x] ; Useful when you want a to generate a unique local port number.
mov ebx, net_sockets ; This proc doesn't guarantee that after calling it and trying to use
mov ecx, [TASK_BASE] ; the port reported being free in calls to socket_open/socket_open_tcp it'll
mov ecx, [ecx + TASKDATA.pid] ; still be free or otherwise it'll still be used if reported being in use.
.next_socket:
mov ebx, [ebx + SOCKET.NextPtr]
or ebx, ebx
jz .error
cmp ebx, eax
jne .next_socket
;cmp [ebx + SOCKET.PID], ecx
;jne .next_socket
ret
.error:
xor eax, eax
ret
endp
;***************************************************************************
; Function
; is_localport_unused
; ;
; Description ; @param BX is a port number
; scans through all the active sockets , looking to see if the ; @return 1 (port is free) or 0 (port is in use) in EAX
; port number specified in bx is in use as a localport number. ;;
; This is useful when you want a to generate a unique local port
; number.
; On return, eax = 1 for free, 0 for in use
;
;***************************************************************************
proc is_localport_unused stdcall proc is_localport_unused stdcall
xchg bl, bh xchg bl, bh
xor eax, eax ; Assume the return value is 'free' ; assume the return value is 'free'
xor eax, eax
inc al inc al
mov edx, net_sockets mov edx, net_sockets
@ -266,27 +269,22 @@ proc is_localport_unused stdcall
or edx, edx or edx, edx
jz .exit jz .exit
cmp [edx + SOCKET.LocalPort], bx cmp [edx + SOCKET.LocalPort], bx
jne .next_socket ; Return back if the port is not occupied jne .next_socket
dec al ; return 'in use' ; return 'in use'
dec al
.exit: .exit:
ret ret
endp endp
;; [53.0] Open DGRAM socket (connectionless, unreliable)
;***************************************************************************
; Function
; socket_open
; ;
; Description ; @param BX is local port number
; find a free socket ; @param CX is remote port number
; local port in ebx ; @param EDX is remote IP address
; remote port in ecx ; @return socket number or -1 (error) in EAX
; remote ip in edx ;;
; return socket # in eax, -1 if none available
;
;***************************************************************************
proc socket_open stdcall proc socket_open stdcall
call net_socket_alloc call net_socket_alloc
or eax, eax or eax, eax
@ -296,7 +294,6 @@ proc socket_open stdcall
push eax push eax
mov [eax + SOCKET.Status], SOCK_OPEN
xchg bh, bl xchg bh, bl
mov [eax + SOCKET.LocalPort], bx mov [eax + SOCKET.LocalPort], bx
xchg ch, cl xchg ch, cl
@ -316,21 +313,14 @@ proc socket_open stdcall
ret ret
endp endp
;; [53.5] Open STREAM socket (connection-based, sequenced, reliable, two-way)
;***************************************************************************
; Function
; socket_open_tcp
; ;
; Description ; @param BX is local port number
; Opens a TCP socket in PASSIVE or ACTIVE mode ; @param CX is remote port number
; find a free socket ; @param EDX is remote IP address
; local port in ebx ( intel format ) ; @param ESI is open mode (SOCKET_ACTIVE, SOCKET_PASSIVE)
; remote port in ecx ( intel format ) ; @return socket number or -1 (error) in EAX
; remote ip in edx ( in Internet byte order ) ;;
; Socket open mode in esi ( SOCKET_PASSIVE or SOCKET_ACTIVE )
; return socket # in eax, -1 if none available
;
;***************************************************************************
proc socket_open_tcp stdcall proc socket_open_tcp stdcall
local sockAddr dd ? local sockAddr dd ?
@ -369,7 +359,6 @@ local sockAddr dd ?
mov [sockAddr], eax mov [sockAddr], eax
; TODO - check this works! ; TODO - check this works!
;xxx: already 0 (intialized by net_socket_alloc)
;mov [eax + SOCKET.wndsizeTimer], 0 ; Reset the window timer. ;mov [eax + SOCKET.wndsizeTimer], 0 ; Reset the window timer.
xchg bh, bl xchg bh, bl
@ -423,10 +412,8 @@ local sockAddr dd ?
call inc_inet_esi call inc_inet_esi
.exit: .exit:
mov ebx, [sockAddr] ; Get the socket number back, so we can return it
mov [ebx + SOCKET.Status], SOCK_OPEN stdcall net_socket_addr_to_num, [sockAddr]
;pop eax ; Get the socket number back, so we can return it
stdcall net_socket_addr_to_num, ebx
ret ret
.error: .error:
@ -435,32 +422,18 @@ local sockAddr dd ?
ret ret
endp endp
;; [53.1] Close DGRAM socket
;***************************************************************************
; Function
; socket_close
; ;
; Description ; @param EBX is socket number
; socket # in ebx ; @return 0 (closed successfully) or -1 (error) in EAX
; returns 0 for ok, -1 for socket not open (fail) ;;
;
;***************************************************************************
proc socket_close stdcall proc socket_close stdcall
DEBUGF 1, "K : socket_close (0x%x)\n", ebx DEBUGF 1, "K : socket_close (0x%x)\n", ebx
stdcall net_socket_num_to_addr, ebx stdcall net_socket_num_to_addr, ebx
or eax, eax or eax, eax
jz .error jz .error
cmp [eax + SOCKET.Status], dword SOCK_EMPTY
jz .error
; Clear the socket varaibles
stdcall net_socket_free, eax stdcall net_socket_free, eax
; mov edi, eax
; xor eax, eax
; mov ecx, SOCKETHEADERSIZE
; cld
; rep stosb
xor eax, eax xor eax, eax
ret ret
@ -471,16 +444,13 @@ proc socket_close stdcall
ret ret
endp endp
;; [53.8] Close STREAM socket
;*************************************************************************** ; Closing TCP sockets takes time, so when you get successful return code
; Function ; from this function doesn't always mean that socket is actually closed.
; socket_close_tcp
; ;
; Description ; @param EBX is socket number
; socket # in ebx ; @return 0 (closed successfully) or -1 (error) in EAX
; returns 0 for ok, -1 for socket not open (fail) ;;
;
;***************************************************************************
proc socket_close_tcp stdcall proc socket_close_tcp stdcall
local sockAddr dd ? local sockAddr dd ?
DEBUGF 1, "K : socket_close_tcp (0x%x)\n", ebx DEBUGF 1, "K : socket_close_tcp (0x%x)\n", ebx
@ -493,14 +463,12 @@ local sockAddr dd ?
.next_resendq: .next_resendq:
cmp ecx, NUMRESENDENTRIES cmp ecx, NUMRESENDENTRIES
je .last_resendq ; None left je .last_resendq ; None left
;cmp [esi], bl ; XTODO: bl -> ebx
cmp [esi + 4], ebx cmp [esi + 4], ebx
je @f ; found one je @f ; found one
inc ecx inc ecx
add esi, 8 add esi, 8
jmp .next_resendq jmp .next_resendq
;@@: mov byte[esi], 0xff ; XTODO: 0xff -> 0
@@: mov dword[esi + 4], 0 @@: mov dword[esi + 4], 0
inc ecx inc ecx
add esi, 8 add esi, 8
@ -515,13 +483,11 @@ local sockAddr dd ?
mov ebx, eax mov ebx, eax
mov [sockAddr], eax mov [sockAddr], eax
cmp [ebx + SOCKET.Status], SOCK_EMPTY
je .error
cmp [ebx + SOCKET.TCBState], TCB_LISTEN ;xxx cmp [ebx + SOCKET.TCBState], TCB_LISTEN
je .destroy_tcb ;xxx je .destroy_tcb
cmp [ebx + SOCKET.TCBState], TCB_SYN_SENT ;xxx cmp [ebx + SOCKET.TCBState], TCB_SYN_SENT
je .destroy_tcb ;xxx je .destroy_tcb
; Now construct the response, and queue for sending by IP ; Now construct the response, and queue for sending by IP
mov eax, EMPTY_QUEUE mov eax, EMPTY_QUEUE
@ -531,8 +497,7 @@ local sockAddr dd ?
push eax push eax
;xxx mov bl, TH_FIN + TH_ACK mov bl, TH_FIN
mov bl, TH_FIN ;xxx
xor ecx, ecx xor ecx, ecx
xor esi, esi xor esi, esi
stdcall build_tcp_packet, [sockAddr] stdcall build_tcp_packet, [sockAddr]
@ -545,10 +510,6 @@ local sockAddr dd ?
; Get the socket state ; Get the socket state
mov eax, [ebx + SOCKET.TCBState] mov eax, [ebx + SOCKET.TCBState]
;xxx cmp eax, TCB_LISTEN
;xxx je .destroy_tcb
;xxx cmp eax, TCB_SYN_SENT
;xxx je .destroy_tcb
cmp eax, TCB_SYN_RECEIVED cmp eax, TCB_SYN_RECEIVED
je .fin_wait_1 je .fin_wait_1
cmp eax, TCB_ESTABLISHED cmp eax, TCB_ESTABLISHED
@ -556,7 +517,6 @@ local sockAddr dd ?
; assume CLOSE WAIT ; assume CLOSE WAIT
; Send a fin, then enter last-ack state ; Send a fin, then enter last-ack state
; TODO: check if it's really a TCB_CLOSE_WAIT
mov [ebx + SOCKET.TCBState], TCB_LAST_ACK mov [ebx + SOCKET.TCBState], TCB_LAST_ACK
jmp .send jmp .send
@ -580,10 +540,8 @@ local sockAddr dd ?
jmp .exit jmp .exit
.destroy_tcb: .destroy_tcb:
;xxx pop eax
; Clear the socket variables ; Clear the socket variables
;xxx stdcall net_socket_free, [sockAddr]
stdcall net_socket_free, ebx stdcall net_socket_free, ebx
.exit: .exit:
@ -596,16 +554,11 @@ local sockAddr dd ?
ret ret
endp endp
;; [53.2] Poll socket
;***************************************************************************
; Function
; socket_poll
; ;
; Description ; @param EBX is socket number
; socket # in ebx ; @return count or bytes in rx buffer or 0 (error) in EAX
; returns count in eax. ;;
;
;***************************************************************************
proc socket_poll stdcall proc socket_poll stdcall
; DEBUGF 1, "socket_poll(0x%x)\n", ebx ; DEBUGF 1, "socket_poll(0x%x)\n", ebx
stdcall net_socket_num_to_addr, ebx stdcall net_socket_num_to_addr, ebx
@ -616,21 +569,15 @@ proc socket_poll stdcall
ret ret
.error: .error:
;or eax, -1
xor eax, eax xor eax, eax
ret ret
endp endp
;; [53.6] Get socket TCB state
;***************************************************************************
; Function
; socket_status
; ;
; Description ; @param EBX is socket number
; socket # in ebx ; @return socket TCB state or 0 (error) in EAX
; returns TCB state in eax. ;;
;
;***************************************************************************
proc socket_status stdcall proc socket_status stdcall
;; DEBUGF 1, "socket_status(0x%x)\n", ebx ;; DEBUGF 1, "socket_status(0x%x)\n", ebx
stdcall net_socket_num_to_addr, ebx stdcall net_socket_num_to_addr, ebx
@ -641,79 +588,81 @@ proc socket_status stdcall
ret ret
.error: .error:
;or eax, -1
xor eax, eax xor eax, eax
ret ret
endp endp
; Index2RealAddr ebx ;; [53.3] Get one byte from rx buffer
; mov eax, [ebx + SOCKET.TCBState] ; This function can return 0 in two cases: if there's one byte read and
; non left, and if an error occured. Behavior should be changed and function
; shouldn't be used for now. Consider using [53.11] instead.
; ;
; ret ; @param EBX is socket number
; @return number of bytes left in rx buffer or 0 (error) in EAX
; @return byte read in BL
;*************************************************************************** ;;
; Function
; socket_read
;
; Description
; socket # in ebx
; returns # of bytes remaining in eax, data in bl
;
;***************************************************************************
proc socket_read stdcall proc socket_read stdcall
; DEBUGF 1, "socket_read(0x%x)\n", ebx ; DEBUGF 1, "socket_read(0x%x)\n", ebx
stdcall net_socket_num_to_addr, ebx stdcall net_socket_num_to_addr, ebx
or eax, eax or eax, eax
jz .error jz .error
lea ebx, [eax + SOCKET.lock]
call wait_mutex
mov ebx, eax mov ebx, eax
mov eax, [ebx + SOCKET.rxDataCount] ; get count of bytes mov eax, [ebx + SOCKET.rxDataCount] ; get count of bytes
test eax, eax test eax, eax
jz .error jz .error_release
dec eax dec eax
mov esi, ebx ; esi is address of socket mov esi, ebx ; esi is address of socket
mov [ebx + SOCKET.rxDataCount], eax ; store new count mov [ebx + SOCKET.rxDataCount], eax ; store new count
;movzx ebx, byte[ebx + SOCKET.rxData] ; get the byte movzx eax, byte[ebx + SOCKET.rxData] ; get the byte
movzx ebx, byte[ebx + SOCKETHEADERSIZE] ; get the byte
add esi, SOCKETHEADERSIZE
mov edi, esi
inc esi
mov ecx, (SOCKETBUFFSIZE - SOCKETHEADERSIZE) / 4 mov ecx, SOCKETBUFFSIZE - SOCKET.rxData - 1
lea edi, [ebx + SOCKETHEADERSIZE] lea edi, [esi + SOCKET.rxData]
lea esi, [edi + 1] lea esi, [edi + 1]
cld cld
push ecx
shr ecx, 2
rep movsd rep movsd
pop ecx
and ecx, 3
rep movsb
mov [ebx + SOCKET.lock], 0
mov ebx, eax
ret ret
.error_release:
mov [ebx + SOCKET.lock], 0
.error: .error:
;or eax, -1
xor eax, eax
xor ebx, ebx xor ebx, ebx
ret ret
endp endp
;; [53.11] Get specified number of bytes from rx buffer
;*************************************************************************** ; Number of bytes in rx buffer can be less than requested size. In this case,
; Function ; only available number of bytes is read.
; socket_read_packet ; This function can return 0 in two cases: if there's no data to read, and if
; an error occured. Behavior should be changed.
; ;
; Description ; @param EBX is socket number
; socket # in ebx ; @param ECX is pointer to application buffer
; datapointer # in ecx ; @param EDX is application buffer size (number of bytes to read)
; buffer size in edx ; @return number of bytes read or 0 (error) in EAX
; returns # of bytes copied in eax ;;
;
;***************************************************************************
proc socket_read_packet stdcall proc socket_read_packet stdcall
; DEBUGF 1, "socket_read_packet(0x%x)\n", ebx ; DEBUGF 1, "socket_read_packet(0x%x)\n", ebx
stdcall net_socket_num_to_addr, ebx ; get real socket address stdcall net_socket_num_to_addr, ebx ; get real socket address
or eax, eax or eax, eax
jz .error jz .error
lea ebx, [eax + SOCKET.lock]
call wait_mutex
mov ebx, eax mov ebx, eax
mov eax, [ebx + SOCKET.rxDataCount] ; get count of bytes mov eax, [ebx + SOCKET.rxDataCount] ; get count of bytes
test eax, eax ; if count of bytes is zero.. test eax, eax ; if count of bytes is zero..
@ -731,7 +680,7 @@ proc socket_read_packet stdcall
call .start_copy ; copy to the application call .start_copy ; copy to the application
mov esi, ebx ; now we're going to copy the remaining bytes to the beginning mov esi, ebx ; now we're going to copy the remaining bytes to the beginning
add esi, SOCKETHEADERSIZE ; we dont need to copy the header add esi, SOCKET.rxData ; we dont need to copy the header
mov edi, esi ; edi is where we're going to copy to mov edi, esi ; edi is where we're going to copy to
add esi, edx ; esi is from where we copy add esi, edx ; esi is from where we copy
pop ecx ; count of bytes we have left pop ecx ; count of bytes we have left
@ -744,10 +693,10 @@ proc socket_read_packet stdcall
rep movsb ; copy remaining bytes rep movsb ; copy remaining bytes
.exit: .exit:
mov [ebx + SOCKET.lock], 0
ret ; at last, exit ret ; at last, exit
.error: .error:
;or eax, -1
xor eax, eax xor eax, eax
ret ret
@ -755,12 +704,13 @@ proc socket_read_packet stdcall
xor esi, esi xor esi, esi
mov [ebx + SOCKET.rxDataCount], esi ; store new count (zero) mov [ebx + SOCKET.rxDataCount], esi ; store new count (zero)
call .start_copy call .start_copy
mov [ebx + SOCKET.lock], 0
ret ret
.start_copy: .start_copy:
mov edi, ecx mov edi, ecx
mov esi, ebx mov esi, ebx
add esi, SOCKETHEADERSIZE ; we dont need to copy the header add esi, SOCKET.rxData ; we dont need to copy the header
mov ecx, eax ; eax is count of bytes mov ecx, eax ; eax is count of bytes
push ecx push ecx
shr ecx, 2 ; divide eax by 4 shr ecx, 2 ; divide eax by 4
@ -772,19 +722,13 @@ proc socket_read_packet stdcall
retn ; exit, or go back to shift remaining bytes if any retn ; exit, or go back to shift remaining bytes if any
endp endp
;; [53.4] Send data through DGRAM socket
;***************************************************************************
; Function
; socket_write
; ;
; Description ; @param EBX is socket number
; socket in ebx ; @param ECX is application data size (number of bytes to send)
; # of bytes to write in ecx ; @param EDX is pointer to application data buffer
; pointer to data in edx ; @return 0 (sent successfully) or -1 (error) in EAX
; returns 0 in eax ok, -1 == failed ( invalid socket, or ;;
; could not queue IP packet )
;
;***************************************************************************
proc socket_write stdcall proc socket_write stdcall
; DEBUGF 1, "socket_write(0x%x)\n", ebx ; DEBUGF 1, "socket_write(0x%x)\n", ebx
stdcall net_socket_num_to_addr, ebx ; get real socket address stdcall net_socket_num_to_addr, ebx ; get real socket address
@ -793,10 +737,6 @@ proc socket_write stdcall
mov ebx, eax mov ebx, eax
; If the socket is invalid, return with an error code
cmp [ebx + SOCKET.Status], SOCK_EMPTY
je .error
mov eax, EMPTY_QUEUE mov eax, EMPTY_QUEUE
call dequeue call dequeue
cmp ax, NO_BUFFER cmp ax, NO_BUFFER
@ -940,19 +880,13 @@ proc socket_write stdcall
ret ret
endp endp
;; [53.7] Send data through STREAM socket
;***************************************************************************
; Function
; socket_write_tcp
; ;
; Description ; @param EBX is socket number
; socket in ebx ; @param ECX is application data size (number of bytes to send)
; # of bytes to write in ecx ; @param EDX is pointer to application data buffer
; pointer to data in edx ; @return 0 (sent successfully) or -1 (error) in EAX
; returns 0 in eax ok, -1 == failed ( invalid socket, or ;;
; could not queue IP packet )
;
;***************************************************************************
proc socket_write_tcp stdcall proc socket_write_tcp stdcall
local sockAddr dd ? local sockAddr dd ?
@ -964,12 +898,7 @@ local sockAddr dd ?
mov ebx, eax mov ebx, eax
mov [sockAddr], ebx mov [sockAddr], ebx
; If the socket is invalid, return with an error code
cmp [ebx + SOCKET.Status], SOCK_EMPTY
je .error
; If the sockets window timer is nonzero, do not queue packet ; If the sockets window timer is nonzero, do not queue packet
; TODO - done
cmp [ebx + SOCKET.wndsizeTimer], 0 cmp [ebx + SOCKET.wndsizeTimer], 0
jne .error jne .error
@ -999,8 +928,8 @@ local sockAddr dd ?
pop ebx pop ebx
push ecx push ecx
mov eax, NET1OUT_QUEUE
mov eax, NET1OUT_QUEUE
mov edx, [stack_ip] mov edx, [stack_ip]
mov ecx, [sockAddr] mov ecx, [sockAddr]
cmp edx, [ecx + SOCKET.RemoteIP] cmp edx, [ecx + SOCKET.RemoteIP]
@ -1031,7 +960,6 @@ local sockAddr dd ?
.next_resendq: .next_resendq:
cmp ecx, NUMRESENDENTRIES cmp ecx, NUMRESENDENTRIES
je .exit ; None found je .exit ; None found
;cmp byte[esi], 0xff ; XTODO: 0xff -> 0
cmp dword[esi + 4], 0 cmp dword[esi + 4], 0
je @f ; found one je @f ; found one
inc ecx inc ecx
@ -1049,7 +977,6 @@ local sockAddr dd ?
; fill IP buffer associated with this descriptor ; fill IP buffer associated with this descriptor
stdcall net_socket_addr_to_num, [sockAddr] stdcall net_socket_addr_to_num, [sockAddr]
;mov [esi], al ; XTODO: al -> eax
mov [esi + 4], eax mov [esi + 4], eax
mov byte[esi + 1], TCP_RETRIES mov byte[esi + 1], TCP_RETRIES
mov word[esi + 2], TCP_TIMEOUT mov word[esi + 2], TCP_TIMEOUT

View File

@ -1,14 +1,12 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; STACK.INC ;; ;; STACK.INC ;;
;; ;; ;; ;;
;; TCP/IP stack for Menuet OS ;; ;; TCP/IP stack for Menuet OS ;;
;; ;; ;; ;;
;; Version 0.7 4th July 2004 ;;
;; ;;
;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;; ;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;;
;; ;; ;; ;;
;; See file COPYING for details ;; ;; See file COPYING for details ;;
@ -46,7 +44,7 @@ endg
; socket buffers ; socket buffers
SOCKETBUFFSIZE equ 4096 ; state + config + buffer. SOCKETBUFFSIZE equ 4096 ; state + config + buffer.
SOCKETHEADERSIZE equ 76+8+8 ; thus 4096 - SOCKETHEADERSIZE bytes data SOCKETHEADERSIZE equ SOCKET.rxData ; thus 4096 - SOCKETHEADERSIZE bytes data
;NUM_SOCKETS equ 16 ; Number of open sockets supported. Was 20 ;NUM_SOCKETS equ 16 ; Number of open sockets supported. Was 20

View File

@ -1,14 +1,12 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; TCP.INC ;; ;; TCP.INC ;;
;; ;; ;; ;;
;; TCP Processes for Menuet OS TCP/IP stack ;; ;; TCP Processes for Menuet OS TCP/IP stack ;;
;; ;; ;; ;;
;; Version 0.6 4th July 2004 ;;
;; ;;
;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;; ;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;;
;; ;; ;; ;;
;; See file COPYING for details ;; ;; See file COPYING for details ;;
@ -118,14 +116,14 @@ proc tcp_tcb_handler stdcall uses ebx
cmp [ebx + SOCKET.NextPtr], 0 cmp [ebx + SOCKET.NextPtr], 0
je .exit je .exit
DEBUGF 1, "K : sockets:\n" ;DEBUGF 1, "K : sockets:\n"
.next_socket: .next_socket:
mov ebx, [ebx + SOCKET.NextPtr] mov ebx, [ebx + SOCKET.NextPtr]
or ebx, ebx or ebx, ebx
jz .exit jz .exit
DEBUGF 1, "K : %x: %x-%x-%x-%u\n", ebx, [ebx + SOCKET.LocalPort]:4, [ebx + SOCKET.RemoteIP], [ebx + SOCKET.RemotePort]:4, [ebx + SOCKET.TCBState] ;DEBUGF 1, "K : %x-%x: %x-%x-%x-%u\n", [ebx + SOCKET.PID]:2, [ebx + SOCKET.Number]:2, [ebx + SOCKET.LocalPort]:4, [ebx + SOCKET.RemoteIP], [ebx + SOCKET.RemotePort]:4, [ebx + SOCKET.TCBState]
cmp [ebx + SOCKET.TCBTimer], 0 cmp [ebx + SOCKET.TCBTimer], 0
jne .decrement_tcb jne .decrement_tcb
@ -177,7 +175,6 @@ proc tcp_tx_handler stdcall
.next_resendq: .next_resendq:
cmp ecx, NUMRESENDENTRIES cmp ecx, NUMRESENDENTRIES
je .exit ; None left je .exit ; None left
;cmp [esi], byte 0xFF ; XTODO: 0xff -> 0
cmp dword[esi + 4], 0 cmp dword[esi + 4], 0
jne @f ; found one jne @f ; found one
inc ecx inc ecx
@ -192,7 +189,6 @@ proc tcp_tx_handler stdcall
jmp .next_resendq ; Timer not zero, so move on jmp .next_resendq ; Timer not zero, so move on
@@: @@:
;mov bl, 0xff ; XTODO: bl -> ebx, 0xff -> 0
xor ebx, ebx xor ebx, ebx
; restart timer, and decrement retries ; restart timer, and decrement retries
; After the first resend, back of on next, by a factor of 5 ; After the first resend, back of on next, by a factor of 5
@ -201,7 +197,6 @@ proc tcp_tx_handler stdcall
jnz @f jnz @f
; retries now 0, so delete from queue ; retries now 0, so delete from queue
;xchg [esi], bl ; XTODO: bl -> ebx
xchg [esi + 4], ebx xchg [esi + 4], ebx
@@: ; resend packet @@: ; resend packet
@ -213,10 +208,8 @@ proc tcp_tx_handler stdcall
jne .tth004z jne .tth004z
; TODO - try again in 10ms. ; TODO - try again in 10ms.
;cmp bl, 0xff ; XTODO: 0xff -> 0
test ebx, ebx test ebx, ebx
jnz @f jnz @f
;mov [esi], bl ; XTODO: bl -> ebx
mov [esi + 4], ebx mov [esi + 4], ebx
@@: ; Mark it to expire in 10ms - 1 tick @@: ; Mark it to expire in 10ms - 1 tick
@ -316,9 +309,6 @@ proc tcp_rx stdcall uses ebx
or ebx, ebx or ebx, ebx
jz .next_socket.1.exit jz .next_socket.1.exit
cmp [ebx + SOCKET.Status], SOCK_OPEN
jne .next_socket.1
; DEBUGF 1, "K : tcp_rx - 1.dport: %x - %x\n", [edx + 20 + TCP_PACKET.DestinationPort]:4, [ebx + SOCKET.LocalPort]:4 ; DEBUGF 1, "K : tcp_rx - 1.dport: %x - %x\n", [edx + 20 + TCP_PACKET.DestinationPort]:4, [ebx + SOCKET.LocalPort]:4
mov ax, [edx + 20 + TCP_PACKET.DestinationPort] ; get the dest. port from the TCP hdr mov ax, [edx + 20 + TCP_PACKET.DestinationPort] ; get the dest. port from the TCP hdr
@ -355,9 +345,6 @@ proc tcp_rx stdcall uses ebx
or ebx, ebx or ebx, ebx
jz .next_socket.2.exit jz .next_socket.2.exit
cmp [ebx + SOCKET.Status], SOCK_OPEN
jne .next_socket.2
; DEBUGF 1, "K : tcp_rx - 2.dport: %x - %x\n", [edx + 20 + TCP_PACKET.DestinationPort]:4, [ebx + SOCKET.LocalPort]:4 ; DEBUGF 1, "K : tcp_rx - 2.dport: %x - %x\n", [edx + 20 + TCP_PACKET.DestinationPort]:4, [ebx + SOCKET.LocalPort]:4
mov ax, [edx + 20 + TCP_PACKET.DestinationPort] ; get the dest. port from the TCP hdr mov ax, [edx + 20 + TCP_PACKET.DestinationPort] ; get the dest. port from the TCP hdr
@ -393,9 +380,6 @@ proc tcp_rx stdcall uses ebx
or ebx, ebx or ebx, ebx
jz .next_socket.3.exit jz .next_socket.3.exit
cmp [ebx + SOCKET.Status], SOCK_OPEN
jne .next_socket.3
; DEBUGF 1, "K : tcp_rx - 3.dport: %x - %x\n", [edx + 20 + TCP_PACKET.DestinationPort]:4, [ebx + SOCKET.LocalPort]:4 ; DEBUGF 1, "K : tcp_rx - 3.dport: %x - %x\n", [edx + 20 + TCP_PACKET.DestinationPort]:4, [ebx + SOCKET.LocalPort]:4
mov ax, [edx + 20 + TCP_PACKET.DestinationPort] ; get destination port from the TCP hdr mov ax, [edx + 20 + TCP_PACKET.DestinationPort] ; get destination port from the TCP hdr
@ -421,16 +405,7 @@ proc tcp_rx stdcall uses ebx
DEBUGF 1, "K : tcp_rx - dumped\n" DEBUGF 1, "K : tcp_rx - dumped\n"
DEBUGF 1, "K : --------: %x-%x-%x (flags: %x)\n", [edx + 20 + TCP_PACKET.DestinationPort]:4, [edx + IP_PACKET.SourceAddress], [edx + 20 + TCP_PACKET.SourcePort]:4, [edx + 20 + TCP_PACKET.Flags]:2 DEBUGF 1, "K : --------: %x-%x-%x (flags: %x)\n", [edx + 20 + TCP_PACKET.DestinationPort]:4, [edx + IP_PACKET.SourceAddress], [edx + 20 + TCP_PACKET.SourcePort]:4, [edx + 20 + TCP_PACKET.Flags]:2
; mov ebx, net_sockets
;
; .next_socket.4:
; mov ebx, [ebx + SOCKET.NextPtr]
; or ebx, ebx
; jz .next_socket.4.exit
; DEBUGF 1, "K : %x: %x-%x-%x-%u\n", ebx, [ebx + SOCKET.LocalPort]:4, [ebx + SOCKET.RemoteIP], [ebx + SOCKET.RemotePort]:4, [ebx + SOCKET.TCBState]
; jne .next_socket.4
;
; .next_socket.4.exit:
inc [dumped_rx_count] inc [dumped_rx_count]
jmp .exit jmp .exit
@ -661,7 +636,6 @@ proc tcpStateMachine stdcall, sockAddr:DWORD
.next_resendq: .next_resendq:
cmp ecx, NUMRESENDENTRIES cmp ecx, NUMRESENDENTRIES
je .call_handler ; None left je .call_handler ; None left
;cmp [esi], al ; XTODO: al -> eax
cmp [esi + 4], eax cmp [esi + 4], eax
je @f ; found one je @f ; found one
inc ecx inc ecx
@ -702,7 +676,6 @@ proc tcpStateMachine stdcall, sockAddr:DWORD
add esi, 8 add esi, 8
jmp .next_resendq jmp .next_resendq
;@@: mov byte[esi], 0xff ; XTODO: 0xff -> 0
@@: mov dword[esi + 4], 0 @@: mov dword[esi + 4], 0
inc ecx inc ecx
add esi, 8 add esi, 8
@ -852,16 +825,16 @@ proc stateTCB_SYN_RECEIVED stdcall, sockAddr:DWORD
; For now, if the packet is an ACK, process it, ; For now, if the packet is an ACK, process it,
; If not, ignore it ; If not, ignore it
test [edx + 20 + TCP_PACKET.Flags], TH_RST ;xxx test [edx + 20 + TCP_PACKET.Flags], TH_RST
jz .check_ack ;xxx jz .check_ack
push [ebx + SOCKET.OrigRemotePort] [ebx + SOCKET.OrigRemoteIP] push [ebx + SOCKET.OrigRemotePort] [ebx + SOCKET.OrigRemoteIP]
pop [ebx + SOCKET.RemoteIP] [ebx + SOCKET.RemotePort] pop [ebx + SOCKET.RemoteIP] [ebx + SOCKET.RemotePort]
mov [ebx + SOCKET.TCBState], TCB_LISTEN ;xxx mov [ebx + SOCKET.TCBState], TCB_LISTEN
jmp .exit ;xxx jmp .exit
.check_ack: ;xxx .check_ack:
; Look at control flags - expecting an ACK ; Look at control flags - expecting an ACK
test [edx + 20 + TCP_PACKET.Flags], TH_ACK test [edx + 20 + TCP_PACKET.Flags], TH_ACK
jz .exit jz .exit
@ -878,10 +851,8 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
; OR both... ; OR both...
; Did we receive a FIN or RST? ; Did we receive a FIN or RST?
;xxx test [edx + 20 + TCP_PACKET.Flags], TH_FIN + TH_RST test [edx + 20 + TCP_PACKET.Flags], TH_FIN
;xxx jz .check_ack jz .check_ack
test [edx + 20 + TCP_PACKET.Flags], TH_FIN ;xxx
jz .check_ack ;xxx
; It was a fin or reset. ; It was a fin or reset.
@ -897,14 +868,12 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
.next_resendq: .next_resendq:
cmp ecx, NUMRESENDENTRIES cmp ecx, NUMRESENDENTRIES
je .last_resendq ; None left je .last_resendq ; None left
;cmp [esi], al ; XTODO: al -> eax
cmp [esi + 4], eax cmp [esi + 4], eax
je @f ; found one je @f ; found one
inc ecx inc ecx
add esi, 8 add esi, 8
jmp .next_resendq jmp .next_resendq
;@@: mov byte[esi], 0xff ; XTODO: 0xff -> 0
@@: mov dword[esi + 4], 0 @@: mov dword[esi + 4], 0
inc ecx inc ecx
add esi, 8 add esi, 8
@ -913,13 +882,6 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
.last_resendq: .last_resendq:
popad popad
;xxx ; was it a reset?
;xxx test [edx + 20 + TCP_PACKET.Flags], TH_RST
;xxx jz @f
;xxx mov [ebx + SOCKET.TCBState], TCB_CLOSED
;xxx jmp .exit
@@: ; Send an ACK to that fin, and enter closewait state @@: ; Send an ACK to that fin, and enter closewait state
mov [ebx + SOCKET.TCBState], TCB_CLOSE_WAIT mov [ebx + SOCKET.TCBState], TCB_CLOSE_WAIT
@ -966,7 +928,7 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
movzx ecx, [edx + IP_PACKET.TotalLength] movzx ecx, [edx + IP_PACKET.TotalLength]
xchg cl, ch xchg cl, ch
sub ecx, 40 ; Discard 40 bytes of header sub ecx, 40 ; Discard 40 bytes of header
jnz .data ; Read data, if any ja .data ; Read data, if any
; If we had received a fin, we need to ACK it. ; If we had received a fin, we need to ACK it.
cmp [ebx + SOCKET.TCBState], TCB_CLOSE_WAIT cmp [ebx + SOCKET.TCBState], TCB_CLOSE_WAIT
@ -974,14 +936,19 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
jmp .exit jmp .exit
.data: .data:
push ebx
add ebx, SOCKET.lock
call wait_mutex
pop ebx
push ecx push ecx
push [ebx + SOCKET.PID] ; get socket owner PID
mov eax, [ebx + SOCKET.rxDataCount]
add eax, ecx
cmp eax, SOCKETBUFFSIZE - SOCKETHEADERSIZE
ja .overflow
add [ebx + SOCKET.rxDataCount], ecx ; increment the count of bytes in buffer mov [ebx + SOCKET.rxDataCount], eax ; increment the count of bytes in buffer
mov eax, [ebx + SOCKET.PID] ; get socket owner PID
push eax
mov eax, [ebx + SOCKET.rxDataCount] ; get # of bytes already in buffer
; point to the location to store the data ; point to the location to store the data
lea edi, [ebx + eax + SOCKETHEADERSIZE] lea edi, [ebx + eax + SOCKETHEADERSIZE]
@ -992,6 +959,7 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
cld cld
rep movsb ; copy the data across rep movsb ; copy the data across
mov [ebx + SOCKET.lock], 0 ; release mutex
; flag an event to the application ; flag an event to the application
pop eax pop eax
@ -1046,6 +1014,12 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
.exit: .exit:
ret ret
.overflow:
; no place in buffer
; so simply restore stack and exit
pop eax ecx
mov [ebx + SOCKET.lock], 0
ret
endp endp
@ -1167,11 +1141,6 @@ proc stateTCB_LAST_ACK stdcall, sockAddr:DWORD
; delete the socket ; delete the socket
stdcall net_socket_free, ebx stdcall net_socket_free, ebx
; mov edi, ebx
; xor eax, eax
; mov ecx, SOCKETHEADERSIZE
; cld
; rep stosb
.exit: .exit:
ret ret

View File

@ -1,10 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; ;; ;; ;;
@ -12,8 +8,6 @@
;; ;; ;; ;;
;; UDP Processes for Menuet OS TCP/IP stack ;; ;; UDP Processes for Menuet OS TCP/IP stack ;;
;; ;; ;; ;;
;; Version 0.3 29 August 2002 ;;
;; ;;
;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;; ;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;;
;; ;; ;; ;;
;; See file COPYING for details ;; ;; See file COPYING for details ;;
@ -102,7 +96,7 @@ proc udp_rx stdcall
je @f je @f
mov eax, [edx + IP_PACKET.SourceAddress] ; get the Source address from the IP packet mov eax, [edx + IP_PACKET.SourceAddress] ; get the Source address from the IP packet
cmp [ebx + SOCKET.RemoteIP], ebx cmp [ebx + SOCKET.RemoteIP], eax
jne .exit ; Quit if the source IP is not valid jne .exit ; Quit if the source IP is not valid
@@: ; OK - we have a valid UDP packet for this socket. @@: ; OK - we have a valid UDP packet for this socket.

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; PLAYNOTE.INC version 1.1 22 November 2003 ;; ;; PLAYNOTE.INC version 1.1 22 November 2003 ;;

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -489,7 +489,6 @@ proc init_cursors
cmp ebx, 32 cmp ebx, 32
jne @F jne @F
mov dword [select_hw_cursor], select_cursor mov dword [select_hw_cursor], select_cursor
mov dword [set_hw_cursor], cursor_32 mov dword [set_hw_cursor], cursor_32
mov dword [hw_restore], restore_32 mov dword [hw_restore], restore_32
@ -642,7 +641,6 @@ proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword
lodsd lodsd
test eax, 0xFF000000 test eax, 0xFF000000
jz @F jz @F
mov [edi], ax mov [edi], ax
shr eax, 16 shr eax, 16
mov [edi+2], al mov [edi+2], al
@ -656,6 +654,7 @@ proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword
ret ret
endp endp
align 4 align 4
proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
locals locals
@ -756,6 +755,7 @@ proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
ret ret
endp endp
align 4 align 4
def_arrow: def_arrow:
file 'arrow.cur' file 'arrow.cur'

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; VESA12.INC ;; ;; VESA12.INC ;;
@ -884,6 +884,8 @@ vesa12_putimage:
add esi,[esp+32] add esi,[esp+32]
cmp ebp,putimage_get1bpp cmp ebp,putimage_get1bpp
jz .correct jz .correct
cmp ebp,putimage_get2bpp
jz .correct
cmp ebp,putimage_get4bpp cmp ebp,putimage_get4bpp
jnz @f jnz @f
.correct: .correct:
@ -957,6 +959,8 @@ vesa12_putimage:
add edi,[BytesPerScanLine] add edi,[BytesPerScanLine]
cmp ebp,putimage_get1bpp cmp ebp,putimage_get1bpp
jz .correct jz .correct
cmp ebp,putimage_get2bpp
jz .correct
cmp ebp,putimage_get4bpp cmp ebp,putimage_get4bpp
jnz @f jnz @f
.correct: .correct:

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; VESA20.INC ;; ;; VESA20.INC ;;
@ -239,6 +239,8 @@ end if
; inc ebp ; inc ebp
cmp [putimg.ebp], putimage_get1bpp cmp [putimg.ebp], putimage_get1bpp
jz .correct jz .correct
cmp [putimg.ebp], putimage_get2bpp
jz .correct
cmp [putimg.ebp], putimage_get4bpp cmp [putimg.ebp], putimage_get4bpp
jnz @f jnz @f
.correct: .correct:
@ -283,6 +285,8 @@ end if
; inc ebp ; inc ebp
cmp [putimg.ebp], putimage_get1bpp cmp [putimg.ebp], putimage_get1bpp
jz .correct jz .correct
cmp [putimg.ebp], putimage_get2bpp
jz .correct
cmp [putimg.ebp], putimage_get4bpp cmp [putimg.ebp], putimage_get4bpp
jnz @f jnz @f
.correct: .correct: