forked from KolibriOS/kolibrios
kolibri_pe: the latest 32-bit version
git-svn-id: svn://kolibrios.org@2971 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
7a5bca6402
commit
a20b1c888d
@ -14,7 +14,7 @@ $Revision$
|
||||
; Автор части исходного текста Кулаков Владимир Геннадьевич
|
||||
; Адаптация, доработка и разработка Mario79
|
||||
|
||||
; Максимальное количество повторений операции чтени
|
||||
; Максимальное количество повторений операции чтения
|
||||
MaxRetr equ 10
|
||||
; Предельное время ожидания готовности к приему команды
|
||||
; (в тиках)
|
||||
@ -38,7 +38,7 @@ ReadCD:
|
||||
mov [CDBlockSize],2048 ;2352
|
||||
; Очистить буфер пакетной команды
|
||||
call clear_packet_buffer
|
||||
; Сформировать пакетную команду для считывани
|
||||
; Сформировать пакетную команду для считывания
|
||||
; сектора данных
|
||||
; Задать код команды Read CD
|
||||
mov [PacketCommand],byte 0x28 ;0xBE
|
||||
@ -168,6 +168,7 @@ MaxCDWaitTime equ 1000 ;200 ;10
|
||||
; Область памяти для формирования пакетной команды
|
||||
PacketCommand: rb 12 ;DB 12 DUP (?)
|
||||
; Область памяти для приема данных от дисковода
|
||||
;CDDataBuf DB 4096 DUP (0)
|
||||
; Размер принимаемого блока данных в байтах
|
||||
CDBlockSize DW ?
|
||||
; Адрес считываемого сектора данных
|
||||
@ -176,7 +177,7 @@ CDSectorAddress: DD ?
|
||||
TickCounter_1 DD 0
|
||||
; Время начала ожидания готовности устройства
|
||||
WURStartTime DD 0
|
||||
; указатель буфера для считывани
|
||||
; указатель буфера для считывания
|
||||
CDDataBuf_pointer dd 0
|
||||
|
||||
;****************************************************
|
||||
@ -341,7 +342,7 @@ SendPacketNoDatCommand:
|
||||
add DX,7 ;порт 1х7h
|
||||
@@WaitDevice0_1:
|
||||
call change_task
|
||||
; Проверить время ожидани
|
||||
; Проверить время ожидания
|
||||
mov EAX,[timer_ticks]
|
||||
sub EAX,[TickCounter_1]
|
||||
cmp EAX,BSYWaitTime
|
||||
@ -463,12 +464,12 @@ SendCommandToHDD_1:
|
||||
jmp .test
|
||||
@@:
|
||||
call change_task
|
||||
; Проверить время ожидани
|
||||
; Проверить время ожидания
|
||||
mov eax,[timer_ticks]
|
||||
sub eax,[TickCounter_1]
|
||||
cmp eax,BSYWaitTime ;300 ;ожидать 3 сек.
|
||||
ja @@Err1_4 ;ошибка тайм-аута
|
||||
; Прочитать регистр состояни
|
||||
; Прочитать регистр состояния
|
||||
.test:
|
||||
in AL,DX
|
||||
; Проверить состояние сигнала BSY
|
||||
@ -644,7 +645,7 @@ LoadMedium:
|
||||
; Сформировать команду START/STOP UNIT
|
||||
; Задать код команды
|
||||
mov [PacketCommand],word 1Bh
|
||||
; Задать операцию загрузки носител
|
||||
; Задать операцию загрузки носителя
|
||||
mov [PacketCommand+4],word 00000011b
|
||||
; Подать команду
|
||||
call SendPacketNoDatCommand
|
||||
@ -665,7 +666,7 @@ EjectMedium:
|
||||
; Сформировать команду START/STOP UNIT
|
||||
; Задать код команды
|
||||
mov [PacketCommand],word 1Bh
|
||||
; Задать операцию извлечения носител
|
||||
; Задать операцию извлечения носителя
|
||||
mov [PacketCommand+4],word 00000010b
|
||||
; Подать команду
|
||||
call SendPacketNoDatCommand
|
||||
|
@ -858,6 +858,10 @@ rd_find_lfn:
|
||||
mov [esp+8], eax
|
||||
mov dword [esp+4], ramdisk_notroot_first
|
||||
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
|
||||
.notfound:
|
||||
add esp, 12
|
||||
@ -891,7 +895,6 @@ rd_find_lfn:
|
||||
;
|
||||
;--------------------------------------------------------------
|
||||
fs_RamdiskRead:
|
||||
|
||||
cmp byte [esi], 0
|
||||
jnz @f
|
||||
or ebx, -1
|
||||
|
@ -22,7 +22,7 @@ endg
|
||||
sysfn_saveramdisk: ; 18.6 = SAVE FLOPPY IMAGE (HD version only)
|
||||
call restorefatchain
|
||||
mov eax, [_rd_base]
|
||||
mov [saverd_fileinfo+4], eax
|
||||
mov [saverd_fileinfo+4*4], eax
|
||||
mov eax, saverd_fileinfo
|
||||
mov [saverd_fileinfo.name], ecx
|
||||
pushad
|
||||
|
@ -107,7 +107,7 @@ _rs db 186,'
|
||||
_bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ',13,10,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
|
||||
remarks dw remark1, remark2, remark3
|
||||
num_remarks = 3
|
||||
|
@ -109,7 +109,7 @@ save_quest db "J
|
||||
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
|
||||
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
|
||||
remarks dw remark1, remark2, remark3
|
||||
num_remarks = 3
|
||||
|
@ -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
|
||||
|
||||
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
|
||||
remarks dw remark1, remark2, remark3
|
||||
num_remarks = 3
|
||||
|
@ -84,7 +84,7 @@ _bt db 186,'
|
||||
|
||||
|
||||
remark1 db "‡ ç¥¨ï ¯® 㬮«ç ¨î ¢ë¡à ë ¤«ï 㤮¡á⢠¡®«ìè¨á⢠, ® ¥ ¢á¥å.",0
|
||||
remark2 db "…᫨ ã ‚ á LCD-¬®¨â®à, ®âª«îç¨â¥ VRR ¢ ¯ãªâ¥ [c] - ® ‚ ¬ ¥ 㦥.",0
|
||||
remark2 db "…᫨ ã ‚ á <EFBFBD>‹’-¬®¨â®à, ¢ª«îç¨â¥ VRR ¢ ¯ãªâ¥ [c].",0
|
||||
remark3 db "…᫨ ã ‚ á ¥ £à㧨âáï á¨á⥬ , ¯®¯à®¡ã©â¥ ®âª«îç¨âì ¯ãªâ [b].",0
|
||||
remarks dw remark1, remark2, remark3
|
||||
num_remarks = 3
|
||||
|
@ -217,14 +217,14 @@ calc_vmodes_table:
|
||||
; cmp [es:mi.BitsPerPixel], 24
|
||||
; jb @f
|
||||
|
||||
cmp [es:mi.BitsPerPixel],16
|
||||
jne .l0
|
||||
cmp [es:mi.GreenMaskSize],5
|
||||
jne .l0
|
||||
mov [es:mi.BitsPerPixel],15
|
||||
; cmp [es:mi.BitsPerPixel],16
|
||||
; jne .l0
|
||||
; cmp [es:mi.GreenMaskSize],5
|
||||
; jne .l0
|
||||
; mov [es:mi.BitsPerPixel],15
|
||||
|
||||
|
||||
.l0:
|
||||
.l0:
|
||||
cmp [es:mi.XRes],640
|
||||
jb @f
|
||||
cmp [es:mi.YRes],480
|
||||
@ -243,10 +243,10 @@ calc_vmodes_table:
|
||||
jb .lp1
|
||||
|
||||
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]
|
||||
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
|
||||
@ -413,9 +413,17 @@ check_first_parm:
|
||||
mov ax,modes_table
|
||||
@@:
|
||||
|
||||
mov word[home_cursor],ax
|
||||
push word [preboot_graph]
|
||||
pop word [cursor_pos]
|
||||
mov word [home_cursor],ax
|
||||
mov si,[preboot_graph]
|
||||
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
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
.loops:
|
||||
@ -432,7 +440,9 @@ check_first_parm:
|
||||
je .exit
|
||||
jmp .loops
|
||||
.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
|
||||
.@@_next_bit:
|
||||
;clear cursor
|
||||
mov word[ds:_r1+21],' '
|
||||
mov word[ds:_r1+50],' '
|
||||
mov ax,' '
|
||||
mov word[ds:_r1+21],ax
|
||||
mov word[ds:_r1+50],ax
|
||||
|
||||
mov word[ds:_r2+21],' '
|
||||
mov word[ds:_r2+45],' '
|
||||
mov word[ds:_r2+21],ax
|
||||
mov word[ds:_r2+45],ax
|
||||
|
||||
mov word[ds:_rs+21],' '
|
||||
mov word[ds:_rs+46],' '
|
||||
mov word[ds:_rs+21],ax
|
||||
mov word[ds:_rs+46],ax
|
||||
; draw string
|
||||
cmp word [es:si+6],0x12
|
||||
je .show_0x12
|
||||
@ -649,7 +660,7 @@ clear_vmodes_table:
|
||||
rep stosw
|
||||
mov cx,70
|
||||
add di,20
|
||||
dec bp ; 㬥ìè¨âì DX,
|
||||
dec bp
|
||||
jns .loop_start
|
||||
pop es
|
||||
popa
|
||||
|
@ -187,57 +187,22 @@ end virtual
|
||||
|
||||
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
|
||||
app_page_tabs equ 0xDD800000
|
||||
|
||||
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
|
||||
;heap_tabs equ (page_tabs+ (HEAP_BASE shr 9))
|
||||
kernel_tabs equ page_tabs)
|
||||
master_tab equ (page_tabs+ (page_tabs shr 9))
|
||||
|
||||
_16BIT_BASE equ 0x00010000
|
||||
LOAD_BASE equ 0x00100000
|
||||
OS_BASE equ 0xE0000000
|
||||
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
|
||||
IMAGE_BASE equ LOAD_BASE
|
||||
|
||||
LAST_PAGE equ 0x01CB000
|
||||
|
||||
twdw equ (CURRENT_TASK-window_data)
|
||||
NCPU equ 8
|
||||
|
||||
RING0_STACK_SIZE equ (0x2000 - 512) ;512 áàéò äëÿ êîíòåêñòà FPU
|
||||
|
||||
@ -386,6 +351,40 @@ virtual at 0
|
||||
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
|
||||
{
|
||||
.mutex rd 1
|
||||
@ -438,13 +437,13 @@ virtual at 0
|
||||
end virtual
|
||||
|
||||
struc MEM_STATE
|
||||
{ .mutex rd 1
|
||||
.smallmap rd 1
|
||||
.treemap rd 1
|
||||
.topsize rd 1
|
||||
.top rd 1
|
||||
.smallbins rd 4*32
|
||||
.treebins rd 32
|
||||
{ .mutex rd 1
|
||||
.smallmap rd 1
|
||||
.treemap rd 1
|
||||
.topsize rd 1
|
||||
.top rd 1
|
||||
.smallbins rd 4*32
|
||||
.treebins rd 32
|
||||
}
|
||||
|
||||
struc PG_DATA
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
PIMAGE_DOS_HEADER dos;
|
||||
PIMAGE_NT_HEADERS32 nt;
|
||||
|
||||
size_t img_size;
|
||||
count_t img_pages;
|
||||
count_t img_tabs;
|
||||
|
||||
addr_t ex_pg_dir;
|
||||
addr_t ex_stack_page;
|
||||
addr_t ex_pl0_stack;
|
||||
@ -588,6 +590,7 @@ bool link_pe(addr_t img_base)
|
||||
exp_dll = find_dll(&core_dll.link, libname);
|
||||
if(exp_dll == NULL)
|
||||
{
|
||||
|
||||
exp_dll = find_dll(¤t_slot->dll_list, libname);
|
||||
if(exp_dll == NULL)
|
||||
{
|
||||
|
@ -17,6 +17,8 @@ PID_KERNEL equ 1 ;os_idle thread
|
||||
align 4
|
||||
proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
|
||||
|
||||
push ebx
|
||||
|
||||
mov ebx, [irq] ;irq num
|
||||
test ebx, ebx
|
||||
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
|
||||
|
||||
stdcall enable_irq, [irq]
|
||||
pop ebx
|
||||
mov eax, 1
|
||||
ret
|
||||
.err:
|
||||
pop ebx
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
@ -824,6 +828,8 @@ proc load_driver stdcall, driver_name:dword
|
||||
mov dword [edx+8], 'vers'
|
||||
mov byte [edx+12], '/'
|
||||
mov esi, [driver_name]
|
||||
.redo:
|
||||
lea edx, [file_name]
|
||||
lea edi, [edx+13]
|
||||
mov ecx, 16
|
||||
@@:
|
||||
|
@ -17,6 +17,7 @@
|
||||
.ascii " -export:CreateRingBuffer" # stdcall
|
||||
.ascii " -export:CommitPages" # eax, ebx, ecx FIXME
|
||||
.ascii " -export:UnmapPages" # eax, ecx FIXME
|
||||
|
||||
.ascii " -export:CreateObject" # eax, ebx FIXME
|
||||
.ascii " -export:DestroyObject" # eax
|
||||
|
||||
@ -24,7 +25,6 @@
|
||||
.ascii " -export:SysMsgBoardStr" #
|
||||
.ascii " -export:SetScreen" #
|
||||
|
||||
|
||||
.ascii " -export:PciApi" #
|
||||
.ascii " -export:PciRead8" # stdcall
|
||||
.ascii " -export:PciRead16" # stdcall
|
||||
@ -38,6 +38,10 @@
|
||||
.ascii " -export:HwCursorRestore" #
|
||||
.ascii " -export:HwCursorCreate" #
|
||||
|
||||
.ascii " -export:create_window" # cdecl
|
||||
.ascii " -export:show_window" # cdecl
|
||||
.ascii " -export:get_event" # cdecl
|
||||
.ascii " -export:def_window_proc" # cdecl
|
||||
|
||||
|
||||
|
||||
|
@ -180,7 +180,7 @@ e7: ;#NM exception handler
|
||||
|
||||
iglobal
|
||||
fpu_owner dd 0
|
||||
endg
|
||||
endg
|
||||
|
||||
reg_eip equ ebp+4
|
||||
reg_cs equ ebp+8
|
||||
|
@ -300,7 +300,7 @@ addr_t alloc_page(void)
|
||||
list_remove(&slab->link);
|
||||
list_prepend(&slab->link, &page_cache.full_slabs);
|
||||
page_cache.partial_count--;
|
||||
DBG("%s insert empty page slab\n");
|
||||
DBG("%s insert empty page slab\n", __FUNCTION__);
|
||||
};
|
||||
spinlock_unlock(&page_cache.lock);
|
||||
|
||||
@ -396,9 +396,9 @@ size_t __fastcall frame_free(addr_t addr)
|
||||
(slab->avail >= 4))
|
||||
{
|
||||
slab->state = 1;
|
||||
// list_remove(&slab->link);
|
||||
// list_prepend(&slab->link, &page_cache.partial_slabs);
|
||||
// page_cache.partial_count++;
|
||||
list_remove(&slab->link);
|
||||
list_prepend(&slab->link, &page_cache.partial_slabs);
|
||||
page_cache.partial_count++;
|
||||
|
||||
DBG("%s: insert partial page slab\n", __FUNCTION__);
|
||||
}
|
||||
@ -440,3 +440,6 @@ count_t get_free_mem()
|
||||
return z_core.free_count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
#define ALLOC_FAST
|
||||
|
||||
#include <types.h>
|
||||
#include <core.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) +
|
||||
sizeof(addr_t) * pages) >> PAGE_WIDTH));
|
||||
|
||||
map->size = size;
|
||||
|
||||
if ( map )
|
||||
{
|
||||
map->size = size;
|
||||
|
||||
order = size >> HF_WIDTH;
|
||||
|
||||
if( order )
|
||||
@ -313,7 +315,6 @@ addr_t __fastcall mem_alloc(size_t size, u32_t flags)
|
||||
|
||||
if( frame )
|
||||
{
|
||||
addr_t page = 0;
|
||||
addr_t mem;
|
||||
|
||||
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 )
|
||||
{
|
||||
addr_t page_frame;
|
||||
|
||||
#ifdef ALLOC_IMM
|
||||
#ifdef ALLOC_FAST
|
||||
|
||||
while( pages )
|
||||
{
|
||||
u32_t order;
|
||||
addr_t page_frame;
|
||||
|
||||
asm volatile ("bsr %0, %1":"=&r"(order):"r"(tmp):"cc");
|
||||
asm volatile ("btr %0, %1" :"=r"(tmp):"r"(order):"cc");
|
||||
asm volatile ("bsrl %1, %0":"=&r"(order):"r"(pages):"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++)
|
||||
{
|
||||
*pte++ = 0; //page;
|
||||
*mpte++ = page;
|
||||
*pte++ = 0;
|
||||
*mpte++ = page_frame;
|
||||
|
||||
asm volatile ( "invlpg (%0)" ::"r" (mem) );
|
||||
mem+= 4096;
|
||||
page_frame+= 4096;
|
||||
};
|
||||
}
|
||||
#else
|
||||
|
||||
page = PG_DEMAND | (flags & 0xFFF);
|
||||
page_frame = PG_DEMAND | (flags & 0xFFF);
|
||||
|
||||
while(pages--)
|
||||
{
|
||||
*pte++ = 0;
|
||||
*mpte++ = page;
|
||||
*mpte++ = page_frame;
|
||||
asm volatile ( "invlpg (%0)" ::"r" (mem) );
|
||||
mem+= 4096;
|
||||
};
|
||||
@ -381,7 +383,7 @@ addr_t __fastcall mem_alloc(size_t size, u32_t flags)
|
||||
{
|
||||
while(pages--)
|
||||
{
|
||||
*pte++ = 0; //page;
|
||||
*pte++ = 0;
|
||||
*mpte++ = 0;
|
||||
|
||||
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);
|
||||
|
||||
return heap;
|
||||
|
@ -23,7 +23,6 @@ HEAP_TOP equ 0x7FC00000
|
||||
align 4
|
||||
_init_user_heap:
|
||||
init_heap:
|
||||
|
||||
mov ebx,[current_slot]
|
||||
mov eax, [ebx+APPDATA.heap_top]
|
||||
test eax, eax
|
||||
@ -46,6 +45,7 @@ init_heap:
|
||||
sub eax, 4096
|
||||
or ecx, FREE_BLOCK
|
||||
mov [page_tabs+edx], ecx
|
||||
|
||||
ret
|
||||
|
||||
align 4
|
||||
|
@ -230,7 +230,6 @@ core_init:
|
||||
mov eax, cr3
|
||||
mov cr3, eax
|
||||
|
||||
|
||||
jmp system_init
|
||||
|
||||
if 0
|
||||
|
@ -265,6 +265,7 @@ proc new_mem_resize stdcall, new_size:dword
|
||||
pop edi
|
||||
pop esi
|
||||
@@:
|
||||
|
||||
call _alloc_page
|
||||
test eax, eax
|
||||
jz .exit
|
||||
|
@ -135,11 +135,11 @@ addr_t __fastcall load_image(const char *path)
|
||||
};
|
||||
|
||||
if( ! validate_pe(raw, raw_size, false) )
|
||||
{
|
||||
{
|
||||
DBG("invalid pe file %s\n", path);
|
||||
mem_free(raw);
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dos = (PIMAGE_DOS_HEADER)raw;
|
||||
nt = MakePtr( PIMAGE_NT_HEADERS32, dos, dos->e_lfanew);
|
||||
@ -207,7 +207,6 @@ void create_image(addr_t img_base, addr_t raw, bool force_clear)
|
||||
u32_t sec_align;
|
||||
int i;
|
||||
|
||||
|
||||
/* assumed that image is valid */
|
||||
|
||||
dos = (PIMAGE_DOS_HEADER)raw;
|
||||
@ -233,11 +232,11 @@ void create_image(addr_t img_base, addr_t raw, bool force_clear)
|
||||
|
||||
if(force_clear)
|
||||
{
|
||||
sec_size = (img_sec->Misc.VirtualSize + sec_align -1) & -sec_align;
|
||||
sec_size = (img_sec->Misc.VirtualSize + sec_align -1) & -sec_align;
|
||||
|
||||
if(sec_size > img_sec->SizeOfRawData)
|
||||
sec_clear(dest_ptr + img_sec->SizeOfRawData,
|
||||
sec_size - img_sec->SizeOfRawData);
|
||||
if(sec_size > img_sec->SizeOfRawData)
|
||||
sec_clear(dest_ptr + img_sec->SizeOfRawData,
|
||||
sec_size - img_sec->SizeOfRawData);
|
||||
};
|
||||
img_sec++;
|
||||
};
|
||||
@ -314,8 +313,6 @@ bool link_image(addr_t img_base)
|
||||
imp = MakePtr(PIMAGE_IMPORT_DESCRIPTOR, img_base,
|
||||
nt->OptionalHeader.DataDirectory[1].VirtualAddress);
|
||||
|
||||
|
||||
|
||||
while ( 1 )
|
||||
{
|
||||
PIMAGE_THUNK_DATA32 thunk;
|
||||
@ -420,7 +417,7 @@ bool link_image(addr_t img_base)
|
||||
|
||||
if ( !warn )
|
||||
return true;
|
||||
else
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -27,40 +27,40 @@ static slab_cache_t * slab_cache_alloc();
|
||||
*/
|
||||
static slab_t * slab_space_alloc(slab_cache_t *cache, int flags)
|
||||
{
|
||||
void *data;
|
||||
slab_t *slab;
|
||||
size_t fsize;
|
||||
unsigned int i;
|
||||
u32_t p;
|
||||
void *data;
|
||||
slab_t *slab;
|
||||
size_t fsize;
|
||||
unsigned int i;
|
||||
u32_t p;
|
||||
|
||||
DBG("%s order %d\n", __FUNCTION__, cache->order);
|
||||
|
||||
data = (void*)PA2KA(frame_alloc(1 << cache->order));
|
||||
if (!data) {
|
||||
return NULL;
|
||||
}
|
||||
slab = (slab_t*)slab_create();
|
||||
if (!slab) {
|
||||
if (!data) {
|
||||
return NULL;
|
||||
}
|
||||
slab = (slab_t*)slab_create();
|
||||
if (!slab) {
|
||||
frame_free(KA2PA(data));
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Fill in slab structures */
|
||||
for (i = 0; i < ((u32_t) 1 << cache->order); i++)
|
||||
frame_set_parent(ADDR2PFN(KA2PA(data)) + i, slab);
|
||||
for (i = 0; i < ((u32_t) 1 << cache->order); i++)
|
||||
frame_set_parent(ADDR2PFN(KA2PA(data)) + i, slab);
|
||||
|
||||
slab->start = data;
|
||||
slab->available = cache->objects;
|
||||
slab->nextavail = (void*)data;
|
||||
slab->cache = cache;
|
||||
slab->start = data;
|
||||
slab->available = cache->objects;
|
||||
slab->nextavail = (void*)data;
|
||||
slab->cache = cache;
|
||||
|
||||
for (i = 0, p = (u32_t)slab->start; i < cache->objects; i++)
|
||||
{
|
||||
*(addr_t *)p = p+cache->size;
|
||||
p = p+cache->size;
|
||||
};
|
||||
atomic_inc(&cache->allocated_slabs);
|
||||
return slab;
|
||||
for (i = 0, p = (u32_t)slab->start; i < cache->objects; i++)
|
||||
{
|
||||
*(addr_t *)p = p+cache->size;
|
||||
p = p+cache->size;
|
||||
};
|
||||
atomic_inc(&cache->allocated_slabs);
|
||||
return slab;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -178,7 +178,7 @@ _slab_cache_create(slab_cache_t *cache,
|
||||
int (*destructor)(void *obj),
|
||||
int flags)
|
||||
{
|
||||
int pages;
|
||||
int pages;
|
||||
// ipl_t ipl;
|
||||
|
||||
// memsetb((uintptr_t)cache, sizeof(*cache), 0);
|
||||
@ -188,15 +188,15 @@ _slab_cache_create(slab_cache_t *cache,
|
||||
// align = sizeof(unative_t);
|
||||
// size = ALIGN_UP(size, align);
|
||||
|
||||
cache->size = size;
|
||||
cache->size = size;
|
||||
|
||||
// cache->constructor = constructor;
|
||||
// cache->destructor = destructor;
|
||||
cache->flags = flags;
|
||||
cache->flags = flags;
|
||||
|
||||
list_initialize(&cache->full_slabs);
|
||||
list_initialize(&cache->partial_slabs);
|
||||
list_initialize(&cache->magazines);
|
||||
list_initialize(&cache->full_slabs);
|
||||
list_initialize(&cache->partial_slabs);
|
||||
list_initialize(&cache->magazines);
|
||||
// spinlock_initialize(&cache->slablock, "slab_lock");
|
||||
// spinlock_initialize(&cache->maglock, "slab_maglock");
|
||||
// if (! (cache->flags & SLAB_CACHE_NOMAGAZINE))
|
||||
@ -205,23 +205,23 @@ _slab_cache_create(slab_cache_t *cache,
|
||||
/* Compute slab sizes, object counts in slabs etc. */
|
||||
|
||||
/* Minimum slab order */
|
||||
pages = SIZE2FRAMES(cache->size);
|
||||
pages = SIZE2FRAMES(cache->size);
|
||||
/* We need the 2^order >= pages */
|
||||
if (pages <= 1)
|
||||
cache->order = 0;
|
||||
else
|
||||
cache->order = fnzb(pages-1)+1;
|
||||
if (pages <= 1)
|
||||
cache->order = 0;
|
||||
else
|
||||
cache->order = fnzb(pages-1)+1;
|
||||
|
||||
while (badness(cache) > SLAB_MAX_BADNESS(cache)) {
|
||||
cache->order += 1;
|
||||
}
|
||||
cache->objects = comp_objects(cache);
|
||||
while (badness(cache) > SLAB_MAX_BADNESS(cache)) {
|
||||
cache->order += 1;
|
||||
}
|
||||
cache->objects = comp_objects(cache);
|
||||
|
||||
/* Add cache to cache list */
|
||||
// ipl = interrupts_disable();
|
||||
// spinlock_lock(&slab_cache_lock);
|
||||
|
||||
list_append(&cache->link, &slab_cache_list);
|
||||
list_append(&cache->link, &slab_cache_list);
|
||||
|
||||
// spinlock_unlock(&slab_cache_lock);
|
||||
// interrupts_restore(ipl);
|
||||
@ -240,7 +240,9 @@ slab_cache_t * slab_cache_create(
|
||||
DBG("%s\n", __FUNCTION__);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -331,9 +333,9 @@ void __fastcall slab_free(slab_cache_t *cache, void *obj)
|
||||
|
||||
static slab_t *slab_create()
|
||||
{
|
||||
slab_t *slab;
|
||||
void *obj;
|
||||
u32_t p;
|
||||
slab_t *slab;
|
||||
void *obj;
|
||||
u32_t p;
|
||||
|
||||
DBG("%s\n", __FUNCTION__);
|
||||
|
||||
@ -390,9 +392,9 @@ static slab_t *slab_create()
|
||||
|
||||
static slab_cache_t * slab_cache_alloc()
|
||||
{
|
||||
slab_t *slab;
|
||||
void *obj;
|
||||
u32_t *p;
|
||||
slab_t *slab;
|
||||
void *obj;
|
||||
u32_t *p;
|
||||
|
||||
DBG("%s\n", __FUNCTION__);
|
||||
|
||||
@ -401,62 +403,62 @@ static slab_cache_t * slab_cache_alloc()
|
||||
// spinlock_unlock(&cache->slablock);
|
||||
// slab = slab_create();
|
||||
|
||||
void *data;
|
||||
unsigned int i;
|
||||
void *data;
|
||||
unsigned int i;
|
||||
|
||||
data = (void*)(PA2KA(alloc_page()));
|
||||
if (!data) {
|
||||
return NULL;
|
||||
}
|
||||
if (!data) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
slab = (slab_t*)((u32_t)data + PAGE_SIZE - sizeof(slab_t));
|
||||
slab = (slab_t*)((u32_t)data + PAGE_SIZE - sizeof(slab_t));
|
||||
|
||||
/* Fill in slab structures */
|
||||
frame_set_parent(ADDR2PFN(KA2PA(data)), slab);
|
||||
frame_set_parent(ADDR2PFN(KA2PA(data)), slab);
|
||||
|
||||
slab->start = data;
|
||||
slab->available = slab_cache_cache.objects;
|
||||
slab->nextavail = (void*)data;
|
||||
slab->cache = &slab_cache_cache;
|
||||
slab->start = data;
|
||||
slab->available = slab_cache_cache.objects;
|
||||
slab->nextavail = (void*)data;
|
||||
slab->cache = &slab_cache_cache;
|
||||
|
||||
for (i = 0,p = (u32_t*)slab->start;i < slab_cache_cache.objects; i++)
|
||||
{
|
||||
*p = (u32_t)p+slab_cache_cache.size;
|
||||
p = (u32_t*)((u32_t)p+slab_cache_cache.size);
|
||||
};
|
||||
for (i = 0,p = (u32_t*)slab->start;i < slab_cache_cache.objects; i++)
|
||||
{
|
||||
*p = (u32_t)p+slab_cache_cache.size;
|
||||
p = (u32_t*)((u32_t)p+slab_cache_cache.size);
|
||||
};
|
||||
|
||||
|
||||
atomic_inc(&slab_cache_cache.allocated_slabs);
|
||||
atomic_inc(&slab_cache_cache.allocated_slabs);
|
||||
// spinlock_lock(&cache->slablock);
|
||||
}
|
||||
else {
|
||||
slab = list_get_instance(slab_cache_cache.partial_slabs.next, slab_t, link);
|
||||
list_remove(&slab->link);
|
||||
}
|
||||
obj = slab->nextavail;
|
||||
slab->nextavail = *((void**)obj);
|
||||
slab->available--;
|
||||
slab = list_get_instance(slab_cache_cache.partial_slabs.next, slab_t, link);
|
||||
list_remove(&slab->link);
|
||||
}
|
||||
obj = slab->nextavail;
|
||||
slab->nextavail = *((void**)obj);
|
||||
slab->available--;
|
||||
|
||||
if (!slab->available)
|
||||
list_prepend(&slab->link, &slab_cache_cache.full_slabs);
|
||||
else
|
||||
list_prepend(&slab->link, &slab_cache_cache.partial_slabs);
|
||||
if (!slab->available)
|
||||
list_prepend(&slab->link, &slab_cache_cache.full_slabs);
|
||||
else
|
||||
list_prepend(&slab->link, &slab_cache_cache.partial_slabs);
|
||||
|
||||
// spinlock_unlock(&cache->slablock);
|
||||
|
||||
return (slab_cache_t*)obj;
|
||||
return (slab_cache_t*)obj;
|
||||
}
|
||||
|
||||
void slab_cache_init(void)
|
||||
{
|
||||
DBG("%s\n", __FUNCTION__);
|
||||
|
||||
_slab_cache_create(&slab_cache_cache, sizeof(slab_cache_t),
|
||||
_slab_cache_create(&slab_cache_cache, sizeof(slab_cache_t),
|
||||
sizeof(void *), NULL, NULL,
|
||||
SLAB_CACHE_NOMAGAZINE | SLAB_CACHE_SLINSIDE);
|
||||
|
||||
/* Initialize external slab cache */
|
||||
slab_cache = slab_cache_create(sizeof(slab_t),
|
||||
slab_cache = slab_cache_create(sizeof(slab_t),
|
||||
0, NULL, NULL,SLAB_CACHE_MAGDEFERRED);
|
||||
};
|
||||
|
||||
|
@ -291,22 +291,13 @@ ready_for_next_irq_1:
|
||||
ret
|
||||
|
||||
irqD:
|
||||
save_ring3_context
|
||||
mov ax, sel_app_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
mov dx,0xf0
|
||||
push eax
|
||||
mov al,0
|
||||
out dx,al
|
||||
|
||||
mov dx,0xa0
|
||||
out 0xf0,al
|
||||
mov al,0x20
|
||||
out dx,al
|
||||
mov dx,0x20
|
||||
out dx,al
|
||||
|
||||
restore_ring3_context
|
||||
out 0xa0,al
|
||||
out 0x20,al
|
||||
pop eax
|
||||
|
||||
iret
|
||||
|
||||
@ -459,7 +450,6 @@ terminate: ; terminate application
|
||||
@@:
|
||||
;mov esi,process_terminating
|
||||
;call sys_msg_board_str
|
||||
DEBUGF 1,"%s",process_terminating
|
||||
@@:
|
||||
cli
|
||||
cmp [application_table_status],0
|
||||
@ -603,11 +593,13 @@ term9:
|
||||
|
||||
xor eax, eax
|
||||
mov [window_data+esi+WDATA.box.left],eax
|
||||
|
||||
mov [window_data+esi+WDATA.box.width],eax
|
||||
mov [window_data+esi+WDATA.box.top],eax
|
||||
mov [window_data+esi+WDATA.box.height],eax
|
||||
mov [window_data+esi+WDATA.cl_workarea],eax
|
||||
mov [window_data+esi+WDATA.cl_titlebar],eax
|
||||
|
||||
mov [window_data+esi+WDATA.cl_frames],eax
|
||||
mov dword [window_data+esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn
|
||||
lea edi, [esi+draw_data]
|
||||
@ -814,7 +806,6 @@ term9:
|
||||
mov [application_table_status],0
|
||||
;mov esi,process_terminated
|
||||
;call sys_msg_board_str
|
||||
DEBUGF 1,"%s",process_terminated
|
||||
add esp, 4
|
||||
ret
|
||||
restore .slot
|
||||
|
@ -4,6 +4,21 @@ format MS COFF
|
||||
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
|
||||
|
||||
align 16
|
||||
@ -14,3 +29,74 @@ _i40:
|
||||
int 0x41
|
||||
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
|
||||
|
||||
|
@ -16,27 +16,11 @@ cross_order:
|
||||
mov ecx, edx
|
||||
mov edx, esi
|
||||
mov esi, edi
|
||||
mov edi, [esp+28 + 4]
|
||||
and edi,0xff
|
||||
movzx edi, byte[esp+28 + 4]
|
||||
call dword [servetable+edi*4]
|
||||
ret
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; SYSTEM CALL ENTRY ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
align 16
|
||||
i41:
|
||||
pushad
|
||||
cld
|
||||
movzx eax, al
|
||||
call dword [servetable2 + eax * 4]
|
||||
popad
|
||||
iretd
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; SYSENTER ENTRY ;;
|
||||
@ -68,6 +52,21 @@ sysenter_entry:
|
||||
pop edx
|
||||
sysexit
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; SYSTEM CALL ENTRY ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
align 16
|
||||
i40:
|
||||
pushad
|
||||
cld
|
||||
movzx eax, al
|
||||
call dword [servetable2 + eax * 4]
|
||||
popad
|
||||
iretd
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; SYSCALL ENTRY ;;
|
||||
@ -183,79 +182,83 @@ iglobal
|
||||
align 4
|
||||
servetable2:
|
||||
|
||||
dd sys_drawwindow ; 0-DrawWindow
|
||||
dd syscall_setpixel ; 1-SetPixel
|
||||
dd sys_getkey ; 2-GetKey
|
||||
dd sys_clock ; 3-GetTime
|
||||
dd syscall_writetext ; 4-WriteText
|
||||
dd delay_hs ; 5-DelayHs
|
||||
dd syscall_openramdiskfile ; 6-OpenRamdiskFile
|
||||
dd syscall_putimage ; 7-PutImage
|
||||
dd sys_button ; 8-DefineButton
|
||||
dd sys_cpuusage ; 9-GetProcessInfo
|
||||
dd sys_waitforevent ; 10-WaitForEvent
|
||||
dd sys_getevent ; 11-CheckForEvent
|
||||
dd sys_redrawstat ; 12-BeginDraw and EndDraw
|
||||
dd syscall_drawrect ; 13-DrawRect
|
||||
dd syscall_getscreensize ; 14-GetScreenSize
|
||||
dd sys_background ; 15-bgr
|
||||
dd sys_cachetodiskette ; 16-FlushFloppyCache
|
||||
dd sys_getbutton ; 17-GetButton
|
||||
dd sys_system ; 18-System Services
|
||||
dd paleholder ; 19-reserved
|
||||
dd cross_order ; 20-ResetMidi and OutputMidi
|
||||
dd cross_order ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
|
||||
dd cross_order ; 22-setting date,time,clock and alarm-clock
|
||||
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent
|
||||
dd cross_order ; 24-PlayCdTrack,StopCd and GetCdPlaylist
|
||||
dd undefined_syscall ; 25-reserved
|
||||
dd cross_order ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
|
||||
dd undefined_syscall ; 27-reserved
|
||||
dd undefined_syscall ; 28-reserved
|
||||
dd sys_date ; 29-GetDate
|
||||
dd cross_order ; 30-Get/SetCurrentDirectory
|
||||
dd undefined_syscall ; 31-reserved
|
||||
dd undefined_syscall ; 32-reserved
|
||||
dd undefined_syscall ; 33-reserved
|
||||
dd undefined_syscall ; 34-reserved
|
||||
dd syscall_getpixel ; 35-GetPixel
|
||||
dd undefined_syscall ; 36-reserved
|
||||
dd cross_order ; 37-GetMousePosition_ScreenRelative,.
|
||||
dd syscall_drawline ; 38-DrawLine
|
||||
dd cross_order ; 39-GetBackgroundSize,ReadBgrData,.
|
||||
dd set_app_param ; 40-WantEvents
|
||||
dd syscall_getirqowner ; 41-GetIrqOwner
|
||||
dd get_irq_data ; 42-ReadIrqData
|
||||
dd cross_order ; 43-SendDeviceData
|
||||
dd sys_programirq ; 44-ProgramIrqs
|
||||
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq
|
||||
dd cross_order ; 46-ReservePortArea and FreePortArea
|
||||
dd cross_order ; 47-WriteNum
|
||||
dd cross_order ; 48-SetRedrawType and SetButtonType
|
||||
dd cross_order ; 49-Advanced Power Management (APM)
|
||||
dd cross_order ; 50-Window shape & scale
|
||||
dd cross_order ; 51-Threads
|
||||
dd cross_order ; 52-Stack driver status
|
||||
dd cross_order ; 53-Socket interface
|
||||
dd undefined_syscall ; 54-reserved
|
||||
dd cross_order ; 55-Sound interface
|
||||
dd undefined_syscall ; 56-reserved
|
||||
dd cross_order ; 57-PCI BIOS32
|
||||
dd cross_order ; 58-Common file system interface
|
||||
dd undefined_syscall ; 59-reserved
|
||||
dd cross_order ; 60-Inter Process Communication
|
||||
dd cross_order ; 61-Direct graphics access
|
||||
dd cross_order ; 62-PCI functions
|
||||
dd cross_order ; 63-System message board
|
||||
dd cross_order ; 64-Resize application memory usage
|
||||
dd cross_order ; 65-PutImagePalette
|
||||
dd cross_order ; 66-Process definitions - keyboard
|
||||
dd cross_order ; 67-Window move or resize
|
||||
dd cross_order ; 68-Some internal services
|
||||
dd cross_order ; 69-Debug
|
||||
dd cross_order ; 70-Common file system interface, version 2
|
||||
dd cross_order ; 71-Window settings
|
||||
dd cross_order ; 72-Send window message
|
||||
dd sys_drawwindow ; 0-DrawWindow
|
||||
dd syscall_setpixel ; 1-SetPixel
|
||||
dd sys_getkey ; 2-GetKey
|
||||
dd sys_clock ; 3-GetTime
|
||||
dd syscall_writetext ; 4-WriteText
|
||||
dd delay_hs ; 5-DelayHs
|
||||
dd syscall_openramdiskfile ; 6-OpenRamdiskFile
|
||||
dd syscall_putimage ; 7-PutImage
|
||||
dd sys_button ; 8-DefineButton
|
||||
dd sys_cpuusage ; 9-GetProcessInfo
|
||||
dd sys_waitforevent ; 10-WaitForEvent
|
||||
dd sys_getevent ; 11-CheckForEvent
|
||||
dd sys_redrawstat ; 12-BeginDraw and EndDraw
|
||||
dd syscall_drawrect ; 13-DrawRect
|
||||
dd syscall_getscreensize ; 14-GetScreenSize
|
||||
dd sys_background ; 15-bgr
|
||||
dd sys_cachetodiskette ; 16-FlushFloppyCache
|
||||
dd sys_getbutton ; 17-GetButton
|
||||
dd sys_system ; 18-System Services
|
||||
dd paleholder ; 19-reserved
|
||||
dd cross_order ; 20-ResetMidi and OutputMidi
|
||||
dd cross_order ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
|
||||
dd cross_order ; 22-setting date,time,clock and alarm-clock
|
||||
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent
|
||||
dd cross_order ; 24-PlayCdTrack,StopCd and GetCdPlaylist
|
||||
dd undefined_syscall ; 25-reserved
|
||||
dd cross_order ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
|
||||
dd undefined_syscall ; 27-reserved
|
||||
dd undefined_syscall ; 28-reserved
|
||||
dd sys_date ; 29-GetDate
|
||||
dd cross_order ; 30-Get/SetCurrentDirectory
|
||||
dd undefined_syscall ; 31-reserved
|
||||
dd undefined_syscall ; 32-reserved
|
||||
dd undefined_syscall ; 33-reserved
|
||||
dd undefined_syscall ; 34-reserved
|
||||
dd syscall_getpixel ; 35-GetPixel
|
||||
dd undefined_syscall ; 36-reserved
|
||||
dd cross_order ; 37-GetMousePosition_ScreenRelative,.
|
||||
dd syscall_drawline ; 38-DrawLine
|
||||
dd cross_order ; 39-GetBackgroundSize,ReadBgrData,.
|
||||
dd set_app_param ; 40-WantEvents
|
||||
dd syscall_getirqowner ; 41-GetIrqOwner
|
||||
dd get_irq_data ; 42-ReadIrqData
|
||||
dd cross_order ; 43-SendDeviceData
|
||||
dd sys_programirq ; 44-ProgramIrqs
|
||||
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq
|
||||
dd cross_order ; 46-ReservePortArea and FreePortArea
|
||||
dd cross_order ; 47-WriteNum
|
||||
dd cross_order ; 48-SetRedrawType and SetButtonType
|
||||
dd cross_order ; 49-Advanced Power Management (APM)
|
||||
dd cross_order ; 50-Window shape & scale
|
||||
dd cross_order ; 51-Threads
|
||||
dd cross_order ; 52-Stack driver status
|
||||
dd cross_order ; 53-Socket interface
|
||||
dd undefined_syscall ; 54-reserved
|
||||
dd cross_order ; 55-Sound interface
|
||||
dd undefined_syscall ; 56-reserved
|
||||
dd cross_order ; 57-PCI BIOS32
|
||||
dd cross_order ; 58-Common file system interface
|
||||
dd undefined_syscall ; 59-reserved
|
||||
dd cross_order ; 60-Inter Process Communication
|
||||
dd cross_order ; 61-Direct graphics access
|
||||
dd cross_order ; 62-PCI functions
|
||||
dd cross_order ; 63-System message board
|
||||
dd cross_order ; 64-Resize application memory usage
|
||||
dd cross_order ; 65-PutImagePalette
|
||||
dd cross_order ; 66-Process definitions - keyboard
|
||||
dd cross_order ; 67-Window move or resize
|
||||
dd cross_order ; 68-Some internal services
|
||||
dd cross_order ; 69-Debug
|
||||
dd cross_order ; 70-Common file system interface, version 2
|
||||
dd cross_order ; 71-Window settings
|
||||
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
|
||||
dd sys_end ; -1-end application
|
||||
|
||||
|
@ -119,7 +119,7 @@ proc mnt_exec stdcall file_base:dword, file_size:dword, \
|
||||
filename rb 1024
|
||||
|
||||
save_cr3 dd ?
|
||||
slot dd ?
|
||||
slot dd ?
|
||||
slot_base dd ?
|
||||
|
||||
;app header data
|
||||
@ -141,6 +141,7 @@ proc mnt_exec stdcall file_base:dword, file_size:dword, \
|
||||
@@:
|
||||
cmp edi, ecx
|
||||
jae .bigfilename
|
||||
|
||||
lodsb
|
||||
stosb
|
||||
test al, al
|
||||
@ -172,7 +173,7 @@ proc mnt_exec stdcall file_base:dword, file_size:dword, \
|
||||
test eax, eax
|
||||
jz .err_hdr
|
||||
|
||||
DEBUGF 1,"%s",new_process_loading
|
||||
; DEBUGF 1,"%s",new_process_loading
|
||||
|
||||
lea ebx, [application_table_status]
|
||||
call wait_mutex
|
||||
@ -226,8 +227,8 @@ proc mnt_exec stdcall file_base:dword, file_size:dword, \
|
||||
mov [ebx+APPDATA.mem_size],ecx
|
||||
|
||||
mov edi, [file_size]
|
||||
; add edi, 4095
|
||||
; and edi, not 4095
|
||||
add edi, 4095
|
||||
and edi, not 4095
|
||||
sub ecx, edi
|
||||
jna @F
|
||||
|
||||
@ -261,6 +262,7 @@ proc mnt_exec stdcall file_base:dword, file_size:dword, \
|
||||
pop ebx
|
||||
mov eax, -ERROR_FILE_NOT_FOUND
|
||||
ret
|
||||
|
||||
.failed:
|
||||
mov eax, [save_cr3]
|
||||
call set_cr3
|
||||
@ -279,6 +281,7 @@ proc mnt_exec stdcall file_base:dword, file_size:dword, \
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc pe_app_param stdcall path:dword, raw:dword, ex_pg_dir:dword, ex_stack:dword
|
||||
|
||||
@ -417,7 +420,7 @@ proc pe_app_param stdcall path:dword, raw:dword, ex_pg_dir:dword, ex_stack:dword
|
||||
lea ecx, [ebx+REG_EDI]
|
||||
mov edx, [ex_stack]
|
||||
|
||||
mov [ebx+REG_ENTRY], dword _sys_app_entry
|
||||
mov [ebx+REG_ENTRY], dword _sys_app_entry
|
||||
mov [ebx+REG_RESTART], dword _pe_restart
|
||||
mov [ebx+REG_RAW], eax
|
||||
mov [ebx+REG_CSTACK], ecx
|
||||
@ -439,7 +442,7 @@ proc pe_app_param stdcall path:dword, raw:dword, ex_pg_dir:dword, ex_stack:dword
|
||||
pop esi
|
||||
pop ebx
|
||||
|
||||
ret
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
@ -448,7 +451,6 @@ _pe_restart:
|
||||
popad
|
||||
iretd
|
||||
|
||||
|
||||
align 4
|
||||
proc get_new_process_place
|
||||
;input:
|
||||
@ -674,9 +676,10 @@ align 4
|
||||
add esp, 16
|
||||
ret
|
||||
|
||||
|
||||
|
||||
align 4
|
||||
set_cr3:
|
||||
|
||||
mov ebx, [current_slot]
|
||||
mov [ebx+APPDATA.dir_table], eax
|
||||
mov cr3, eax
|
||||
@ -1045,9 +1048,8 @@ proc new_sys_threads
|
||||
mov [app_eip], ebx
|
||||
mov [app_esp], ecx
|
||||
|
||||
;mov esi,new_process_loading
|
||||
;call sys_msg_board_str
|
||||
DEBUGF 1,"%s",new_process_loading
|
||||
;DEBUGF 1,"%s",new_process_loading
|
||||
|
||||
.wait_lock:
|
||||
cmp [application_table_status],0
|
||||
je .get_lock
|
||||
@ -1101,9 +1103,7 @@ proc new_sys_threads
|
||||
stdcall set_app_params ,[slot],eax,dword 0,\
|
||||
dword 0,dword 0
|
||||
|
||||
;mov esi,new_process_running
|
||||
;call sys_msg_board_str ;output information about succefull startup
|
||||
DEBUGF 1,"%s",new_process_running
|
||||
; DEBUGF 1,"%s",new_process_running
|
||||
|
||||
mov [application_table_status],0 ;unlock application_table_status mutex
|
||||
mov eax,[process_number] ;set result
|
||||
@ -1207,7 +1207,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
||||
mov edx,[params]
|
||||
mov edx,[edx] ;app_cmdline
|
||||
test edx,edx
|
||||
jz @f ;application doesn't need parameters
|
||||
jz @f ;application doesn't need parameters
|
||||
|
||||
mov eax, edx
|
||||
add eax, 256
|
||||
@ -1225,7 +1225,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
||||
mov edx,[params]
|
||||
mov edx, [edx+4] ;app_path
|
||||
test edx,edx
|
||||
jz @F ;application don't need path of file
|
||||
jz @F ;application don't need path of file
|
||||
mov eax, edx
|
||||
add eax, 1024
|
||||
jc @f
|
||||
@ -1274,13 +1274,13 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
||||
mov [ebx+REG_ECX], eax
|
||||
mov [ebx+REG_EAX], eax
|
||||
|
||||
mov eax, [esi+0x08] ;app_eip
|
||||
mov [ebx+REG_EIP], eax ;app_entry
|
||||
mov eax, [esi+0x08] ;app_eip
|
||||
mov [ebx+REG_EIP], eax ;app_entry
|
||||
mov [ebx+REG_CS], dword sel_app_code
|
||||
mov [ebx+REG_EFLAGS], dword EFL_IOPL3+EFL_IF
|
||||
mov [ebx+REG_EFLAGS], dword EFL_IOPL3+EFL_IF
|
||||
|
||||
mov eax, [esi+0x0C] ;app_esp
|
||||
mov [ebx+REG_APP_ESP], eax ;app_stack
|
||||
mov eax, [esi+0x0C] ;app_esp
|
||||
mov [ebx+REG_APP_ESP], eax ;app_stack
|
||||
mov [ebx+REG_SS], dword sel_app_data
|
||||
|
||||
lea ecx, [ebx+REG_RET]
|
||||
|
@ -63,6 +63,7 @@ keymap_alt:
|
||||
boot_setostask db 'Setting OS task',0
|
||||
boot_allirqs db 'Unmasking all IRQs',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_vga db 'Setting VGA 640x480 palette',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
|
||||
;end if
|
||||
|
||||
new_process_loading db 'K : New Process - loading',13,10,0
|
||||
new_process_running db 'K : New Process - done',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
|
||||
start_not_enough_memory db 'K : New Process - not enough memory',13,10,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_www db 'please visit www.kolibrios.org',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
|
||||
;szInfinity db 'INFINITY',0
|
||||
@ -92,6 +96,8 @@ szAtiHW db '/rd/1/drivers/ati2d.drv',0
|
||||
|
||||
szSTART db 'START',0
|
||||
szEXPORTS db 'EXPORTS',0
|
||||
sz_EXPORTS db '_EXPORTS',0
|
||||
|
||||
szIMPORTS db 'IMPORTS',0
|
||||
|
||||
read_firstapp db '/sys/'
|
||||
@ -107,7 +113,13 @@ vrr_m db 'VRR_M',0
|
||||
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:
|
||||
dw 1280,1024,32,60
|
||||
mode_1280_1024_24:
|
||||
@ -129,13 +141,6 @@ mode_640_480_16:
|
||||
mode_320_240_8:
|
||||
dw 320,240,8,60
|
||||
|
||||
|
||||
;bx_from_load: dw 'r1' ; ñòðóêòóðà äëÿ õðàíåíèÿ ïàðàìåòðîâ- îòêóäà ãàøðóçèëèñü, áåðåòñÿ íèæå èç bx ; {SPraid}[13.03.2007]
|
||||
; ; a,b,c,d - âèí÷åñòåðû, r - ðàì äèñê
|
||||
; ; # äèñêà... ñèìâîë, à íå áàéò. '1', à íå 1
|
||||
|
||||
|
||||
|
||||
; mike.dld {
|
||||
db 0
|
||||
dd servetable-0x10000
|
||||
@ -513,6 +518,11 @@ hdpos rd 1 ; for boot 0x1
|
||||
fat32part rd 1 ; for boot 0x1
|
||||
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
|
||||
|
@ -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.
|
||||
‚맮¢ á¨á⥬®© äãªæ¨¨ ®áãé¥á⢫ï¥âáï ª®¬ ¤®© "int 0x40".
|
||||
@ -67,7 +67,7 @@
|
||||
ª®®à¤¨ â (¨«¨, ¢®§¬®¦®, ®¡¥) áç¨â ¥âáï ã«¥¬, ¥á«¨ ¨ íâ®
|
||||
¥ ¯®¬®£ ¥â, ⮠ᮮ⢥âáâ¢ãî騩 à §¬¥à (¨«¨, ¢®§¬®¦®, ®¡ )
|
||||
ãáâ ¢«¨¢ ¥âáï ¢ à §¬¥à íªà .
|
||||
|
||||
|
||||
„ «¥¥ ®¡®§ 稬 xpos,ypos,xsize,ysize - § 票ï, ¯¥à¥¤ ¢ ¥¬ë¥
|
||||
¢ ebx,ecx. Š®®à¤¨ âë ¯à¨¢®¤ïâáï ®â®á¨â¥«ì® «¥¢®£® ¢¥à奣®
|
||||
㣫 ®ª , ª®â®àë©, â ª¨¬ ®¡à §®¬, § ¤ ¥âáï ª ª (0,0), ª®®à¤¨ âë
|
||||
@ -223,9 +223,6 @@
|
||||
âॡã¥âáï ¯¥à¥¤ âì ã¯à ¢«¥¨¥ á«¥¤ãî饬㠯à®æ¥ááã
|
||||
(§ ª®ç¨âì ⥪ã騩 ª¢ ⠢६¥¨), ¨á¯®«ì§ã©â¥ ¯®¤äãªæ¨î 1
|
||||
äãªæ¨¨ 68.
|
||||
* <20>ਠ⥪ã饩 ॠ«¨§ 樨 ¯à®¨§®©¤¥â ¥¬¥¤«¥ë© ¢®§¢à â ¨§ äãªæ¨¨,
|
||||
¥á«¨ á«®¦¥¨¥ ebx á ⥪ã騬 § 票¥¬ áç¥â稪 ¢à¥¬¥¨ ¢ë§®¢¥â
|
||||
32-¡¨â®¥ ¯¥à¥¯®«¥¨¥.
|
||||
|
||||
======================================================================
|
||||
=============== ”ãªæ¨ï 6 - ¯à®ç¨â âì ä ©« á à ¬¤¨áª . ===============
|
||||
@ -621,16 +618,22 @@
|
||||
* eax = 17 - ®¬¥à äãªæ¨¨
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* ¥á«¨ ¡ãä¥à ¯ãáâ, ¢®§¢à é ¥âáï eax=1
|
||||
* ¥á«¨ ¡ãä¥à ¥ ¯ãáâ, ⮣¤ ¢®§¢à é ¥âáï: áâ à訥 24 ¡¨â eax
|
||||
ᮤ¥à¦ â ¨¤¥â¨ä¨ª â®à ª®¯ª¨ (¢ ç áâ®áâ¨, ¢ ah ®ª §ë¢ ¥âáï
|
||||
¬« ¤è¨© ¡ ©â ¨¤¥â¨ä¨ª â®à ; ¥á«¨ ¢á¥ ª®¯ª¨ ¨¬¥îâ ¨¤¥â¨ä¨ª â®à,
|
||||
¬¥ì訩 256, â® ¤«ï à §«¨ç¥¨ï ¤®áâ â®ç® ah),
|
||||
¢ al ¢®§¢à é ¥âáï 0 - ¥á«¨ ¨á¯®«ì§®¢ « áì «¥¢ ï ª®¯ª ¬ëè¨, ¨«¨ ¡¨â ⮩ ª®¯ª¨ ¬ëè¨, ª®â®à ï ¨á¯®«ì§®¢ « áì.
|
||||
* ¥á«¨ ¡ãä¥à ¥¯ãáâ:
|
||||
* áâ à訥 24 ¡¨â eax ᮤ¥à¦ â ¨¤¥â¨ä¨ª â®à ª®¯ª¨
|
||||
(¢ ç áâ®áâ¨, ¢ ah ®ª §ë¢ ¥âáï ¬« ¤è¨© ¡ ©â ¨¤¥â¨ä¨ª â®à ;
|
||||
¥á«¨ ¢á¥ ª®¯ª¨ ¨¬¥îâ ¨¤¥â¨ä¨ª â®à, ¬¥ì訩 256,
|
||||
â® ¤«ï à §«¨ç¥¨ï ¤®áâ â®ç® ah)
|
||||
* al = 0 - ª®¯ª ¡ë« ¦ â «¥¢®© ª®¯ª®© ¬ëè¨
|
||||
* al = ¡¨â, ᮮ⢥âáâ¢ãî騩 ¦ ¢è¥© ª®¯ª¥ ¬ëè¨, ¥á«¨ ¥ «¥¢®©
|
||||
‡ ¬¥ç ¨ï:
|
||||
* "<22>ãä¥à" åà ¨â ⮫쪮 ®¤ã ª®¯ªã, ¯à¨ ¦ ⨨ ®¢®© ª®¯ª¨
|
||||
¨ä®à¬ æ¨ï ® áâ ன â¥àï¥âáï.
|
||||
* <20>ਠ¢ë§®¢¥ í⮩ äãªæ¨¨ ¯à¨«®¦¥¨¥¬ á ¥ ªâ¨¢ë¬ ®ª®¬
|
||||
¢®§¢à é ¥âáï ®â¢¥â "¡ãä¥à ¯ãáâ".
|
||||
* ‚®§¢à é ¥¬®¥ § 票¥ al ᮮ⢥âáâ¢ã¥â á®áâ®ï¨î ª®¯®ª ¬ëè¨
|
||||
¢ ä®à¬ ⥠¯®¤äãªæ¨¨ 2 äãªæ¨¨ 37 ¢ ¬®¬¥â ç « ¦ â¨ï
|
||||
ª®¯ªã, § ¨áª«î票¥¬ ¬« ¤è¥£® ¡¨â (ᮮ⢥âáâ¢ãî饣® «¥¢®©
|
||||
ª®¯ª¥ ¬ëè¨), ª®â®àë© á¡à áë¢ ¥âáï.
|
||||
|
||||
======================================================================
|
||||
==== ”ãªæ¨ï 18, ¯®¤äãªæ¨ï 2 - § ¢¥àè¨âì ¯à®æ¥áá/¯®â®ª ¯® á«®âã. ====
|
||||
@ -735,7 +738,7 @@
|
||||
* äãªæ¨ï ¥ ¢®§¢à é ¥â § 票ï
|
||||
|
||||
======================================================================
|
||||
======= ”ãªæ¨ï 18, ¯®¤äãªæ¨ï 9 - § ¢¥à襨¥ à ¡®âë á¨á⥬ë ========
|
||||
= ”ãªæ¨ï 18, ¯®¤äãªæ¨ï 9 - § ¢¥à襨¥ à ¡®âë á¨á⥬ë á ¯ à ¬¥â஬. =
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 18 - ®¬¥à äãªæ¨¨
|
||||
@ -750,8 +753,7 @@
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>¥ á«¥¤ã¥â ¯®« £ âìáï ¢®§¢à é ¥¬®¥ § 票¥ ¯à¨ ¥¢¥à®¬
|
||||
¢ë§®¢¥, ®® ¬®¦¥â ¨§¬¥¨âìáï ¢ ¯®á«¥¤ãîé¨å ¢¥àá¨ïå ï¤à .
|
||||
* Œ®¦® ¨á¯®«ì§®¢ âì ¯®¤äãªæ¨î 1, çâ®¡ë ¯®á«¥¤¥¬ è £¥
|
||||
§ ¢¥à襨ï à ¡®âë ¯®«ì§®¢ ⥫ì á ¬ à¥è «, çâ® ¥¬ã 㦮.
|
||||
|
||||
======================================================================
|
||||
======== ”ãªæ¨ï 18, ¯®¤äãªæ¨ï 10 - ᢥàãâì ®ª® ¯à¨«®¦¥¨ï. =======
|
||||
======================================================================
|
||||
@ -1131,11 +1133,6 @@ dd 638
|
||||
* <20>®«ãç¨âì ãáâ ®¢«¥ãî ¡ §ã CD ¬®¦® ¢ë§®¢®¬
|
||||
¯®¤äãªæ¨¨ 3 äãªæ¨¨ 26.
|
||||
|
||||
======================================================================
|
||||
== ”ãªæ¨ï 21, ¯®¤äãªæ¨ï 4 - ãáâ ®¢¨âì ¡ §®¢ë© ¯®àâ Sound Blaster. =
|
||||
======================================================================
|
||||
“¤ «¥
|
||||
|
||||
======================================================================
|
||||
========= ”ãªæ¨ï 21, ¯®¤äãªæ¨ï 5 - ãáâ ®¢¨âì ï§ëª á¨á⥬ë. ========
|
||||
======================================================================
|
||||
@ -1199,11 +1196,6 @@ dd 638
|
||||
* ‘«¥¤ã¥â â ª¦¥ ®¯à¥¤¥«¨âì ¨á¯®«ì§ã¥¬ãî ¡ §ã ¦ñá⪮£® ¤¨áª
|
||||
¯®¤äãªæ¨¥© 7.
|
||||
|
||||
======================================================================
|
||||
===== ”ãªæ¨ï 21, ¯®¤äãªæ¨ï 10 - ãáâ ®¢¨âì ª « DMA ¤«ï §¢ãª . ====
|
||||
======================================================================
|
||||
“¤ «¥ :
|
||||
|
||||
======================================================================
|
||||
====================== ”ãªæ¨ï 21, ¯®¤äãªæ¨ï 11 =====================
|
||||
=========== <20> §à¥è¨âì/§ ¯à¥â¨âì ¨§ª®ã஢¥¢ë© ¤®áâ㯠ª HD. ==========
|
||||
@ -1497,11 +1489,6 @@ dd 638
|
||||
* ”ãªæ¨ï ¯®¤¤¥à¦¨¢ ¥âáï ⮫쪮 ¤«ï ATAPI-ãáâனá⢠(CD ¨ DVD).
|
||||
* <20>ਬ¥à®¬ ¨á¯®«ì§®¢ ¨ï äãªæ¨¨ ï¥âáï ¯à¨«®¦¥¨¥ CD_tray.
|
||||
|
||||
======================================================================
|
||||
============== ”ãªæ¨ï 25 - ãáâ ®¢¨âì £à®¬ª®áâì SBPro. ==============
|
||||
======================================================================
|
||||
“¤ «¥
|
||||
|
||||
======================================================================
|
||||
===== ”ãªæ¨ï 26, ¯®¤äãªæ¨ï 1 - ¯®«ãç¨âì ¡ §®¢ë© ¯®àâ MPU MIDI. =====
|
||||
======================================================================
|
||||
@ -1564,11 +1551,6 @@ dd 638
|
||||
* <20> § CD ¨á¯®«ì§ã¥âáï äãªæ¨¥© 24.
|
||||
* “áâ ®¢¨âì ¡ §ã CD ¬®¦® ¢ë§®¢®¬ ¯®¤äãªæ¨¨ 3 äãªæ¨¨ 21.
|
||||
|
||||
======================================================================
|
||||
=== ”ãªæ¨ï 26, ¯®¤äãªæ¨ï 4 - ¯®«ãç¨âì ¡ §®¢ë© ¯®àâ Sound Blaster. ==
|
||||
======================================================================
|
||||
“¤ «¥
|
||||
|
||||
======================================================================
|
||||
========== ”ãªæ¨ï 26, ¯®¤äãªæ¨ï 5 - ¯®«ãç¨âì ï§ëª á¨á⥬ë. =========
|
||||
======================================================================
|
||||
@ -1633,11 +1615,6 @@ dd 638
|
||||
497 áã⮪.
|
||||
* ‘¨á⥬®¥ ¢à¥¬ï ¬®¦® ¯®«ãç¨âì äãªæ¨¥© 3.
|
||||
|
||||
======================================================================
|
||||
====== ”ãªæ¨ï 26, ¯®¤äãªæ¨ï 10 - ¯®«ãç¨âì ª « DMA ¤«ï §¢ãª . =====
|
||||
======================================================================
|
||||
“¤ «¥
|
||||
|
||||
======================================================================
|
||||
====================== ”ãªæ¨ï 26, ¯®¤äãªæ¨ï 11 =====================
|
||||
=========== “§ âì, à §à¥èñ «¨ ¨§ª®ã஢¥¢ë© ¤®áâ㯠ª HD. ==========
|
||||
@ -1667,11 +1644,6 @@ dd 638
|
||||
* “áâ ®¢¨âì ⥪ã饥 á®áâ®ï¨¥ ¬®¦® ¢ë§®¢®¬
|
||||
¯®¤äãªæ¨¨ 12 äãªæ¨¨ 21.
|
||||
|
||||
======================================================================
|
||||
=============== ”ãªæ¨ï 28 - ãáâ ®¢¨âì £à®¬ª®áâì SB16. ==============
|
||||
======================================================================
|
||||
“¤ «¥
|
||||
|
||||
======================================================================
|
||||
================ ”ãªæ¨ï 29 - ¯®«ãç¨âì á¨á⥬ãî ¤ âã. ===============
|
||||
======================================================================
|
||||
@ -1711,6 +1683,56 @@ dd 638
|
||||
ª®¯¨àãîâáï ⮫쪮 ¯¥à¢ë¥ (edx-1) ¡ ©â
|
||||
¨ ¢ ª®æ¥ áâ ¢¨âáï § ¢¥àè î騩 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 - ¯à®ç¨â âì 梥â â®çª¨ íªà ¥. ============
|
||||
======================================================================
|
||||
@ -1728,6 +1750,22 @@ dd 638
|
||||
äãªæ¨©) ç¥à¥§ ᥫ¥ªâ®à gs. <20> à ¬¥âàë ⥪ã饣® ¢¨¤¥®à¥¦¨¬
|
||||
¬®¦® ¯®«ãç¨âì äãªæ¨¥© 61.
|
||||
|
||||
======================================================================
|
||||
=============== ”ãªæ¨ï 36 - ¯à®ç¨â âì ®¡« áâì íªà . ===============
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 36 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 㪠§ â¥«ì ¯à¥¤¢ à¨â¥«ì® ¢ë¤¥«¥ãî ®¡« áâì ¯ ¬ïâ¨,
|
||||
ªã¤ ¡ã¤¥â ¯®¬¥é¥® ¨§®¡à ¦¥¨¥ ¢ ä®à¬ ⥠BBGGRRBBGGRR...
|
||||
* ecx = [à §¬¥à ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ y]
|
||||
* edx = [ª®®à¤¨ â ¯® ®á¨ x]*65536 + [ª®®à¤¨ â ¯® ®á¨ y]
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* äãªæ¨ï ¥ ¢®§¢à é ¥â § 票ï
|
||||
‡ ¬¥ç ¨ï:
|
||||
* Š®®à¤¨ âë ®¡« á⨠- íâ® ª®®à¤¨ âë ¢¥à奣® «¥¢®£® 㣫
|
||||
®¡« á⨠®â®á¨â¥«ì® íªà .
|
||||
* <20> §¬¥à ¨§®¡à ¦¥¨ï ¢ ¡ ©â å ¥áâì 3*xsize*ysize.
|
||||
|
||||
======================================================================
|
||||
==================== ”ãªæ¨ï 37 - à ¡®â á ¬ëèìî. ====================
|
||||
======================================================================
|
||||
@ -1921,43 +1959,35 @@ dd 638
|
||||
* eax = -1 ¤«ï ¥ª®à४⮣® ebx
|
||||
|
||||
======================================================================
|
||||
========== ”ãªæ¨ï 42 - à ¡®â á ¤ 묨, ¯®«ãç¥ë¬¨ ¯® IRQ. =======
|
||||
========= ”ãªæ¨ï 42 - à ¡®â á ¤ 묨, ¯®«ãç¥ë¬¨ ¯® IRQ. =========
|
||||
======================================================================
|
||||
|
||||
------------------------ —⥨¥ ¤ ëå -------------------------------
|
||||
<EFBFBD>ਠ¢®§¨ª®¢¥¨¨ IRQ á¨á⥬ ¬®¦¥â áç¨âë¢ âì ¤ ë¥ ¨§ 㪠§ ëå
|
||||
à ¥¥ äãªæ¨¥© 44 ¯®à⮢ ¨ § ¯¨áë¢ âì í⨠¤ ë¥ ¢ ¡ãä¥à.
|
||||
Ž¯¨áë¢ ¥¬ ï äãªæ¨ï áç¨âë¢ ¥â ¤ ë¥ ¨§ í⮣® ¡ãä¥à ¢ ¡ãä¥à
|
||||
㪠§ ë© ¢ ª ç¥á⢥ ¯ à ¬¥âà .
|
||||
|
||||
-------------------- <20>®¤äãªæ¨ï 0 - ç⥨¥ ¤ ëå --------------------
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 42 - ®¬¥à äãªæ¨¨
|
||||
* bl = ®¬¥à IRQ, 0..15
|
||||
* bh = ®¬¥à ¯®¤äãªæ¨¨, 0
|
||||
Žáâ «ì ï ç áâì ॣ¨áâà ebx ¤®«¦ ¡ëâì ®¡ã«¥ .
|
||||
* ecx = 㪠§ â¥«ì ¡ãä¥à, ªã¤ ¡ã¤ã⠯ਨ¬ âìáï ¤ ë¥
|
||||
* bl = ®¬¥à IRQ, 0..15
|
||||
* bh = 0 - ®¬¥à ¯®¤äãªæ¨¨
|
||||
* ®áâ «ì ï ç áâì ॣ¨áâà ebx ¤®«¦ ¡ëâì ®¡ã«¥
|
||||
* ecx = 㪠§ â¥«ì ¡ãä¥à à §¬¥à®¬ ¥ ¬¥¥¥ 4000 ¡ ©â
|
||||
‚®§¢à é ¥¬®¥ § 票¥: (á¨âã æ¨î ¬®¦® à §«¨ç¨âì ¯® § 票î eax)
|
||||
* ¥á«¨ ¯®â®ª ¥ ï¥âáï ¢« ¤¥«ì楬 IRQ
|
||||
(¨«¨ ®¬¥à IRQ § ¤ ¥¢¥à®):
|
||||
* eax = -1
|
||||
* ¥á«¨ ¤ ëå ¥â:
|
||||
* eax = 0
|
||||
(¨«¨ ®¬¥à IRQ § ¤ ¥¢¥à®): eax = -1
|
||||
* ¥á«¨ ¤ ëå ¥â: eax = 0
|
||||
* ¥á«¨ ¢áñ ¢ ¯®à浪¥ ¨ ¤ ë¥ ¡ë«¨:
|
||||
* eax = à §¬¥à ¤ ëå, ¯à®ç¨â ëå ¨§ ¡ãä¥à (¢ ¡ ©â å)
|
||||
eax = à §¬¥à ¤ ëå, ¯à®ç¨â ëå ¨§ ¡ãä¥à (¢ ¡ ©â å)
|
||||
|
||||
‘¬®âà¨â¥ § ¬¥ç ¨ï ¨¦¥.
|
||||
|
||||
------------------------ “§ âì à §¬¥à ¤ ëå ¢ ¡ãä¥à¥ ---------------
|
||||
------------ <20>®¤äãªæ¨ï 1 - 㧠âì à §¬¥à ¤ ëå ¢ ¡ãä¥à¥ ------------
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 42 - ®¬¥à äãªæ¨¨
|
||||
* bl = ®¬¥à IRQ, 0..15
|
||||
* bh = ®¬¥à ¯®¤äãªæ¨¨, 1
|
||||
Žáâ «ì ï ç áâì ॣ¨áâà ebx ¤®«¦ ¡ëâì ®¡ã«¥ .
|
||||
‚®§¢à é ¥¬®¥ § 票¥: (á¨âã æ¨î ¬®¦® à §«¨ç¨âì ¯® § 票î eax)
|
||||
* bl = ®¬¥à IRQ, 0..15
|
||||
* bh = 1 - ®¬¥à ¯®¤äãªæ¨¨
|
||||
* ®áâ «ì ï ç áâì ॣ¨áâà ebx ¤®«¦ ¡ëâì ®¡ã«¥
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* ¥á«¨ ¯®â®ª ¥ ï¥âáï ¢« ¤¥«ì楬 IRQ
|
||||
(¨«¨ ®¬¥à IRQ § ¤ ¥¢¥à®):
|
||||
* eax = -1
|
||||
* ¥á«¨ ¢áñ ¢ ¯®à浪¥, ¢ eax à §¬¥à ¤ ëå
|
||||
|
||||
(¨«¨ ®¬¥à IRQ § ¤ ¥¢¥à®): eax = -1
|
||||
* ¨ ç¥ eax = à §¬¥à ¤ ëå ¢ ¡ãä¥à¥
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>।¢ à¨â¥«ì® ¯®â®ª ¤®«¦¥ § १¥à¢¨à®¢ âì ¤«ï ᥡï 㪠§ ë© IRQ
|
||||
äãªæ¨¥© 45.
|
||||
@ -2188,11 +2218,11 @@ dword-
|
||||
‡ ¬¥ç ¨ï:
|
||||
* ‘âàãªâãà â ¡«¨æë 梥⮢ ®¯¨á ¢ áâ ¤ à⮬ ¢ª«îç ¥¬®¬ ä ©«¥
|
||||
macros.inc ¯®¤ §¢ ¨¥¬ system_colors; ¯à¨¬¥à, ¬®¦® ¯¨á âì:
|
||||
sc system_colors ; ®¡ê¥¨¥ ¯¥à¥¬¥®©
|
||||
... ; £¤¥-â® ¤® ¢ë§¢ âì
|
||||
; ®¯¨áë¢ ¥¬ãî äãªæ¨î á ecx=sc
|
||||
mov ecx, [sc.work_button_text] ; ç¨â ¥¬ 梥â ⥪áâ
|
||||
; ª®¯ª¥ ¢ à ¡®ç¥© ®¡« áâ¨
|
||||
sc system_colors ; ®¡ê¥¨¥ ¯¥à¥¬¥®©
|
||||
... ; £¤¥-â® ¤® ¢ë§¢ âì
|
||||
; ®¯¨áë¢ ¥¬ãî äãªæ¨î á ecx=sc
|
||||
mov ecx, [sc.work_button_text] ; ç¨â ¥¬ 梥â ⥪áâ
|
||||
; ª®¯ª¥ ¢ à ¡®ç¥© ®¡« áâ¨
|
||||
* ˆá¯®«ì§®¢ ¨¥/¥¨á¯®«ì§®¢ ¨¥ íâ¨å 梥⮢ - ¤¥«® ¨áª«îç¨â¥«ì®
|
||||
á ¬®© ¯à®£à ¬¬ë. „«ï ¨á¯®«ì§®¢ ¨ï 㦮 ¯à®áâ® ¯à¨ ¢ë§®¢¥ äãªæ¨©
|
||||
à¨á®¢ ¨ï 㪠§ë¢ âì 梥â, ¢§ïâë© ¨§ í⮩ â ¡«¨æë.
|
||||
@ -2581,9 +2611,6 @@ dword-
|
||||
* ’¥ªãé ï ॠ«¨§ æ¨ï ¥ § ªàë¢ ¥â ¢â®¬ â¨ç¥áª¨ ¢á¥ ᮪¥âë ¯®â®ª
|
||||
¯à¨ ¥£® § ¢¥à襨¨. ‚ ç áâ®áâ¨, ¥ á«¥¤ã¥â ¯à¨¡¨¢ âì ¯®â®ª
|
||||
á ªã祩 ®âªàëâëå ᮪¥â®¢ - ¡ã¤¥â ãâ¥çª à¥áãàᮢ.
|
||||
* ’¥ªãé ï ॠ«¨§ æ¨ï ¥ ¤¥« ¥â ¯à®¢¥à®ª ª®à४â®áâì
|
||||
(¥¤¨á⢥®¥, çâ® ¢®§¢à é ¥âáï ®è¨¡ª , - ¯®¯ë⪠§ ªàëâì
|
||||
¥®âªàëâë© á®ª¥â á ª®à४âë¬ åí¤«®¬).
|
||||
|
||||
======================================================================
|
||||
============== ”ãªæ¨ï 53, ¯®¤äãªæ¨ï 2 - ®¯à®á ᮪¥â . ==============
|
||||
@ -2593,10 +2620,8 @@ dword-
|
||||
* ebx = 2 - ®¬¥à ¯®¤äãªæ¨¨
|
||||
* ecx = åí¤« ᮪¥â
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax = ç¨á«® ¯®«ãç¥ëå ¡ ©â
|
||||
* eax = ç¨á«® ¯®«ãç¥ëå ¡ ©â, 0 ¤«ï ¥¢¥à®£® åí¤«
|
||||
* ebx à §àãè ¥âáï
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>஢¥àª¨ ª®à४â®á⨠¥ ¤¥« ¥âáï.
|
||||
|
||||
======================================================================
|
||||
======== ”ãªæ¨ï 53, ¯®¤äãªæ¨ï 3 - ¯à®ç¨â âì ¡ ©â ¨§ ᮪¥â . ========
|
||||
@ -2606,12 +2631,10 @@ dword-
|
||||
* ebx = 3 - ®¬¥à ¯®¤äãªæ¨¨
|
||||
* ecx = åí¤« ᮪¥â
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* ¥á«¨ ¥â ¯à¨ïâëå ¤ ëå: eax=0, bl=0,
|
||||
¯à®ç¨¥ ¡ ©âë ebx à §àãè îâáï
|
||||
* ¥á«¨ ¥â ¯à¨ïâëå ¤ ëå ¨«¨ 㪠§ ¥¢¥àë© åí¤«:
|
||||
eax=0, bl=0, ¯à®ç¨¥ ¡ ©âë ebx à §àãè îâáï
|
||||
* ¥á«¨ ¡ë«¨ ¯à¨ïâë¥ ¤ ë¥: eax=ç¨á«® ®áâ ¢è¨åáï ¡ ©â
|
||||
(¢®§¬®¦®, 0), bl=¯à®ç¨â ë© ¡ ©â, ¯à®ç¨¥ ¡ ©âë ebx à §àãè îâáï
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>஢¥àª¨ ª®à४â®á⨠¥ ¯à®¨§¢®¤¨âáï.
|
||||
|
||||
======================================================================
|
||||
========== ”ãªæ¨ï 53, ¯®¤äãªæ¨ï 4 - § ¯¨á âì ¢ UDP-᮪¥â. ==========
|
||||
@ -2623,13 +2646,10 @@ dword-
|
||||
* edx = ç¨á«® ¡ ©â ¤«ï § ¯¨á¨
|
||||
* esi = 㪠§ â¥«ì ¤ ë¥ ¤«ï § ¯¨á¨
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax = 0xffffffff - ¥¢¥àë© åí¤«
|
||||
* eax = 0xffff - ¥¤®áâ â®ç® ¯ ¬ïâ¨
|
||||
* eax = 0xffffffff - ®è¨¡ª (¥¢¥àë© åí¤« ¨«¨ ¥¤®áâ â®ç® ¯ ¬ïâ¨)
|
||||
* eax = 0 - ãᯥè®
|
||||
* ebx à §àãè ¥âáï
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>஢¥àª ¯à ¢¨«ì®áâì åí¤« ¬¨¨¬ «ì - ¨áª«îç îâáï ⮫쪮
|
||||
¥ ®ç¥ì ¥¯à ¢¨«ìë¥ ¥®âªàëâë¥ åí¤«ë.
|
||||
* —¨á«® ¡ ©â ¤«ï § ¯¨á¨ ¥ ¬®¦¥â ¯à¥¢ëè âì 1500-28, å®âï
|
||||
ᮮ⢥âáâ¢ãî饩 ¯à®¢¥àª¨ ¥ ¤¥« ¥âáï.
|
||||
|
||||
@ -2657,7 +2677,7 @@ dword-
|
||||
* ebx = 6 - ®¬¥à ¯®¤äãªæ¨¨
|
||||
* ecx = åí¤« ᮪¥â
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax = áâ âãá ᮪¥â : ®¤® ¨§
|
||||
* eax = 0 ¤«ï ¥¢¥à®£® ᮪¥â ¨«¨ áâ âãá: ®¤® ¨§
|
||||
* TCB_LISTEN = 1
|
||||
* TCB_SYN_SENT = 2
|
||||
* TCB_SYN_RECEIVED = 3
|
||||
@ -2670,8 +2690,6 @@ dword-
|
||||
* TCB_TIME_WAIT = 10
|
||||
* TCB_CLOSED = 11
|
||||
* ebx à §àãè ¥âáï
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>஢¥à®ª ª®à४â®á⨠¥ ¯à®¨§¢®¤¨âáï.
|
||||
|
||||
======================================================================
|
||||
========== ”ãªæ¨ï 53, ¯®¤äãªæ¨ï 7 - § ¯¨á âì ¢ TCP-᮪¥â. ==========
|
||||
@ -2683,13 +2701,10 @@ dword-
|
||||
* edx = ç¨á«® ¡ ©â ¤«ï § ¯¨á¨
|
||||
* esi = 㪠§ â¥«ì ¤ ë¥ ¤«ï § ¯¨á¨
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax = 0xffffffff - ®è¨¡ª
|
||||
* eax = 0xffff - ¥¤®áâ â®ç® ¯ ¬ïâ¨
|
||||
* eax = 0xffffffff - ®è¨¡ª (¥¢¥àë© åí¤« ¨«¨ ¥¤®áâ â®ç® ¯ ¬ïâ¨)
|
||||
* eax = 0 - ãᯥè®
|
||||
* ebx à §àãè ¥âáï
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>஢¥àª ¯à ¢¨«ì®áâì åí¤« ¬¨¨¬ «ì - ¨áª«îç îâáï ⮫쪮
|
||||
¥ ®ç¥ì ¥¯à ¢¨«ìë¥ ¥®âªàëâë¥ åí¤«ë.
|
||||
* —¨á«® ¡ ©â ¤«ï § ¯¨á¨ ¥ ¬®¦¥â ¯à¥¢ëè âì 1500-40,
|
||||
å®âï ᮮ⢥âáâ¢ãî饩 ¯à®¢¥àª¨ ¥ ¤¥« ¥âáï.
|
||||
|
||||
@ -2701,19 +2716,14 @@ dword-
|
||||
* ebx = 8 - ®¬¥à ¯®¤äãªæ¨¨
|
||||
* ecx = åí¤« ᮪¥â
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax = -1 - ¥¢¥àë© åí¤«
|
||||
* eax = 0xffff - ¥¤®áâ â®ç® ¯ ¬ï⨠¤«ï ¯ ª¥â § ªàëâ¨ï ᮪¥â
|
||||
* eax = -1 - ®è¨¡ª (¥¢¥àë© åí¤« ¨«¨
|
||||
¥¤®áâ â®ç® ¯ ¬ï⨠¤«ï ¯ ª¥â § ªàëâ¨ï ᮪¥â )
|
||||
* eax = 0 - ãᯥè®
|
||||
* ¢® ¬®£¨å á«ãç ïå eax à §àãè ¥âáï (¢®§¢à é ¥âáï १ã«ìâ â äãªæ¨¨
|
||||
queue) - ¢¨¤¨¬®, íâ® ¡ £, ª®â®àë© ¡ã¤¥â ¨á¯à ¢«¥
|
||||
* ebx à §àãè ¥âáï
|
||||
‡ ¬¥ç ¨ï:
|
||||
* ’¥ªãé ï ॠ«¨§ æ¨ï ¥ § ªàë¢ ¥â ¢â®¬ â¨ç¥áª¨ ¢á¥ ᮪¥âë ¯®â®ª
|
||||
¯à¨ ¥£® § ¢¥à襨¨. ‚ ç áâ®áâ¨, ¥ á«¥¤ã¥â ¯à¨¡¨¢ âì ¯®â®ª
|
||||
á ªã祩 ®âªàëâëå ᮪¥â®¢ - ¡ã¤¥â ãâ¥çª à¥áãàᮢ.
|
||||
* ’¥ªãé ï ॠ«¨§ æ¨ï ¥ ¤¥« ¥â ¯à®¢¥à®ª ª®à४â®áâì
|
||||
(¥¤¨á⢥®¥, çâ® ¢®§¢à é ¥âáï ®è¨¡ª , - ¯®¯ë⪠§ ªàëâì
|
||||
¥®âªàëâë© á®ª¥â á ª®à४âë¬ åí¤«®¬).
|
||||
|
||||
======================================================================
|
||||
== ”ãªæ¨ï 53, ¯®¤äãªæ¨ï 9 - ¯à®¢¥à¨âì, ᢮¡®¤¥ «¨ «®ª «ìë© ¯®àâ. =
|
||||
@ -2754,10 +2764,8 @@ dword-
|
||||
* esi = ç¨á«® ¡ ©â ¤«ï ç⥨ï;
|
||||
* esi = 0 - ç¨â âì ¢á¥ ¤ ë¥ (¬ ªá¨¬ã¬ 4096 ¡ ©â)
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax = ç¨á«® ¯à®ç¨â ëå ¡ ©â
|
||||
* eax = ç¨á«® ¯à®ç¨â ëå ¡ ©â (0 ¯à¨ ¥¢¥à®¬ åí¤«¥)
|
||||
* ebx à §àãè ¥âáï
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>஢¥àª¨ ¯à ¢¨«ì®áâì åí¤« ¥ ¤¥« ¥âáï.
|
||||
|
||||
======================================================================
|
||||
”ãªæ¨ï 53, ¯®¤äãªæ¨ï 255 - ®â« ¤®ç ï ¨ä®à¬ æ¨ï á¥â¥¢®£® ¤à ©¢¥à .
|
||||
@ -2791,59 +2799,6 @@ dword-
|
||||
* 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 =====================
|
||||
========== <20> ç âì ¯à®¨£àë¢ âì ¤ ë¥ ¢áâ஥®¬ ᯨª¥à¥. ==========
|
||||
@ -3167,10 +3122,10 @@ IPC
|
||||
<EFBFBD>à®£à ¬¬¥ ¤®áâã¯ë ¤ ë¥ £à ä¨ç¥áª®£® íªà (®¡« áâì ¯ ¬ïâ¨, ª®â®à ï
|
||||
ᮡá⢥® ¨ ®â®¡à ¦ ¥â ᮤ¥à¦¨¬®¥ íªà ) ¯àï¬ãî ¡¥§ ¢ë§®¢®¢
|
||||
á¨á⥬ëå äãªæ¨© ç¥à¥§ ᥫ¥ªâ®à gs:
|
||||
mov eax, [gs:0]
|
||||
mov eax, [gs:0]
|
||||
¯®¬¥áâ¨â ¢ eax ¯¥à¢ë© dword ¡ãä¥à , ᮤ¥à¦ 騩 ¨ä®à¬ æ¨î ® 梥â¥
|
||||
«¥¢®© ¢¥à奩 â®çª¨ (¨, ¢®§¬®¦®, 梥⠥᪮«ìª¨å á«¥¤ãîé¨å).
|
||||
mov [gs:0], eax
|
||||
mov [gs:0], eax
|
||||
¯à¨ à ¡®â¥ ¢ ०¨¬ å VESA c LFB
|
||||
ãáâ ®¢¨â 梥⠫¥¢®© ¢¥à奩 â®çª¨
|
||||
(¨ ¢®§¬®¦®, 梥⠥᪮«ìª¨å á«¥¤ãîé¨å).
|
||||
@ -3402,7 +3357,7 @@ IPC
|
||||
* ebx = 㪠§ â¥«ì ¨§®¡à ¦¥¨¥
|
||||
* ecx = [à §¬¥à ¯® ®á¨ 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);
|
||||
¨£®à¨àã¥âáï ¯à¨ esi > 8
|
||||
* ebp = ᬥ饨¥ ¤ ëå ª ¦¤®© á«¥¤ãî饩 áâப¨ ¨§®¡à ¦¥¨ï
|
||||
@ -3412,27 +3367,28 @@ IPC
|
||||
‡ ¬¥ç ¨ï:
|
||||
* Š®®à¤¨ âë ¨§®¡à ¦¥¨ï - íâ® ª®®à¤¨ âë ¢¥à奣® «¥¢®£® 㣫
|
||||
¨§®¡à ¦¥¨ï ®â®á¨â¥«ì® ®ª .
|
||||
* <20> §¬¥à ¨§®¡à ¦¥¨ï ¢ ¡ ©â å ¥áâì xsize*ysize.
|
||||
* ”®à¬ â ¨§®¡à ¦¥¨ï á 1 ¡¨â®¬ ¯¨ªá¥«ì: ª ¦¤ë© ¡ ©â ¨§®¡à ¦¥¨ï,
|
||||
§ ¨áª«î票¥¬, ¡ëâì ¬®¦¥â, ¯®á«¥¤¨å ¡ ©â®¢ áâப, ᮤ¥à¦¨â
|
||||
¨ä®à¬ æ¨î ® 梥⥠8 ¯¨ªá¥«¥©, áâ à訩 ¡¨â ᮮ⢥âáâ¢ã¥â ¯¥à¢®¬ã
|
||||
¯¨ªá¥«î.
|
||||
* ”®à¬ â ¨§®¡à ¦¥¨ï á 2 ¡¨â ¬¨ ¯¨ªá¥«ì: ª ¦¤ë© ¡ ©â ¨§®¡à ¦¥¨ï,
|
||||
§ ¨áª«î票¥¬, ¡ëâì ¬®¦¥â, ¯®á«¥¤¨å ¡ ©â®¢ áâப, ᮤ¥à¦¨â
|
||||
¨ä®à¬ æ¨î ® 梥⥠4 ¯¨ªá¥«¥©, áâ à訥 ¤¢ ¡¨â ᮮ⢥âáâ¢ãîâ
|
||||
¯¥à¢®¬ã ¯¨ªá¥«î.
|
||||
* ”®à¬ â ¨§®¡à ¦¥¨ï á 4 ¡¨â ¬¨ ¯¨ªá¥«ì: ª ¦¤ë© ¡ ©â ¨§®¡à ¦¥¨ï,
|
||||
§ ¨áª«î票¥¬ ¯®á«¥¤¨å ¡ ©â®¢ áâப (¥á«¨ è¨à¨ ¨§®¡à ¦¥¨ï
|
||||
¥çñâ ), ᮤ¥à¦¨â ¨ä®à¬ æ¨î ® 梥⥠2 ¯¨ªá¥«¥©, áâ àè ï â¥âà ¤
|
||||
ᮮ⢥âáâ¢ã¥â ¯¥à¢®¬ã ¯¨ªá¥«î.
|
||||
* ”®à¬ â ¨§®¡à ¦¥¨ï á 8 ¡¨â ¬¨ ¯¨ªá¥«ì: ª ¦¤ë© ¡ ©â ¨§®¡à ¦¥¨ï
|
||||
à áᬠâਢ ¥âáï ª ª ¨¤¥ªá ¢ ¯ «¨âà¥.
|
||||
* …᫨ ¨§®¡à ¦¥¨¥ ¨á¯®«ì§ã¥â ¥ ¢á¥ 256 梥⮢, ¬¥ìè¥,
|
||||
à §¬¥à ¯ «¨âàë ¬®¦¥â ¡ëâì ¬¥ìè¥ 256.
|
||||
* ”®à¬ â ¨§®¡à ¦¥¨ï á 15 ¡¨â ¬¨ ¯¨ªá¥«ì: 梥⠪ ¦¤®£® ¯¨ªá¥«ï
|
||||
ª®¤¨àã¥âáï ª ª (¢ ¡¨â®¢®¬ ¯à¥¤áâ ¢«¥¨¨) 0RRRRRGGGGGBBBBB -
|
||||
¯® 5 ¯¨ªá¥«¥© ª ¦¤ë© 梥â.
|
||||
* ”®à¬ â ¨§®¡à ¦¥¨ï á 16 ¡¨â ¬¨ ¯¨ªá¥«ì: 梥⠪ ¦¤®£® ¯¨ªá¥«ï
|
||||
ª®¤¨àã¥âáï ª ª RRRRRGGGGGGBBBBB (á奬 5+6+5).
|
||||
* ”®à¬ â ¨§®¡à ¦¥¨ï á 24 ¡¨â ¬¨ ¯¨ªá¥«ì: 梥⠪ ¦¤®£® ¯¨ªá¥«ï
|
||||
ª®¤¨àã¥âáï âà¥¬ï ¡ ©â ¬¨ - ¯®á«¥¤®¢ â¥«ì® á¨ïï, §¥«ñ ï,
|
||||
ªà á ï á®áâ ¢«ïî騥 梥â .
|
||||
ª®¤¨àã¥âáï âà¥¬ï ¡ ©â ¬¨ - ¯®á«¥¤®¢ â¥«ì® á¨ïï, §¥«ñ ï, ªà á ï
|
||||
á®áâ ¢«ïî騥 梥â .
|
||||
* ”®à¬ â ¨§®¡à ¦¥¨ï á 32 ¡¨â ¬¨ ¯¨ªá¥«ì: «®£¨ç® 24, ⮫쪮
|
||||
¥áâì ¥éñ ¨£®à¨àã¥¬ë© ç¥â¢ñàâë© ¡ ©â.
|
||||
* ‚맮¢ äãªæ¨¨ 7 íª¢¨¢ «¥â¥ ¢ë§®¢ã í⮩ äãªæ¨¨ á ¯ à ¬¥âà ¬¨
|
||||
@ -3685,30 +3641,24 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
¨«¨ ¯®¤äãªæ¨¥© 20.
|
||||
|
||||
======================================================================
|
||||
===== ”ãªæ¨ï 68, ¯®¤äãªæ¨ï 14 - ®¦¨¤ âì ¨§¢¥é¥¨ï ®â ¤à ©¢¥à . =====
|
||||
==================== ”ãªæ¨ï 68, ¯®¤äãªæ¨ï 14 =======================
|
||||
===== Ž¦¨¤ âì ¯®«ã票ï ᨣ « , ®â ¤àã£¨å ¯à¨«®¦¥¨©/¤à ©¢¥à®¢. =====
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 68 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 14 - ®¬¥à ¯®¤äãªæ¨¨
|
||||
* ecx = 㪠§ â¥«ì ¡ãä¥à ¤«ï ¨ä®à¬ 樨 (8 ¡ ©â)
|
||||
* ecx = 㪠§ â¥«ì ¡ãä¥à ¤«ï ¨ä®à¬ 樨 (24 ¡ ©â )
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* ¡ãä¥à, ª®â®àë© ãª §ë¢ ¥â ecx, ᮤ¥à¦¨â á«¥¤ãîéãî ¨ä®à¬ æ¨î:
|
||||
* +0: dword: ª®áâ â EV_INTR = 1
|
||||
* +4: dword: ¤ ë¥ ¤à ©¢¥à
|
||||
‡ ¬¥ç ¨ï:
|
||||
* ’¥ªãé ï ॠ«¨§ æ¨ï ¢® ¢à¥¬ï ®¦¨¤ ¨ï âॡã¥â ¤®¢®«ì® "âï¦ñ«ëå"
|
||||
®¯¥à 権 ¯¥à¥ª«îç¥¨ï ª®â¥ªáâ .
|
||||
* +0: dword: ¨¤¥â¨ä¨ª â®à ¯®á«¥¤ãîé¨å ¤ ëå ᨣ «
|
||||
* +4: ¤ ë¥ ¯à¨ï⮣® ᨣ « (20 ¡ ©â), ä®à¬ â ª®â®àëå
|
||||
®¯à¥¤¥«ï¥âáï ¯¥à¢ë¬ dword-®¬
|
||||
|
||||
======================================================================
|
||||
== ”ãªæ¨ï 68, ¯®¤äãªæ¨ï 15 - ãáâ ®¢¨âì ®¡à ¡®â稪 ¨áª«î票© FPU. =
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 68 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 15 - ®¬¥à ¯®¤äãªæ¨¨
|
||||
* ecx = ¤à¥á ®¢®£® ®¡à ¡®â稪 ¨áª«î票©
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax = ¤à¥á áâ ண® ®¡à ¡®â稪 ¨áª«î票©
|
||||
(0, ¥á«¨ ® ¥ ¡ë« ãáâ ®¢«¥)
|
||||
“¤ «¥ (¢ ⥪ã饩 ॠ«¨§ 樨 ¯à®áâ® ¢®§¢à é ¥â 0)
|
||||
ˆá¯®«ì§®¢ âì ¯®¤äãªæ¨¨ 24, 25
|
||||
|
||||
======================================================================
|
||||
=========== ”ãªæ¨ï 68, ¯®¤äãªæ¨ï 16 - § £à㧨âì ¤à ©¢¥à. ===========
|
||||
@ -3751,13 +3701,8 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
======================================================================
|
||||
== ”ãªæ¨ï 68, ¯®¤äãªæ¨ï 18 - ãáâ ®¢¨âì ®¡à ¡®â稪 ¨áª«î票© SSE. =
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 68 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 18 - ®¬¥à ¯®¤äãªæ¨¨
|
||||
* ecx = ¤à¥á ®¢®£® ®¡à ¡®â稪 ¨áª«î票©
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax = ¤à¥á áâ ண® ®¡à ¡®â稪 ¨áª«î票©
|
||||
(0, ¥á«¨ ® ¥ ¡ë« ãáâ ®¢«¥)
|
||||
“¤ «¥ (¢ ⥪ã饩 ॠ«¨§ 樨 ¯à®áâ® ¢®§¢à é ¥â 0)
|
||||
ˆá¯®«ì§®¢ âì ¯®¤äãªæ¨¨ 24, 25
|
||||
|
||||
======================================================================
|
||||
============= ”ãªæ¨ï 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 - ®â« ¤ª . =======================
|
||||
======================================================================
|
||||
@ -3831,8 +3874,8 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
…᫨ ®â« ¤ç¨ª í⮣® ¥ å®ç¥â, ® ¤®«¦¥ ¯à¥¤¢ à¨â¥«ì® ®âª«îç¨âìáï
|
||||
¯®¤äãªæ¨¥© 3.
|
||||
|
||||
‚ᥠ¯®¤äãªæ¨¨, ªà®¬¥ 4 ¨ 5, ¯à¨¬¥¨¬ë ⮫쪮 ª ¯à®æ¥áá ¬/¯®â®ª ¬,
|
||||
§ ¯ãé¥ë¬ ¨§ ⥪ã饣® äãªæ¨¥© 70 á ãáâ ®¢«¥ë¬ ä« £®¬ ®â« ¤ª¨.
|
||||
‚ᥠ¯®¤äãªæ¨¨ ¯à¨¬¥¨¬ë ⮫쪮 ª ¯à®æ¥áá ¬/¯®â®ª ¬, § ¯ãé¥ë¬
|
||||
¨§ ⥪ã饣® äãªæ¨¥© 70 á ãáâ ®¢«¥ë¬ ä« £®¬ ®â« ¤ª¨.
|
||||
Žâ« ¤ª ¬®£®¯®â®çëå ¯à®£à ¬¬ ¯®ª ¥ ¯®¤¤¥à¦¨¢ ¥âáï.
|
||||
<EFBFBD>®«ë© ᯨ᮪ ¯®¤äãªæ¨©:
|
||||
* ¯®¤äãªæ¨ï 0 - ®¯à¥¤¥«¨âì ®¡« áâì ¤ ëå ¤«ï ®â« ¤®çëå á®®¡é¥¨©
|
||||
@ -3865,7 +3908,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
¨ ¯à¨ ¯®áâ㯫¥¨¨ ®¢®£® á®®¡é¥¨ï á¨á⥬ ¡ã¤¥â ¦¤ âì.
|
||||
„«ï á¨åந§ 樨 ®¡à ¬«ï©â¥ ¢áî à ¡®âã á ¡ãä¥à®¬ ®¯¥à æ¨ï¬¨
|
||||
¡«®ª¨à®¢ª¨/à §¡«®ª¨à®¢ª¨
|
||||
neg [bufsize]
|
||||
neg [bufsize]
|
||||
* „ ë¥ ¢ ¡ãä¥à¥ âà ªâãîâáï ª ª ¬ áᨢ í«¥¬¥â®¢ ¯¥à¥¬¥®© ¤«¨ë -
|
||||
á®®¡é¥¨©. ”®à¬ â á®®¡é¥¨ï 㪠§ ¢ ®¡é¥¬ ®¯¨á ¨¨.
|
||||
|
||||
@ -3930,7 +3973,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
* …᫨ ¯à®æ¥áá ¡ë« ¯à¨®áâ ®¢«¥, ® ¢®§®¡®¢«ï¥â ¢ë¯®«¥¨¥.
|
||||
|
||||
======================================================================
|
||||
=========== ”ãªæ¨ï 69, ¯®¤äãªæ¨ï 4 - ¯à¨®áâ ®¢¨âì ¯®â®ª. ==========
|
||||
==== ”ãªæ¨ï 69, ¯®¤äãªæ¨ï 4 - ¯à¨®áâ ®¢¨âì ®â« ¦¨¢ ¥¬ë© ¯®â®ª. ====
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 69 - ®¬¥à ¯à®æ¥áá
|
||||
@ -3938,10 +3981,13 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
* ecx = ¨¤¥â¨ä¨ª â®à
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* äãªæ¨ï ¥ ¢®§¢à é ¥â § 票ï
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>à®æ¥áá ¤®«¦¥ ¡ëâì § £à㦥 ¤«ï ®â« ¤ª¨ (ª ª 㪠§ ® ¢
|
||||
®¡é¥¬ ®¯¨á ¨¨).
|
||||
|
||||
======================================================================
|
||||
====================== ”ãªæ¨ï 69, ¯®¤äãªæ¨ï 5 ======================
|
||||
=================== ‚®§®¡®¢¨âì ¢ë¯®«¥¨¥ ¯®â®ª . ===================
|
||||
============ ‚®§®¡®¢¨âì ¢ë¯®«¥¨¥ ®â« ¦¨¢ ¥¬®£® ¯®â®ª . ============
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 69 - ®¬¥à äãªæ¨¨
|
||||
@ -3949,6 +3995,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
* ecx = ¨¤¥â¨ä¨ª â®à
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* äãªæ¨ï ¥ ¢®§¢à é ¥â § 票ï
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>à®æ¥áá ¤®«¦¥ ¡ëâì § £à㦥 ¤«ï ®â« ¤ª¨ (ª ª 㪠§ ® ¢
|
||||
®¡é¥¬ ®¯¨á ¨¨).
|
||||
|
||||
======================================================================
|
||||
====================== ”ãªæ¨ï 69, ¯®¤äãªæ¨ï 6 ======================
|
||||
|
@ -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.
|
||||
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
|
||||
to transfer control to the next process (to complete a current
|
||||
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. ==============
|
||||
@ -613,16 +610,20 @@ Parameters:
|
||||
* eax = 17 - function number
|
||||
Returned value:
|
||||
* if the buffer is empty, function returns eax=1
|
||||
* if the buffer is not empty, function returns:
|
||||
high 24 bits of eax contain button identifier (in particular, ah
|
||||
contains low byte of the identifier; if all buttons have
|
||||
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
|
||||
* if the buffer is not empty:
|
||||
* high 24 bits of eax contain button identifier (in particular,
|
||||
ah contains low byte of the identifier; if all buttons have
|
||||
the identifier less than 256, ah is enough to distinguish)
|
||||
* al = 0 - the button was pressed with left mouse button
|
||||
* al = bit corresponding to used mouse button otherwise
|
||||
Remarks:
|
||||
* "Buffer" keeps only one button, at pressing the new button the
|
||||
information about old is lost.
|
||||
* The call of this function by an application with inactive window
|
||||
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. =
|
||||
@ -678,7 +679,7 @@ Returned value:
|
||||
* eax = clock rate (modulo 2^32 clock ticks = 4GHz)
|
||||
|
||||
======================================================================
|
||||
Function 18, subfunction 6 - save ramdisk to the file on hard drive.
|
||||
Function 18, subfunction 6 - save ramdisk to the file on hard drive.
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 18 - function number
|
||||
@ -731,7 +732,7 @@ Returned value:
|
||||
* function does not return value
|
||||
|
||||
======================================================================
|
||||
============ Function 18, subfunction 9 - system shutdown. ===========
|
||||
== Function 18, subfunction 9 - system shutdown with the parameter. ==
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 18 - function number
|
||||
@ -747,8 +748,7 @@ Returned value:
|
||||
Remarks:
|
||||
* Do not rely on returned value by incorrect call, it can be
|
||||
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. =====
|
||||
======================================================================
|
||||
@ -761,7 +761,7 @@ Returned value:
|
||||
Remarks:
|
||||
* The minimized window from the point of view of function 9
|
||||
keeps position and sizes.
|
||||
* Restoring of an application window occurs at its activation by
|
||||
* Restoring of an application window occurs at its activation by
|
||||
subfunction 3.
|
||||
* Usually there is no necessity to minimize/restire a window
|
||||
obviously: minimization of a window is carried out by the system
|
||||
@ -771,7 +771,7 @@ Remarks:
|
||||
restore of a window is done by the application '@panel'.
|
||||
|
||||
======================================================================
|
||||
Function 18, subfunction 11 - get information on the disk subsystem.
|
||||
Function 18, subfunction 11 - get information on the disk subsystem.
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 18 - function number
|
||||
@ -1062,7 +1062,7 @@ Returned value (is the same for both subfunctions):
|
||||
* eax = 0 - success
|
||||
* eax = 1 - base port is not defined
|
||||
Remarks:
|
||||
* Previously the base port must be defined by
|
||||
* Previously the base port must be defined by
|
||||
subfunction 1 of function 21.
|
||||
|
||||
======================================================================
|
||||
@ -1106,7 +1106,7 @@ Remarks:
|
||||
if Alt and Shift are not pressed, but Ctrl is pressed, the normal
|
||||
layout is used and then from the code is subtracted 0x60;
|
||||
if no control key is pressed, the normal layout is used.
|
||||
* To get layout and country identifier use
|
||||
* To get layout and country identifier use
|
||||
subfunction 2 of function 26.
|
||||
* Country identifier is global system variable, which is not used
|
||||
by the kernel itself; however the application '@panel' displays
|
||||
@ -1126,11 +1126,6 @@ Remarks:
|
||||
* CD base is used by function 24.
|
||||
* 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. =========
|
||||
======================================================================
|
||||
@ -1165,7 +1160,7 @@ Remarks:
|
||||
* Do not change base, when any application works with hard disk.
|
||||
If you do not want system bugs.
|
||||
* To get HD base use subfunction 7 of function 26.
|
||||
* It is also necessary to define used partition of hard disk by
|
||||
* It is also necessary to define used partition of hard disk by
|
||||
subfunction 8.
|
||||
|
||||
======================================================================
|
||||
@ -1187,17 +1182,12 @@ Remarks:
|
||||
If you do not want system bugs.
|
||||
* To get used partition use subfunction 8 of function 26.
|
||||
* There is no correctness checks.
|
||||
* To get the number of partitions of a hard disk use
|
||||
* To get the number of partitions of a hard disk use
|
||||
subfunction 11 of function 18.
|
||||
* 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.
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 21 - function number
|
||||
@ -1211,7 +1201,7 @@ Remarks:
|
||||
* To get current status use subfunction 11 of function 26.
|
||||
|
||||
======================================================================
|
||||
Function 21, subfunction 12 - enable/disable low-level access to PCI.
|
||||
Function 21, subfunction 12 - enable/disable low-level access to PCI.
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 21 - function number
|
||||
@ -1278,7 +1268,7 @@ Returned value:
|
||||
* ebx = frequency of the vertical scanning (in Hz)
|
||||
* ecx = number of current videomode
|
||||
Remarks:
|
||||
* Driver must be initialized by call to
|
||||
* Driver must be initialized by call to
|
||||
driver function 1.
|
||||
* If only screen sizes are required, it is more expedient to use
|
||||
function 14 taking into account that it
|
||||
@ -1413,7 +1403,7 @@ Returned value:
|
||||
* eax = 0 - success
|
||||
* eax = 1 - CD base is not defined
|
||||
Remarks:
|
||||
* Previously CD base must be defined by the call to
|
||||
* Previously CD base must be defined by the call to
|
||||
subfunction 3 of function 21.
|
||||
* One second includes 75 frames, one minute includes 60 seconds.
|
||||
* The function is asynchronous (returns control, when play begins).
|
||||
@ -1433,7 +1423,7 @@ Remarks:
|
||||
* The format of the table with tracks information is the same as
|
||||
for ATAPI-CD command 43h (READ TOC), usual table (subcommand 00h).
|
||||
Function returns addresses in MSF.
|
||||
* Previously CD base port must be set by call to
|
||||
* Previously CD base port must be set by call to
|
||||
subfunction 3 of function 21.
|
||||
* Function returns information only about no more than 100
|
||||
first tracks. In most cases it is enough.
|
||||
@ -1448,7 +1438,7 @@ Returned value:
|
||||
* eax = 0 - success
|
||||
* eax = 1 - CD base is not defined
|
||||
Remarks:
|
||||
* Previously CD base port must be defined by call to
|
||||
* Previously CD base port must be defined by call to
|
||||
subfunction 3 of function 21.
|
||||
|
||||
======================================================================
|
||||
@ -1483,11 +1473,6 @@ Remarks:
|
||||
* The function is supported only for ATAPI devices (CD and DVD).
|
||||
* 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. ========
|
||||
======================================================================
|
||||
@ -1528,7 +1513,7 @@ Remarks:
|
||||
if Alt and Shift are not pressed, but Ctrl is pressed, the normal
|
||||
layout is used and then from the code is subtracted 0x60;
|
||||
if no control key is pressed, the normal layout is used.
|
||||
* To set layout and country identifier use
|
||||
* To set layout and country identifier use
|
||||
subfunction 2 of function 21.
|
||||
* Country identifier is global system variable, which is not used
|
||||
by the kernel itself; however the application '@panel' displays
|
||||
@ -1547,11 +1532,6 @@ Remarks:
|
||||
* CD base is used by function 24.
|
||||
* 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. =========
|
||||
======================================================================
|
||||
@ -1614,11 +1594,6 @@ Remarks:
|
||||
than 497 days.
|
||||
* To get system time use function 3.
|
||||
|
||||
======================================================================
|
||||
======== Function 26, subfunction 10 - get sound DMA channel. ========
|
||||
======================================================================
|
||||
Removed
|
||||
|
||||
======================================================================
|
||||
===================== Function 26, subfunction 11 ====================
|
||||
========== Find out whether low-level HD access is enabled. ==========
|
||||
@ -1646,11 +1621,6 @@ Remarks:
|
||||
* The current implementation uses only low bit of ecx.
|
||||
* To set the current state use subfunction 12 of function 21.
|
||||
|
||||
======================================================================
|
||||
=================== Function 28 - set SB16 volume. ===================
|
||||
======================================================================
|
||||
Removed
|
||||
|
||||
======================================================================
|
||||
=================== Function 29 - get system date. ===================
|
||||
======================================================================
|
||||
@ -1689,6 +1659,56 @@ Remarks:
|
||||
* If the buffer is too small to hold all data, only first (edx-1)
|
||||
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. =======
|
||||
======================================================================
|
||||
@ -1706,6 +1726,22 @@ Remarks:
|
||||
to videomemory through the selector gs. To get parameters of
|
||||
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. ===================
|
||||
======================================================================
|
||||
@ -1852,7 +1888,7 @@ Remarks:
|
||||
changed in future kernel versions.
|
||||
* Offset for pixel with coordinates (x,y)
|
||||
is calculated as (x+y*xsize)*3.
|
||||
* There is a pair function to set pixel on the background image -
|
||||
* There is a pair function to set pixel on the background image -
|
||||
subfunction 2 of function 15.
|
||||
|
||||
======================================================================
|
||||
@ -1865,7 +1901,7 @@ Returned value:
|
||||
* eax = 1 - tile
|
||||
* eax = 2 - stretch
|
||||
Remarks:
|
||||
* There is a pair function to set drawing mode -
|
||||
* There is a pair function to set drawing mode -
|
||||
subfunction 4 of function 15.
|
||||
|
||||
======================================================================
|
||||
@ -1899,45 +1935,36 @@ Returned value:
|
||||
* 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
|
||||
earlier by function 44 and writes this data to
|
||||
internal buffer. This function reads out data from that buffer
|
||||
to the buffer specified as parameter.
|
||||
internal buffer. This function reads out data from that buffer.
|
||||
|
||||
--------------------- Subfunction 0 - read data ----------------------
|
||||
Parameters:
|
||||
* eax = 42 - function number
|
||||
* bl = IRQ number, 0..15
|
||||
* bh = subfunction number, 0
|
||||
Other part of register ebx, must be zero.
|
||||
* ecx = pointer to the receive buffer
|
||||
* bh = 0 - subfunction number
|
||||
* rest of ebx must be zeroed
|
||||
* ecx = pointer to a buffer with size not less than 4000 bytes
|
||||
Returned value: (use value of eax to distinguish)
|
||||
* if the thread is not IRQ owner (or IRQ number is incorrect):
|
||||
* eax = -1
|
||||
* if there is no data:
|
||||
* eax = 0
|
||||
* if the thread is not IRQ owner
|
||||
(or IRQ number is incorrect): eax = -1
|
||||
* if there is no data: eax = 0
|
||||
* if all is ok:
|
||||
* eax = byte size of data, read from buffer
|
||||
|
||||
See remarks below.
|
||||
|
||||
------------------------ Get data size -------------------------------
|
||||
eax = size of data read (in bytes)
|
||||
|
||||
------------- Subfunction 1 - get size of data in buffer -------------
|
||||
Parameters:
|
||||
* eax = 42 - function number
|
||||
* bl = IRQ number, 0..15
|
||||
* bh = subfunction number, 0
|
||||
Other part of register ebx, must be zero.
|
||||
* ecx = pointer to receive buffer
|
||||
Returned value: (use value of eax to distinguish)
|
||||
* if the thread is not IRQ owner (or IRQ number is incorrect):
|
||||
* eax = -1
|
||||
* if all is ok:
|
||||
* eax = byte size of data in buffer
|
||||
|
||||
* bh = 0 - subfunction number
|
||||
* rest of ebx must be zeroed
|
||||
Returned value:
|
||||
* if the thread is not IRQ owner
|
||||
(or IRQ number is incorrect): eax = -1
|
||||
* otherwise eax = size of data in buffer
|
||||
Remarks:
|
||||
* Previously the thread must reserve indicated IRQ for itself
|
||||
by function 45.
|
||||
@ -2166,11 +2193,11 @@ Remarks:
|
||||
* Structure of the color table is described in the standard
|
||||
include file 'macros.inc' as 'system_colors'; for example,
|
||||
it is possible to write:
|
||||
sc system_colors ; variable declaration
|
||||
... ; somewhere one must call
|
||||
; this function with ecx=sc
|
||||
mov ecx, [sc.work_button_text] ; read text color on
|
||||
; buttin in working area
|
||||
sc system_colors ; variable declaration
|
||||
... ; somewhere one must call
|
||||
; this function with ecx=sc
|
||||
mov ecx, [sc.work_button_text] ; read text color on
|
||||
; buttin in working area
|
||||
* A program itself desides to use or not to use color table.
|
||||
For usage program must simply at calls to drawing functions select
|
||||
color taken from the table.
|
||||
@ -2365,7 +2392,7 @@ Parameters:
|
||||
Returned value:
|
||||
* eax = -1 - error (there is too many threads)
|
||||
* otherwise eax = TID - thread identifier
|
||||
</UL>
|
||||
</UL>
|
||||
|
||||
======================================================================
|
||||
=== Function 52, subfunction 0 - get network driver configuration. ===
|
||||
@ -2443,7 +2470,7 @@ Remarks:
|
||||
performs no checks on correctness.
|
||||
|
||||
======================================================================
|
||||
Function 52, subfunction 8 - read data from the network output queue.
|
||||
Function 52, subfunction 8 - read data from the network output queue.
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 52 - function number
|
||||
@ -2562,9 +2589,6 @@ Remarks:
|
||||
sockets of a thread at termination. In particular, one should not
|
||||
kill a thread with many opened sockets - there will be an outflow
|
||||
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. =============
|
||||
@ -2574,10 +2598,8 @@ Parameters:
|
||||
* ebx = 2 - subfunction number
|
||||
* ecx = socket handle
|
||||
Returned value:
|
||||
* eax = number of read bytes
|
||||
* eax = number of read bytes, 0 for incorrect handle
|
||||
* ebx destroyed
|
||||
Remarks:
|
||||
* There is no checks for correctness.
|
||||
|
||||
======================================================================
|
||||
========= Function 53, subfunction 3 - read byte from socket. ========
|
||||
@ -2587,12 +2609,10 @@ Parameters:
|
||||
* ebx = 3 - subfunction number
|
||||
* ecx = socket handle
|
||||
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
|
||||
* if there are read data: eax=number of rest bytes
|
||||
(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. =========
|
||||
@ -2604,13 +2624,10 @@ Parameters:
|
||||
* edx = number of bytes to write
|
||||
* esi = pointer to data to write
|
||||
Returned value:
|
||||
* eax = 0xffffffff - invalid handle
|
||||
* eax = 0xffff - not enough memory
|
||||
* eax = 0xffffffff - error (invalid handle or not enough memory)
|
||||
* eax = 0 - success
|
||||
* ebx destroyed
|
||||
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
|
||||
the appropriate check is not made.
|
||||
|
||||
@ -2638,7 +2655,7 @@ Parameters:
|
||||
* ebx = 6 - subfunction number
|
||||
* ecx = socket handle
|
||||
Returned value:
|
||||
* eax = socket status: one of
|
||||
* eax = 0 for incorrect handle or socket status: one of
|
||||
* TCB_LISTEN = 1
|
||||
* TCB_SYN_SENT = 2
|
||||
* TCB_SYN_RECEIVED = 3
|
||||
@ -2650,9 +2667,7 @@ Returned value:
|
||||
* TCB_LAST_ASK = 9
|
||||
* TCB_TIME_WAIT = 10
|
||||
* TCB_CLOSED = 11
|
||||
* ebx destroys
|
||||
Remarks:
|
||||
* There is no checks for correctness.
|
||||
* ebx destroyed
|
||||
|
||||
======================================================================
|
||||
========== Function 53, subfunction 7 - write to TCP-socket. =========
|
||||
@ -2664,13 +2679,10 @@ Parameters:
|
||||
* edx = number of bytes to write
|
||||
* esi = pointer to data to write
|
||||
Returned value:
|
||||
* eax = 0xffffffff - error
|
||||
* eax = 0xffff - not enough memory
|
||||
* eax = 0xffffffff - error (invalid handle or not enough memory)
|
||||
* eax = 0 - success
|
||||
* ebx destroyed
|
||||
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
|
||||
the appropriate check is not made.
|
||||
|
||||
@ -2682,20 +2694,15 @@ Parameters:
|
||||
* ebx = 8 - subfunction number
|
||||
* ecx = socket handle
|
||||
Returned value:
|
||||
* eax = -1 - invalid handle
|
||||
* eax = 0xffff - not enough memory for socket close packet
|
||||
* eax = -1 - error (invalid handle or
|
||||
not enough memory for socket close packet)
|
||||
* 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
|
||||
Remarks:
|
||||
* The current implementation does not close automatically all
|
||||
sockets of a thread at termination. In particular, one should not
|
||||
kill a thread with many opened sockets - there will be an outflow
|
||||
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. ===
|
||||
@ -2736,13 +2743,11 @@ Paramters:
|
||||
* esi = number of bytes to read;
|
||||
* esi = 0 - read all data (maximum 4096 bytes)
|
||||
Returned value:
|
||||
* eax = number of bytes read
|
||||
* eax = number of bytes read (0 for incorrect handle)
|
||||
* 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.
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 53 - function number
|
||||
@ -2773,59 +2778,7 @@ Possible values for ecx:
|
||||
* 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.
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 55 - function number
|
||||
@ -2970,7 +2923,7 @@ Remarks:
|
||||
that he requested 1;
|
||||
* if one requests more than 14 blocks or starting block is
|
||||
not less than 14, function returns eax=5 (not found) è ebx=-1;
|
||||
* size of ramdisk root folder is 14 blocks,
|
||||
* size of ramdisk root folder is 14 blocks,
|
||||
0x1C00=7168 áàéò; but function returns ebx=0
|
||||
(except of the case of previous item);
|
||||
* strangely enough, it is possible to read 14th block (which
|
||||
@ -3032,8 +2985,8 @@ Remarks:
|
||||
* Block size is 512 bytes; function reads one block.
|
||||
* Do not depend on returned value, it can be changed
|
||||
in future versions.
|
||||
* Function requires that LBA-access to devices is enabled by
|
||||
subfunction 11 of function 21. To check this one can use
|
||||
* Function requires that LBA-access to devices is enabled by
|
||||
subfunction 11 of function 21. To check this one can use
|
||||
subfunction 11 of function 26.
|
||||
* LBA-read of floppy is not supported.
|
||||
* Function reads data on physical hard drive; if for any reason
|
||||
@ -3143,11 +3096,11 @@ Remarks:
|
||||
The data of the graphics screen (the memory area which displays
|
||||
screen contents) are accessible to a program directly, without
|
||||
any system calls, through the selector gs:
|
||||
mov eax, [gs:0]
|
||||
mov eax, [gs:0]
|
||||
places in eax the first dword of the buffer, which contains
|
||||
information on color of the left upper point (and, possibly, colors
|
||||
of several following).
|
||||
mov [gs:0], eax
|
||||
mov [gs:0], eax
|
||||
by work in VESA modes with LFB sets color of the left upper point
|
||||
(and, possibly, colors of several following).
|
||||
To interpret the data of graphics screen program needs to know
|
||||
@ -3375,19 +3328,36 @@ Parameters:
|
||||
* ebx = pointer to the image
|
||||
* ecx = [size on axis x]*65536 + [size on axis y]
|
||||
* edx = [coordinate on axis x]*65536 + [coordinate on axis y]
|
||||
* esi = number of bits per pixel, must be 8, 24 or 32
|
||||
* edi = pointer to palette (256 colors 0x00RRGGBB);
|
||||
ignored when esi = 24 and 32
|
||||
* esi = number of bits per pixel, must be 1,2,4,8,15,16,24 or 32
|
||||
* edi = pointer to palette (2 to the power esi colors 0x00RRGGBB);
|
||||
ignored when esi > 8
|
||||
* ebp = offset of next row data relative to previous row data
|
||||
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 window.
|
||||
* Size of the image in bytes is xsize*ysize.
|
||||
* Each byte of image is index in the palette.
|
||||
* If the image uses less than 256 colors, palette size may be
|
||||
less than 256 too.
|
||||
* Format of image with 1 bit per pixel: each byte of image
|
||||
(possibly excluding last bytes in rows), contains information on
|
||||
the color of 8 pixels, MSB corresponds to first pixel.
|
||||
* 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
|
||||
with esi=24, ebp=0.
|
||||
|
||||
@ -3643,29 +3613,24 @@ Remarks:
|
||||
or subfunction 20.
|
||||
|
||||
======================================================================
|
||||
======== Function 68, subfunction 14 - wait for driver notify. =======
|
||||
===================== Function 68, subfunction 14 ====================
|
||||
====== Waiting delivering of signal from another program/driver ======
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 68 - function 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:
|
||||
* buffer pointed to by ecx contains the following information:
|
||||
* +0: dword: constant EV_INTR = 1
|
||||
* +4: dword: driver data
|
||||
Remarks:
|
||||
* The current implementation at wait time uses "heavy" operations
|
||||
of task switch.
|
||||
* +0: dword: identifier for underlying data of signal
|
||||
* +4: data of signal (20 bytes), format of which is defining by
|
||||
first dword
|
||||
|
||||
======================================================================
|
||||
====== Function 68, subfunction 15 - set FPU exception handler. ======
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 68 - function number
|
||||
* 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)
|
||||
Deleted (in current implementation only 0 is returned).
|
||||
Using subfunctions 24, 25 is true.
|
||||
|
||||
======================================================================
|
||||
============= Function 68, subfunction 16 - load driver. =============
|
||||
@ -3699,7 +3664,11 @@ Parameters:
|
||||
* +16 = +0x10: dword: pointer to output data
|
||||
* +20 = +0x14: dword: size of output data
|
||||
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:
|
||||
* Function codes and the structure of input/output data
|
||||
are defined by driver.
|
||||
@ -3708,12 +3677,8 @@ Remarks:
|
||||
======================================================================
|
||||
====== Function 68, subfunction 18 - set SSE exception handler. ======
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 68 - function number
|
||||
* 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)
|
||||
Deleted (in current implementation only 0 is returned).
|
||||
Using subfunctions 24, 25 is true.
|
||||
|
||||
======================================================================
|
||||
=============== Function 68, subfunction 19 - load DLL. ==============
|
||||
@ -3753,6 +3718,50 @@ Remarks:
|
||||
* The contents of the block are unchanged up to the shorter of
|
||||
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. ======================
|
||||
======================================================================
|
||||
@ -3784,9 +3793,8 @@ When debugger terminates, all debugged processes are killed.
|
||||
If debugger does not want this, it must previously detach by
|
||||
subfunction 3.
|
||||
|
||||
All subfunctions except 4 and 5 are applicable only to
|
||||
processes/threads started from the current by function 70
|
||||
with set debugging flag.
|
||||
All subfunctions are applicable only to processes/threads started
|
||||
from the current by function 70 with set debugging flag.
|
||||
Debugging of multithreaded programs is not supported yet.
|
||||
The full list of subfunctions:
|
||||
* subfunction 0 - define data area for debug messages
|
||||
@ -3818,7 +3826,7 @@ Remarks:
|
||||
and at arrival of new message the system will wait.
|
||||
For synchronization frame all work with the buffer by operations
|
||||
lock/unlock
|
||||
neg [bufsize]
|
||||
neg [bufsize]
|
||||
* Data in the buffer are considered as array of items with variable
|
||||
length - messages. Format of a message is explained in
|
||||
general description.
|
||||
@ -3884,7 +3892,7 @@ Remarks:
|
||||
* If the process was suspended, it resumes execution.
|
||||
|
||||
======================================================================
|
||||
============= Function 69, subfunction 4 - suspend thread. ===========
|
||||
======== Function 69, subfunction 4 - suspend debugged thread. =======
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 69 - function number
|
||||
@ -3892,9 +3900,12 @@ Parameters:
|
||||
* ecx = thread identifier
|
||||
Returned 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:
|
||||
* eax = 69 - function number
|
||||
@ -3902,6 +3913,9 @@ Parameters:
|
||||
* ecx = thread identifier
|
||||
Returned 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. =
|
||||
|
@ -8,7 +8,7 @@ API_VERSION equ 0 ;debug
|
||||
OS_BASE equ 0xE0000000
|
||||
;PROC_BASE equ (OS_BASE+0x080000)
|
||||
SB16Buffer equ (OS_BASE+0x10000)
|
||||
DMAPage equ ((SB16Buffer-OS_BASE) shr 16)
|
||||
DMAPage equ ((SB16Buffer-OS_BASE) shr 16)
|
||||
|
||||
SB16Buffer0 equ SB16Buffer
|
||||
SB16Buffer1 equ (SB16Buffer+16384)
|
||||
@ -20,7 +20,7 @@ sb_dma_num equ 5 ;default values for SB16, may be overrided by autodetect
|
||||
|
||||
small_buffer equ 32768
|
||||
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>
|
||||
|
||||
|
@ -201,7 +201,6 @@ macro DEBUGH_N _sign,_num,_hex {
|
||||
if ~_hex eq ax
|
||||
movzx eax,_hex
|
||||
end if
|
||||
shl eax,16
|
||||
if (_num eq)
|
||||
mov edx,4
|
||||
end if
|
||||
@ -209,7 +208,6 @@ macro DEBUGH_N _sign,_num,_hex {
|
||||
if ~_hex eq al
|
||||
movzx eax,_hex
|
||||
end if
|
||||
shl eax,24
|
||||
if (_num eq)
|
||||
mov edx,2
|
||||
end if
|
||||
|
@ -1069,14 +1069,6 @@ fs_HdRead:
|
||||
mov eax, ERROR_ACCESS_DENIED
|
||||
ret
|
||||
|
||||
.noaccess_3:
|
||||
add esp,4
|
||||
.noaccess_1:
|
||||
add esp,4
|
||||
.noaccess_4:
|
||||
add esp,4*5
|
||||
jmp .noaccess_2
|
||||
|
||||
@@:
|
||||
call hd_find_lfn
|
||||
jnc .found
|
||||
@ -1140,9 +1132,9 @@ fs_HdRead:
|
||||
push ebx
|
||||
mov ebx, edx
|
||||
call hd_read
|
||||
pop ebx
|
||||
cmp [hd_error],0
|
||||
jne .noaccess_1
|
||||
pop ebx
|
||||
add edx, 512
|
||||
sub ecx, 512
|
||||
jmp .skip
|
||||
@ -1151,11 +1143,11 @@ fs_HdRead:
|
||||
push eax ebx
|
||||
mov ebx, buffer
|
||||
call hd_read
|
||||
cmp [hd_error],0
|
||||
jne .noaccess_3
|
||||
|
||||
mov eax, ebx
|
||||
pop ebx
|
||||
cmp [hd_error],0
|
||||
jne .noaccess_3
|
||||
add eax, ebx
|
||||
push ecx
|
||||
add ecx, ebx
|
||||
@ -1178,9 +1170,14 @@ fs_HdRead:
|
||||
mov eax, [cluster_tmp]
|
||||
call get_FAT
|
||||
cmp [hd_error],0
|
||||
jne .noaccess_4
|
||||
jne .noaccess_1
|
||||
|
||||
jmp .new_cluster
|
||||
.noaccess_3:
|
||||
pop eax
|
||||
.noaccess_1:
|
||||
pop eax
|
||||
push 11
|
||||
.done:
|
||||
mov ebx, edx
|
||||
pop eax edx ecx edi
|
||||
|
@ -764,17 +764,17 @@ i1:
|
||||
; ja err
|
||||
sub al,48
|
||||
shl cx,1
|
||||
jc err
|
||||
jc error
|
||||
mov bx,cx
|
||||
shl cx,1
|
||||
jc err
|
||||
jc error
|
||||
shl cx,1
|
||||
jc err
|
||||
jc error
|
||||
add cx,bx
|
||||
jc err
|
||||
jc error
|
||||
cbw
|
||||
add cx,ax
|
||||
jc err
|
||||
jc error
|
||||
i3:
|
||||
inc edi
|
||||
jmp i1
|
||||
@ -789,7 +789,7 @@ i4:
|
||||
pop bx
|
||||
ret
|
||||
|
||||
err:
|
||||
error:
|
||||
stc
|
||||
jmp i4
|
||||
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -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 ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -589,7 +589,7 @@ checkbuttons:
|
||||
iglobal
|
||||
mx dw 0x0 ; keeps the x mouse's position when it was clicked
|
||||
my dw 0x0 ; keeps the y mouse's position when it was clicked
|
||||
bPressedMouseXY_B db 0x0
|
||||
bPressedMouseXY_B db 0x0
|
||||
btn_down_determ db 0x0 ; << // Alver 22.06.2008// <<
|
||||
endg
|
||||
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
204
kernel/branches/kolibri_pe/gui/win.c
Normal file
204
kernel/branches/kolibri_pe/gui/win.c
Normal 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]);
|
||||
|
||||
};
|
||||
};
|
@ -22,7 +22,7 @@ get_rolledup_height: ; edi = window draw_data pointer
|
||||
mov al,[edi+WDATA.fl_wstyle]
|
||||
and al,0x0F
|
||||
cmp al,0x03
|
||||
jne @f
|
||||
jb @f
|
||||
mov eax,[_skinh]
|
||||
add eax,3
|
||||
ret
|
||||
@ -61,78 +61,78 @@ setwindowdefaults:
|
||||
; ÷àñòåé îêîí âûçâàòü setscreen
|
||||
align 4
|
||||
calculatescreen:
|
||||
pushad
|
||||
pushfd
|
||||
cli
|
||||
pushad
|
||||
pushfd
|
||||
cli
|
||||
|
||||
push edx ecx ebx eax
|
||||
push edx ecx ebx eax
|
||||
|
||||
mov esi, 1
|
||||
call setscreen
|
||||
mov esi, 1
|
||||
call setscreen
|
||||
|
||||
mov ebp, [TASK_COUNT] ; number of processes
|
||||
cmp ebp, 1
|
||||
jbe .finish
|
||||
mov ebp, [TASK_COUNT] ; number of processes
|
||||
cmp ebp, 1
|
||||
jbe .finish
|
||||
align 4
|
||||
.new_wnd:
|
||||
movzx edi, word [WIN_POS + esi * 2]
|
||||
shl edi, 5
|
||||
movzx edi, word [WIN_POS + esi * 2]
|
||||
shl edi, 5
|
||||
|
||||
cmp [CURRENT_TASK+edi+TASKDATA.state], byte 9
|
||||
je .not_wnd
|
||||
cmp [CURRENT_TASK+edi+TASKDATA.state], byte 9
|
||||
je .not_wnd
|
||||
|
||||
add edi, window_data
|
||||
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED
|
||||
jnz .not_wnd
|
||||
add edi, window_data
|
||||
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED
|
||||
jnz .not_wnd
|
||||
|
||||
mov eax,[edi+WDATA.box.left]
|
||||
cmp eax, [esp+RECT.right]
|
||||
ja .out_of_bounds
|
||||
mov ebx,[edi+WDATA.box.top]
|
||||
cmp ebx, [esp+RECT.bottom]
|
||||
ja .out_of_bounds
|
||||
mov ecx,[edi+WDATA.box.width]
|
||||
add ecx, eax
|
||||
cmp ecx, [esp+RECT.left]
|
||||
jb .out_of_bounds
|
||||
mov edx,[edi+WDATA.box.height]
|
||||
add edx, ebx
|
||||
cmp edx, [esp+RECT.top]
|
||||
jb .out_of_bounds
|
||||
mov eax,[edi+WDATA.box.left]
|
||||
cmp eax, [esp+RECT.right]
|
||||
ja .out_of_bounds
|
||||
mov ebx,[edi+WDATA.box.top]
|
||||
cmp ebx, [esp+RECT.bottom]
|
||||
ja .out_of_bounds
|
||||
mov ecx,[edi+WDATA.box.width]
|
||||
add ecx, eax
|
||||
cmp ecx, [esp+RECT.left]
|
||||
jb .out_of_bounds
|
||||
mov edx,[edi+WDATA.box.height]
|
||||
add edx, ebx
|
||||
cmp edx, [esp+RECT.top]
|
||||
jb .out_of_bounds
|
||||
|
||||
cmp eax, [esp+RECT.left]
|
||||
jae @f
|
||||
mov eax, [esp+RECT.left]
|
||||
cmp eax, [esp+RECT.left]
|
||||
jae @f
|
||||
mov eax, [esp+RECT.left]
|
||||
@@:
|
||||
cmp ebx, [esp+RECT.top]
|
||||
jae @f
|
||||
mov ebx, [esp+RECT.top]
|
||||
cmp ebx, [esp+RECT.top]
|
||||
jae @f
|
||||
mov ebx, [esp+RECT.top]
|
||||
@@:
|
||||
cmp ecx, [esp+RECT.right]
|
||||
jbe @f
|
||||
mov ecx, [esp+RECT.right]
|
||||
cmp ecx, [esp+RECT.right]
|
||||
jbe @f
|
||||
mov ecx, [esp+RECT.right]
|
||||
@@:
|
||||
cmp edx, [esp+RECT.bottom]
|
||||
jbe @f
|
||||
mov edx, [esp+RECT.bottom]
|
||||
cmp edx, [esp+RECT.bottom]
|
||||
jbe @f
|
||||
mov edx, [esp+RECT.bottom]
|
||||
@@:
|
||||
|
||||
push esi
|
||||
movzx esi, word [WIN_POS + esi * 2]
|
||||
call setscreen
|
||||
pop esi
|
||||
push esi
|
||||
movzx esi, word [WIN_POS + esi * 2]
|
||||
call setscreen
|
||||
pop esi
|
||||
|
||||
.not_wnd:
|
||||
.out_of_bounds:
|
||||
inc esi
|
||||
dec ebp
|
||||
jnz .new_wnd
|
||||
inc esi
|
||||
dec ebp
|
||||
jnz .new_wnd
|
||||
.finish:
|
||||
|
||||
pop eax ebx ecx edx
|
||||
pop eax ebx ecx edx
|
||||
|
||||
popfd
|
||||
popad
|
||||
popfd
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
@ -173,40 +173,40 @@ pushad
|
||||
jne .free_form
|
||||
|
||||
; get x&y size
|
||||
sub ecx, eax
|
||||
sub edx, ebx
|
||||
inc ecx
|
||||
inc edx
|
||||
sub ecx, eax
|
||||
sub edx, ebx
|
||||
inc ecx
|
||||
inc edx
|
||||
|
||||
; get WinMap start
|
||||
mov edi, [Screen_Max_X] ; screen_sx
|
||||
inc edi
|
||||
imul edi, ebx
|
||||
add edi, eax
|
||||
inc edi
|
||||
imul edi, ebx
|
||||
add edi, eax
|
||||
add edi, [_display_data]
|
||||
|
||||
.new_y:
|
||||
push ecx ; sx
|
||||
push edx
|
||||
push ecx ; sx
|
||||
push edx
|
||||
|
||||
mov edx, esi
|
||||
mov edx, esi
|
||||
align 4
|
||||
.new_x:
|
||||
mov byte [edi], dl
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .new_x
|
||||
mov byte [edi], dl
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .new_x
|
||||
|
||||
pop edx
|
||||
pop ecx
|
||||
pop edx
|
||||
pop ecx
|
||||
add edi, [Screen_Max_X]
|
||||
inc edi
|
||||
sub edi, ecx
|
||||
dec edx
|
||||
jnz .new_y
|
||||
inc edi
|
||||
sub edi, ecx
|
||||
dec edx
|
||||
jnz .new_y
|
||||
.ret:
|
||||
popad
|
||||
ret
|
||||
popad
|
||||
ret
|
||||
.read_byte:
|
||||
;eax - address
|
||||
;esi - slot
|
||||
@ -557,7 +557,6 @@ endg
|
||||
|
||||
|
||||
|
||||
|
||||
check_window_position:
|
||||
|
||||
pushad ; window inside screen ?
|
||||
@ -862,7 +861,6 @@ dw3l:
|
||||
jnz noinside2
|
||||
call [drawbar]
|
||||
noinside2:
|
||||
|
||||
popad
|
||||
|
||||
ret
|
||||
@ -1130,12 +1128,10 @@ restore_minimized_window:
|
||||
ret
|
||||
|
||||
|
||||
iglobal
|
||||
window_moving db 'K : Window - move/resize',13,10,0
|
||||
window_moved db 'K : Window - done',13,10,0
|
||||
endg
|
||||
|
||||
bPressedMouseXY_W db 0x0
|
||||
;iglobal
|
||||
; window_moving db 'K : Window - move/resize',13,10,0
|
||||
; window_moved db 'K : Window - done',13,10,0
|
||||
;endg
|
||||
|
||||
; check window touch
|
||||
align 4
|
||||
@ -1164,44 +1160,74 @@ checkwindows:
|
||||
popad
|
||||
ret
|
||||
.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]
|
||||
inc esi
|
||||
|
||||
;..................................... start 3/4 : modified by vhanla .................
|
||||
cmp [bPressedMouseXY_W],0
|
||||
jnz @f
|
||||
mov [bPressedMouseXY_W],1
|
||||
@@:
|
||||
cmp [bPressedMouseXY_W],1
|
||||
ja @f
|
||||
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 ...................
|
||||
|
||||
movzx eax,word [MOUSE_Y]
|
||||
movzx ebx,word [MOUSE_X]
|
||||
mov ecx, [Screen_Max_X]
|
||||
add ebx, [_display_data]
|
||||
inc ecx
|
||||
mul ecx
|
||||
movzx edi, byte [ebx+eax]
|
||||
|
||||
cwloop:
|
||||
|
||||
movzx esi, word [WIN_STACK + edi * 2]
|
||||
cwloop:
|
||||
cmp esi,2
|
||||
jb .exit
|
||||
|
||||
dec esi
|
||||
movzx edi, word [WIN_POS + esi * 2] ; ebx
|
||||
shl edi, 5
|
||||
add edi, window_data
|
||||
; mov edi, ebx
|
||||
mov ecx, [edi + WDATA.box.left]
|
||||
mov edx, [edi + WDATA.box.top]
|
||||
|
||||
movzx eax,word [MOUSE_X]
|
||||
movzx ebx,word [MOUSE_Y]
|
||||
mov eax,ecx
|
||||
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
|
||||
mov eax, esi
|
||||
mov eax, esi
|
||||
mov ebx, [TASK_COUNT]
|
||||
cmp eax, ebx ; is this window active?
|
||||
jz .move_resize_window
|
||||
|
||||
cmp [bPressedMouseXY_W], 1
|
||||
ja .exit_popa
|
||||
|
||||
; eax = position in windowing stack
|
||||
; redraw must ?
|
||||
lea esi, [WIN_POS + esi * 2]
|
||||
call waredraw
|
||||
.exit_popa:
|
||||
add esp, 32
|
||||
|
||||
.exit:
|
||||
@ -1252,10 +1278,10 @@ cwloop:
|
||||
|
||||
.continue:
|
||||
|
||||
push esi
|
||||
mov esi, window_moving
|
||||
call sys_msg_board_str
|
||||
pop esi
|
||||
; push esi
|
||||
; mov esi, window_moving
|
||||
; call sys_msg_board_str
|
||||
; pop esi
|
||||
|
||||
mov ecx, [timer_ticks] ; double-click ?
|
||||
mov edx, ecx
|
||||
@ -1311,6 +1337,7 @@ cwloop:
|
||||
call drawwindowframes
|
||||
|
||||
mov [reposition],0
|
||||
mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down
|
||||
|
||||
; move window
|
||||
|
||||
@ -1320,6 +1347,7 @@ newchm:
|
||||
|
||||
call checkVga_N13
|
||||
|
||||
mov [MOUSE_BACKGROUND],byte 0
|
||||
|
||||
call [draw_pointer]
|
||||
|
||||
@ -1328,7 +1356,7 @@ newchm:
|
||||
popad
|
||||
|
||||
mov esi,[WIN_TEMP_XY]
|
||||
cmp esi, dword [MOUSE_X]
|
||||
cmp esi,[MOUSE_X]
|
||||
je cwb
|
||||
|
||||
mov cx,[MOUSE_X]
|
||||
@ -1409,7 +1437,7 @@ newchm:
|
||||
mov [reposition],1
|
||||
|
||||
popad
|
||||
norepos_size:
|
||||
norepos_size:
|
||||
|
||||
pop bx
|
||||
pop ax
|
||||
@ -1608,8 +1636,8 @@ waitre2:
|
||||
|
||||
retwm:
|
||||
|
||||
mov esi,window_moved
|
||||
call sys_msg_board_str
|
||||
; mov esi,window_moved
|
||||
; call sys_msg_board_str
|
||||
|
||||
popad
|
||||
|
||||
@ -1617,9 +1645,9 @@ retwm:
|
||||
|
||||
|
||||
uglobal
|
||||
add_window_data dd 0
|
||||
add_window_data dd 0
|
||||
do_resize_from_corner db 0x0
|
||||
reposition db 0x0
|
||||
reposition db 0x0
|
||||
latest_window_touch dd 0x0
|
||||
latest_window_touch_delta dd 0x0
|
||||
|
||||
@ -1745,3 +1773,405 @@ rsw_no_scale:
|
||||
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
|
||||
|
@ -1,7 +1,8 @@
|
||||
|
||||
#define OS_BASE 0xE0000000
|
||||
#define IMAGE_BASE 0xE0100000
|
||||
#define LOAD_BASE 0x00100000
|
||||
|
||||
#define OS_BASE 0xE0000000
|
||||
#define IMAGE_BASE 0xE0100000
|
||||
#define LOAD_BASE 0x00100000
|
||||
|
||||
|
||||
#define page_tabs 0xDD800000
|
||||
@ -64,13 +65,13 @@ extern void panic_printf(char *fmt, ...) __attribute__((noreturn));
|
||||
|
||||
static inline eflags_t safe_cli(void)
|
||||
{
|
||||
eflags_t tmp;
|
||||
eflags_t tmp;
|
||||
asm volatile (
|
||||
"pushfl\n\t"
|
||||
"popl %0\n\t"
|
||||
"cli\n"
|
||||
"cli\n"
|
||||
: "=r" (tmp));
|
||||
return tmp;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static inline void safe_sti(eflags_t efl)
|
||||
@ -83,20 +84,20 @@ static inline void safe_sti(eflags_t efl)
|
||||
|
||||
static inline index_t fnzb(u32_t arg)
|
||||
{
|
||||
count_t n;
|
||||
count_t n;
|
||||
asm volatile (
|
||||
"xorl %0, %0 \n\t"
|
||||
"bsr %1, %0"
|
||||
"bsr %1, %0"
|
||||
:"=&r"(n) :"r"(arg) );
|
||||
return n;
|
||||
}
|
||||
|
||||
static inline index_t _bsf(u32_t arg)
|
||||
{
|
||||
count_t n;
|
||||
count_t n;
|
||||
asm volatile (
|
||||
"xorl %0, %0 \n\t"
|
||||
"bsf %1, %0"
|
||||
"bsf %1, %0"
|
||||
:"=&r" (n) :"r"(arg));
|
||||
return n;
|
||||
}
|
||||
@ -211,25 +212,25 @@ typedef struct __attribute__ ((packed))
|
||||
{
|
||||
struct /* window event */
|
||||
{
|
||||
u32_t win; /* window handle */
|
||||
u32_t val1;
|
||||
u32_t val2;
|
||||
u16_t x; /* cursor x */
|
||||
u16_t y; /* cursor y */
|
||||
u32_t unused;
|
||||
u32_t win; /* window handle */
|
||||
u32_t val1;
|
||||
u32_t val2;
|
||||
u16_t x; /* cursor x */
|
||||
u16_t y; /* cursor y */
|
||||
u32_t unused;
|
||||
};
|
||||
|
||||
struct /* realtime io */
|
||||
{
|
||||
u32_t sender; /* service handler */
|
||||
u32_t stream; /* io stream id, if present */
|
||||
addr_t offset;
|
||||
size_t size;
|
||||
u32_t sender; /* service handler */
|
||||
u32_t stream; /* io stream id, if present */
|
||||
addr_t offset;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct /* ipc event */
|
||||
{
|
||||
u32_t sender;
|
||||
u32_t sender;
|
||||
u32_t io_code;
|
||||
addr_t *input;
|
||||
size_t inp_size;
|
||||
|
@ -11,26 +11,27 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
link_t buddy_link; /**< link to the next free block inside one order */
|
||||
link_t buddy_link; /**< link to the next free block inside one order */
|
||||
u16_t refcount; /**< tracking of shared frames */
|
||||
u16_t buddy_order; /**< buddy system block order */
|
||||
void *parent; /**< If allocated by slab, this points there */
|
||||
void *parent; /**< If allocated by slab, this points there */
|
||||
} frame_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SPINLOCK_DECLARE(lock); /**< this lock protects everything below */
|
||||
pfn_t base; /**< frame_no of the first frame in the frames array */
|
||||
count_t count; /**< Size of zone */
|
||||
SPINLOCK_DECLARE(lock); /**< this lock protects everything below */
|
||||
pfn_t base; /**< frame_no of the first frame in the frames array */
|
||||
count_t count; /**< Size of zone */
|
||||
|
||||
frame_t *frames; /**< array of frame_t structures in this zone */
|
||||
count_t free_count; /**< number of free frame_t structures */
|
||||
count_t busy_count; /**< number of busy frame_t structures */
|
||||
frame_t *frames; /**< array of frame_t structures in this zone */
|
||||
count_t free_count; /**< number of free frame_t structures */
|
||||
count_t busy_count; /**< number of busy frame_t structures */
|
||||
|
||||
u32_t max_order;
|
||||
link_t order[21];
|
||||
u32_t max_order;
|
||||
link_t order[21];
|
||||
|
||||
int flags;
|
||||
int flags;
|
||||
} zone_t;
|
||||
|
||||
|
||||
@ -45,13 +46,12 @@ typedef struct
|
||||
}md_t;
|
||||
|
||||
|
||||
#define PG_MAP 1
|
||||
#define PG_WRITE 2
|
||||
#define PG_USER 4
|
||||
|
||||
#define PG_SW 3
|
||||
#define PG_UW 7
|
||||
#define PG_MAP 1
|
||||
#define PG_WRITE 2
|
||||
#define PG_USER 4
|
||||
|
||||
#define PG_SW 3
|
||||
#define PG_UW 7
|
||||
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
@ -63,8 +63,8 @@ typedef struct
|
||||
|
||||
static inline count_t SIZE2FRAMES(size_t size)
|
||||
{
|
||||
if (!size)
|
||||
return 0;
|
||||
if (!size)
|
||||
return 0;
|
||||
return (count_t) ((size - 1) >> PAGE_WIDTH) + 1;
|
||||
}
|
||||
|
||||
|
@ -198,8 +198,8 @@ extern dll_t core_dll;
|
||||
|
||||
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);
|
||||
|
||||
|
@ -80,3 +80,33 @@ slab_cache_t * slab_cache_create(
|
||||
void* __fastcall slab_alloc(slab_cache_t *cache, int flags);
|
||||
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;
|
||||
|
@ -20,6 +20,7 @@ format MS COFF
|
||||
;; Sergey Semyonov (Serge)
|
||||
;; Johnny_B
|
||||
;; SPraid (simba)
|
||||
;; Hidnplayr
|
||||
;;
|
||||
;; 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
|
||||
@ -246,6 +247,8 @@ extrn _bx_from_load
|
||||
|
||||
extrn _sys_app_entry
|
||||
|
||||
public _set_screen
|
||||
|
||||
extrn _i40
|
||||
|
||||
extrn test_cpu
|
||||
@ -255,7 +258,10 @@ extrn cpu_sign
|
||||
extrn cpu_info
|
||||
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
|
||||
|
||||
@ -339,9 +345,9 @@ init_apm:
|
||||
align 16
|
||||
system_init:
|
||||
|
||||
mov [pg_data.pg_mutex], 0
|
||||
mov [pg_data.pg_mutex], 0
|
||||
|
||||
call init_apm
|
||||
call init_apm
|
||||
|
||||
; SAVE REAL MODE VARIABLES
|
||||
mov ax, [OS_BASE + 0x9031]
|
||||
@ -414,8 +420,9 @@ no_mode_0x12:
|
||||
call @mem_alloc@8
|
||||
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
|
||||
|
||||
mov edx, PG_SW
|
||||
call @mem_alloc@8
|
||||
mov [unpack.p], eax
|
||||
@ -570,80 +577,80 @@ include 'detect/disks.inc'
|
||||
|
||||
; SET PRELIMINARY WINDOW STACK AND POSITIONS
|
||||
|
||||
mov esi,boot_windefs
|
||||
call boot_log
|
||||
call setwindowdefaults
|
||||
mov esi,boot_windefs
|
||||
call boot_log
|
||||
call setwindowdefaults
|
||||
|
||||
; SET BACKGROUND DEFAULTS
|
||||
|
||||
mov esi,boot_bgr
|
||||
call boot_log
|
||||
call init_background
|
||||
call calculatebackground
|
||||
mov esi,boot_bgr
|
||||
call boot_log
|
||||
call init_background
|
||||
call calculatebackground
|
||||
|
||||
; RESERVE SYSTEM IRQ'S JA PORT'S
|
||||
|
||||
mov esi,boot_resirqports
|
||||
call boot_log
|
||||
call reserve_irqs_ports
|
||||
mov esi,boot_resirqports
|
||||
call boot_log
|
||||
call reserve_irqs_ports
|
||||
|
||||
; SET PORTS FOR IRQ HANDLERS
|
||||
|
||||
mov esi,boot_setrports
|
||||
call boot_log
|
||||
mov esi,boot_setrports
|
||||
call boot_log
|
||||
;call setirqreadports
|
||||
|
||||
; SETUP OS TASK
|
||||
|
||||
mov esi,boot_setostask
|
||||
call boot_log
|
||||
mov esi,boot_setostask
|
||||
call boot_log
|
||||
|
||||
xor eax, eax
|
||||
mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
|
||||
mov dword [SLOT_BASE+APPDATA.fpu_handler], eax
|
||||
mov dword [SLOT_BASE+APPDATA.sse_handler], eax
|
||||
xor eax, eax
|
||||
mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
|
||||
mov dword [SLOT_BASE+APPDATA.fpu_handler], eax
|
||||
mov dword [SLOT_BASE+APPDATA.sse_handler], eax
|
||||
|
||||
; name for OS/IDLE process
|
||||
|
||||
mov dword [SLOT_BASE+256+APPDATA.app_name], dword 'OS/I'
|
||||
mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
|
||||
mov dword [SLOT_BASE+256+APPDATA.app_name], dword 'OS/I'
|
||||
mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
|
||||
mov edi, __os_stack-8192+512
|
||||
mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
|
||||
add edi, 0x2000-512
|
||||
mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
|
||||
mov dword [SLOT_BASE+256+APPDATA.saved_esp0], edi ; just for case
|
||||
mov dword [SLOT_BASE+256+APPDATA.io_map],\
|
||||
(tss._io_map_0-OS_BASE+PG_MAP)
|
||||
mov dword [SLOT_BASE+256+APPDATA.io_map+4],\
|
||||
(tss._io_map_1-OS_BASE+PG_MAP)
|
||||
mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
|
||||
add edi, 0x2000-512
|
||||
mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
|
||||
mov dword [SLOT_BASE+256+APPDATA.saved_esp0], edi ; just for case
|
||||
mov dword [SLOT_BASE+256+APPDATA.io_map],\
|
||||
(tss._io_map_0-OS_BASE+PG_MAP)
|
||||
mov dword [SLOT_BASE+256+APPDATA.io_map+4],\
|
||||
(tss._io_map_1-OS_BASE+PG_MAP)
|
||||
|
||||
mov esi, fpu_data
|
||||
mov ecx, 512/4
|
||||
cld
|
||||
rep movsd
|
||||
mov esi, fpu_data
|
||||
mov ecx, 512/4
|
||||
cld
|
||||
rep movsd
|
||||
|
||||
mov dword [SLOT_BASE+256+APPDATA.fpu_handler], eax
|
||||
mov dword [SLOT_BASE+256+APPDATA.sse_handler], eax
|
||||
mov dword [SLOT_BASE+256+APPDATA.sse_handler], eax
|
||||
|
||||
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
|
||||
mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
|
||||
mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
|
||||
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
|
||||
mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
|
||||
mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
|
||||
|
||||
mov dword [SLOT_BASE+256+APPDATA.cur_dir], sysdir_path
|
||||
mov dword [SLOT_BASE+256+APPDATA.cur_dir], sysdir_path
|
||||
|
||||
; task list
|
||||
mov [CURRENT_TASK],dword 1
|
||||
mov [TASK_COUNT],dword 1
|
||||
mov [current_slot], SLOT_BASE+256
|
||||
mov [TASK_BASE],dword TASK_DATA
|
||||
mov [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
|
||||
mov [TASK_DATA+TASKDATA.pid], 1 ; process id number
|
||||
mov [TASK_DATA+TASKDATA.mem_start], 0 ; process base address
|
||||
; task list
|
||||
mov [CURRENT_TASK],dword 1
|
||||
mov [TASK_COUNT],dword 1
|
||||
mov [current_slot], SLOT_BASE+256
|
||||
mov [TASK_BASE],dword TASK_DATA
|
||||
mov [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
|
||||
mov [TASK_DATA+TASKDATA.pid], 1 ; process id number
|
||||
mov [TASK_DATA+TASKDATA.mem_start], 0 ; process base address
|
||||
|
||||
call init_cursors
|
||||
mov eax, [def_cursor]
|
||||
mov [SLOT_BASE+APPDATA.cursor],eax
|
||||
mov [SLOT_BASE+APPDATA.cursor+256],eax
|
||||
mov [SLOT_BASE+APPDATA.cursor],eax
|
||||
mov [SLOT_BASE+APPDATA.cursor+256],eax
|
||||
|
||||
; mov ecx, szAtiHW
|
||||
; call @load_pe_driver@4
|
||||
@ -799,6 +806,7 @@ first_app_found:
|
||||
setnz [dma_hdd]
|
||||
mov [timer_ticks_enable],1 ; for cd driver
|
||||
|
||||
;xchg bx, bx
|
||||
sti
|
||||
call change_task
|
||||
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; KERNEL32.INC ;;
|
||||
@ -84,12 +84,12 @@ struc TASKDATA
|
||||
{
|
||||
.event_mask dd ?
|
||||
.pid dd ?
|
||||
dw ?
|
||||
dw ?
|
||||
.state db ?
|
||||
db ?
|
||||
dw ?
|
||||
dw ?
|
||||
.wnd_number db ?
|
||||
db ?
|
||||
db ?
|
||||
.mem_start dd ?
|
||||
.counter_sum dd ?
|
||||
.counter_add dd ?
|
||||
@ -101,11 +101,11 @@ end virtual
|
||||
|
||||
; structures definition
|
||||
struc WDATA {
|
||||
.box BOX
|
||||
.box BOX
|
||||
.cl_workarea dd ?
|
||||
.cl_titlebar dd ?
|
||||
.cl_frames dd ?
|
||||
.reserved db ?
|
||||
.reserved db ?
|
||||
.fl_wstate db ?
|
||||
.fl_wdrawn db ?
|
||||
.fl_redraw db ?
|
||||
@ -117,8 +117,8 @@ label WDATA.fl_wstyle byte at 0x13
|
||||
|
||||
struc APPDATA
|
||||
{
|
||||
.app_name db 11 dup(?)
|
||||
db 5 dup(?)
|
||||
.app_name db 11 dup(?)
|
||||
db 5 dup(?)
|
||||
|
||||
.fpu_state dd ? ;+16
|
||||
.ev_count dd ? ;+20
|
||||
@ -147,12 +147,12 @@ struc APPDATA
|
||||
.mem_size dd ? ;+140
|
||||
.saved_box BOX
|
||||
.ipc_start dd ?
|
||||
.ipc_size dd ?
|
||||
.ipc_size dd ?
|
||||
.event_mask dd ?
|
||||
.debugger_slot dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
.keyboard_mode db ?
|
||||
db 3 dup(?)
|
||||
db 3 dup(?)
|
||||
.dir_table dd ?
|
||||
.dbg_event_mem dd ?
|
||||
.dbg_regs:
|
||||
|
@ -40,6 +40,7 @@ PE_SRC:= \
|
||||
dll.c \
|
||||
spinlock.c \
|
||||
thread.c \
|
||||
win.c \
|
||||
syscall.asm \
|
||||
boot/boot.asm \
|
||||
boot/start.asm
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; ARP.INC ;;
|
||||
;; ;;
|
||||
;; Address Resolution Protocol ;;
|
||||
;; ;;
|
||||
;; Last revision: 10.11.2006 ;;
|
||||
;; ;;
|
||||
;; This file contains the following: ;;
|
||||
;; arp_table_manager - Manages an ARPTable ;;
|
||||
;; arp_request - Sends an ARP request on the ethernet ;;
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; ETHERNET.INC ;;
|
||||
;; ;;
|
||||
;; Ethernet network layer for Menuet OS ;;
|
||||
;; ;;
|
||||
;; Version 0.4 22 September 2003 ;;
|
||||
;; ;;
|
||||
;; This file contains the following: ;;
|
||||
;; PCI bus scanning for valid devices ;;
|
||||
;; Table of supported ethernet drivers ;;
|
||||
@ -353,9 +351,9 @@ endp
|
||||
; All registers may be destroyed
|
||||
;
|
||||
;***************************************************************************
|
||||
uglobal
|
||||
ether_IP_handler_cnt dd ?
|
||||
endg
|
||||
;uglobal
|
||||
; ether_IP_handler_cnt dd ?
|
||||
;endg
|
||||
ether_IP_handler:
|
||||
mov eax, EMPTY_QUEUE
|
||||
call dequeue
|
||||
|
@ -223,7 +223,7 @@ local buffer_number dd ?
|
||||
jmp .dump.x
|
||||
|
||||
.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
|
||||
|
||||
.dump.5:
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; ;;
|
||||
@ -8,8 +8,6 @@
|
||||
;; ;;
|
||||
;; Buffer queue management for Menuet OS TCP/IP Stack ;;
|
||||
;; ;;
|
||||
;; Version 0.3 29 August 2002 ;;
|
||||
;; ;;
|
||||
;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;;
|
||||
;; ;;
|
||||
;; See file COPYING for details ;;
|
||||
@ -43,9 +41,9 @@ $Revision$
|
||||
; all other registers preserved
|
||||
; This always works, so no error returned
|
||||
;***************************************************************************
|
||||
uglobal
|
||||
freeBuff_cnt dd ?
|
||||
endg
|
||||
;uglobal
|
||||
; freeBuff_cnt dd ?
|
||||
;endg
|
||||
freeBuff:
|
||||
; inc [freeBuff_cnt]
|
||||
; DEBUGF 1, "K : freeBuff (%u)\n", [freeBuff_cnt]
|
||||
@ -106,9 +104,9 @@ qs_exit:
|
||||
; all other registers preserved
|
||||
; This always works, so no error returned
|
||||
;***************************************************************************
|
||||
uglobal
|
||||
queue_cnt dd ?
|
||||
endg
|
||||
;uglobal
|
||||
; queue_cnt dd ?
|
||||
;endg
|
||||
queue:
|
||||
; inc [queue_cnt]
|
||||
; DEBUGF 1, "K : queue (%u)\n", [queue_cnt]
|
||||
@ -161,9 +159,9 @@ qu_exit:
|
||||
; all other registers preserved
|
||||
;
|
||||
;***************************************************************************
|
||||
uglobal
|
||||
dequeue_cnt dd ?
|
||||
endg
|
||||
;uglobal
|
||||
; dequeue_cnt dd ?
|
||||
;endg
|
||||
dequeue:
|
||||
push ebx
|
||||
shl eax, 1
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; SOCKET.INC ;;
|
||||
;; ;;
|
||||
;; Sockets constants, structures and functions ;;
|
||||
;; ;;
|
||||
;; Last revision: 11.11.2006 ;;
|
||||
;; ;;
|
||||
;; This file contains the following: ;;
|
||||
;; is_localport_unused ;;
|
||||
;; get_free_socket ;;
|
||||
@ -31,113 +29,59 @@
|
||||
|
||||
$Revision$
|
||||
|
||||
|
||||
;
|
||||
; Socket Descriptor + Buffer
|
||||
;
|
||||
; 0 1 2 3
|
||||
; 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
|
||||
;
|
||||
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
; 0| Status ( of this buffer ) |
|
||||
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
; 4| Application Process ID |
|
||||
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
; 8| Local IP Address |
|
||||
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
; 12| Local IP Port | Unused ( set to 0 ) |
|
||||
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
; 16| Remote IP Address |
|
||||
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
; 20| Remote IP Port | Unused ( set to 0 ) |
|
||||
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
; 24| Rx Data Count INTEL format|
|
||||
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
; 28| TCB STATE INTEL format|
|
||||
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
; 32| TCB Timer (seconds) INTEL format|
|
||||
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
; 36| ISS (Inital Sequence # used by this connection ) INET format|
|
||||
; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
; 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
|
||||
; socket data structure
|
||||
struct SOCKET
|
||||
.PrevPtr dd ? ; pointer to previous socket in list
|
||||
.NextPtr dd ? ; pointer to next socket in list
|
||||
.Number dd ? ; socket number (unique within single process)
|
||||
.PID dd ? ; application process id
|
||||
.LocalIP dd ? ; local IP address
|
||||
.LocalPort dw ? ; local port
|
||||
.RemoteIP dd ? ; remote IP address
|
||||
.RemotePort dw ? ; remote port
|
||||
.OrigRemoteIP dd ? ; original remote IP address (used to reset to LISTEN state)
|
||||
.OrigRemotePort dw ? ; original remote port (used to reset to LISTEN state)
|
||||
.rxDataCount dd ? ; rx data count
|
||||
.TCBState dd ? ; TCB state
|
||||
.TCBTimer dd ? ; TCB timer (seconds)
|
||||
.ISS dd ? ; initial send sequence
|
||||
.IRS dd ? ; initial receive sequence
|
||||
.SND_UNA dd ? ; sequence number of unack'ed sent packets
|
||||
.SND_NXT dd ? ; bext send sequence number to use
|
||||
.SND_WND dd ? ; send window
|
||||
.RCV_NXT dd ? ; next receive sequence number to use
|
||||
.RCV_WND dd ? ; receive window
|
||||
.SEG_LEN dd ? ; segment length
|
||||
.SEG_WND dd ? ; segment window
|
||||
.wndsizeTimer dd ? ; window size timer
|
||||
.lock dd ? ; lock mutex
|
||||
.rxData dd ? ; receive data buffer here
|
||||
ends
|
||||
|
||||
; TCP opening modes
|
||||
SOCKET_PASSIVE equ 0
|
||||
SOCKET_ACTIVE equ 1
|
||||
SOCKET_PASSIVE = 0
|
||||
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
|
||||
mov ecx, SOCKETBUFFSIZE
|
||||
mov edx, PG_SW
|
||||
call @mem_alloc@8
|
||||
DEBUGF 1, "K : net_socket_alloc (0x%x)\n", eax
|
||||
; check if we can allocate needed amount of memory
|
||||
or eax, eax
|
||||
jz .exit
|
||||
|
||||
; zero-initialize allocated memory
|
||||
push eax
|
||||
mov edi, eax
|
||||
mov ecx, SOCKETBUFFSIZE / 4
|
||||
@ -146,6 +90,7 @@ proc net_socket_alloc stdcall uses ebx ecx edx edi
|
||||
rep stosd
|
||||
pop eax
|
||||
|
||||
; add socket to the list by changing pointers
|
||||
mov ebx, net_sockets
|
||||
push [ebx + SOCKET.NextPtr]
|
||||
mov [ebx + SOCKET.NextPtr], eax
|
||||
@ -156,23 +101,50 @@ proc net_socket_alloc stdcall uses ebx ecx edx edi
|
||||
jz @f
|
||||
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 [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:
|
||||
ret
|
||||
endp
|
||||
|
||||
proc net_socket_free stdcall uses ebx ecx edx, sock:DWORD
|
||||
mov eax, [sock]
|
||||
;; Free socket data memory and pop socket off the list
|
||||
;
|
||||
; @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
|
||||
; check if we got something similar to socket structure address
|
||||
or eax, eax
|
||||
jz .error
|
||||
|
||||
; make sure sockAddr is one of the socket addresses in the list
|
||||
mov ebx, net_sockets
|
||||
mov ecx, [TASK_BASE]
|
||||
mov ecx, [ecx + TASKDATA.pid]
|
||||
;mov ecx, [TASK_BASE]
|
||||
;mov ecx, [ecx + TASKDATA.pid]
|
||||
.next_socket:
|
||||
mov ebx, [ebx + SOCKET.NextPtr]
|
||||
or ebx, ebx
|
||||
@ -182,6 +154,8 @@ proc net_socket_free stdcall uses ebx ecx edx, sock:DWORD
|
||||
;cmp [ebx + SOCKET.PID], ecx
|
||||
;jne .next_socket
|
||||
|
||||
; okay, we found the correct one
|
||||
; remove it from the list first, changing pointers
|
||||
mov ebx, [eax + SOCKET.NextPtr]
|
||||
mov eax, [eax + SOCKET.PrevPtr]
|
||||
mov [eax + SOCKET.NextPtr], ebx
|
||||
@ -199,12 +173,60 @@ proc net_socket_free stdcall uses ebx ecx edx, sock:DWORD
|
||||
ret
|
||||
endp
|
||||
|
||||
proc net_socket_num_to_addr stdcall uses ebx ecx, x:DWORD
|
||||
; FIXME: do real transform
|
||||
mov eax, [x]
|
||||
;; Get socket structure address by its number
|
||||
; Scan through sockets list to find the socket with specified number.
|
||||
; 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 ecx, [TASK_BASE]
|
||||
mov ecx, [ecx + TASKDATA.pid]
|
||||
;mov ecx, [TASK_BASE]
|
||||
;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:
|
||||
mov ebx, [ebx + SOCKET.NextPtr]
|
||||
or ebx, ebx
|
||||
@ -213,6 +235,9 @@ proc net_socket_num_to_addr stdcall uses ebx ecx, x:DWORD
|
||||
jne .next_socket
|
||||
;cmp [ebx + SOCKET.PID], ecx
|
||||
;jne .next_socket
|
||||
|
||||
; okay, we found the correct one
|
||||
mov eax, [ebx + SOCKET.Number]
|
||||
ret
|
||||
|
||||
.error:
|
||||
@ -220,44 +245,22 @@ proc net_socket_num_to_addr stdcall uses ebx ecx, x:DWORD
|
||||
ret
|
||||
endp
|
||||
|
||||
proc net_socket_addr_to_num stdcall uses ebx ecx, x:DWORD
|
||||
; FIXME: do real transform
|
||||
mov eax, [x]
|
||||
mov ebx, net_sockets
|
||||
mov ecx, [TASK_BASE]
|
||||
mov ecx, [ecx + TASKDATA.pid]
|
||||
.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
|
||||
;; [53.9] Check if local port is used by any socket in the system.
|
||||
; Scan through sockets list, checking SOCKET.LocalPort.
|
||||
; Useful when you want a to generate a unique local port number.
|
||||
; This proc doesn't guarantee that after calling it and trying to use
|
||||
; the port reported being free in calls to socket_open/socket_open_tcp it'll
|
||||
; still be free or otherwise it'll still be used if reported being in use.
|
||||
;
|
||||
; Description
|
||||
; scans through all the active sockets , looking to see if the
|
||||
; 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
|
||||
;
|
||||
;***************************************************************************
|
||||
; @param BX is a port number
|
||||
; @return 1 (port is free) or 0 (port is in use) in EAX
|
||||
;;
|
||||
proc is_localport_unused stdcall
|
||||
|
||||
xchg bl, bh
|
||||
|
||||
xor eax, eax ; Assume the return value is 'free'
|
||||
; assume the return value is 'free'
|
||||
xor eax, eax
|
||||
inc al
|
||||
mov edx, net_sockets
|
||||
|
||||
@ -266,27 +269,22 @@ proc is_localport_unused stdcall
|
||||
or edx, edx
|
||||
jz .exit
|
||||
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:
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; socket_open
|
||||
;; [53.0] Open DGRAM socket (connectionless, unreliable)
|
||||
;
|
||||
; Description
|
||||
; find a free socket
|
||||
; local port in ebx
|
||||
; remote port in ecx
|
||||
; remote ip in edx
|
||||
; return socket # in eax, -1 if none available
|
||||
;
|
||||
;***************************************************************************
|
||||
; @param BX is local port number
|
||||
; @param CX is remote port number
|
||||
; @param EDX is remote IP address
|
||||
; @return socket number or -1 (error) in EAX
|
||||
;;
|
||||
proc socket_open stdcall
|
||||
call net_socket_alloc
|
||||
or eax, eax
|
||||
@ -296,7 +294,6 @@ proc socket_open stdcall
|
||||
|
||||
push eax
|
||||
|
||||
mov [eax + SOCKET.Status], SOCK_OPEN
|
||||
xchg bh, bl
|
||||
mov [eax + SOCKET.LocalPort], bx
|
||||
xchg ch, cl
|
||||
@ -308,7 +305,7 @@ proc socket_open stdcall
|
||||
|
||||
;pop eax ; Get the socket number back, so we can return it
|
||||
stdcall net_socket_addr_to_num
|
||||
ret
|
||||
ret
|
||||
|
||||
.error:
|
||||
DEBUGF 1, "K : socket_open (fail)\n"
|
||||
@ -316,21 +313,14 @@ proc socket_open stdcall
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; socket_open_tcp
|
||||
;; [53.5] Open STREAM socket (connection-based, sequenced, reliable, two-way)
|
||||
;
|
||||
; Description
|
||||
; Opens a TCP socket in PASSIVE or ACTIVE mode
|
||||
; find a free socket
|
||||
; local port in ebx ( intel format )
|
||||
; remote port in ecx ( intel format )
|
||||
; 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
|
||||
;
|
||||
;***************************************************************************
|
||||
; @param BX is local port number
|
||||
; @param CX is remote port number
|
||||
; @param EDX is remote IP address
|
||||
; @param ESI is open mode (SOCKET_ACTIVE, SOCKET_PASSIVE)
|
||||
; @return socket number or -1 (error) in EAX
|
||||
;;
|
||||
proc socket_open_tcp stdcall
|
||||
local sockAddr dd ?
|
||||
|
||||
@ -369,7 +359,6 @@ local sockAddr dd ?
|
||||
mov [sockAddr], eax
|
||||
|
||||
; TODO - check this works!
|
||||
;xxx: already 0 (intialized by net_socket_alloc)
|
||||
;mov [eax + SOCKET.wndsizeTimer], 0 ; Reset the window timer.
|
||||
|
||||
xchg bh, bl
|
||||
@ -423,11 +412,9 @@ local sockAddr dd ?
|
||||
call inc_inet_esi
|
||||
|
||||
.exit:
|
||||
mov ebx, [sockAddr]
|
||||
mov [ebx + SOCKET.Status], SOCK_OPEN
|
||||
;pop eax ; Get the socket number back, so we can return it
|
||||
stdcall net_socket_addr_to_num, ebx
|
||||
ret
|
||||
; Get the socket number back, so we can return it
|
||||
stdcall net_socket_addr_to_num, [sockAddr]
|
||||
ret
|
||||
|
||||
.error:
|
||||
DEBUGF 1, "K : socket_open_tcp (fail)\n"
|
||||
@ -435,35 +422,21 @@ local sockAddr dd ?
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; socket_close
|
||||
;; [53.1] Close DGRAM socket
|
||||
;
|
||||
; Description
|
||||
; socket # in ebx
|
||||
; returns 0 for ok, -1 for socket not open (fail)
|
||||
;
|
||||
;***************************************************************************
|
||||
; @param EBX is socket number
|
||||
; @return 0 (closed successfully) or -1 (error) in EAX
|
||||
;;
|
||||
proc socket_close stdcall
|
||||
DEBUGF 1, "K : socket_close (0x%x)\n", ebx
|
||||
stdcall net_socket_num_to_addr, ebx
|
||||
or eax, eax
|
||||
jz .error
|
||||
|
||||
cmp [eax + SOCKET.Status], dword SOCK_EMPTY
|
||||
jz .error
|
||||
|
||||
; Clear the socket varaibles
|
||||
stdcall net_socket_free, eax
|
||||
; mov edi, eax
|
||||
; xor eax, eax
|
||||
; mov ecx, SOCKETHEADERSIZE
|
||||
; cld
|
||||
; rep stosb
|
||||
|
||||
xor eax, eax
|
||||
ret
|
||||
ret
|
||||
|
||||
.error:
|
||||
DEBUGF 1, "K : socket_close (fail)\n"
|
||||
@ -471,16 +444,13 @@ proc socket_close stdcall
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; socket_close_tcp
|
||||
;; [53.8] Close STREAM socket
|
||||
; Closing TCP sockets takes time, so when you get successful return code
|
||||
; from this function doesn't always mean that socket is actually closed.
|
||||
;
|
||||
; Description
|
||||
; socket # in ebx
|
||||
; returns 0 for ok, -1 for socket not open (fail)
|
||||
;
|
||||
;***************************************************************************
|
||||
; @param EBX is socket number
|
||||
; @return 0 (closed successfully) or -1 (error) in EAX
|
||||
;;
|
||||
proc socket_close_tcp stdcall
|
||||
local sockAddr dd ?
|
||||
DEBUGF 1, "K : socket_close_tcp (0x%x)\n", ebx
|
||||
@ -493,21 +463,19 @@ local sockAddr dd ?
|
||||
.next_resendq:
|
||||
cmp ecx, NUMRESENDENTRIES
|
||||
je .last_resendq ; None left
|
||||
;cmp [esi], bl ; XTODO: bl -> ebx
|
||||
cmp [esi + 4], ebx
|
||||
je @f ; found one
|
||||
inc ecx
|
||||
add esi, 8
|
||||
jmp .next_resendq
|
||||
|
||||
;@@: mov byte[esi], 0xff ; XTODO: 0xff -> 0
|
||||
@@: mov dword[esi + 4], 0
|
||||
inc ecx
|
||||
add esi, 8
|
||||
jmp .next_resendq
|
||||
|
||||
.last_resendq:
|
||||
popa
|
||||
popa
|
||||
|
||||
stdcall net_socket_num_to_addr, ebx
|
||||
or eax, eax
|
||||
@ -515,13 +483,11 @@ local sockAddr dd ?
|
||||
|
||||
mov ebx, eax
|
||||
mov [sockAddr], eax
|
||||
cmp [ebx + SOCKET.Status], SOCK_EMPTY
|
||||
je .error
|
||||
|
||||
cmp [ebx + SOCKET.TCBState], TCB_LISTEN ;xxx
|
||||
je .destroy_tcb ;xxx
|
||||
cmp [ebx + SOCKET.TCBState], TCB_SYN_SENT ;xxx
|
||||
je .destroy_tcb ;xxx
|
||||
cmp [ebx + SOCKET.TCBState], TCB_LISTEN
|
||||
je .destroy_tcb
|
||||
cmp [ebx + SOCKET.TCBState], TCB_SYN_SENT
|
||||
je .destroy_tcb
|
||||
|
||||
; Now construct the response, and queue for sending by IP
|
||||
mov eax, EMPTY_QUEUE
|
||||
@ -531,8 +497,7 @@ local sockAddr dd ?
|
||||
|
||||
push eax
|
||||
|
||||
;xxx mov bl, TH_FIN + TH_ACK
|
||||
mov bl, TH_FIN ;xxx
|
||||
mov bl, TH_FIN
|
||||
xor ecx, ecx
|
||||
xor esi, esi
|
||||
stdcall build_tcp_packet, [sockAddr]
|
||||
@ -545,10 +510,6 @@ local sockAddr dd ?
|
||||
|
||||
; Get the socket state
|
||||
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
|
||||
je .fin_wait_1
|
||||
cmp eax, TCB_ESTABLISHED
|
||||
@ -556,7 +517,6 @@ local sockAddr dd ?
|
||||
|
||||
; assume CLOSE WAIT
|
||||
; 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
|
||||
jmp .send
|
||||
|
||||
@ -580,15 +540,13 @@ local sockAddr dd ?
|
||||
jmp .exit
|
||||
|
||||
.destroy_tcb:
|
||||
;xxx pop eax
|
||||
|
||||
; Clear the socket variables
|
||||
;xxx stdcall net_socket_free, [sockAddr]
|
||||
stdcall net_socket_free, ebx
|
||||
|
||||
.exit:
|
||||
xor eax, eax
|
||||
ret
|
||||
ret
|
||||
|
||||
.error:
|
||||
DEBUGF 1, "K : socket_close_tcp (fail)\n"
|
||||
@ -596,16 +554,11 @@ local sockAddr dd ?
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; socket_poll
|
||||
;; [53.2] Poll socket
|
||||
;
|
||||
; Description
|
||||
; socket # in ebx
|
||||
; returns count in eax.
|
||||
;
|
||||
;***************************************************************************
|
||||
; @param EBX is socket number
|
||||
; @return count or bytes in rx buffer or 0 (error) in EAX
|
||||
;;
|
||||
proc socket_poll stdcall
|
||||
; DEBUGF 1, "socket_poll(0x%x)\n", ebx
|
||||
stdcall net_socket_num_to_addr, ebx
|
||||
@ -616,21 +569,15 @@ proc socket_poll stdcall
|
||||
ret
|
||||
|
||||
.error:
|
||||
;or eax, -1
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; socket_status
|
||||
;; [53.6] Get socket TCB state
|
||||
;
|
||||
; Description
|
||||
; socket # in ebx
|
||||
; returns TCB state in eax.
|
||||
;
|
||||
;***************************************************************************
|
||||
; @param EBX is socket number
|
||||
; @return socket TCB state or 0 (error) in EAX
|
||||
;;
|
||||
proc socket_status stdcall
|
||||
;; DEBUGF 1, "socket_status(0x%x)\n", ebx
|
||||
stdcall net_socket_num_to_addr, ebx
|
||||
@ -638,82 +585,84 @@ proc socket_status stdcall
|
||||
jz .error
|
||||
|
||||
mov eax, [eax + SOCKET.TCBState]
|
||||
ret
|
||||
ret
|
||||
|
||||
.error:
|
||||
;or eax, -1
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Index2RealAddr ebx
|
||||
; mov eax, [ebx + SOCKET.TCBState]
|
||||
;; [53.3] Get one byte from rx buffer
|
||||
; 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
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; socket_read
|
||||
;
|
||||
; Description
|
||||
; socket # in ebx
|
||||
; returns # of bytes remaining in eax, data in bl
|
||||
;
|
||||
;***************************************************************************
|
||||
; @param EBX is socket number
|
||||
; @return number of bytes left in rx buffer or 0 (error) in EAX
|
||||
; @return byte read in BL
|
||||
;;
|
||||
proc socket_read stdcall
|
||||
; DEBUGF 1, "socket_read(0x%x)\n", ebx
|
||||
stdcall net_socket_num_to_addr, ebx
|
||||
or eax, eax
|
||||
jz .error
|
||||
|
||||
lea ebx, [eax + SOCKET.lock]
|
||||
call wait_mutex
|
||||
|
||||
mov ebx, eax
|
||||
mov eax, [ebx + SOCKET.rxDataCount] ; get count of bytes
|
||||
test eax, eax
|
||||
jz .error
|
||||
jz .error_release
|
||||
|
||||
dec eax
|
||||
mov esi, ebx ; esi is address of socket
|
||||
mov [ebx + SOCKET.rxDataCount], eax ; store new count
|
||||
;movzx ebx, byte[ebx + SOCKET.rxData] ; get the byte
|
||||
movzx ebx, byte[ebx + SOCKETHEADERSIZE] ; get the byte
|
||||
add esi, SOCKETHEADERSIZE
|
||||
mov edi, esi
|
||||
inc esi
|
||||
movzx eax, byte[ebx + SOCKET.rxData] ; get the byte
|
||||
|
||||
mov ecx, (SOCKETBUFFSIZE - SOCKETHEADERSIZE) / 4
|
||||
lea edi, [ebx + SOCKETHEADERSIZE]
|
||||
mov ecx, SOCKETBUFFSIZE - SOCKET.rxData - 1
|
||||
lea edi, [esi + SOCKET.rxData]
|
||||
lea esi, [edi + 1]
|
||||
cld
|
||||
push ecx
|
||||
shr ecx, 2
|
||||
rep movsd
|
||||
pop ecx
|
||||
and ecx, 3
|
||||
rep movsb
|
||||
|
||||
mov [ebx + SOCKET.lock], 0
|
||||
mov ebx, eax
|
||||
|
||||
ret
|
||||
|
||||
.error_release:
|
||||
mov [ebx + SOCKET.lock], 0
|
||||
.error:
|
||||
;or eax, -1
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; socket_read_packet
|
||||
;; [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,
|
||||
; only available number of bytes is read.
|
||||
; 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
|
||||
; socket # in ebx
|
||||
; datapointer # in ecx
|
||||
; buffer size in edx
|
||||
; returns # of bytes copied in eax
|
||||
;
|
||||
;***************************************************************************
|
||||
; @param EBX is socket number
|
||||
; @param ECX is pointer to application buffer
|
||||
; @param EDX is application buffer size (number of bytes to read)
|
||||
; @return number of bytes read or 0 (error) in EAX
|
||||
;;
|
||||
proc socket_read_packet stdcall
|
||||
; DEBUGF 1, "socket_read_packet(0x%x)\n", ebx
|
||||
stdcall net_socket_num_to_addr, ebx ; get real socket address
|
||||
or eax, eax
|
||||
jz .error
|
||||
|
||||
lea ebx, [eax + SOCKET.lock]
|
||||
call wait_mutex
|
||||
|
||||
mov ebx, eax
|
||||
mov eax, [ebx + SOCKET.rxDataCount] ; get count of bytes
|
||||
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
|
||||
|
||||
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
|
||||
add esi, edx ; esi is from where we copy
|
||||
pop ecx ; count of bytes we have left
|
||||
@ -744,10 +693,10 @@ proc socket_read_packet stdcall
|
||||
rep movsb ; copy remaining bytes
|
||||
|
||||
.exit:
|
||||
mov [ebx + SOCKET.lock], 0
|
||||
ret ; at last, exit
|
||||
|
||||
.error:
|
||||
;or eax, -1
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
@ -755,12 +704,13 @@ proc socket_read_packet stdcall
|
||||
xor esi, esi
|
||||
mov [ebx + SOCKET.rxDataCount], esi ; store new count (zero)
|
||||
call .start_copy
|
||||
mov [ebx + SOCKET.lock], 0
|
||||
ret
|
||||
|
||||
.start_copy:
|
||||
mov edi, ecx
|
||||
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
|
||||
push ecx
|
||||
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
|
||||
endp
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; socket_write
|
||||
;; [53.4] Send data through DGRAM socket
|
||||
;
|
||||
; Description
|
||||
; socket in ebx
|
||||
; # of bytes to write in ecx
|
||||
; pointer to data in edx
|
||||
; returns 0 in eax ok, -1 == failed ( invalid socket, or
|
||||
; could not queue IP packet )
|
||||
;
|
||||
;***************************************************************************
|
||||
; @param EBX is socket number
|
||||
; @param ECX is application data size (number of bytes to send)
|
||||
; @param EDX is pointer to application data buffer
|
||||
; @return 0 (sent successfully) or -1 (error) in EAX
|
||||
;;
|
||||
proc socket_write stdcall
|
||||
; DEBUGF 1, "socket_write(0x%x)\n", ebx
|
||||
stdcall net_socket_num_to_addr, ebx ; get real socket address
|
||||
@ -793,10 +737,6 @@ proc socket_write stdcall
|
||||
|
||||
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
|
||||
call dequeue
|
||||
cmp ax, NO_BUFFER
|
||||
@ -933,26 +873,20 @@ proc socket_write stdcall
|
||||
call queue
|
||||
|
||||
xor eax, eax
|
||||
ret
|
||||
ret
|
||||
|
||||
.error:
|
||||
or eax, -1
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; socket_write_tcp
|
||||
;; [53.7] Send data through STREAM socket
|
||||
;
|
||||
; Description
|
||||
; socket in ebx
|
||||
; # of bytes to write in ecx
|
||||
; pointer to data in edx
|
||||
; returns 0 in eax ok, -1 == failed ( invalid socket, or
|
||||
; could not queue IP packet )
|
||||
;
|
||||
;***************************************************************************
|
||||
; @param EBX is socket number
|
||||
; @param ECX is application data size (number of bytes to send)
|
||||
; @param EDX is pointer to application data buffer
|
||||
; @return 0 (sent successfully) or -1 (error) in EAX
|
||||
;;
|
||||
proc socket_write_tcp stdcall
|
||||
local sockAddr dd ?
|
||||
|
||||
@ -964,12 +898,7 @@ local sockAddr dd ?
|
||||
mov ebx, eax
|
||||
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
|
||||
; TODO - done
|
||||
cmp [ebx + SOCKET.wndsizeTimer], 0
|
||||
jne .error
|
||||
|
||||
@ -999,8 +928,8 @@ local sockAddr dd ?
|
||||
|
||||
pop ebx
|
||||
push ecx
|
||||
mov eax, NET1OUT_QUEUE
|
||||
|
||||
mov eax, NET1OUT_QUEUE
|
||||
mov edx, [stack_ip]
|
||||
mov ecx, [sockAddr]
|
||||
cmp edx, [ecx + SOCKET.RemoteIP]
|
||||
@ -1031,7 +960,6 @@ local sockAddr dd ?
|
||||
.next_resendq:
|
||||
cmp ecx, NUMRESENDENTRIES
|
||||
je .exit ; None found
|
||||
;cmp byte[esi], 0xff ; XTODO: 0xff -> 0
|
||||
cmp dword[esi + 4], 0
|
||||
je @f ; found one
|
||||
inc ecx
|
||||
@ -1049,7 +977,6 @@ local sockAddr dd ?
|
||||
; fill IP buffer associated with this descriptor
|
||||
|
||||
stdcall net_socket_addr_to_num, [sockAddr]
|
||||
;mov [esi], al ; XTODO: al -> eax
|
||||
mov [esi + 4], eax
|
||||
mov byte[esi + 1], TCP_RETRIES
|
||||
mov word[esi + 2], TCP_TIMEOUT
|
||||
@ -1076,7 +1003,7 @@ local sockAddr dd ?
|
||||
|
||||
.exit:
|
||||
xor eax, eax
|
||||
ret
|
||||
ret
|
||||
|
||||
.error:
|
||||
or eax, -1
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; STACK.INC ;;
|
||||
;; ;;
|
||||
;; TCP/IP stack for Menuet OS ;;
|
||||
;; ;;
|
||||
;; Version 0.7 4th July 2004 ;;
|
||||
;; ;;
|
||||
;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;;
|
||||
;; ;;
|
||||
;; See file COPYING for details ;;
|
||||
@ -46,7 +44,7 @@ endg
|
||||
|
||||
; socket buffers
|
||||
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
|
||||
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; TCP.INC ;;
|
||||
;; ;;
|
||||
;; TCP Processes for Menuet OS TCP/IP stack ;;
|
||||
;; ;;
|
||||
;; Version 0.6 4th July 2004 ;;
|
||||
;; ;;
|
||||
;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;;
|
||||
;; ;;
|
||||
;; See file COPYING for details ;;
|
||||
@ -118,14 +116,14 @@ proc tcp_tcb_handler stdcall uses ebx
|
||||
|
||||
cmp [ebx + SOCKET.NextPtr], 0
|
||||
je .exit
|
||||
DEBUGF 1, "K : sockets:\n"
|
||||
;DEBUGF 1, "K : sockets:\n"
|
||||
|
||||
.next_socket:
|
||||
mov ebx, [ebx + SOCKET.NextPtr]
|
||||
or ebx, ebx
|
||||
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
|
||||
jne .decrement_tcb
|
||||
@ -177,7 +175,6 @@ proc tcp_tx_handler stdcall
|
||||
.next_resendq:
|
||||
cmp ecx, NUMRESENDENTRIES
|
||||
je .exit ; None left
|
||||
;cmp [esi], byte 0xFF ; XTODO: 0xff -> 0
|
||||
cmp dword[esi + 4], 0
|
||||
jne @f ; found one
|
||||
inc ecx
|
||||
@ -192,7 +189,6 @@ proc tcp_tx_handler stdcall
|
||||
jmp .next_resendq ; Timer not zero, so move on
|
||||
|
||||
@@:
|
||||
;mov bl, 0xff ; XTODO: bl -> ebx, 0xff -> 0
|
||||
xor ebx, ebx
|
||||
; restart timer, and decrement retries
|
||||
; After the first resend, back of on next, by a factor of 5
|
||||
@ -201,7 +197,6 @@ proc tcp_tx_handler stdcall
|
||||
jnz @f
|
||||
|
||||
; retries now 0, so delete from queue
|
||||
;xchg [esi], bl ; XTODO: bl -> ebx
|
||||
xchg [esi + 4], ebx
|
||||
|
||||
@@: ; resend packet
|
||||
@ -213,10 +208,8 @@ proc tcp_tx_handler stdcall
|
||||
jne .tth004z
|
||||
|
||||
; TODO - try again in 10ms.
|
||||
;cmp bl, 0xff ; XTODO: 0xff -> 0
|
||||
test ebx, ebx
|
||||
jnz @f
|
||||
;mov [esi], bl ; XTODO: bl -> ebx
|
||||
mov [esi + 4], ebx
|
||||
|
||||
@@: ; Mark it to expire in 10ms - 1 tick
|
||||
@ -316,9 +309,6 @@ proc tcp_rx stdcall uses ebx
|
||||
or ebx, ebx
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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 : --------: %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]
|
||||
jmp .exit
|
||||
|
||||
@ -661,7 +636,6 @@ proc tcpStateMachine stdcall, sockAddr:DWORD
|
||||
.next_resendq:
|
||||
cmp ecx, NUMRESENDENTRIES
|
||||
je .call_handler ; None left
|
||||
;cmp [esi], al ; XTODO: al -> eax
|
||||
cmp [esi + 4], eax
|
||||
je @f ; found one
|
||||
inc ecx
|
||||
@ -702,7 +676,6 @@ proc tcpStateMachine stdcall, sockAddr:DWORD
|
||||
add esi, 8
|
||||
jmp .next_resendq
|
||||
|
||||
;@@: mov byte[esi], 0xff ; XTODO: 0xff -> 0
|
||||
@@: mov dword[esi + 4], 0
|
||||
inc ecx
|
||||
add esi, 8
|
||||
@ -711,7 +684,7 @@ proc tcpStateMachine stdcall, sockAddr:DWORD
|
||||
.call_handler:
|
||||
popad
|
||||
|
||||
; Call handler for given TCB state
|
||||
; Call handler for given TCB state
|
||||
|
||||
mov eax, [ebx + SOCKET.TCBState]
|
||||
cmp eax, TCB_LISTEN
|
||||
@ -852,16 +825,16 @@ proc stateTCB_SYN_RECEIVED stdcall, sockAddr:DWORD
|
||||
; For now, if the packet is an ACK, process it,
|
||||
; If not, ignore it
|
||||
|
||||
test [edx + 20 + TCP_PACKET.Flags], TH_RST ;xxx
|
||||
jz .check_ack ;xxx
|
||||
test [edx + 20 + TCP_PACKET.Flags], TH_RST
|
||||
jz .check_ack
|
||||
|
||||
push [ebx + SOCKET.OrigRemotePort] [ebx + SOCKET.OrigRemoteIP]
|
||||
pop [ebx + SOCKET.RemoteIP] [ebx + SOCKET.RemotePort]
|
||||
|
||||
mov [ebx + SOCKET.TCBState], TCB_LISTEN ;xxx
|
||||
jmp .exit ;xxx
|
||||
mov [ebx + SOCKET.TCBState], TCB_LISTEN
|
||||
jmp .exit
|
||||
|
||||
.check_ack: ;xxx
|
||||
.check_ack:
|
||||
; Look at control flags - expecting an ACK
|
||||
test [edx + 20 + TCP_PACKET.Flags], TH_ACK
|
||||
jz .exit
|
||||
@ -878,10 +851,8 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
|
||||
; OR both...
|
||||
|
||||
; Did we receive a FIN or RST?
|
||||
;xxx test [edx + 20 + TCP_PACKET.Flags], TH_FIN + TH_RST
|
||||
;xxx jz .check_ack
|
||||
test [edx + 20 + TCP_PACKET.Flags], TH_FIN ;xxx
|
||||
jz .check_ack ;xxx
|
||||
test [edx + 20 + TCP_PACKET.Flags], TH_FIN
|
||||
jz .check_ack
|
||||
|
||||
; It was a fin or reset.
|
||||
|
||||
@ -897,14 +868,12 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
|
||||
.next_resendq:
|
||||
cmp ecx, NUMRESENDENTRIES
|
||||
je .last_resendq ; None left
|
||||
;cmp [esi], al ; XTODO: al -> eax
|
||||
cmp [esi + 4], eax
|
||||
je @f ; found one
|
||||
inc ecx
|
||||
add esi, 8
|
||||
jmp .next_resendq
|
||||
|
||||
;@@: mov byte[esi], 0xff ; XTODO: 0xff -> 0
|
||||
@@: mov dword[esi + 4], 0
|
||||
inc ecx
|
||||
add esi, 8
|
||||
@ -913,13 +882,6 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
|
||||
.last_resendq:
|
||||
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
|
||||
|
||||
mov [ebx + SOCKET.TCBState], TCB_CLOSE_WAIT
|
||||
@ -966,7 +928,7 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
|
||||
movzx ecx, [edx + IP_PACKET.TotalLength]
|
||||
xchg cl, ch
|
||||
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.
|
||||
cmp [ebx + SOCKET.TCBState], TCB_CLOSE_WAIT
|
||||
@ -974,14 +936,19 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
|
||||
jmp .exit
|
||||
|
||||
.data:
|
||||
push ecx
|
||||
push ebx
|
||||
add ebx, SOCKET.lock
|
||||
call wait_mutex
|
||||
pop ebx
|
||||
|
||||
add [ebx + SOCKET.rxDataCount], ecx ; increment the count of bytes in buffer
|
||||
push ecx
|
||||
push [ebx + SOCKET.PID] ; get socket owner PID
|
||||
mov eax, [ebx + SOCKET.rxDataCount]
|
||||
add eax, ecx
|
||||
cmp eax, SOCKETBUFFSIZE - SOCKETHEADERSIZE
|
||||
ja .overflow
|
||||
|
||||
mov eax, [ebx + SOCKET.PID] ; get socket owner PID
|
||||
push eax
|
||||
|
||||
mov eax, [ebx + SOCKET.rxDataCount] ; get # of bytes already in buffer
|
||||
mov [ebx + SOCKET.rxDataCount], eax ; increment the count of bytes in buffer
|
||||
|
||||
; point to the location to store the data
|
||||
lea edi, [ebx + eax + SOCKETHEADERSIZE]
|
||||
@ -992,6 +959,7 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
|
||||
|
||||
cld
|
||||
rep movsb ; copy the data across
|
||||
mov [ebx + SOCKET.lock], 0 ; release mutex
|
||||
|
||||
; flag an event to the application
|
||||
pop eax
|
||||
@ -1046,11 +1014,17 @@ proc stateTCB_ESTABLISHED stdcall, sockAddr:DWORD
|
||||
|
||||
.exit:
|
||||
ret
|
||||
.overflow:
|
||||
; no place in buffer
|
||||
; so simply restore stack and exit
|
||||
pop eax ecx
|
||||
mov [ebx + SOCKET.lock], 0
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
proc stateTCB_FIN_WAIT_1 stdcall, sockAddr:DWORD
|
||||
; We can either receive an ACK of a fin, or a fin
|
||||
; We can either receive an ACK of a fin, or a fin
|
||||
mov al, [edx + 20 + TCP_PACKET.Flags]
|
||||
and al, TH_FIN + TH_ACK
|
||||
|
||||
@ -1167,11 +1141,6 @@ proc stateTCB_LAST_ACK stdcall, sockAddr:DWORD
|
||||
|
||||
; delete the socket
|
||||
stdcall net_socket_free, ebx
|
||||
; mov edi, ebx
|
||||
; xor eax, eax
|
||||
; mov ecx, SOCKETHEADERSIZE
|
||||
; cld
|
||||
; rep stosb
|
||||
|
||||
.exit:
|
||||
ret
|
||||
|
@ -1,10 +1,6 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;; ;;
|
||||
;; 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 ;;
|
||||
;; ;;
|
||||
;; ;;
|
||||
@ -12,8 +8,6 @@
|
||||
;; ;;
|
||||
;; UDP Processes for Menuet OS TCP/IP stack ;;
|
||||
;; ;;
|
||||
;; Version 0.3 29 August 2002 ;;
|
||||
;; ;;
|
||||
;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;;
|
||||
;; ;;
|
||||
;; See file COPYING for details ;;
|
||||
@ -102,7 +96,7 @@ proc udp_rx stdcall
|
||||
je @f
|
||||
|
||||
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
|
||||
|
||||
@@: ; OK - we have a valid UDP packet for this socket.
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; PLAYNOTE.INC version 1.1 22 November 2003 ;;
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -489,7 +489,6 @@ proc init_cursors
|
||||
cmp ebx, 32
|
||||
jne @F
|
||||
|
||||
|
||||
mov dword [select_hw_cursor], select_cursor
|
||||
mov dword [set_hw_cursor], cursor_32
|
||||
mov dword [hw_restore], restore_32
|
||||
@ -642,7 +641,6 @@ proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword
|
||||
lodsd
|
||||
test eax, 0xFF000000
|
||||
jz @F
|
||||
|
||||
mov [edi], ax
|
||||
shr eax, 16
|
||||
mov [edi+2], al
|
||||
@ -656,6 +654,7 @@ proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
|
||||
locals
|
||||
@ -756,6 +755,7 @@ proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
def_arrow:
|
||||
file 'arrow.cur'
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; VESA12.INC ;;
|
||||
@ -884,6 +884,8 @@ vesa12_putimage:
|
||||
add esi,[esp+32]
|
||||
cmp ebp,putimage_get1bpp
|
||||
jz .correct
|
||||
cmp ebp,putimage_get2bpp
|
||||
jz .correct
|
||||
cmp ebp,putimage_get4bpp
|
||||
jnz @f
|
||||
.correct:
|
||||
@ -957,6 +959,8 @@ vesa12_putimage:
|
||||
add edi,[BytesPerScanLine]
|
||||
cmp ebp,putimage_get1bpp
|
||||
jz .correct
|
||||
cmp ebp,putimage_get2bpp
|
||||
jz .correct
|
||||
cmp ebp,putimage_get4bpp
|
||||
jnz @f
|
||||
.correct:
|
||||
|
@ -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 ;;
|
||||
;; ;;
|
||||
;; VESA20.INC ;;
|
||||
@ -239,6 +239,8 @@ end if
|
||||
; inc ebp
|
||||
cmp [putimg.ebp], putimage_get1bpp
|
||||
jz .correct
|
||||
cmp [putimg.ebp], putimage_get2bpp
|
||||
jz .correct
|
||||
cmp [putimg.ebp], putimage_get4bpp
|
||||
jnz @f
|
||||
.correct:
|
||||
@ -283,6 +285,8 @@ end if
|
||||
; inc ebp
|
||||
cmp [putimg.ebp], putimage_get1bpp
|
||||
jz .correct
|
||||
cmp [putimg.ebp], putimage_get2bpp
|
||||
jz .correct
|
||||
cmp [putimg.ebp], putimage_get4bpp
|
||||
jnz @f
|
||||
.correct:
|
||||
|
Loading…
Reference in New Issue
Block a user