diff --git a/kernel/branches/Kolibri-acpi/blkdev/bd_drv.inc b/kernel/branches/Kolibri-acpi/blkdev/bd_drv.inc index 427e2c8986..4e8cb6c6fe 100644 --- a/kernel/branches/Kolibri-acpi/blkdev/bd_drv.inc +++ b/kernel/branches/Kolibri-acpi/blkdev/bd_drv.inc @@ -178,7 +178,7 @@ bd_read: ja .notread sub eax, [bios_cur_sector] shl eax, 9 - add eax, (OS_BASE+0x9A000) + add eax, (OS_BASE+0x99000) push ecx esi mov esi, eax mov ecx, 512/4 @@ -207,12 +207,14 @@ bd_read: jmp bd_read .readerr: .v86err: + pop edx + pop eax mov [hd_error], 1 jmp hd_read_error ;----------------------------------------------------------------- bd_write_cache_chain: pusha - mov edi, OS_BASE + 0x9A000 + mov edi, OS_BASE + 0x99000 movzx ecx, [cache_chain_size] push ecx shl ecx, 9-2 @@ -240,7 +242,7 @@ int13_call: ; In current implementation it is protected by common mutex 'ide_status' mov word [OS_BASE + 510h], 10h ; packet length mov word [OS_BASE + 512h], cx ; number of sectors - mov dword [OS_BASE + 514h], 9A000000h ; buffer 9A00:0000 + mov dword [OS_BASE + 514h], 99000000h ; buffer 9900:0000 mov dword [OS_BASE + 518h], eax and dword [OS_BASE + 51Ch], 0 push ebx ecx esi edi @@ -267,7 +269,7 @@ int13_call: @@: mov word [ebx+v86_regs.esi], 510h mov word [ebx+v86_regs.ss], 9000h - mov word [ebx+v86_regs.esp], 0A000h + mov word [ebx+v86_regs.esp], 09000h mov word [ebx+v86_regs.eip], 500h mov [ebx+v86_regs.eflags], 20200h mov esi, [sys_v86_machine] diff --git a/kernel/branches/Kolibri-acpi/blkdev/hd_drv.inc b/kernel/branches/Kolibri-acpi/blkdev/hd_drv.inc index 69a732a694..628f16abc8 100644 --- a/kernel/branches/Kolibri-acpi/blkdev/hd_drv.inc +++ b/kernel/branches/Kolibri-acpi/blkdev/hd_drv.inc @@ -504,81 +504,66 @@ align 4 IDE_irq_14_handler: IDE_irq_15_handler: IDE_common_irq_handler: +; Most of the time, we are here because we have requested +; a DMA transfer for the corresponding drive. +; However, +; a) we can be here because IDE IRQ is shared with some other device, +; that device has actually raised IRQ, +; it has nothing to do with IDE; +; b) we can be here because IDE controller just does not want +; to be silent and reacts to something even though +; we have, in theory, disabled IRQs. +; If the interrupt corresponds to our current request, +; remove the interrupt request and raise the event for the waiting code. +; In the case a), just return zero - not our interrupt. +; In the case b), remove the interrupt request and hope for the best. ; DEBUGF 1, 'K : IDE_irq_handler %x\n', [IDE_common_irq_param]:2 - cmp [IDE_common_irq_param], 0 - jz .exit - pushfd - cli - pushad - mov ecx, [IDE_controller_pointer] + mov ecx, [esp+4] mov dx, [ecx+IDE_DATA.RegsBaseAddres] - cmp [IDE_common_irq_param], 14 - jz @f - add dx, 8 -@@: add edx, 2 ; Bus Master IDE Status register in al, dx test al, 4 - jz @f - mov [IDE_common_irq_param], 0 + jnz .interrupt_from_primary + add edx, 8 + in al, dx + test al, 4 + jnz .interrupt_from_secondary +.exit_notour: + xor eax, eax ; not our interrupt + ret +.interrupt_from_primary: out dx, al ; clear Interrupt bit sub edx, 2 xor eax, eax out dx, al ; clear Bus Master IDE Command register - mov edx, [hdbase] + mov dx, [ecx+IDE_DATA.BAR0_val] add edx, 7 - in al, dx ; read status register + in al, dx ; read status register + cmp [IDE_common_irq_param], 14 + jz .raise +.exit_our: + mov al, 1 + ret +.interrupt_from_secondary: + out dx, al ; clear Interrupt bit + sub edx, 2 + xor eax, eax + out dx, al ; clear Bus Master IDE Command register + mov dx, [ecx+IDE_DATA.BAR2_val] + add edx, 7 + in al, dx ; read status register + cmp [IDE_common_irq_param], 15 + jnz .exit_our +.raise: + cmp ecx, [IDE_controller_pointer] + jnz .exit_our + pushad mov eax, [eventPointer] mov ebx, [eventID] xor edx, edx xor esi, esi call raise_event popad - popfd mov al, 1 ; remove the interrupt request ret -@@: - popad - popfd -.exit: - xor eax, eax ; not our interrupt - ret ;----------------------------------------------------------------- -proc clear_pci_ide_interrupts - mov esi, pcidev_list -align 4 -.loop: - mov esi, [esi+PCIDEV.fd] - cmp esi, pcidev_list - jz .done - -; cmp [esi+PCIDEV.class], 0x01018F - mov eax, [esi+PCIDEV.class] - shr eax, 4 - cmp eax, 0x01018 - jnz .loop - - mov ah, [esi+PCIDEV.bus] - mov al, 2 - mov bh, [esi+PCIDEV.devfn] - mov bl, 0x20 - call pci_read_reg - - and eax, 0FFFCh - mov edx, eax - add edx, 2 - in al, dx - DEBUGF 1,'K : clear_pci_ide_interrupts: port[%x] = %x ',dx,al - out dx, al - in al, dx - DEBUGF 1,'-> %x; ',al - add edx, 8 - in al, dx - DEBUGF 1,'port[%x] = %x ',dx,al - out dx, al - in al, dx - DEBUGF 1,'-> %x\n',al - jmp .loop -.done: - ret -endp diff --git a/kernel/branches/Kolibri-acpi/core/dll.inc b/kernel/branches/Kolibri-acpi/core/dll.inc index d25ce59f50..ba5688d6ea 100644 --- a/kernel/branches/Kolibri-acpi/core/dll.inc +++ b/kernel/branches/Kolibri-acpi/core/dll.inc @@ -747,12 +747,13 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\ test eax, eax jnz @F - mov esi, msg_unresolved - call sys_msg_board_str - mov esi, edi - call sys_msg_board_str - mov esi, msg_CR - call sys_msg_board_str + ; disable debug msg + ;mov esi, msg_unresolved + ;call sys_msg_board_str + ;mov esi, edi + ;call sys_msg_board_str + ;mov esi, msg_CR + ;call sys_msg_board_str mov [retval], 0 @@: diff --git a/kernel/branches/Kolibri-acpi/core/exports.inc b/kernel/branches/Kolibri-acpi/core/exports.inc index a4b3a14231..2e6c3c7ba6 100644 --- a/kernel/branches/Kolibri-acpi/core/exports.inc +++ b/kernel/branches/Kolibri-acpi/core/exports.inc @@ -119,13 +119,13 @@ __exports: usb_get_param, 'USBGetParam', \ usb_hc_func, 'USBHCFunc', \ \ - NET_add_device, 'NetRegDev', \ - NET_remove_device, 'NetUnRegDev', \ - NET_ptr_to_num, 'NetPtrToNum', \ - NET_link_changed, 'NetLinkChanged', \ - ETH_input, 'EthInput', \ - NET_BUFF_alloc, 'NetAlloc', \ - NET_BUFF_free, 'NetFree', \ + net_add_device, 'NetRegDev', \ + net_remove_device, 'NetUnRegDev', \ + net_ptr_to_num, 'NetPtrToNum', \ + net_link_changed, 'NetLinkChanged', \ + eth_input, 'EthInput', \ + net_buff_alloc, 'NetAlloc', \ + net_buff_free, 'NetFree', \ \ get_pcidev_list, 'GetPCIList', \ \ diff --git a/kernel/branches/Kolibri-acpi/core/irq.inc b/kernel/branches/Kolibri-acpi/core/irq.inc index 49d264ab33..0b3a10d9b4 100644 --- a/kernel/branches/Kolibri-acpi/core/irq.inc +++ b/kernel/branches/Kolibri-acpi/core/irq.inc @@ -203,6 +203,8 @@ align 16 ; Note: this still isn't 100% correct, because two IRQs can fire simultaneously, ; the better way would be to find the correct IRQ, but I don't know how to do ; this in that case. + cmp ebp, 1 + jz .fail push ebp xor ebp, ebp .try_other_irqs: diff --git a/kernel/branches/Kolibri-acpi/core/sync.inc b/kernel/branches/Kolibri-acpi/core/sync.inc index 420a4a5c0e..d52cdf490b 100644 --- a/kernel/branches/Kolibri-acpi/core/sync.inc +++ b/kernel/branches/Kolibri-acpi/core/sync.inc @@ -144,13 +144,13 @@ align 4 sub esp, sizeof.MUTEX_WAITER mov ebx, [TASK_BASE] - mov [ebx+TASKDATA.state], 1 mov [esp+MUTEX_WAITER.task], ebx lea esi, [ebp+FUTEX.wait_list] list_add_tail esp, esi ;esp= new waiter, esi= list head .again: + mov [ebx+TASKDATA.state], 1 call change_task lock cmpxchg [ecx], edx @@ -199,7 +199,7 @@ align 4 mov eax, [TASK_BASE] mov [eax+TASKDATA.state], 5 - mov [esp+MUTEX_WAITER.task], ebx + mov [esp+MUTEX_WAITER.task], eax lea esi, [ebp+FUTEX.wait_list] list_add_tail esp, esi ;esp= new waiter, esi= list head diff --git a/kernel/branches/Kolibri-acpi/core/v86.inc b/kernel/branches/Kolibri-acpi/core/v86.inc index 4e1e43564e..66b7f0b830 100644 --- a/kernel/branches/Kolibri-acpi/core/v86.inc +++ b/kernel/branches/Kolibri-acpi/core/v86.inc @@ -89,10 +89,10 @@ v86_create: mov byte [0x504], 0x10 mov byte [0x505], 0xF4 - mov eax, 0x99000+PG_UWR - mov edi, page_tabs+0x99*4 + mov eax, 0x98000+PG_UWR + mov edi, page_tabs+0x98*4 mov edx, 0x1000 - mov ecx, 7 + mov ecx, 8 @@: stosd add eax, edx diff --git a/kernel/branches/Kolibri-acpi/detect/init_ata.inc b/kernel/branches/Kolibri-acpi/detect/init_ata.inc index 9cbdde8cf0..62a9092ef2 100644 --- a/kernel/branches/Kolibri-acpi/detect/init_ata.inc +++ b/kernel/branches/Kolibri-acpi/detect/init_ata.inc @@ -378,9 +378,11 @@ Init_IDE_ATA_controller_2: je .end_set_interrupts push ecx - stdcall attach_int_handler, 14, IDE_irq_14_handler, 0 + stdcall attach_int_handler, 14, IDE_irq_14_handler, ecx + pop ecx DEBUGF 1, "K : Set IDE IRQ14 return code %x\n", eax - stdcall attach_int_handler, 15, IDE_irq_15_handler, 0 + push ecx + stdcall attach_int_handler, 15, IDE_irq_15_handler, ecx DEBUGF 1, "K : Set IDE IRQ15 return code %x\n", eax pop ecx @@ -400,20 +402,18 @@ Init_IDE_ATA_controller_2: ; the IDE controller 01018f. For this reason, the interrupt handler ; does not need to be installed if both channel IDE controller ; running in PIO mode. + +; ...unfortunately, PCI interrupt can be shared with other devices +; which could enable it without consulting IDE code. +; So install the handler anyways and try to process +; even those interrupts which we are not expecting. cmp [ecx+IDE_DATA.RegsBaseAddres], 0 je .end_set_interrupts - cmp [ecx+IDE_DATA.dma_hdd_channel_1], 0 - jne @f - - cmp [ecx+IDE_DATA.dma_hdd_channel_2], 0 - je .end_set_interrupts -;-------------------------------------- -@@: mov ax, [ecx+IDE_DATA.Interrupt] movzx eax, al push ecx - stdcall attach_int_handler, eax, IDE_common_irq_handler, 0 + stdcall attach_int_handler, eax, IDE_common_irq_handler, ecx pop ecx DEBUGF 1, "K : Set IDE IRQ%d return code %x\n", [ecx+IDE_DATA.Interrupt]:1, eax ;-------------------------------------- diff --git a/kernel/branches/Kolibri-acpi/docs/sysfuncr.txt b/kernel/branches/Kolibri-acpi/docs/sysfuncr.txt index 0327b317e8..d30ec9fd65 100644 --- a/kernel/branches/Kolibri-acpi/docs/sysfuncr.txt +++ b/kernel/branches/Kolibri-acpi/docs/sysfuncr.txt @@ -129,6 +129,8 @@ * Значение переменной _skinh доступно как результат вызова подфункции 4 функции 48 +---------------------- Константы для регистров: ---------------------- + eax - SF_CREATE_WINDOW (0) ====================================================================== ================= Функция 1 - поставить точку в окне. ================ ====================================================================== @@ -142,6 +144,8 @@ Возвращаемое значение: * функция не возвращает значения +---------------------- Константы для регистров: ---------------------- + eax - SF_PUT_PIXEL (1) ====================================================================== ============== Функция 2 - получить код нажатой клавиши. ============= ====================================================================== @@ -178,6 +182,8 @@ * Поступает информация только о тех горячих клавишах, которые были определены этим потоком подфункцией 4 функции 66. +---------------------- Константы для регистров: ---------------------- + eax - SF_GET_KEY (2) ====================================================================== ================ Функция 3 - получить системное время. =============== ====================================================================== @@ -193,6 +199,8 @@ поскольку возвращает просто DWORD-значение счетчика времени. * Системное время можно установить функцией 22. +---------------------- Константы для регистров: ---------------------- + eax - SF_GET_SYS_TIME (3) ====================================================================== ================ Функция 4 - нарисовать строку текста. =============== ====================================================================== @@ -229,6 +237,8 @@ Xsize dd Ysize dd picture rb Xsize*Ysize*4 ; 32 бита +---------------------- Константы для регистров: ---------------------- + eax - SF_DRAW_TEXT (4) ====================================================================== ========================= Функция 5 - пауза. ========================= ====================================================================== @@ -245,6 +255,8 @@ picture rb Xsize*Ysize*4 ; 32 бита (закончить текущий квант времени), используйте подфункцию 1 функции 68. +---------------------- Константы для регистров: ---------------------- + eax - SF_SLEEP (5) ====================================================================== =============== Функция 7 - вывести изображение в окно. ============== ====================================================================== @@ -260,6 +272,8 @@ picture rb Xsize*Ysize*4 ; 32 бита изображения относительно окна. * Размер изображения в байтах есть 3*xsize*ysize. +---------------------- Константы для регистров: ---------------------- + eax - SF_PUT_IMAGE (7) ====================================================================== =============== Функция 8 - определить/удалить кнопку. =============== ====================================================================== @@ -293,6 +307,8 @@ picture rb Xsize*Ysize*4 ; 32 бита * Общее количество кнопок для всех приложений ограничено числом 4095. +---------------------- Константы для регистров: ---------------------- + eax - SF_DEFINE_BUTTON (8) ====================================================================== ============= Функция 9 - информация о потоке выполнения. ============ ====================================================================== @@ -393,6 +409,8 @@ picture rb Xsize*Ysize*4 ; 32 бита размером 1 Кб для будущей совместимости, в будущем могут быть добавлены некоторые поля. +---------------------- Константы для регистров: ---------------------- + eax - SF_THREAD_INFO (9) ====================================================================== ==================== Функция 10 - ожидать события. =================== ====================================================================== @@ -412,6 +430,8 @@ picture rb Xsize*Ysize*4 ; 32 бита Чтобы ждать не более определенного времени, используйте функцию 23. +---------------------- Константы для регистров: ---------------------- + eax - SF_WAIT_EVENT (10) ====================================================================== ======= Функция 11 - проверить, есть ли событие, без ожидания. ======= ====================================================================== @@ -430,6 +450,8 @@ picture rb Xsize*Ysize*4 ; 32 бита Чтобы ждать не более определенного времени, используйте функцию 23. +---------------------- Константы для регистров: ---------------------- + eax - SF_CHECK_EVENT (11) ====================================================================== =========== Функция 12 - начать/закончить перерисовку окна. ========== ====================================================================== @@ -451,6 +473,9 @@ picture rb Xsize*Ysize*4 ; 32 бита * Функция начала перерисовки удаляет все определённые функцией 8 кнопки, их следует определить повторно. +---------------------- Константы для регистров: ---------------------- + eax - SF_REDRAW (12) + ebx - SSF_BEGIN_DRAW (1), SSF_END_DRAW (2) ====================================================================== ============ Функция 13 - нарисовать прямоугольник в окне. =========== ====================================================================== @@ -465,6 +490,8 @@ picture rb Xsize*Ysize*4 ; 32 бита * Под координатами понимаются координаты левого верхнего угла прямоугольника относительно окна. +---------------------- Константы для регистров: ---------------------- + eax - SF_DRAW_RECT (13) ====================================================================== ================ Функция 14 - получить размеры экрана. =============== ====================================================================== @@ -480,6 +507,8 @@ picture rb Xsize*Ysize*4 ; 32 бита * Смотри также подфункцию 5 функции 48 - получить размеры рабочей области экрана. +---------------------- Константы для регистров: ---------------------- + eax - SF_GET_SCREEN_SIZE (14) ====================================================================== = Функция 15, подфункция 1 - установить размер фонового изображения. = ====================================================================== @@ -497,6 +526,9 @@ picture rb Xsize*Ysize*4 ; 32 бита * Есть парная функция получения размеров фонового изображения - подфункция 1 функции 39. +---------------------- Константы для регистров: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_SIZE_BG (1) ====================================================================== = Функция 15, подфункция 2 - поставить точку на фоновом изображении. = ====================================================================== @@ -517,6 +549,9 @@ picture rb Xsize*Ysize*4 ; 32 бита * Есть парная функция получения точки с фонового изображения - подфункция 2 функции 39. +---------------------- Константы для регистров: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_PIXEL_BG (2) ====================================================================== ============ Функция 15, подфункция 3 - перерисовать фон. ============ ====================================================================== @@ -526,6 +561,9 @@ picture rb Xsize*Ysize*4 ; 32 бита Возвращаемое значение: * функция не возвращает значения +---------------------- Константы для регистров: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_REDRAW_BG (3) ====================================================================== ===== Функция 15, подфункция 4 - установить режим отрисовки фона. ==== ====================================================================== @@ -543,6 +581,9 @@ picture rb Xsize*Ysize*4 ; 32 бита * Есть парная команда получения режима отрисовки фона - подфункция 4 функции 39. +---------------------- Константы для регистров: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_MODE_BG (4) ====================================================================== ===== Функция 15, подфункция 5 - поместить блок пикселей на фон. ===== ====================================================================== @@ -563,6 +604,9 @@ picture rb Xsize*Ysize*4 ; 32 бита * Для обновления экрана (после завершения серии команд, работающих с фоном) вызывайте подфункцию 3 перерисовки фона. +---------------------- Константы для регистров: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_IMAGE_BG (5) ====================================================================== ====================== Функция 15, подфункция 6 ====================== ==== Спроецировать данные фона на адресное пространство процесса. ==== @@ -580,6 +624,9 @@ picture rb Xsize*Ysize*4 ; 32 бита * Пиксели фонового изображения записываются последовательно слева направо, сверху вниз. +---------------------- Константы для регистров: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_MAP_BG (6) ====================================================================== ====================== Функция 15, подфункция 7 ====================== === Закрыть проекцию данных фона на адресное пространство процесса. == @@ -591,6 +638,9 @@ picture rb Xsize*Ysize*4 ; 32 бита Возвращаемое значение: * eax = 1 при успехе, 0 при ошибке +---------------------- Константы для регистров: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_UNMAP_BG (7) ====================================================================== ====================== Функция 15, подфункция 8 ====================== =========== Получить координаты последней отрисовки фона. ============ @@ -608,6 +658,9 @@ picture rb Xsize*Ysize*4 ; 32 бита функцию сразу после получения события: 5 = завершилась перерисовка фона рабочего стола +---------------------- Константы для регистров: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_LAST_DRAW (8) ====================================================================== ====================== Функция 15, подфункция 9 ====================== =============== Перерисовать прямоугольную часть фона. =============== @@ -624,6 +677,9 @@ picture rb Xsize*Ysize*4 ; 32 бита (right,bottom) - координаты правого нижнего. * Если параметры установлены некорректно - фон не перерисовывается. +---------------------- Константы для регистров: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_REDRAW_RECT (9) ====================================================================== ============= Функция 16 - сохранить рамдиск на дискету. ============= ====================================================================== @@ -634,6 +690,8 @@ picture rb Xsize*Ysize*4 ; 32 бита * eax = 0 - успешно * eax = 1 - ошибка +---------------------- Константы для регистров: ---------------------- + eax - SF_RD_TO_FLOPPY (16) ====================================================================== ============== Функция 17 - получить код нажатой кнопки. ============= ====================================================================== @@ -658,6 +716,9 @@ picture rb Xsize*Ysize*4 ; 32 бита в формате подфункции 2 функции 37 в момент начала нажатия на кнопку, за исключением младшего бита (соответствующего левой кнопке мыши), который сбрасывается. + +---------------------- Константы для регистров: ---------------------- + eax - SF_GET_BUTTON (17) ====================================================================== = Функция 18, подфункция 1 - сделать самым нижним окно потока. ======= ====================================================================== @@ -668,6 +729,9 @@ picture rb Xsize*Ysize*4 ; 32 бита Возвращаемое значение: * функция не возвращает значения +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_UNFOCUS_WINDOW (1) ====================================================================== ==== Функция 18, подфункция 2 - завершить процесс/поток по слоту. ==== ====================================================================== @@ -683,6 +747,9 @@ picture rb Xsize*Ysize*4 ; 32 бита * Смотри также подфункцию 18 - завершение процесса/потока с заданным идентификатором. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_TERMINATE_THREAD (2) ====================================================================== = Функция 18, подфункция 3 - сделать активным окно заданного потока. = ====================================================================== @@ -697,6 +764,9 @@ picture rb Xsize*Ysize*4 ; 32 бита какое-то окно. * Узнать, какое окно является активным, можно вызовом подфункции 7. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_FOCUS_WINDOW (3) ====================================================================== Функция 18, подфункция 4 - получить счётчик пустых тактов в секунду. ====================================================================== @@ -709,6 +779,9 @@ picture rb Xsize*Ysize*4 ; 32 бита Возвращаемое значение: * eax = значение счётчика пустых тактов в секунду +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_IDLE_COUNT (4) ====================================================================== ======== Функция 18, подфункция 5 - получить тактовую частоту. ======= ====================================================================== @@ -718,6 +791,9 @@ picture rb Xsize*Ysize*4 ; 32 бита Возвращаемое значение: * eax = тактовая частота (по модулю 2^32 тактов = 4ГГц) +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_CPU_REQUENCY (5) ====================================================================== Функция 18, подфункция 6 - сохранить рамдиск в файл на жёстком диске. ====================================================================== @@ -733,6 +809,9 @@ picture rb Xsize*Ysize*4 ; 32 бита * Все папки в указанном пути должны существовать, иначе вернётся значение 5, "файл не найден". +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_RD_TO_HDD (6) ====================================================================== ====== Функция 18, подфункция 7 - получить номер активного окна. ===== ====================================================================== @@ -747,6 +826,9 @@ picture rb Xsize*Ysize*4 ; 32 бита сообщения обо всём вводе с клавиатуры. * Сделать окно активным можно вызовом подфункции 3. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_ACTIVE_WINDOW (7) ====================================================================== ==== Функция 18, подфункция 8 - отключить/разрешить звук спикера. ==== ====================================================================== @@ -770,6 +852,10 @@ picture rb Xsize*Ysize*4 ; 32 бита Возвращаемое значение: * функция не возвращает значения +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_SPEAKER (8) + ecx - SSSF_GET_STATE (1), SSSF_TOGGLE (2) ====================================================================== = Функция 18, подфункция 9 - завершение работы системы с параметром. = ====================================================================== @@ -787,6 +873,9 @@ picture rb Xsize*Ysize*4 ; 32 бита * Не следует полагаться на возвращаемое значение при неверном вызове, оно может измениться в последующих версиях ядра. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_SHUTDOWN (9) ====================================================================== ========= Функция 18, подфункция 10 - свернуть активное окно. ======== ====================================================================== @@ -807,6 +896,9 @@ picture rb Xsize*Ysize*4 ; 32 бита функцией 0, для окон без скина её можно определить функцией 8), восстановление - приложением @taskbar. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_MINIMIZE_WINDOW (10) ====================================================================== ====================== Функция 18, подфункция 11 ===================== ============= Получить информацию о дисковой подсистеме. ============= @@ -874,6 +966,9 @@ picture rb Xsize*Ysize*4 ; 32 бита * Таблица может быть использована для получения информации об имеющихся устройствах. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_INFO_DISC_SYS (11) ====================================================================== ========== Функция 18, подфункция 13 - получить версию ядра. ========= ====================================================================== @@ -893,6 +988,9 @@ db 0,7,7,0 db 0 dd 1675 +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_KERNEL_VERSION (13) ====================================================================== ====================== Функция 18, подфункция 14 ===================== ======= Ожидать начала обратного хода луча развёртки монитора. ======= @@ -907,6 +1005,9 @@ dd 1675 высокопроизводительных графических приложений; используется для плавного вывода графики. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_WAIT_RETRACE (14) ====================================================================== == Функция 18, подфункция 15 - поместить курсор мыши в центр экрана. = ====================================================================== @@ -916,6 +1017,9 @@ dd 1675 Возвращаемое значение: * eax = 0 как признак успеха +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_CURSOR_CENTER (15) ====================================================================== ====================== Функция 18, подфункция 16 ===================== ============ Получить размер свободной оперативной памяти. =========== @@ -926,6 +1030,9 @@ dd 1675 Возвращаемое значение: * eax = размер свободной памяти в килобайтах +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_FREE_RAM (16) ====================================================================== ====================== Функция 18, подфункция 17 ===================== ============ Получить размер имеющейся оперативной памяти. =========== @@ -936,6 +1043,9 @@ dd 1675 Возвращаемое значение: * eax = общий размер имеющейся памяти в килобайтах +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_TOTAL_RAM (17) ====================================================================== ====================== Функция 18, подфункция 18 ===================== ============= Завершить процесс/поток по идентификатору. ============= @@ -953,6 +1063,9 @@ dd 1675 * Смотри также подфункцию 2 - завершение процесса/потока по заданному слоту. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_TERMINATE_THREAD_ID (18) ====================================================================== === Функция 18, подфункция 19 - получить/установить настройки мыши. == ====================================================================== @@ -1036,6 +1149,12 @@ dd 1675 Замечание: настройки мыши можно регулировать в приложении mouse_cfg. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_MOUSE_SETTINGS (19) + ecx - SSSF_GET_SPEED (0), SSSF_SET_SPEED (1), SSSF_GET_SPEEDUP (2), + SSSF_SET_SPEEDUP (3), SSSF_SET_POS (4), SSSF_SET_BUTTON (5), + SSSF_GET_DOUBLE_CLICK_DELAY (6), SSSF_SET_DOUBLE_CLICK_DELAY (7) ====================================================================== ====================== Функция 18, подфункция 20 ===================== ============= Получить информацию об оперативной памяти. ============= @@ -1061,6 +1180,9 @@ dd 1675 * +32: dword: размер наибольшего выделенного блока в куче ядра (зарезервировано) +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_RAM_INFO (20) ====================================================================== ====================== Функция 18, подфункция 21 ===================== ======= Получить номер слота процесса/потока по идентификатору. ====== @@ -1073,6 +1195,9 @@ dd 1675 * eax = 0 - ошибка (неверный идентификатор) * иначе eax = номер слота +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_THREAD_SLOT (21) ====================================================================== Функция 18, подфункция 22 - операции с окном другого процесса/потока. ====================================================================== @@ -1093,6 +1218,11 @@ dd 1675 * Восстановление окна с одновременной активизацией осуществляется подфункции 3 (принимающей номер слота). +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_FOREIGN_WINDOW (22) + ecx - SSSF_MINIMIZE (0), SSSF_MINIMIZE_ID (1), SSSF_RESTORE (2), + SSSF_RESTORE_ID (3) ====================================================================== ======= Функция 18, подфункция 23 - минимизировать все окна. ========= ====================================================================== @@ -1105,6 +1235,9 @@ dd 1675 Замечания: * Окна спец. потоков (имя начинается с символа @) не сворачиваются. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_MINIMIZE_ALL (23) ====================================================================== ===== Функция 18, подфункция 24 - установить пределы отрисовки. ====== ====================================================================== @@ -1121,6 +1254,9 @@ dd 1675 * Размеры указываемые в функции не должны превышать размеры текущего видеорежима, иначе функция ничего не изменит. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_SET_SCREEN_LIMITS (24) ====================================================================== ===================== Функция 18, подфункция 25 ====================== ======== Управление положением окна относительно других окон. ======== @@ -1152,6 +1288,10 @@ dd 1675 ZPOS_NORMAL = 0 - обычное ZPOS_ALWAYS_TOP = 1 - поверх всех окон +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_WINDOW_BEHAVIOR (25) + ecx - SSSF_GET_WB (1), SSSF_SET_WB (2) ====================================================================== ==================== Функция 20 - интерфейс MIDI. ==================== ====================================================================== @@ -1173,6 +1313,9 @@ dd 1675 * Предварительно должен быть определён базовый порт вызовом подфункции 1 функции 21. +---------------------- Константы для регистров: ---------------------- + eax - SF_MIDI (20) + ebx - SSF_RESET (1), SSF_OUTPUT (2) ====================================================================== ==== Функция 21, подфункция 1 - установить базовый порт MPU MIDI. ==== ====================================================================== @@ -1189,6 +1332,9 @@ dd 1675 * Получить установленный базовый порт можно вызовом подфункции 1 функции 26. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM_SET (21) + ebx - SSF_MPU_MIDI_BASE (1) ====================================================================== ===== Функция 21, подфункция 2 - установить раскладку клавиатуры. ==== ====================================================================== @@ -1223,6 +1369,9 @@ dd 1675 соответствующую текущей стране иконку. * Приложение @taskbar переключает раскладки по запросу пользователя. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM_SET (21) + ebx - SSF_KEYBOARD_LAYOUT (2) ====================================================================== ========= Функция 21, подфункция 5 - установить язык системы. ======== ====================================================================== @@ -1240,6 +1389,9 @@ dd 1675 переменную не использует. * Получить язык системы можно вызовом подфункции 5 функции 26. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM_SET (21) + ebx - SSF_SYS_LANG (5) ====================================================================== ====================== Функция 21, подфункция 11 ===================== =========== Разрешить/запретить низкоуровневый доступ к HD. ========== @@ -1255,6 +1407,9 @@ dd 1675 * Текущая реализация использует только младший бит ecx. * Получить текущее состояние можно вызовом подфункции 11 функции 26. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM_SET (21) + ebx - SSF_ACCESS_HD_LBA (11) ====================================================================== ====================== Функция 21, подфункция 12 ===================== ========== Разрешить/запретить низкоуровневый доступ к PCI. ========== @@ -1270,6 +1425,9 @@ dd 1675 * Текущая реализация использует только младший бит ecx. * Получить текущее состояние можно вызовом подфункции 12 функции 26. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM_SET (21) + ebx - SSF_ACCESS_PCI (12) ====================================================================== ============ Функция 22 - установить системную дату/время. =========== ====================================================================== @@ -1309,6 +1467,8 @@ dd 1675 автоматически отменяет предыдущую установку. Впрочем, на данный момент ни одна программа его не использует. +---------------------- Константы для регистров: ---------------------- + eax - SF_SET_TIME_DATE (22) ====================================================================== ============== Функция 23 - ожидать события с таймаутом. ============= ====================================================================== @@ -1332,6 +1492,8 @@ dd 1675 с eax=0, если сложение ebx с текущим значением счётчика времени вызовет 32-битное переполнение. +---------------------- Константы для регистров: ---------------------- + eax - SF_WAIT_EVENT_TIMEOUT (23) ====================================================================== ======= Функция 24, подфункция 4 - извлечь лоток привода диска. ====== ====================================================================== @@ -1352,6 +1514,9 @@ dd 1675 устройства. * Примером использования функции является приложение CD_tray. +---------------------- Константы для регистров: ---------------------- + eax - SF_CD (24) + ebx - SSF_EJECT_TRAY (4), SSF_INSERT_TRAY (5) ====================================================================== ====== Функция 24, подфункция 5 - загрузить лоток привода диска. ===== ====================================================================== @@ -1368,6 +1533,9 @@ dd 1675 * Функция поддерживается только для ATAPI-устройств (CD и DVD). * Примером использования функции является приложение CD_tray. +---------------------- Константы для регистров: ---------------------- + eax - SF_CD (24) + ebx - SSF_EJECT_TRAY (4), SSF_INSERT_TRAY (5) ====================================================================== ========== Функция 25 - записать область на слой фона. =============== ====================================================================== @@ -1388,6 +1556,8 @@ dd 1675 * Функция размещает изображение не на фоновое изображение (ф.15), а напрямую в LFB. Опции ф.15 для ф. 25 не имеют смысла. +---------------------- Константы для регистров: ---------------------- + eax - SF_SCREEN_PUT_IMAGE (25) ====================================================================== ===== Функция 26, подфункция 1 - получить базовый порт MPU MIDI. ===== ====================================================================== @@ -1400,6 +1570,9 @@ dd 1675 * Установить базовый порт можно вызовом подфункции 1 функции 21. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_MPU_MIDI_BASE (1) ====================================================================== ====== Функция 26, подфункция 2 - получить раскладку клавиатуры. ===== ====================================================================== @@ -1438,6 +1611,9 @@ dd 1675 (используя описываемую функцию). * Приложение @taskbar переключает раскладки по запросу пользователя. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_KEYBOARD_LAYOUT (2) ====================================================================== ========== Функция 26, подфункция 5 - получить язык системы. ========= ====================================================================== @@ -1452,6 +1628,9 @@ dd 1675 соответствующую иконку (используя описываемую функцию). * Установить язык системы можно вызовом подфункции 5 функции 21. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_SYS_LANG (5) ====================================================================== === Функция 26, подфункция 9 - получить значение счётчика времени. === ====================================================================== @@ -1466,6 +1645,9 @@ dd 1675 497 суток. * Системное время можно получить функцией 3. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_TIME_COUNT (9) ====================================================================== ===================== Функция 26, подфункция 10 ====================== ========== Получить значение высокоточного счётчика времени. ========= @@ -1482,6 +1664,9 @@ Remarks: счётчик PIT. В этом случае точность будет уменьшена до 10 000 000 наносекунд. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_TIME_COUNT_PRO (10) ====================================================================== ====================== Функция 26, подфункция 11 ===================== =========== Узнать, разрешён ли низкоуровневый доступ к HD. ========== @@ -1496,6 +1681,9 @@ Remarks: * Установить текущее состояние можно вызовом подфункции 11 функции 21. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_ACCESS_HD_LBA (11) ====================================================================== ====================== Функция 26, подфункция 12 ===================== ========== Узнать, разрешён ли низкоуровневый доступ к PCI. ========== @@ -1511,6 +1699,9 @@ Remarks: * Установить текущее состояние можно вызовом подфункции 12 функции 21. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_ACCESS_PCI (12) ====================================================================== ================ Функция 29 - получить системную дату. =============== ====================================================================== @@ -1525,6 +1716,8 @@ Remarks: Замечания: * Системную дату можно установить функцией 22. +---------------------- Константы для регистров: ---------------------- + eax - SF_GET_SYS_DATE (29) ====================================================================== ================ Функция 30 - работа с текущей папкой. =============== ====================================================================== @@ -1570,6 +1763,9 @@ dir_path1 db 'HD0/1',0 Замечания: * Функция может быть вызвана только 1 раз за 1 сессию работы ОС. +---------------------- Константы для регистров: ---------------------- + eax - SF_CURRENT_FOLDER (30) + ebx - SSF_SET_CF (1), SSF_GET_CF (2), SSF_ADD_SYS_FOLDER (3) ====================================================================== ========= Функция 34 - узнать кому принадлежит точка экрана. ========= ====================================================================== @@ -1583,6 +1779,8 @@ dir_path1 db 'HD0/1',0 При некорректных значениях ebx и ecx функция возвращает 0 * Функция берет значения из области [_WinMapAddress] +---------------------- Константы для регистров: ---------------------- + eax - SF_GET_PIXEL_OWNER (34) ====================================================================== ============ Функция 35 - прочитать цвет точки на экране. ============ ====================================================================== @@ -1600,6 +1798,8 @@ dir_path1 db 'HD0/1',0 функций) через селектор gs. Параметры текущего видеорежима можно получить функцией 61. +---------------------- Константы для регистров: ---------------------- + eax - SF_GET_PIXEL (35) ====================================================================== =============== Функция 36 - прочитать область экрана. =============== ====================================================================== @@ -1616,6 +1816,8 @@ dir_path1 db 'HD0/1',0 области относительно экрана. * Размер изображения в байтах есть 3*xsize*ysize. +---------------------- Константы для регистров: ---------------------- + eax - SF_GET_IMAGE (36) ====================================================================== ==================== Функция 37 - работа с мышью. ==================== ====================================================================== @@ -1738,6 +1940,11 @@ dir_path1 db 'HD0/1',0 * После прочтения значения обнуляются. * Данные имеют знаковые значения. +---------------------- Константы для регистров: ---------------------- + eax - SF_MOUSE_GET (37) + ebx - SSF_SCREEN_POSITION (0), SSF_WINDOW_POSITION (1), + SSF_BUTTON (2), SSF_BUTTON_EXT (3), SSF_LOAD_CURSOR (4), + SSF_SET_CURSOR (5), SSF_DEL_CURSOR (6), SSF_SCROLL_DATA (7) ====================================================================== ================== Функция 38 - нарисовать отрезок. ================== ====================================================================== @@ -1756,6 +1963,8 @@ dir_path1 db 'HD0/1',0 * Координаты берутся относительно окна. * Конечная точка также рисуется. +---------------------- Константы для регистров: ---------------------- + eax - SF_DRAW_LINE (38) ====================================================================== == Функция 39, подфункция 1 - получить размер фонового изображения. == ====================================================================== @@ -1769,6 +1978,8 @@ dir_path1 db 'HD0/1',0 подфункция 1 функции 15. После которой, разумеется, следует заново определить само изображение. +---------------------- Константы для регистров: ---------------------- + eax - SF_BACKGROUND_GET (39) ====================================================================== = Функция 39, подфункция 2 - прочитать точку с фонового изображения. = ====================================================================== @@ -1787,6 +1998,8 @@ dir_path1 db 'HD0/1',0 * Есть парная функция установки точки на фоновом изображении - подфункция 2 функции 15. +---------------------- Константы для регистров: ---------------------- + eax - SF_BACKGROUND_GET (39) ====================================================================== ====== Функция 39, подфункция 4 - получить режим отрисовки фона. ===== ====================================================================== @@ -1800,6 +2013,8 @@ dir_path1 db 'HD0/1',0 * Есть парная функция установки режима отрисовки фона - подфункция 4 функции 15. +---------------------- Константы для регистров: ---------------------- + eax - SF_BACKGROUND_GET (39) ====================================================================== ======== Функция 40 - установить маску для ожидаемых событий. ======== ====================================================================== @@ -1828,7 +2043,8 @@ dir_path1 db 'HD0/1',0 * Функции работы с событиями учитывают маску на момент вызова функции, а не на момент поступления сообщения. - +---------------------- Константы для регистров: ---------------------- + eax - SF_SET_EVENTS_MASK (40) ====================================================================== =================== Функция 43 - ввод/вывод в порт. ================== ====================================================================== @@ -1858,7 +2074,8 @@ dir_path1 db 'HD0/1',0 быстрее и несколько короче и проще. Из незарезервированных портов читать всё равно нельзя. - +---------------------- Константы для регистров: ---------------------- + eax - SF_PORT_IN_OUT (43) ====================================================================== = Функция 46 - зарезервировать/освободить группу портов ввода/вывода. ====================================================================== @@ -1893,6 +2110,8 @@ dir_path1 db 'HD0/1',0 * При завершении потока автоматически освобождаются все зарезервированные им порты. +---------------------- Константы для регистров: ---------------------- + eax - SF_SET_PORTS (46) ====================================================================== ================= Функция 47 - вывести число в окно. ================= ====================================================================== @@ -1927,6 +2146,8 @@ dir_path1 db 'HD0/1',0 таким количеством цифр, "лишние" ведущие цифры обрезаются. * Параметры шрифтов указаны в описании функции 4 (вывода текста). +---------------------- Константы для регистров: ---------------------- + eax - SF_DRAW_NUMBER (47) ====================================================================== ======= Функция 48, подфункция 0 - применить настройки экрана. ======= ====================================================================== @@ -1943,6 +2164,9 @@ dir_path1 db 'HD0/1',0 игнорируется. * Вызов функции с ненулевым ecx игнорируется. +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_APPLY (0) ====================================================================== ========= Функция 48, подфункция 1 - установить стиль кнопок. ======== ====================================================================== @@ -1959,6 +2183,9 @@ dir_path1 db 'HD0/1',0 подфункцией 0. * Тип кнопок влияет только на их прорисовку функцией 8. +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_SET_BUTTON_STYLE (1) ====================================================================== ==== Функция 48, подфункция 2 - установить стандартные цвета окон. === ====================================================================== @@ -1982,6 +2209,9 @@ dir_path1 db 'HD0/1',0 * Таблицу цветов можно просматривать/изменять интерактивно с помощью приложения desktop. +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_SET_COLORS (2) ====================================================================== ===== Функция 48, подфункция 3 - получить стандартные цвета окон. ==== ====================================================================== @@ -2026,6 +2256,9 @@ dword-значение цвета 0x00RRGGBB * Стандартные цвета можно просматривать/изменять интерактивно с помощью приложения desktop. +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_GET_COLORS (3) ====================================================================== ========== Функция 48, подфункция 4 - получить высоту скина. ========= ====================================================================== @@ -2039,6 +2272,9 @@ dword-значение цвета 0x00RRGGBB использующих скин. * Смотри также общую структуру окна в описании функции 0. +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_GET_SKIN_HEIGHT (4) ====================================================================== ===== Функция 48, подфункция 5 - получить рабочую область экрана. ==== ====================================================================== @@ -2061,6 +2297,9 @@ dword-значение цвета 0x00RRGGBB позволяющую определить размеры всего экрана. * Есть парная функция установки рабочей области - подфункция 6. +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_GET_SCREEN_AREA (5) ====================================================================== ==== Функция 48, подфункция 6 - установить рабочую область экрана. === ====================================================================== @@ -2092,6 +2331,9 @@ dword-значение цвета 0x00RRGGBB обновляет координаты и размеры максимизированных окон. Все окна извещаются о необходимости перерисовки (событие 1). +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_SET_SCREEN_AREA (6) ====================================================================== ====================== Функция 48, подфункция 7 ====================== ============ Получить область скина для текста заголовка. ============ @@ -2112,6 +2354,9 @@ dword-значение цвета 0x00RRGGBB какого-нибудь заменителя текста заголовка (по усмотрению приложения). +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_GET_SKIN_MARGINS (7) ====================================================================== ==== Функция 48, подфункция 8 - установить используемый скин окон. === ====================================================================== @@ -2131,6 +2376,9 @@ dword-значение цвета 0x00RRGGBB * Пользователь может изменять скин статически, создав свой default.skn, или динамически с помощью приложения desktop. +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_SET_SKIN (8) ====================================================================== = Функция 48, подфункция 9 - получить настройку сглаживания шрифтов. = ====================================================================== @@ -2140,6 +2388,9 @@ dword-значение цвета 0x00RRGGBB Возвращаемое значение: * eax = 2 - субпиксельное, 1 - обычное, 0 - выключить +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_GET_FONT_SMOOTH (9) ====================================================================== ===== Функция 48, подфункция 10 - настроить сглаживание шрифтов. ===== ====================================================================== @@ -2148,6 +2399,9 @@ dword-значение цвета 0x00RRGGBB * ebx = 10 - номер подфункции * cl = 2 - субпиксельное, 1 - обычное, 0 - выключить +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_SET_FONT_SMOOTH (10) ====================================================================== ======== Функция 48, подфункция 11 - получить размер шрифтов. ======== ====================================================================== @@ -2157,6 +2411,9 @@ dword-значение цвета 0x00RRGGBB Возвращаемое значение: * eax = текущая высота шрифта в пикселях +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_GET_FONT_SIZE (11) ====================================================================== ======= Функция 48, подфункция 12 - установить размер шрифтов. ======= ====================================================================== @@ -2165,6 +2422,9 @@ dword-значение цвета 0x00RRGGBB * ebx = 10 - номер подфункции * cl = новая высота шрифта в пикселях +---------------------- Константы для регистров: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_SET_FONT_SIZE (12) ====================================================================== ============ Функция 49 - Advanced Power Management (APM). =========== ====================================================================== @@ -2186,6 +2446,8 @@ dword-значение цвета 0x00RRGGBB (http://www.pobox.com/~ralf/files.html, ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/). +---------------------- Константы для регистров: ---------------------- + eax - SF_APM (49) ====================================================================== ================= Функция 50 - установка формы окна. ================= ====================================================================== @@ -2231,6 +2493,8 @@ dword-значение цвета 0x00RRGGBB * Вызов подфункции 0 с нулевым указателем приводит к возврату к прямоугольной форме. +---------------------- Константы для регистров: ---------------------- + eax - SF_SET_WINDOW_SHAPE (50) ====================================================================== ===================== Функция 51 - создать поток. ==================== ====================================================================== @@ -2243,6 +2507,8 @@ dword-значение цвета 0x00RRGGBB * eax = -1 - ошибка (в системе слишком много потоков) * иначе eax = TID - идентификатор потока +---------------------- Константы для регистров: ---------------------- + eax - SF_CREATE_THREAD (51) ====================================================================== ====================== Функция 54, подфункция 0 ====================== ============== Узнать количество слотов в буфере обмена. ============= @@ -2254,6 +2520,9 @@ dword-значение цвета 0x00RRGGBB * eax = количество слотов в буфере * eax = -1 - отсутствует область главного списка +---------------------- Константы для регистров: ---------------------- + eax - SF_CLIPBOARD (54) + ebx - SSF_GET_SLOT_COUNT (0) ====================================================================== ====================== Функция 54, подфункция 1 ====================== ================== Считать данные из буфера обмена. ================== @@ -2267,6 +2536,9 @@ dword-значение цвета 0x00RRGGBB * eax = 1 - ошибка * eax = -1 - отсутствует область главного списка +---------------------- Константы для регистров: ---------------------- + eax - SF_CLIPBOARD (54) + ebx - SSF_READ_CB (1) ====================================================================== ====================== Функция 54, подфункция 2 ====================== ================== Записать данные в буфер обмена. =================== @@ -2281,6 +2553,9 @@ dword-значение цвета 0x00RRGGBB * eax = 1 - ошибка * eax = -1 - отсутствует область главного списка +---------------------- Константы для регистров: ---------------------- + eax - SF_CLIPBOARD (54) + ebx - SSF_WRITE_CB (2) ====================================================================== ====================== Функция 54, подфункция 3 ====================== ========= Удалить последний слот с данными в буфере обмена =========== @@ -2293,6 +2568,9 @@ dword-значение цвета 0x00RRGGBB * eax = 1 - ошибка * eax = -1 - отсутствует область главного списка +---------------------- Константы для регистров: ---------------------- + eax - SF_CLIPBOARD (54) + ebx - SSF_DEL_SLOT (3) ====================================================================== ====================== Функция 54, подфункция 4 ====================== =================== Аварийный сброс блокировки буфера ================ @@ -2307,6 +2585,9 @@ dword-значение цвета 0x00RRGGBB * Используется в исключительных случаях, когда зависшее или убитое приложение заблокировало работу с буфером обмена. +---------------------- Константы для регистров: ---------------------- + eax - SF_CLIPBOARD (54) + ebx - SSF_UNLOCK_BUFFER (4) ====================================================================== ====================== Функция 55, подфункция 55 ===================== ========== Начать проигрывать данные на встроенном спикере. ========== @@ -2340,6 +2621,8 @@ dword-значение цвета 0x00RRGGBB * Данные должны сохраняться в памяти по крайней мере до конца проигрывания. +---------------------- Константы для регистров: ---------------------- + eax - SF_SPEAKER_PLAY (55) ====================================================================== ======================= Функция 57 - PCI BIOS. ======================= ====================================================================== @@ -2358,6 +2641,8 @@ dword-значение цвета 0x00RRGGBB * Если BIOS не поддерживает это расширение, поведение функции эмулируется (через аналоги подфункций функции 62 режима ядра). +---------------------- Константы для регистров: ---------------------- + eax - SF_PCI_BIOS (57) ====================================================================== =========== Функция 60 - Inter Process Communication (IPC). ========== ====================================================================== @@ -2409,6 +2694,9 @@ IPC применяется для посылок сообщений от одн * Система сразу после записи IPC-сообщения в буфер посылает потоку-приёмнику событие с кодом 7 (см. коды событий). +---------------------- Константы для регистров: ---------------------- + eax - SF_IPC (60) + ebx - SSF_SET_AREA (1), SSF_SEND_MESSAGE (2) ====================================================================== === Функция 61 - получить параметры для прямого доступа к графике. === ====================================================================== @@ -2471,6 +2759,10 @@ IPC применяется для посылок сообщений от одн * eax = число байт, которое занимает одна строка развёртки (горизонтальная линия на экране) +---------------------- Константы для регистров: ---------------------- + eax - SF_GET_GRAPHICAL_PARAMS (61) + ebx - SSF_SCREEN_SIZE (1), SSF_BITS_PER_PIXEL (2), + SSF_BYTES_PER_LINE (3) ====================================================================== ===== Функция 62, подфункция 0 - получить версию PCI-интерфейса. ===== ====================================================================== @@ -2486,6 +2778,9 @@ IPC применяется для посылок сообщений от одн для приложений подфункцией 12 функции 21. * Если PCI BIOS не поддерживается, то значение ax неопределено. +---------------------- Константы для регистров: ---------------------- + eax - SF_PCI (62) + ebx - SSF_GET_VERSION (0) ====================================================================== ==== Функция 62, подфункция 1 - получить номер последней PCI-шины. === ====================================================================== @@ -2500,6 +2795,9 @@ IPC применяется для посылок сообщений от одн для приложений подфункцией 12 функции 21. * Если PCI BIOS не поддерживается, то значение al неопределено. +---------------------- Константы для регистров: ---------------------- + eax - SF_PCI (62) + ebx - SSF_GET_LAST_BUS (1) ====================================================================== ====================== Функция 62, подфункция 2 ====================== == Получить механизм обращения к конфигурационному пространству PCI. = @@ -2518,6 +2816,9 @@ IPC применяется для посылок сообщений от одн * Подфункции чтения и записи автоматически работают с выбранным механизмом. +---------------------- Константы для регистров: ---------------------- + eax - SF_PCI (62) + ebx - SSF_GET_ADRR_MODE (2) ====================================================================== ======== Функция 62, подфункции 4,5,6 - прочитать PCI-регистр. ======= ====================================================================== @@ -2549,6 +2850,9 @@ IPC применяется для посылок сообщений от одн ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/); список вторых должен быть указан в документации по устройству. +---------------------- Константы для регистров: ---------------------- + eax - SF_PCI (62) + ebx - SSF_READ_BYTE (4), SSF_READ_WORD (5), SSF_READ_DWORD (6) ====================================================================== ======= Функция 62, подфункции 8,9,10 - записать в PCI-регистр. ====== ====================================================================== @@ -2579,6 +2883,9 @@ IPC применяется для посылок сообщений от одн входит, например, в известный Interrupt List by Ralf Brown; список вторых должен быть указан в документации по устройству. +---------------------- Константы для регистров: ---------------------- + eax - SF_PCI (62) + ebx - SSF_WRITE_BYTE (8), SSF_WRITE_WORD (9), SSF_WRITE_DWORD (10) ====================================================================== ================ Функция 63 - работа с доской отладки. =============== ====================================================================== @@ -2625,6 +2932,9 @@ IPC применяется для посылок сообщений от одн * eax = ebx = 0 - буфер пуст * eax = байт, ebx = 1 - байт успешно прочитан +---------------------- Константы для регистров: ---------------------- + eax - SF_BOARD (63) + ebx - SSF_DEBUG_WRITE (1), SSF_DEBUG_READ (2) ====================================================================== ========== Функция 64 - перераспределить память приложения. ========== ====================================================================== @@ -2642,6 +2952,8 @@ IPC применяется для посылок сообщений от одн Вызов функции будет игнорироваться, если приложение создаст локальную кучу вызовом 68.11. +---------------------- Константы для регистров: ---------------------- + eax - SF_MEMORY_RESIZE (64) ====================================================================== ========= Функция 65 - вывести изображение с палитрой в окно. ======== ====================================================================== @@ -2690,6 +3002,8 @@ IPC применяется для посылок сообщений от одн * Вызов функции 7 эквивалентен вызову этой функции с параметрами esi=24, ebp=0. +---------------------- Константы для регистров: ---------------------- + eax - SF_PUT_IMAGE_EXT (65) ====================================================================== ================= Функция 66 - работа с клавиатурой. ================= ====================================================================== @@ -2799,6 +3113,11 @@ IPC применяется для посылок сообщений от одн * Разблокирование результатов ф. 66.6 * Для эмуляции мыши через клавиатуру, приложение MOUSEMUL +---------------------- Константы для регистров: ---------------------- + eax - SF_KEYBOARD (66) + ebx - SSF_SET_INPUT_MODE (1), SSF_GET_INPUT_MODE (2), + SSF_GET_CONTROL_KEYS (3), SSF_SET_SYS_HOTKEY (4), + SSF_DEL_SYS_HOTKEY (5), SSF_LOCK_INPUT (6), SSF_UNLOCK_INPUT (7) ====================================================================== ============ Функция 67 - изменить положение/размеры окна. =========== ====================================================================== @@ -2823,6 +3142,8 @@ IPC применяется для посылок сообщений от одн получены вызовом функции 9. * Функция посылает окну событие перерисовки (с кодом 1). +---------------------- Константы для регистров: ---------------------- + eax - SF_CHANGE_WINDOW (67) ====================================================================== === Функция 68, подфункция 0 - получить счётчик переключений задач. == ====================================================================== @@ -2833,6 +3154,9 @@ IPC применяется для посылок сообщений от одн * eax = число переключений задач с момента загрузки системы (по модулю 2^32) +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_GET_TASK_SWITCH_COUNT (0) ====================================================================== ====================== Функция 68, подфункция 1 ====================== ============ Переключиться на следующий поток выполнения. ============ @@ -2848,6 +3172,9 @@ IPC применяется для посылок сообщений от одн Возвращаемое значение: * функция не возвращает значения +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_SWITCH_TASK (1) ====================================================================== =============== Функция 68, подфункция 2 - кэш + rdpmc. ============== ====================================================================== @@ -2870,6 +3197,11 @@ IPC применяется для посылок сообщений от одн * для ecx=2 и ecx=3: * функция не возвращает значения +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_PERFORMANCE (2) + ecx - SSSF_ALLOW_RDPMC (0), SSSF_CACHE_STATUS (1), + SSSF_CACHE_ON (2), SSSF_CACHE_OFF (3) ====================================================================== ========== Функция 68, подфункция 3 - прочитать MSR-регистр. ========= ====================================================================== @@ -2891,6 +3223,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); командой cpuid. Иначе возникнет уже другое исключение в ядре, которое всё равно прибьёт поток. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_READ_MSR (3) ====================================================================== ========= Функция 68, подфункция 4 - записать в MSR-регистр. ========= ====================================================================== @@ -2913,6 +3248,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); командой cpuid. Иначе возникнет уже другое исключение в ядре, которое всё равно прибьёт поток. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_WRITE_MSR (4) ====================================================================== ===== Функция 68, подфункция 11 - инициализировать кучу процесса. ==== ====================================================================== @@ -2930,6 +3268,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); размер существующей кучи. * После создания кучи вызовы функции 64 игнорируются. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_HEAP_INIT (11) ====================================================================== ========== Функция 68, подфункция 12 - выделить блок памяти. ========= ====================================================================== @@ -2945,6 +3286,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Функция выделяет целое число страниц (4 Кб) так, что фактический размер выделенного блока больше или равен запрошенному. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_MEM_ALLOC (12) ====================================================================== ========= Функция 68, подфункция 13 - освободить блок памяти. ======== ====================================================================== @@ -2959,6 +3303,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Блок памяти должен быть ранее выделен подфункцией 12 или подфункцией 20. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_MEM_FREE (13) ====================================================================== ====================== Функция 68, подфункция 14 ===================== ====== Ожидать получения сигнала от других приложений/драйверов. ===== @@ -2974,6 +3321,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * +4: данные принятого сигнала (20 байт), формат которых определяется первым dword-ом +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_WAIT_SIGNAL (14) ====================================================================== =========== Функция 68, подфункция 16 - загрузить драйвер. =========== ====================================================================== @@ -2992,6 +3342,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); нулевой символ, остальные символы игнорируются. * Драйвер с именем ABC загружается из файла /rd/1/drivers/ABC.obj. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_LOAD_DRIVER (16) ====================================================================== ========== Функция 68, подфункция 17 - управление драйвером. ========= ====================================================================== @@ -3012,6 +3365,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); определяются драйвером. * Предварительно должен быть получен хэндл драйвера подфункцией 16. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_CONTROL_DRIVER (17) ====================================================================== ============= Функция 68, подфункция 19 - загрузить DLL. ============= ====================================================================== @@ -3027,6 +3383,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); заканчивающийся нулём. Первый dword в структуре является указателем на имя функции, второй содержит адрес функции. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_LOAD_DLL (19) ====================================================================== ====== Функция 68, подфункция 20 - перераспределить блок памяти. ===== ====================================================================== @@ -3051,6 +3410,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Содержимое памяти вплоть до наименьшего из старого и нового размеров сохраняется. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_MEM_REALLOC (20) ====================================================================== ========= Функция 68, подфункция 21 - загрузить драйвер PE. ========== ====================================================================== @@ -3066,6 +3428,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Если драйвер ещё не загружен, он загружается; если драйвер уже загружен, ничего не меняется. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_LOAD_DRIVER_PE (21) ====================================================================== === Функция 68, подфункция 22 - открыть именованную область памяти. == ====================================================================== @@ -3105,6 +3470,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); с кодом ошибки E_ACCESS. * Процесс, создавший область, всегда имеет доступ на запись. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_MEM_OPEN (22) ====================================================================== === Функция 68, подфункция 23 - закрыть именованную область памяти. == ====================================================================== @@ -3121,6 +3489,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * При завершении потока освобождаются все открытые им области памяти. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_MEM_CLOSE (23) ====================================================================== ==== Функция 68, подфункция 24 - установить обработчик исключений. === ====================================================================== @@ -3151,6 +3522,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); подфункцией 25. Сброс флагов исключений в модулях FPU и XMM также возлагается на обработчик пользователя. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_SET_EXCEPTION_HANDLER (24) ====================================================================== = Функция 68, подфункция 25 - изменить состояние активности сигнала. = ====================================================================== @@ -3167,6 +3541,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); обработчика исключений, установленного подфункцией 24. При этом номер сигнала соответствует номеру исключения. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_SET_EXCEPTION_STATE (25) ====================================================================== = Функция 68, подфункция 26 - освободить страницы памяти ============ ====================================================================== @@ -3180,6 +3557,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * функция освобождает страницы с ecx+edx по ecx+edx+esi и устанавливает виртуальную память в зарезервированное состояние. +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_MEM_FREE_EXT (26) ====================================================================== = Функция 68, подфункция 27 - загрузить файл =================== ====================================================================== @@ -3193,6 +3573,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); Примечания: * функция загружает и, при необходимости, распаковывает файл (kunpack) +---------------------- Константы для регистров: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_LOAD_FILE (27) ====================================================================== ======================== Функция 69 - отладка. ======================= ====================================================================== @@ -3241,6 +3624,12 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * подфункция 8 - завершить отлаживаемый поток * подфункция 9 - установить/снять аппаратную точку останова +---------------------- Константы для регистров: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_SET_MESSAGE_AREA (0), SSF_GET_REGISTERS (1), + SSF_SET_REGISTERS (2), SSF_DETACH (3), SSF_SUSPEND (4), + SSF_RESUME (5), SSF_READ_MEMORY (6), SSF_WRITE_MEMORY (7), + SSF_TERMINATE (8), SSF_DEFINE_BREAKPOINT (9) ====================================================================== ====================== Функция 69, подфункция 0 ====================== ========= Определить область данных для отладочных сообщений. ======== @@ -3264,6 +3653,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Данные в буфере трактуются как массив элементов переменной длины - сообщений. Формат сообщения указан в общем описании. +---------------------- Константы для регистров: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_SET_MESSAGE_AREA (0) ====================================================================== ====================== Функция 69, подфункция 1 ====================== ========= Получить состояние регистров отлаживаемого потока. ========= @@ -3293,6 +3685,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Процесс должен быть загружен для отладки (как указано в общем описании). +---------------------- Константы для регистров: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_GET_REGISTERS (1) ====================================================================== ====================== Функция 69, подфункция 2 ====================== ======== Установить состояние регистров отлаживаемого потока. ======== @@ -3312,6 +3707,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Процесс должен быть загружен для отладки (как указано в общем описании). +---------------------- Константы для регистров: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_SET_REGISTERS (2) ====================================================================== == Функция 69, подфункция 3 - отключиться от отлаживаемого процесса. = ====================================================================== @@ -3324,6 +3722,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); Замечания: * Если процесс был приостановлен, он возобновляет выполнение. +---------------------- Константы для регистров: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_DETACH (3) ====================================================================== ==== Функция 69, подфункция 4 - приостановить отлаживаемый поток. ==== ====================================================================== @@ -3337,6 +3738,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Процесс должен быть загружен для отладки (как указано в общем описании). +---------------------- Константы для регистров: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_SUSPEND (4) ====================================================================== ====================== Функция 69, подфункция 5 ====================== ============ Возобновить выполнение отлаживаемого потока. ============ @@ -3351,6 +3755,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Процесс должен быть загружен для отладки (как указано в общем описании). +---------------------- Константы для регистров: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_RESUME (5) ====================================================================== ====================== Функция 69, подфункция 6 ====================== ============= Прочитать из памяти отлаживаемого процесса. ============ @@ -3370,6 +3777,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Процесс должен быть загружен для отладки (как указано в общем описании). +---------------------- Константы для регистров: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_READ_MEMORY (6) ====================================================================== Функция 69, подфункция 7 - записать в память отлаживаемого процесса. ====================================================================== @@ -3388,6 +3798,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Процесс должен быть загружен для отладки (как указано в общем описании). +---------------------- Константы для регистров: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_WRITE_MEMORY (7) ====================================================================== ====== Функция 69, подфункция 8 - завершить отлаживаемый поток. ====== ====================================================================== @@ -3404,6 +3817,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); требуется выполнение первого замечания и принимается PID, а не номер слота. +---------------------- Константы для регистров: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_TERMINATE (8) ====================================================================== ====================== Функция 69, подфункция 9 ====================== ============= Установить/снять аппаратную точку останова. ============ @@ -3447,6 +3863,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Точка останова на запись и чтение/запись срабатывает после выполнения вызвавшей её инструкции. +---------------------- Константы для регистров: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_DEFINE_BREAKPOINT (9) ====================================================================== = Функция 70 - работа с файловой системой с поддержкой длинных имён. = ====================================================================== @@ -3517,6 +3936,12 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); Разблокировка осуществляется при обращении подфункции 4 функции 24 к соответствующему устройству. +---------------------- Константы для регистров: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_READ_FILE (0), SSF_READ_FOLDER (1), SSF_CREATE_FILE (2), + SSF_WRITE_FILE (3), SSF_SET_END (4), SSF_GET_INFO (5), + SSF_SET_INFO (6), SSF_START_APP (7), SSF_DELETE (8), + SSF_CREATE_FOLDER (9) ====================================================================== = Функция 70, подфункция 0 - чтение файла с поддержкой длинных имён. = ====================================================================== @@ -3545,6 +3970,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Функция не позволяет читать папки (вернётся eax=10, access denied). +---------------------- Константы для регистров: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_READ_FILE (0) ====================================================================== = Функция 70, подфункция 1 - чтение папки с поддержкой длинных имён. = ====================================================================== @@ -3644,6 +4072,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); 0x10, а времена и даты обнулены. Альтернативный способ получения информации об оборудовании - подфункция 11 функции 18. +---------------------- Константы для регистров: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_READ_FOLDER (1) ====================================================================== ====================== Функция 70, подфункция 2 ====================== ======== Создание/перезапись файла с поддержкой длинных имён. ======== @@ -3672,6 +4103,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); сколько сможет, после чего вернёт код ошибки 8. * Функция не поддерживается для CD (вернётся код ошибки 2). +---------------------- Константы для регистров: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_CREATE_FILE (2) ====================================================================== ====================== Функция 70, подфункция 3 ====================== ======== Запись в существующий файл с поддержкой длинных имён. ======= @@ -3702,6 +4136,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); необходимого размера нулевыми символами. * Функция не поддерживается для CD (вернётся код ошибки 2). +---------------------- Константы для регистров: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_WRITE_FILE (3) ====================================================================== ========= Функция 70, подфункция 4 - установка размера файла. ======== ====================================================================== @@ -3733,6 +4170,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); код ошибки 8. * Функция не поддерживается для CD (вернётся код ошибки 2). +---------------------- Константы для регистров: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_SET_END (4) ====================================================================== === Функция 70, подфункция 5 - получение информации о файле/папке. === ====================================================================== @@ -3762,6 +4202,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Функция не поддерживает виртуальные папки типа /, /rd и корневые папки типа /rd/1. +---------------------- Константы для регистров: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_GET_INFO (5) ====================================================================== ===== Функция 70, подфункция 6 - установка атрибутов файла/папки. ==== ====================================================================== @@ -3792,6 +4235,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); корневые папки типа /rd/1. * Функция не поддерживается для CD (вернётся код ошибки 2). +---------------------- Константы для регистров: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_SET_INFO (6) ====================================================================== ============ Функция 70, подфункция 7 - запуск программы. ============ ====================================================================== @@ -3825,6 +4271,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); в замороженном состоянии; для запуска используйте подфункцию 5 функции 69. +---------------------- Константы для регистров: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_START_APP (7) ====================================================================== ========== Функция 70, подфункция 8 - удаление файла/папки. ========== ====================================================================== @@ -3850,6 +4299,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Можно удалять только пустые папки (попытка удаления непустой папки приведёт к ошибке с кодом 10, "доступ запрещён"). +---------------------- Константы для регистров: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_DELETE (8) ====================================================================== ============= Функция 70, подфункция 9 - создание папки. ============= ====================================================================== @@ -3875,6 +4327,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Родительская папка должна уже существовать. * Если папка уже существует, функция завершится успешно (eax=0). +---------------------- Константы для регистров: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_CREATE_FOLDER (9) ====================================================================== === Функция 71, подфункция 1 - установить заголовок окна программы. == ====================================================================== @@ -3894,6 +4349,8 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); иначе будет использоваться cp866. * Чтобы убрать заголовок, передайте NULL в ecx. +---------------------- Константы для регистров: ---------------------- + eax - SF_SET_CAPTION (71) ====================================================================== ================ Функция 72 - послать сообщение окну. ================ ====================================================================== @@ -3908,6 +4365,8 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = 0 - успешно * eax = 1 - буфер заполнен +---------------------- Константы для регистров: ---------------------- + eax - SF_SEND_MESSAGE (72) ====================================================================== ===================== Функция 73 - blit bitmap ===================== ====================================================================== @@ -3948,6 +4407,8 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); Возвращаемое значение: * функция не возвращает значения +---------------------- Константы для регистров: ---------------------- + eax - SF_BLITTER (73) ====================================================================== =================== Функция 74, подфункция -1 ======================== =========== Получить количество активных сетевых устройств. ========== @@ -3958,6 +4419,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); Возвращаемое значение: * eax = количество активных сетевых устройств +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_DEVICE_COUNT (255) ====================================================================== ==== Функция 74, подфункция 0, Получить тип сетевого устройства. ===== ====================================================================== @@ -3968,6 +4432,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); Возвращаемое значение: * eax = тип устройства +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_DEVICE_TYPE (0) ====================================================================== ==== Функция 74, подфункция 1, Получить имя сетевого устройства. ===== ====================================================================== @@ -3980,6 +4447,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = -1 для ошибки * В случае успеха в буфер записывается имя сетевого устройства +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_DEVICE_NAME (1) ====================================================================== ======= Функция 74, подфункция 2, Сброс сетевого устройства. ========= ====================================================================== @@ -3990,6 +4460,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); Возвращаемое значение: * eax = -1 для ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_RESET_DEVICE (2) ====================================================================== ====== Функция 74, подфункция 3, Остановить сетевое устройство. ====== ====================================================================== @@ -4000,6 +4473,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); Возвращаемое значение: * eax = -1 для ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_STOP_DEVICE (3) ====================================================================== ===== Функция 74, подфункция 4, Получить указатель на устройство ===== ====================================================================== @@ -4010,6 +4486,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); Возвращаемое значение: * eax = указатель, -1 для ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_DEVICE_POINER (4) ====================================================================== === Функция 74, подфункция 6, Получить количество посланых пакетов === ====================================================================== @@ -4020,6 +4499,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); Возвращаемое значение: * eax = количество с момента старта устройства, -1 для ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_TX_PACKET_COUNT (6) ====================================================================== === Функция 74, подфункция 7, Получить количество принятых пакетов === ====================================================================== @@ -4030,6 +4512,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); Возвращаемое значение: * eax = количество с момента старта устройства, -1 для ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_RX_PACKET_COUNT (7) ====================================================================== ==== Функция 74, подфункция 8, Получить количество посланых байт. ==== ====================================================================== @@ -4041,6 +4526,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = количество с момента старта устройства, -1 для ошибки * ebx = старшая часть +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_TX_BYTE_COUNT (8) ====================================================================== ==== Функция 74, подфункция 9, Получить количество принятых байт. ==== ====================================================================== @@ -4052,6 +4540,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = количество с момента старта устройства, -1 для ошибки * ebx = старшая часть +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_RX_BYTE_COUNT (9) ====================================================================== ======= Функция 74, подфункция 10, Получить статус соединения. ======= ====================================================================== @@ -4070,6 +4561,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); 12 = 1 Гбит 10b = флаг полного дуплекса +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_LINK_STATUS (10) ====================================================================== ======= Функция 75, подфункция 0, Open socket (Открыть сокет). ======= ====================================================================== @@ -4083,6 +4577,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = номер сокета, -1 для ошибки * ebx = код ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_OPEN (0) ====================================================================== ======= Функция 75, подфункция 1, Close socket (Закрыть сокет). ====== ====================================================================== @@ -4094,6 +4591,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = -1 для ошибки * ebx = код ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_CLOSE (1) ====================================================================== ============= Функция 75, подфункция 2, Bind (Привязка). ============= ====================================================================== @@ -4107,6 +4607,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = -1 для ошибки * ebx = код ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_BIND (2) ====================================================================== ============ Функция 75, подфункция 3, Listen (Слушать). ============= ====================================================================== @@ -4119,6 +4622,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = -1 для ошибки * ebx = код ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_LISTEN (3) ====================================================================== ========== Функция 75, подфункция 4, Connect (Соединение). =========== ====================================================================== @@ -4132,6 +4638,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = -1 для ошибки * ebx = код ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_CONNECT (4) ====================================================================== =========== Функция 75, подфункция 5, Accept (Соглашение). =========== ====================================================================== @@ -4145,6 +4654,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = номер сокета из принятого сокета, -1 для ошибки * ebx = код ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_ACCEPT (5) ====================================================================== ============= Функция 75, подфункция 6, Send (Послать). ============== ====================================================================== @@ -4159,6 +4671,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = количество скопированных байтов, -1 для ошибки * ebx = код ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_SEND (6) ====================================================================== ============ Функция 75, подфункция 7, Receive (Получить). =========== ====================================================================== @@ -4173,6 +4688,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = количество скопированных байтов, -1 для ошибки * ebx = код ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_RECEIVE (7) ====================================================================== = Функция 75, подфункция 8, Set socket options (Задать опции сокета) = ====================================================================== @@ -4191,6 +4709,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); dd optlength db options... +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_SET_OPTIONS (8) ====================================================================== = Функция 75, подфункция 9, Get socket options(Получить опции сокета) ====================================================================== @@ -4209,6 +4730,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); dd optlength db options... +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_GET_OPTIONS (9) ====================================================================== = Функция 75, подфункция 10, Get socketpair (Получить парный сокет). = ====================================================================== @@ -4219,6 +4743,58 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = socketnum1, -1 для ошибки * ebx = socketnum2, код ошибки в случае ошибки +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_GET_PAIR (10) +====================================================================== +=============== Функция 76, Сетевые опции и статистика. ============== +====================================================================== +Параметры: + * eax = 76 - номер функции + * верхняя часть ebx = номер протокола + * bh = номер устройства + * bl = номер подфункции + +Ethernet (0) + 0 - Read MAC + +IPv4 (1) + 0 - Read # IP packets sent + 1 - Read # IP packets received + 2 - Read IP + 3 - Write IP + 4 - Read DNS + 5 - Write DNS + 6 - Read subnet + 7 - Write subnet + 8 - Read gateway + 9 - Write gateway + +ICMP (2) + 0 - Read # ICMP packets sent + 1 - Read # ICMP packets received + 3 - enable/disable ICMP echo reply + +UDP (3) + 0 - Read # UDP packets sent + 1 - Read # UDP packets received + +TCP (4) + 0 - Read # TCP packets sent + 1 - Read # TCP packets received + +ARP (5) + 0 - Read # ARP packets sent + 1 - Read # ARP packets received + 2 - Read # ARP entry's + 3 - Read ARP entry + 4 - Add static ARP entry + 5 - Remove ARP entry (-1 = remove all) + 6 - Send ARP announce on specified interface + 7 - Read # ARP conflicts (IP address conflicts) + +---------------------- Константы для регистров: ---------------------- + eax - SF_NETWORK_PROTOCOL (76) ====================================================================== ========== Функция -1 - завершить выполнение потока/процесса ========= ====================================================================== @@ -4234,6 +4810,8 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Эта функция завершает текущий поток. Другой поток можно прибить вызовом подфункции 2 функции 18. +---------------------- Константы для регистров: ---------------------- + eax - SF_TERMINATE_PROCESS (-1) ====================================================================== =========================== Список событий =========================== ====================================================================== diff --git a/kernel/branches/Kolibri-acpi/docs/sysfuncs.txt b/kernel/branches/Kolibri-acpi/docs/sysfuncs.txt index 09f55297a2..767642bd62 100644 --- a/kernel/branches/Kolibri-acpi/docs/sysfuncs.txt +++ b/kernel/branches/Kolibri-acpi/docs/sysfuncs.txt @@ -126,6 +126,8 @@ Remarks: * value _skinh is accessible as the result of call subfunction 4 of function 48 +---------------------- Constants for registers: ---------------------- + eax - SF_CREATE_WINDOW (0) ====================================================================== ================ Function 1 - put pixel in the window. =============== ====================================================================== @@ -139,6 +141,8 @@ Parameters: Returned value: * function does not return value +---------------------- Constants for registers: ---------------------- + eax - SF_PUT_PIXEL (1) ====================================================================== ============ Function 2 - get the code of the pressed key. =========== ====================================================================== @@ -176,6 +180,8 @@ Remarks: * This function notifies only about those hotkeys, which were defined by this thread by subfunction 4 of function 66. +---------------------- Constants for registers: ---------------------- + eax - SF_GET_KEY (2) ====================================================================== ==================== Function 3 - get system time. =================== ====================================================================== @@ -191,6 +197,8 @@ Remarks: returns simply DWORD-value of the time counter. * System time can be set by function 22. +---------------------- Constants for registers: ---------------------- + eax - SF_GET_SYS_TIME (3) ====================================================================== =================== Function 4 - draw text string. =================== ====================================================================== @@ -225,6 +233,8 @@ Xsize dd Ysize dd picture rb Xsize*Ysize*4 ; 32 bpp +---------------------- Constants for registers: ---------------------- + eax - SF_DRAW_TEXT (4) ====================================================================== ========================= Function 5 - delay. ======================== ====================================================================== @@ -240,6 +250,8 @@ Remarks: to transfer control to the next process (to complete a current time slice), use subfunction 1 of function 68. +---------------------- Constants for registers: ---------------------- + eax - SF_SLEEP (5) ====================================================================== =============== Function 7 - draw image in the window. =============== ====================================================================== @@ -255,6 +267,8 @@ Remarks: of the image relative to the window. * Size of the image in bytes is 3*xsize*ysize. +---------------------- Constants for registers: ---------------------- + eax - SF_PUT_IMAGE (7) ====================================================================== =============== Function 8 - define/delete the button. =============== ====================================================================== @@ -287,6 +301,8 @@ Remarks: In rest it is usual button. * Total number of buttons for all applications is limited to 4095. +---------------------- Constants for registers: ---------------------- + eax - SF_DEFINE_BUTTON (8) ====================================================================== ============ Function 9 - information on execution thread. =========== ====================================================================== @@ -385,6 +401,8 @@ Remarks: 1-Kb buffer for the future compatibility, in the future some fields can be added. +---------------------- Constants for registers: ---------------------- + eax - SF_THREAD_INFO (9) ====================================================================== ==================== Function 10 - wait for event. =================== ====================================================================== @@ -403,6 +421,8 @@ Remarks: * To check, whether there is a message in queue, use function 11. To wait for no more than given time, use function 23. +---------------------- Constants for registers: ---------------------- + eax - SF_WAIT_EVENT (10) ====================================================================== =============== Function 11 - check for event, no wait. ============== ====================================================================== @@ -420,6 +440,8 @@ Remarks: * To wait for event, use function 10. To wait for no more than given time, use function 23. +---------------------- Constants for registers: ---------------------- + eax - SF_CHECK_EVENT (11) ====================================================================== =============== Function 12 - begin/end window redraw. =============== ====================================================================== @@ -441,6 +463,9 @@ Remarks: * Subfunction 1 deletes all buttons defined with function 8, they must be defined again. +---------------------- Constants for registers: ---------------------- + eax - SF_REDRAW (12) + ebx - SSF_BEGIN_DRAW (1), SSF_END_DRAW (2) ====================================================================== ============ Function 13 - draw a rectangle in the window. =========== ====================================================================== @@ -455,6 +480,8 @@ Remarks: * Coordinates are understood as coordinates of the left upper corner of a rectangle relative to the window. +---------------------- Constants for registers: ---------------------- + eax - SF_DRAW_RECT (13) ====================================================================== =================== Function 14 - get screen size. =================== ====================================================================== @@ -470,6 +497,8 @@ Remarks: * See also subfunction 5 of function 48 - get sizes of working area of the screen. +---------------------- Constants for registers: ---------------------- + eax - SF_GET_SCREEN_SIZE (14) ====================================================================== == Function 15, subfunction 1 - set a size of the background image. == ====================================================================== @@ -488,6 +517,9 @@ Remarks: * There is a pair function for get size of the background image - subfunction 1 of function 39. +---------------------- Constants for registers: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_SIZE_BG (1) ====================================================================== === Function 15, subfunction 2 - put pixel on the background image. == ====================================================================== @@ -508,6 +540,9 @@ Remarks: * There is a pair function for get pixel on the background image - subfunction 2 of function 39. +---------------------- Constants for registers: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_PIXEL_BG (2) ====================================================================== =========== Function 15, subfunction 3 - redraw background. ========== ====================================================================== @@ -517,6 +552,9 @@ Parameters: Returned value: * function does not return value +---------------------- Constants for registers: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_REDRAW_BG (3) ====================================================================== == Function 15, subfunction 4 - set drawing mode for the background. = ====================================================================== @@ -534,6 +572,9 @@ Remarks: * There is a pair function for get drawing mode of the background - subfunction 4 of function 39. +---------------------- Constants for registers: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_MODE_BG (4) ====================================================================== ===================== Function 15, subfunction 5 ===================== ============ Put block of pixels on the background image. ============ @@ -555,6 +596,9 @@ Remarks: * For update of the screen (after completion of a series of commands working with a background) call subfunction 3. +---------------------- Constants for registers: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_IMAGE_BG (5) ====================================================================== ===================== Function 15, subfunction 6 ===================== ======== Map background data to the address space of process. ======== @@ -572,6 +616,9 @@ Remarks: * Pixels of the background image are written sequentially from left to right, from up to down. +---------------------- Constants for registers: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_MAP_BG (6) ====================================================================== ===== Function 15, subfunction 7 - close mapped background data. ===== ====================================================================== @@ -582,6 +629,9 @@ Parameters: Returned value: * eax = 1 - success, 0 - error +---------------------- Constants for registers: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_UNMAP_BG (7) ====================================================================== ===================== Function 15, subfunction 8 ===================== ============= Get coordinates of last draw the background ============ @@ -599,6 +649,9 @@ Remarks: immediately after the event: 5 = kernel finished redrawing of the desktop background +---------------------- Constants for registers: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_LAST_DRAW (8) ====================================================================== ===================== Function 15, subfunction 9 ===================== ============= Redraws a rectangular part of the background =========== @@ -615,6 +668,9 @@ Remarks: (right,bottom) are coordinates of the right lower one. * If parameters are set incorrectly then background is not redrawn. +---------------------- Constants for registers: ---------------------- + eax - SF_BACKGROUND_SET (15) + ebx - SSF_REDRAW_RECT (9) ====================================================================== =============== Function 16 - save ramdisk on a floppy. ============== ====================================================================== @@ -625,6 +681,8 @@ Returned value: * eax = 0 - success * eax = 1 - error +---------------------- Constants for registers: ---------------------- + eax - SF_RD_TO_FLOPPY (16) ====================================================================== ======= Function 17 - get the identifier of the pressed button. ====== ====================================================================== @@ -648,6 +706,8 @@ Remarks: as in subfunction 2 of function 37 at the beginning of button press, excluding lower bit, which is cleared. +---------------------- Constants for registers: ---------------------- + eax - SF_GET_BUTTON (17) ====================================================================== ===================== Function 18, subfunction 1 ===================== ============= Make deactive the window of the given thread. ========== @@ -659,6 +719,9 @@ Parameters: Returned value: * function does not return value +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_UNFOCUS_WINDOW (1) ====================================================================== = Function 18, subfunction 2 - terminate process/thread by the slot. = ====================================================================== @@ -675,6 +738,9 @@ Remarks: * See also subfunction 18 - terminate process/thread by the identifier. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_TERMINATE_THREAD (2) ====================================================================== ===================== Function 18, subfunction 3 ===================== ============= Make active the window of the given thread. ============ @@ -690,6 +756,9 @@ Remarks: some window is made active. * To find out, which window is active, use subfunction 7. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_FOCUS_WINDOW (3) ====================================================================== ===================== Function 18, subfunction 4 ===================== =========== Get counter of idle time units per one second. =========== @@ -703,6 +772,9 @@ Parameters: Returned value: * eax = value of the counter of idle time units per one second +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_IDLE_COUNT (4) ====================================================================== ========== Function 18, subfunction 5 - get CPU clock rate. ========== ====================================================================== @@ -712,6 +784,9 @@ Parameters: Returned value: * eax = clock rate (modulo 2^32 clock ticks = 4GHz) +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_CPU_REQUENCY (5) ====================================================================== Function 18, subfunction 6 - save ramdisk to the file on hard drive. ====================================================================== @@ -727,6 +802,9 @@ Remarks: * All folders in the given path must exist, otherwise function returns value 5, "file not found". +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_RD_TO_HDD (6) ====================================================================== =========== Function 18, subfunction 7 - get active window. ========== ====================================================================== @@ -741,6 +819,9 @@ Remarks: messages on all keyboard input. * To make a window active, use subfunction 3. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_ACTIVE_WINDOW (7) ====================================================================== == Function 18, subfunction 8 - disable/enable the internal speaker. = ====================================================================== @@ -765,6 +846,10 @@ Parameters: Returned value: * function does not return value +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_SPEAKER (8) + ecx - SSSF_GET_STATE (1), SSSF_TOGGLE (2) ====================================================================== == Function 18, subfunction 9 - system shutdown with the parameter. == ====================================================================== @@ -783,6 +868,9 @@ Remarks: * Do not rely on returned value by incorrect call, it can be changed in future versions of the kernel. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_SHUTDOWN (9) ====================================================================== ======= Function 18, subfunction 10 - minimize topmost window. ======= ====================================================================== @@ -804,6 +892,9 @@ Remarks: for other windows it can be defined manually by function 8), restore of a window is done by the application '@taskbar'. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_MINIMIZE_WINDOW (10) ====================================================================== Function 18, subfunction 11 - get information on the disk subsystem. ====================================================================== @@ -828,7 +919,7 @@ Format of the table: short version: For example, for the standard configuration from one 1.44-drive here will be 40h, and for the case 1.2Mb on A: and 1.44Mb on B: the value is 24h. - + First IDE controller: * +1: byte: information about hard disks and CD-drives, AABBCCDD, where AA corresponds to the controller IDE0, ..., DD - IDE3: @@ -839,7 +930,7 @@ Format of the table: short version: this field contains 48h. * +2: 4 db: number of the retrieved partitions on hard disks at accordingly IDE0,...,IDE3. - + Second IDE controller: * +6: byte: information about hard disks and CD-drives, AABBCCDD, where AA corresponds to the controller IDE4, ..., DD - IDE7: @@ -860,8 +951,8 @@ Format of the table: short version: For example, in the case HD on IDE8 and CD on IDE10 this field contains 48h. * +12: 4 db: number of the retrieved partitions on hard disks - at accordingly IDE8,...,IDE11. - + at accordingly IDE8,...,IDE11. + If the hard disk on IDEx is absent, appropriate byte is zero, otherwise it shows number of the recognized partitions, which can be not presented (if the drive is not formatted or if @@ -872,6 +963,9 @@ Remarks: * The table can be used for obtaining the information about available devices. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_INFO_DISC_SYS (11) ====================================================================== ========== Function 18, subfunction 13 - get kernel version. ========= ====================================================================== @@ -891,6 +985,9 @@ db 0,7,7,0 db 0 dd 1675 +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_KERNEL_VERSION (13) ====================================================================== ======= Function 18, subfunction 14 - wait for screen retrace. ======= ====================================================================== @@ -905,6 +1002,9 @@ Remarks: * Function is intended only for active high-efficiency graphics applications; is used for smooth output of a graphics. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_WAIT_RETRACE (14) ====================================================================== == Function 18, subfunction 15 - center mouse cursor on the screen. == ====================================================================== @@ -914,6 +1014,9 @@ Parameters: Returned value: * eax = 0 as the tag of success +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_CURSOR_CENTER (15) ====================================================================== ========= Function 18, subfunction 16 - get size of free RAM. ======== ====================================================================== @@ -923,6 +1026,9 @@ Parameters: Returned value: * eax = size of free memory in kilobytes +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_FREE_RAM (16) ====================================================================== ======== Function 18, subfunction 17 - get full amount of RAM. ======= ====================================================================== @@ -932,6 +1038,9 @@ Parameters: Returned value: * eax = total size of existing memory in kilobytes +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_TOTAL_RAM (17) ====================================================================== ===================== Function 18, subfunction 18 ==================== ============= Terminate process/thread by the identifier. ============ @@ -949,6 +1058,9 @@ Remarks: * See also subfunction 2 - terminate process/thread by given slot. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_TERMINATE_THREAD_ID (18) ====================================================================== ======== Function 18, subfunction 19 - get/set mouse features. ======= ====================================================================== @@ -1032,6 +1144,12 @@ Returned value: Remark: mouse settings can be modified in the application mouse_cfg. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_MOUSE_SETTINGS (19) + ecx - SSSF_GET_SPEED (0), SSSF_SET_SPEED (1), SSSF_GET_SPEEDUP (2), + SSSF_SET_SPEEDUP (3), SSSF_SET_POS (4), SSSF_SET_BUTTON (5), + SSSF_GET_DOUBLE_CLICK_DELAY (6), SSSF_SET_DOUBLE_CLICK_DELAY (7) ====================================================================== ======== Function 18, subfunction 20 - get information on RAM. ======= ====================================================================== @@ -1056,6 +1174,9 @@ Returned value: * +32: dword: size of maximum allocated block in kernel heap (reserved) +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_RAM_INFO (20) ====================================================================== ===================== Function 18, subfunction 21 ==================== ======== Get slot number of process/thread by the identifier. ======== @@ -1068,6 +1189,9 @@ Returned value: * eax = 0 - error (invalid identifier) * otherwise eax = slot number +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_GET_THREAD_SLOT (21) ====================================================================== ===================== Function 18, subfunction 22 ==================== ============== Operations with window of another thread. ============= @@ -1089,6 +1213,11 @@ Remarks: * One can restore and activate window simultaneously with subfunction 3 (which requires slot number). +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_FOREIGN_WINDOW (22) + ecx - SSSF_MINIMIZE (0), SSSF_MINIMIZE_ID (1), SSSF_RESTORE (2), + SSSF_RESTORE_ID (3) ====================================================================== ======== Function 18, subfunction 23 - minimize all windows. ========== ====================================================================== @@ -1101,6 +1230,9 @@ Returned value: Remarks: * Window of special thread (name begin to symbol @) is not minimize. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_MINIMIZE_ALL (23) ====================================================================== ======= Function 18, subfunction 24 - set limits of screen. ========== ====================================================================== @@ -1119,6 +1251,9 @@ Remarks: of the current video mode, otherwise the function will not change anything. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_SET_SCREEN_LIMITS (24) ====================================================================== ===================== Function 18, subfunction 25 ==================== ===== Control position of the window relative to other windows. ====== @@ -1150,6 +1285,10 @@ Constant position of the window relative to other windows: ZPOS_NORMAL = 0 - normal ZPOS_ALWAYS_TOP = 1 - on top of all windows +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM (18) + ebx - SSF_WINDOW_BEHAVIOR (25) + ecx - SSSF_GET_WB (1), SSSF_SET_WB (2) ====================================================================== ==================== Function 20 - MIDI interface. =================== ====================================================================== @@ -1171,6 +1310,9 @@ Remarks: * Previously the base port must be defined by subfunction 1 of function 21. +---------------------- Constants for registers: ---------------------- + eax - SF_MIDI (20) + ebx - SSF_RESET (1), SSF_OUTPUT (2) ====================================================================== ======== Function 21, subfunction 1 - set MPU MIDI base port. ======== ====================================================================== @@ -1186,6 +1328,9 @@ Remarks: * The installation of base is necessary for function 20. * To get base port use subfunction 1 of function 26. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM_SET (21) + ebx - SSF_MPU_MIDI_BASE (1) ====================================================================== ========== Function 21, subfunction 2 - set keyboard layout. ========= ====================================================================== @@ -1219,6 +1364,9 @@ Remarks: the corresponding icon. * The application @taskbar switches layouts on user request. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM_SET (21) + ebx - SSF_KEYBOARD_LAYOUT (2) ====================================================================== ========== Function 21, subfunction 5 - set system language. ========= ====================================================================== @@ -1236,6 +1384,9 @@ Remarks: use this variable. * To get system language use subfunction 5 of function 26. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM_SET (21) + ebx - SSF_SYS_LANG (5) ====================================================================== Function 21, subfunction 11 - enable/disable low-level access to HD. ====================================================================== @@ -1250,6 +1401,9 @@ Remarks: * The current implementation uses only low bit of ecx. * To get current status use subfunction 11 of function 26. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM_SET (21) + ebx - SSF_ACCESS_HD_LBA (11) ====================================================================== Function 21, subfunction 12 - enable/disable low-level access to PCI. ====================================================================== @@ -1264,6 +1418,9 @@ Remarks: * The current implementation uses only low bit of ecx. * To get current status use subfunction 12 of function 26. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM_SET (21) + ebx - SSF_ACCESS_PCI (12) ====================================================================== ================= Function 22 - set system date/time. ================ ====================================================================== @@ -1302,6 +1459,8 @@ Remarks: an alarm clock cancels automatically the previous set. However, at moment no program uses it. +---------------------- Constants for registers: ---------------------- + eax - SF_SET_TIME_DATE (22) ====================================================================== ============= Function 23 - wait for event with timeout. ============= ====================================================================== @@ -1325,6 +1484,8 @@ Remarks: if the addition of ebx with the current value of time counter makes 32-bit overflow. +---------------------- Constants for registers: ---------------------- + eax - SF_WAIT_EVENT_TIMEOUT (23) ====================================================================== ======= Function 24, subfunction 4 - eject tray of disk drive. ======= ====================================================================== @@ -1345,6 +1506,9 @@ Remarks: corresponding device. * An example of usage of the function is the application CD_tray. +---------------------- Constants for registers: ---------------------- + eax - SF_CD (24) + ebx - SSF_EJECT_TRAY (4), SSF_INSERT_TRAY (5) ====================================================================== ======== Function 24, subfunction 5 - load tray of disk drive. ======= ====================================================================== @@ -1361,6 +1525,9 @@ Remarks: * The function is supported only for ATAPI devices (CD and DVD). * An example of usage of the function is the application CD_tray. +---------------------- Constants for registers: ---------------------- + eax - SF_CD (24) + ebx - SSF_EJECT_TRAY (4), SSF_INSERT_TRAY (5) ====================================================================== ======= Function 25 - put image area on the background layer. ======== ====================================================================== @@ -1381,6 +1548,8 @@ Remarks: * The function places the image directly to LFB. It is not for background image f.15. Options f.15 to f.25 does not make sense. +---------------------- Constants for registers: ---------------------- + eax - SF_SCREEN_PUT_IMAGE (25) ====================================================================== ======== Function 26, subfunction 1 - get MPU MIDI base port. ======== ====================================================================== @@ -1392,6 +1561,9 @@ Returned value: Parameters: * To set base port use subfunction 1 of function 21. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_MPU_MIDI_BASE (1) ====================================================================== ========== Function 26, subfunction 2 - get keyboard layout. ========= ====================================================================== @@ -1428,6 +1600,9 @@ Remarks: the corresponding icon (using this function). * The application @taskbar switches layouts on user request. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_KEYBOARD_LAYOUT (2) ====================================================================== ========== Function 26, subfunction 5 - get system language. ========= ====================================================================== @@ -1442,6 +1617,9 @@ Remarks: appropriate icon (using this function). * To set system language use subfunction 5 of function 21. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_SYS_LANG (5) ====================================================================== === Function 26, subfunction 9 - get the value of the time counter. == ====================================================================== @@ -1453,8 +1631,11 @@ Returned value: Remarks: * Counter takes modulo 2^32, that correspond to a little more than 497 days. - * To get system time use function 3. - + * To get system time use function 3. + +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_TIME_COUNT (9) ====================================================================== ===================== Function 26, subfunction 10 ==================== ========== Get the value of the high precision time counter. ========= @@ -1464,11 +1645,14 @@ Parameters: * ebx = 10 - subfunction number Returned value: * eax = number of nanoseconds since system boot time (lower DWORD) - * edx = number of nanoseconds since system boot time (high DWORD) + * edx = number of nanoseconds since system boot time (high DWORD) Remarks: * The counter is based on HPET, if HPET is not available, resolution will be reduced to 10 000 000 nanoseconds. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_TIME_COUNT_PRO (10) ====================================================================== ===================== Function 26, subfunction 11 ==================== ========== Find out whether low-level HD access is enabled. ========== @@ -1482,6 +1666,9 @@ Remarks: * Is used in LBA read (subfunction 8 of function 58). * To set current state use subfunction 11 of function 21. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_ACCESS_HD_LBA (11) ====================================================================== ===================== Function 26, subfunction 12 ==================== ========== Find out whether low-level PCI access is enabled. ========= @@ -1496,6 +1683,9 @@ Remarks: * The current implementation uses only low bit of ecx. * To set the current state use subfunction 12 of function 21. +---------------------- Constants for registers: ---------------------- + eax - SF_SYSTEM_GET (26) + ebx - SSF_ACCESS_PCI (12) ====================================================================== =================== Function 29 - get system date. =================== ====================================================================== @@ -1510,6 +1700,8 @@ Returned value: Remarks: * To set system date use function 22. +---------------------- Constants for registers: ---------------------- + eax - SF_GET_SYS_DATE (29) ====================================================================== ============= Function 30 - work with the current folder. ============ ====================================================================== @@ -1554,6 +1746,9 @@ Returned value: Remarks: * The function can be called only 1 time for 1 session of the OS. +---------------------- Constants for registers: ---------------------- + eax - SF_CURRENT_FOLDER (30) + ebx - SSF_SET_CF (1), SSF_GET_CF (2), SSF_ADD_SYS_FOLDER (3) ====================================================================== ========= Function 34 - who owner the pixel on the screen. =========== ====================================================================== @@ -1567,6 +1762,8 @@ Returned value: If incorrect values ebx and ecx then function returns 0 * The function takes the value from the area [_WinMapAddress] +---------------------- Constants for registers: ---------------------- + eax - SF_GET_PIXEL_OWNER (34) ====================================================================== ======= Function 35 - read the color of a pixel on the screen. ======= ====================================================================== @@ -1584,6 +1781,8 @@ Remarks: to videomemory through the selector gs. To get parameters of the current videomode, use function 61. +---------------------- Constants for registers: ---------------------- + eax - SF_GET_PIXEL (35) ====================================================================== =================== Function 36 - read screen area. ================== ====================================================================== @@ -1600,6 +1799,8 @@ Remarks: of the image relative to the screen. * Size of the image in bytes is 3*xsize*ysize. +---------------------- Constants for registers: ---------------------- + eax - SF_GET_IMAGE (36) ====================================================================== =================== Function 37 - work with mouse. =================== ====================================================================== @@ -1722,6 +1923,11 @@ Remarks: * Values are zeroed after reading. * Values are signed. +---------------------- Constants for registers: ---------------------- + eax - SF_MOUSE_GET (37) + ebx - SSF_SCREEN_POSITION (0), SSF_WINDOW_POSITION (1), + SSF_BUTTON (2), SSF_BUTTON_EXT (3), SSF_LOAD_CURSOR (4), + SSF_SET_CURSOR (5), SSF_DEL_CURSOR (6), SSF_SCROLL_DATA (7) ====================================================================== ====================== Function 38 - draw line. ====================== ====================================================================== @@ -1740,6 +1946,8 @@ Remarks: * Coordinates are relative to the window. * End point is also drawn. +---------------------- Constants for registers: ---------------------- + eax - SF_DRAW_LINE (38) ====================================================================== == Function 39, subfunction 1 - get a size of the background image. == ====================================================================== @@ -1753,6 +1961,8 @@ Remarks: subfunction 1 of function 15. After which it is necessary, of course, anew to define image. +---------------------- Constants for registers: ---------------------- + eax - SF_BACKGROUND_GET (39) ====================================================================== == Function 39, subfunction 2 - get pixel from the background image. = ====================================================================== @@ -1772,6 +1982,8 @@ Remarks: * There is a pair function to set pixel on the background image - subfunction 2 of function 15. +---------------------- Constants for registers: ---------------------- + eax - SF_BACKGROUND_GET (39) ====================================================================== == Function 39, subfunction 4 - get drawing mode for the background. = ====================================================================== @@ -1785,6 +1997,8 @@ Remarks: * There is a pair function to set drawing mode - subfunction 4 of function 15. +---------------------- Constants for registers: ---------------------- + eax - SF_BACKGROUND_GET (39) ====================================================================== =========== Function 40 - set the mask for expected events. ========== ====================================================================== @@ -1812,7 +2026,8 @@ Remarks: * Event functions take into account the mask on moment of function call, not on moment of event arrival. - +---------------------- Constants for registers: ---------------------- + eax - SF_SET_EVENTS_MASK (40) ====================================================================== ================ Function 43 - input/output to a port. =============== ====================================================================== @@ -1841,7 +2056,8 @@ Remarks: processor instructions in/out - this is much faster and a bit shorter and easier. - +---------------------- Constants for registers: ---------------------- + eax - SF_PORT_IN_OUT (43) ====================================================================== ====== Function 46 - reserve/free a group of input/output ports. ===== ====================================================================== @@ -1874,6 +2090,8 @@ Remarks: * When a thread terminates, all reserved by it ports are freed automatically. +---------------------- Constants for registers: ---------------------- + eax - SF_SET_PORTS (46) ====================================================================== ============= Function 47 - draw a number in the window. ============= ====================================================================== @@ -1908,6 +2126,8 @@ Remarks: * Parameters of fonts are shown in the description of function 4 (text output). +---------------------- Constants for registers: ---------------------- + eax - SF_DRAW_NUMBER (47) ====================================================================== ========= Function 48, subfunction 0 - apply screen settings. ======== ====================================================================== @@ -1924,6 +2144,9 @@ Remarks: is ignored. * Function call with nonzero ecx is ignored. +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_APPLY (0) ====================================================================== =========== Function 48, subfunction 1 - set button style. =========== ====================================================================== @@ -1940,6 +2163,9 @@ Remarks: subfunction 0. * Button style influences only to their draw of function 8. +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_SET_BUTTON_STYLE (1) ====================================================================== ====== Function 48, subfunction 2 - set standard window colors. ====== ====================================================================== @@ -1963,6 +2189,9 @@ Remarks: * Color table can be viewed/changed interactively with the application 'desktop'. +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_SET_COLORS (2) ====================================================================== ====== Function 48, subfunction 3 - get standard window colors. ====== ====================================================================== @@ -2008,6 +2237,9 @@ Remarks: * Color table can be viewed/changed interactively with the application 'desktop'. +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_GET_COLORS (3) ====================================================================== ============ Function 48, subfunction 4 - get skin height. =========== ====================================================================== @@ -2022,6 +2254,9 @@ Remarks: * See also general structure of window in the description of function 0. +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_GET_SKIN_HEIGHT (4) ====================================================================== ======== Function 48, subfunction 5 - get screen working area. ======= ====================================================================== @@ -2044,6 +2279,9 @@ Remarks: to get sizes of all screen. * There is a pair function to set working area - subfunction 6. +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_GET_SCREEN_AREA (5) ====================================================================== ======== Function 48, subfunction 6 - set screen working area. ======= ====================================================================== @@ -2074,6 +2312,9 @@ Remarks: updating coordinates and sizes of maximized windows. The system sends to all windows redraw message (the event 1). +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_SET_SCREEN_AREA (6) ====================================================================== =========== Function 48, subfunction 7 - get skin margins. =========== ====================================================================== @@ -2092,6 +2333,9 @@ Remarks: (by function 4) or a substitute of header text (at the discretion of an application). +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_GET_SKIN_MARGINS (7) ====================================================================== ============= Function 48, subfunction 8 - set used skin. ============ ====================================================================== @@ -2112,6 +2356,9 @@ Remarks: * User can change the skin statically by creating hisself 'default.skn' or dynamically with the application 'desktop'. +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_SET_SKIN (8) ====================================================================== ====== Function 48, subfunction 9 - get font smoothing setting. ====== ====================================================================== @@ -2121,6 +2368,9 @@ Parameters: Returned value: * eax = 2 - subpixel, 1 - anti-aliasing, 0 - off +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_GET_FONT_SMOOTH (9) ====================================================================== ========== Function 48, subfunction 10 - set font smoothing. ========= ====================================================================== @@ -2129,6 +2379,9 @@ Parameters: * ebx = 10 - subfunction number * cl = 2 - subpixel, 1 - anti-aliasing, 0 - off +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_SET_FONT_SMOOTH (10) ====================================================================== ============ Function 48, subfunction 11 - get font size. ============ ====================================================================== @@ -2138,6 +2391,9 @@ Parameters: Returned value: * eax = current font height in pixels +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_GET_FONT_SIZE (11) ====================================================================== ============ Function 48, subfunction 12 - set font size. ============ ====================================================================== @@ -2146,6 +2402,9 @@ Parameters: * ebx = 10 - subfunction number * cl = new font height in pixels +---------------------- Constants for registers: ---------------------- + eax - SF_STYLE_SETTINGS (48) + ebx - SSF_SET_FONT_SIZE (12) ====================================================================== =========== Function 49 - Advanced Power Management (APM). =========== ====================================================================== @@ -2168,6 +2427,8 @@ Remarks: (http://www.pobox.com/~ralf/files.html, ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/). +---------------------- Constants for registers: ---------------------- + eax - SF_APM (49) ====================================================================== =================== Function 50 - set window shape. ================== ====================================================================== @@ -2214,6 +2475,8 @@ Remarks: * The call of subfunction 0 with NULL pointer results in return to the rectangular shape. +---------------------- Constants for registers: ---------------------- + eax - SF_SET_WINDOW_SHAPE (50) ====================================================================== ==================== Function 51 - create thread. ==================== ====================================================================== @@ -2225,8 +2488,9 @@ Parameters: Returned value: * eax = -1 - error (there is too many threads) * otherwise eax = TID - thread identifier - +---------------------- Constants for registers: ---------------------- + eax - SF_CREATE_THREAD (51) ====================================================================== ==================== Function 54, subfunction 0 ====================== ============== Get the number of slots in the clipboard. ============= @@ -2238,6 +2502,9 @@ Returned value: * eax = slots in the clipboard * eax = -1 - main list area not found +---------------------- Constants for registers: ---------------------- + eax - SF_CLIPBOARD (54) + ebx - SSF_GET_SLOT_COUNT (0) ====================================================================== ==================== Function 54, subfunction 1 ====================== ================= Read the data from the clipboard. ================== @@ -2251,6 +2518,9 @@ Returned value: * eax = 1 - error * eax = -1 - main list area not found +---------------------- Constants for registers: ---------------------- + eax - SF_CLIPBOARD (54) + ebx - SSF_READ_CB (1) ====================================================================== ==================== Function 54, subfunction 2 ====================== ================= Write the data to the clipboard. =================== @@ -2264,7 +2534,10 @@ Returned value: * eax = 0 - success * eax = 1 - error * eax = -1 - main list area not found - + +---------------------- Constants for registers: ---------------------- + eax - SF_CLIPBOARD (54) + ebx - SSF_WRITE_CB (2) ====================================================================== ===================== Function 54, subfunction 3 ===================== ================ Delete the last slot in the clipboard =============== @@ -2276,7 +2549,10 @@ Returned value: * eax = 0 - success * eax = 1 - error * eax = -1 - main list area not found - + +---------------------- Constants for registers: ---------------------- + eax - SF_CLIPBOARD (54) + ebx - SSF_DEL_SLOT (3) ====================================================================== ===================== Function 54, subfunction 4 ===================== ===================== Alarm reset the lock buffer ==================== @@ -2291,6 +2567,9 @@ Remarks: * Used in exceptional cases, where no responsible or killed application blocked the clipboard operations. +---------------------- Constants for registers: ---------------------- + eax - SF_CLIPBOARD (54) + ebx - SSF_UNLOCK_BUFFER (4) ====================================================================== Function 55, subfunction 55 - begin to play data on built-in speaker. ====================================================================== @@ -2324,6 +2603,8 @@ Remarks: * The data must be kept in the memory at least up to the end of play. +---------------------- Constants for registers: ---------------------- + eax - SF_SPEAKER_PLAY (55) ====================================================================== ======================= Function 57 - PCI BIOS. ====================== ====================================================================== @@ -2342,6 +2623,8 @@ Remarks: * If BIOS does not support this extension, its behavior is emulated (through kernel-mode analogues of subfunctions of function 62). +---------------------- Constants for registers: ---------------------- + eax - SF_PCI_BIOS (57) ====================================================================== ========== Function 60 - Inter Process Communication (IPC). ========== ====================================================================== @@ -2391,6 +2674,9 @@ Remarks: * Immediately after writing of IPC-message to the buffer the system sends to the receiver the event with code 7 (see event codes). +---------------------- Constants for registers: ---------------------- + eax - SF_IPC (60) + ebx - SSF_SET_AREA (1), SSF_SEND_MESSAGE (2) ====================================================================== ==== Function 61 - get parameters for the direct graphics access. ==== ====================================================================== @@ -2450,6 +2736,10 @@ Returned value: * eax = number of bytes occupied by one scanline (horizontal line on the screen) +---------------------- Constants for registers: ---------------------- + eax - SF_GET_GRAPHICAL_PARAMS (61) + ebx - SSF_SCREEN_SIZE (1), SSF_BITS_PER_PIXEL (2), + SSF_BYTES_PER_LINE (3) ====================================================================== ===== Function 62, subfunction 0 - get version of PCI-interface. ===== ====================================================================== @@ -2465,6 +2755,9 @@ Remarks: enabled by subfunction 12 of function 21. * If PCI BIOS is not supported, the value of ax is undefined. +---------------------- Constants for registers: ---------------------- + eax - SF_PCI (62) + ebx - SSF_GET_VERSION (0) ====================================================================== ==== Function 62, subfunction 1 - get number of the last PCI-bus. ==== ====================================================================== @@ -2479,6 +2772,9 @@ Remarks: enabled by subfunction 12 of function 21. * If PCI BIOS is not supported, the value of ax is undefined. +---------------------- Constants for registers: ---------------------- + eax - SF_PCI (62) + ebx - SSF_GET_LAST_BUS (1) ====================================================================== ===================== Function 62, subfunction 2 ===================== ===== Get mechanism of addressing to the PCI configuration space. ==== @@ -2497,6 +2793,9 @@ Remarks: * Subfunctions of read and write work automatically with the selected mechanism. +---------------------- Constants for registers: ---------------------- + eax - SF_PCI (62) + ebx - SSF_GET_ADRR_MODE (2) ====================================================================== ======== Function 62, subfunctions 4,5,6 - read PCI-register. ======== ====================================================================== @@ -2529,6 +2828,9 @@ Remarks: registers of the second type must be listed in the device documentation. +---------------------- Constants for registers: ---------------------- + eax - SF_PCI (62) + ebx - SSF_READ_BYTE (4), SSF_READ_WORD (5), SSF_READ_DWORD (6) ====================================================================== ====== Function 62, subfunctions 8,9,10 - write to PCI-register. ===== ====================================================================== @@ -2559,6 +2861,9 @@ Remarks: Ralf Brown; registers of the second type must be listed in the device documentation. +---------------------- Constants for registers: ---------------------- + eax - SF_PCI (62) + ebx - SSF_WRITE_BYTE (8), SSF_WRITE_WORD (9), SSF_WRITE_DWORD (10) ====================================================================== ============== Function 63 - work with the debug board. ============== ====================================================================== @@ -2604,6 +2909,9 @@ Returned value: * eax = ebx = 0 - the buffer is empty * eax = byte, ebx = 1 - byte was successfully read +---------------------- Constants for registers: ---------------------- + eax - SF_BOARD (63) + ebx - SSF_DEBUG_WRITE (1), SSF_DEBUG_READ (2) ====================================================================== ============== Function 64 - resize application memory. ============== ====================================================================== @@ -2621,6 +2929,8 @@ Remarks: The function call will be ignored after creation of process heap with function 68.11. +---------------------- Constants for registers: ---------------------- + eax - SF_MEMORY_RESIZE (64) ====================================================================== ======== Function 65 - draw image with palette in the window. ======== ====================================================================== @@ -2665,6 +2975,8 @@ Remarks: * The call to function 7 is equivalent to call to this function with esi=24, ebp=0. +---------------------- Constants for registers: ---------------------- + eax - SF_PUT_IMAGE_EXT (65) ====================================================================== ================== Function 66 - work with keyboard. ================= ====================================================================== @@ -2773,6 +3085,11 @@ Remarks: * Unlocking the results of the f. 66.6 * To emulate a mouse via the keyboard, the application MOUSEMUL +---------------------- Constants for registers: ---------------------- + eax - SF_KEYBOARD (66) + ebx - SSF_SET_INPUT_MODE (1), SSF_GET_INPUT_MODE (2), + SSF_GET_CONTROL_KEYS (3), SSF_SET_SYS_HOTKEY (4), + SSF_DEL_SYS_HOTKEY (5), SSF_LOCK_INPUT (6), SSF_UNLOCK_INPUT (7) ====================================================================== ========= Function 67 - change position/sizes of the window. ========= ====================================================================== @@ -2797,6 +3114,8 @@ Remarks: call to function 9. * The function sends to the window redraw event (with the code 1). +---------------------- Constants for registers: ---------------------- + eax - SF_CHANGE_WINDOW (67) ====================================================================== ====== Function 68, subfunction 0 - get the task switch counter. ===== ====================================================================== @@ -2807,6 +3126,9 @@ Returned value: * eax = number of task switches from the system booting (modulo 2^32) +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_GET_TASK_SWITCH_COUNT (0) ====================================================================== ======= Function 68, subfunction 1 - switch to the next thread. ====== ====================================================================== @@ -2820,6 +3142,9 @@ Parameters: Returned value: * function does not return value +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_SWITCH_TASK (1) ====================================================================== ============= Function 68, subfunction 2 - cache + rdpmc. ============ ====================================================================== @@ -2842,6 +3167,11 @@ Returned value: * for ecx=2 and ecx=3: * function does not return value +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_PERFORMANCE (2) + ecx - SSSF_ALLOW_RDPMC (0), SSSF_CACHE_STATUS (1), + SSSF_CACHE_ON (2), SSSF_CACHE_OFF (3) ====================================================================== =========== Function 68, subfunction 3 - read MSR-register. ========== ====================================================================== @@ -2866,6 +3196,9 @@ Remarks: will generate other exception in the kernel, which will anyway kill the thread. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_READ_MSR (3) ====================================================================== ========= Function 68, subfunction 4 - write to MSR-register. ======== ====================================================================== @@ -2891,6 +3224,9 @@ Remarks: will generate other exception in the kernel, which will anyway kill the thread. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_WRITE_MSR (4) ====================================================================== ======= Function 68, subfunction 11 - initialize process heap. ======= ====================================================================== @@ -2908,6 +3244,9 @@ Remarks: returning the size of the existing heap. * After creation of the heap calls to function 64 will be ignored. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_HEAP_INIT (11) ====================================================================== ======== Function 68, subfunction 12 - allocate memory block. ======== ====================================================================== @@ -2924,6 +3263,9 @@ Remarks: way that the real size of allocated block is more than or equal to requested size. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_MEM_ALLOC (12) ====================================================================== ========== Function 68, subfunction 13 - free memory block. ========== ====================================================================== @@ -2938,6 +3280,9 @@ Remarks: * The memory block must have been allocated by subfunction 12 or subfunction 20. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_MEM_FREE (13) ====================================================================== ===================== Function 68, subfunction 14 ==================== ============ Wait for signal from another program/driver. ============ @@ -2952,6 +3297,9 @@ Returned value: * +4: dword: data of signal (20 bytes), format of which is defined by the first dword +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_WAIT_SIGNAL (14) ====================================================================== ============= Function 68, subfunction 16 - load driver. ============= ====================================================================== @@ -2970,6 +3318,9 @@ Remarks: terminating null character, the rest is ignored. * Driver ABC is loaded from file /rd/1/drivers/ABC.obj. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_LOAD_DRIVER (16) ====================================================================== ============ Function 68, subfunction 17 - driver control. =========== ====================================================================== @@ -2990,6 +3341,9 @@ Remarks: are defined by driver. * Previously one must obtain driver handle by subfunction 16. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_CONTROL_DRIVER (17) ====================================================================== =============== Function 68, subfunction 19 - load DLL. ============== ====================================================================== @@ -3005,6 +3359,9 @@ Remarks: by zero. The first dword in structure points to function name, the second dword contains address of function. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_LOAD_DLL (19) ====================================================================== ======= Function 68, subfunction 20 - reallocate memory block. ======= ====================================================================== @@ -3028,6 +3385,9 @@ Remarks: * The contents of the block are unchanged up to the shorter of the new and old sizes. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_MEM_REALLOC (20) ====================================================================== =========== Function 68, subfunction 21 - load driver PE. ============ ====================================================================== @@ -3043,6 +3403,9 @@ Remarks: * If the driver was not loaded yet, it is loaded; if the driver was loaded yet, nothing happens. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_LOAD_DRIVER_PE (21) ====================================================================== ======== Function 68, subfunction 22 - open named memory area. ======= ====================================================================== @@ -3081,6 +3444,9 @@ Remarks: with denied rights will fail with error code E_ACCESS. * The process which has created an area always has write access. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_MEM_OPEN (22) ====================================================================== ======= Function 68, subfunction 23 - close named memory area. ======= ====================================================================== @@ -3096,6 +3462,9 @@ Remarks: this area will close it. * When thread is terminating, all opened by it areas are closed. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_MEM_CLOSE (23) ====================================================================== ======== Function 68, subfunction 24 - set exception handler. ======== ====================================================================== @@ -3128,6 +3497,9 @@ Remarks: Also user handler is responsible for clearing exceptions flags in FPU and/or SSE. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_SET_EXCEPTION_HANDLER (24) ====================================================================== ======== Function 68, subfunction 25 - set exception activity ======== ====================================================================== @@ -3144,6 +3516,9 @@ Remarks: which has been previously set by subfunction 24, is changed. Signal number corresponds to exception number. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_SET_EXCEPTION_STATE (25) ====================================================================== ====== Function 68, subfunction 26 - release memory pages ============ ====================================================================== @@ -3157,6 +3532,9 @@ Remarks: * function release range of pages from ecx+edx to ecx+edx+esi and set virtual memory into reserved state. +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_MEM_FREE_EXT (26) ====================================================================== ========== Function 68, subfunction 27 - load file =================== ====================================================================== @@ -3170,6 +3548,9 @@ Returned value: Remarks: * function loads file and unpacks, if necessary +---------------------- Constants for registers: ---------------------- + eax - SF_SYS_MISC (68) + ebx - SSF_LOAD_FILE (27) ====================================================================== ====================== Function 69 - debugging. ====================== ====================================================================== @@ -3216,6 +3597,12 @@ The full list of subfunctions: * subfunction 8 - terminate debugged thread * subfunction 9 - set/clear hardware breakpoint +---------------------- Constants for registers: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_SET_MESSAGE_AREA (0), SSF_GET_REGISTERS (1), + SSF_SET_REGISTERS (2), SSF_DETACH (3), SSF_SUSPEND (4), + SSF_RESUME (5), SSF_READ_MEMORY (6), SSF_WRITE_MEMORY (7), + SSF_TERMINATE (8), SSF_DEFINE_BREAKPOINT (9) ====================================================================== = Function 69, subfunction 0 - define data area fror debug messages. = ====================================================================== @@ -3239,6 +3626,9 @@ Remarks: length - messages. Format of a message is explained in general description. +---------------------- Constants for registers: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_SET_MESSAGE_AREA (0) ====================================================================== ===================== Function 69, subfunction 1 ===================== ============ Get contents of registers of debugged thread. =========== @@ -3268,6 +3658,9 @@ Remarks: * Process must be loaded for debugging (as is shown in general description). +---------------------- Constants for registers: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_GET_REGISTERS (1) ====================================================================== ===================== Function 69, subfunction 2 ===================== ============ Set contents of registers of debugged thread. =========== @@ -3287,6 +3680,9 @@ Remarks: * Process must be loaded for debugging (as is shown in general description). +---------------------- Constants for registers: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_SET_REGISTERS (2) ====================================================================== ===== Function 69, subfunction 3 - detach from debugged process. ===== ====================================================================== @@ -3299,6 +3695,9 @@ Returned value: Remarks: * If the process was suspended, it resumes execution. +---------------------- Constants for registers: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_DETACH (3) ====================================================================== ======== Function 69, subfunction 4 - suspend debugged thread. ======= ====================================================================== @@ -3312,6 +3711,9 @@ Remarks: * Process must be loaded for debugging (as is shown in general description). +---------------------- Constants for registers: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_SUSPEND (4) ====================================================================== ======== Function 69, subfunction 5 - resume debugged thread. ======== ====================================================================== @@ -3325,6 +3727,9 @@ Remarks: * Process must be loaded for debugging (as is shown in general description). +---------------------- Constants for registers: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_RESUME (5) ====================================================================== = Fucntion 69, subfunction 6 - read from memory of debugged process. = ====================================================================== @@ -3343,6 +3748,9 @@ Remarks: * Process must be loaded for debugging (as is shown in general description). +---------------------- Constants for registers: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_READ_MEMORY (6) ====================================================================== == Function 69, subfunction 7 - write to memory of debugged process. = ====================================================================== @@ -3361,6 +3769,9 @@ Remarks: * Process must be loaded for debugging (as is shown in general description). +---------------------- Constants for registers: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_WRITE_MEMORY (7) ====================================================================== ======= Function 69, subfunction 8 - terminate debugged thread. ====== ====================================================================== @@ -3377,6 +3788,9 @@ Remarks: with two differences: it requires first remark and accepts PID rather than slot number. +---------------------- Constants for registers: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_TERMINATE (8) ====================================================================== ===== Function 69, subfunction 9 - set/clear hardware breakpoint. ==== ====================================================================== @@ -3418,6 +3832,9 @@ Remarks: * Breakpoints on write and read/write act after execution of the caused it instruction. +---------------------- Constants for registers: ---------------------- + eax - SF_DEBUG (69) + ebx - SSF_DEFINE_BREAKPOINT (9) ====================================================================== ==== Function 70 - work with file system with long names support. ==== ====================================================================== @@ -3486,6 +3903,12 @@ At the first call of subfunctions 0,1,5,7 to ATAPI devices drive data. Unlocking is made when subfunction 4 of function 24 is called for corresponding device. +---------------------- Constants for registers: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_READ_FILE (0), SSF_READ_FOLDER (1), SSF_CREATE_FILE (2), + SSF_WRITE_FILE (3), SSF_SET_END (4), SSF_GET_INFO (5), + SSF_SET_INFO (6), SSF_START_APP (7), SSF_DELETE (8), + SSF_CREATE_FOLDER (9) ====================================================================== === Function 70, subfunction 0 - read file with long names support. == ====================================================================== @@ -3513,6 +3936,9 @@ Remarks: * The function does not allow to read folder (returns eax=10, access denied). +---------------------- Constants for registers: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_READ_FILE (0) ====================================================================== == Function 70, subfunction 1 - read folder with long names support. = ====================================================================== @@ -3610,6 +4036,9 @@ Remarks: and times and dates are zeroed. An alternative way to get the equipment information - subfunction 11 of function 18. +---------------------- Constants for registers: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_READ_FOLDER (1) ====================================================================== ===================== Function 70, subfunction 2 ===================== ============ Create/rewrite file with long names support. ============ @@ -3638,6 +4067,9 @@ Remarks: write as many as can and then return error code 8. * The function is not supported for CD (returns error code 2). +---------------------- Constants for registers: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_CREATE_FILE (2) ====================================================================== ===================== Function 70, subfunction 3 ===================== =========== Write to existing file with long names support. ========== @@ -3668,6 +4100,9 @@ Remarks: size with zero characters. * The function is not supported for CD (returns error code 2). +---------------------- Constants for registers: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_WRITE_FILE (3) ====================================================================== ============ Function 70, subfunction 4 - set end of file. =========== ====================================================================== @@ -3699,6 +4134,9 @@ Remarks: error code 8. * The function is not supported for CD (returns error code 2). +---------------------- Constants for registers: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_SET_END (4) ====================================================================== ==== Function 70, subfunction 5 - get information on file/folder. ==== ====================================================================== @@ -3727,6 +4165,9 @@ Remarks: * The function does not support virtual folders such as /, /rd and root folders like /rd/1. +---------------------- Constants for registers: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_GET_INFO (5) ====================================================================== ===== Function 70, subfunction 6 - set attributes of file/folder. ==== ====================================================================== @@ -3757,6 +4198,9 @@ Remarks: root folders like /rd/1. * The function is not supported for CD (returns error code 2). +---------------------- Constants for registers: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_SET_INFO (6) ====================================================================== =========== Function 70, subfunction 7 - start application. ========== ====================================================================== @@ -3789,6 +4233,9 @@ Remarks: * If the process is started as debugged, it is created in the suspended state; to run use subfunction 5 of function 69. +---------------------- Constants for registers: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_START_APP (7) ====================================================================== ========== Function 70, subfunction 8 - delete file/folder. ========== ====================================================================== @@ -3814,6 +4261,9 @@ Remarks: * The function can delete only empty folders (attempt to delete nonempty folder results in error with code 10, "access denied"). +---------------------- Constants for registers: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_DELETE (8) ====================================================================== ============= Function 70, subfunction 9 - create folder. ============ ====================================================================== @@ -3839,6 +4289,9 @@ Remarks: * The parent folder must already exist. * If target folder already exists, function returns success (eax=0). +---------------------- Constants for registers: ---------------------- + eax - SF_FILE (70) + [ebx] - SSF_CREATE_FOLDER (9) ====================================================================== ========== Function 71, subfunction 1 - set window caption. ========== ====================================================================== @@ -3857,6 +4310,8 @@ Remarks: otherwise will be used cp866. * Pass NULL in ecx to remove caption. +---------------------- Constants for registers: ---------------------- + eax - SF_SET_CAPTION (71) ====================================================================== =============== Function 72 - send message to a window. ============== ====================================================================== @@ -3871,6 +4326,8 @@ Returned value: * eax = 0 - success * eax = 1 - buffer is full +---------------------- Constants for registers: ---------------------- + eax - SF_SEND_MESSAGE (72) ====================================================================== ===================== Function 73 - blit bitmap ===================== ====================================================================== @@ -3910,6 +4367,8 @@ Parameters: Returned value: * function does not return value +---------------------- Constants for registers: ---------------------- + eax - SF_BLITTER (73) ====================================================================== = Function 74, Subfunction 255, Get number of active network devices. = ====================================================================== @@ -3919,6 +4378,9 @@ Parameters: Returned value: * eax = number of active network devices +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_DEVICE_COUNT (255) ====================================================================== ======== Function 74, Subfunction 0, Get network device type. ======== ====================================================================== @@ -3929,6 +4391,9 @@ Parameters: Returned value: * eax = device type number +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_DEVICE_TYPE (0) ====================================================================== ======== Function 74, Subfunction 1, Get network device name. ======== ====================================================================== @@ -3941,6 +4406,9 @@ Returned value: * eax = -1 on error * The network device name is written into the buffer, on success +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_DEVICE_NAME (1) ====================================================================== ========= Function 74, Subfunction 2, Reset network device. ========== ====================================================================== @@ -3951,6 +4419,9 @@ Parameters: Returned value: * eax = -1 on error +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_RESET_DEVICE (2) ====================================================================== ========== Function 74, Subfunction 3, Stop network device. ========== ====================================================================== @@ -3961,6 +4432,9 @@ Parameters: Returned value: * eax = -1 on error +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_STOP_DEVICE (3) ====================================================================== =========== Function 74, Subfunction 4, Get device pointer. ========== ====================================================================== @@ -3971,6 +4445,9 @@ Parameters: Returned value: * eax = device pointer, -1 on error +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_DEVICE_POINER (4) ====================================================================== ========= Function 74, Subfunction 6, Get packet TX counter. ========= ====================================================================== @@ -3981,6 +4458,9 @@ Parameters: Returned value: * eax = Number of packets sent since device start, -1 on error +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_TX_PACKET_COUNT (6) ====================================================================== ========= Function 74, Subfunction 7, Get packet RX counter. ========= ====================================================================== @@ -3991,6 +4471,9 @@ Parameters: Returned value: * eax = Number of packets received since device start, -1 on error +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_RX_PACKET_COUNT (7) ====================================================================== ========== Function 74, Subfunction 8, Get TX byte counter. ========== ====================================================================== @@ -4003,6 +4486,9 @@ Returned value: -1 on error * ebx = Number of bytes sent since device start (higher dword) +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_TX_BYTE_COUNT (8) ====================================================================== ========== Function 74, Subfunction 9, Get RX byte counter. ========== ====================================================================== @@ -4015,6 +4501,9 @@ Returned value: -1 on error * ebx = Number of bytes received since device start (higher dword) +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_RX_BYTE_COUNT (9) ====================================================================== ========== Function 74, Subfunction 10, Get link status. ============= ====================================================================== @@ -4033,6 +4522,9 @@ Returned value: ETH_LINK_100M = 1000b ; 100 mbit ETH_LINK_1G = 1100b ; gigabit +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_GET (74) + bl - SSF_LINK_STATUS (10) ====================================================================== ============== Function 75, Subfunction 0, Open socket. ============== ====================================================================== @@ -4046,6 +4538,9 @@ Returned value: * eax = socket number, -1 on error * ebx = errorcode +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_OPEN (0) ====================================================================== ============= Function 75, Subfunction 1, Close socket. ============== ====================================================================== @@ -4057,6 +4552,9 @@ Returned value: * eax = -1 on error * ebx = errorcode +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_CLOSE (1) ====================================================================== ================== Function 75, Subfunction 2, Bind. ================= ====================================================================== @@ -4070,6 +4568,9 @@ Returned value: * eax = -1 on error * ebx = errorcode +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_BIND (2) ====================================================================== ================= Function 75, Subfunction 3, Listen. ================ ====================================================================== @@ -4082,6 +4583,9 @@ Returned value: * eax = -1 on error * ebx = errorcode +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_LISTEN (3) ====================================================================== ================ Function 75, Subfunction 4, Connect. ================ ====================================================================== @@ -4095,6 +4599,9 @@ Returned value: * eax = -1 on error * ebx = errorcode +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_CONNECT (4) ====================================================================== ================= Function 75, Subfunction 5, Accept. ================ ====================================================================== @@ -4108,6 +4615,9 @@ Returned value: * eax = socket number of accepted socket, -1 on error * ebx = errorcode +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_ACCEPT (5) ====================================================================== ================== Function 75, Subfunction 6, Send. ================= ====================================================================== @@ -4122,6 +4632,9 @@ Returned value: * eax = number of bytes copied, -1 on error * ebx = errorcode +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_SEND (6) ====================================================================== ================ Function 75, Subfunction 7, Receive. ================ ====================================================================== @@ -4136,6 +4649,9 @@ Returned value: * eax = number of bytes copied, -1 on error * ebx = errorcode +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_RECEIVE (7) ====================================================================== =========== Function 75, Subfunction 8, Set socket options. ========== ====================================================================== @@ -4149,12 +4665,15 @@ Returned value: * ebx = errorcode Remarks: - Optstruct: + Optstruct: dd level dd optionname dd optlength db options... +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_SET_OPTIONS (8) ====================================================================== =========== Function 75, Subfunction 9, Get socket options. ========== ====================================================================== @@ -4168,12 +4687,15 @@ Returned value: * ebx = errorcode Remarks: - Optstruct: + Optstruct: dd level dd optionname dd optlength db options... +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_GET_OPTIONS (9) ====================================================================== ============ Function 75, Subfunction 10, Get socketpair. =========== ====================================================================== @@ -4183,7 +4705,10 @@ Parameters: Returned value: * eax = socketnum1, -1 on error * ebx = socketnum2, errorcode on error - + +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_SOCKET (75) + bl - SSF_GET_PAIR (10) ====================================================================== ============ Function 76, Network options and statistics. ============ ====================================================================== @@ -4195,9 +4720,9 @@ Parameters: Ethernet (0) 0 - Read MAC - + IPv4 (1) - 0 - Read # IP packets send + 0 - Read # IP packets sent 1 - Read # IP packets received 2 - Read IP 3 - Write IP @@ -4207,29 +4732,75 @@ IPv4 (1) 7 - Write subnet 8 - Read gateway 9 - Write gateway - + ICMP (2) - 0 - Read # ICMP packets send + 0 - Read # ICMP packets sent 1 - Read # ICMP packets received 3 - enable/disable ICMP echo reply UDP (3) - 0 - Read # UDP packets send + 0 - Read # UDP packets sent 1 - Read # UDP packets received TCP (4) - 0 - Read # TCP packets send - 1 - Read # TCP packets received - + 0 - Read # TCP packets sent + 1 - Read # TCP packets received + ARP (5) - 0 - Read # ARP packets send + 0 - Read # ARP packets sent 1 - Read # ARP packets received 2 - Read # ARP entry's 3 - Read ARP entry 4 - Add static ARP entry 5 - Remove ARP entry (-1 = remove all) 6 - Send ARP announce on specified interface - 7 - Read # ARP conflicts (IP address conflicts) + 7 - Read # ARP conflicts (IP address conflicts) + +---------------------- Constants for registers: ---------------------- + eax - SF_NETWORK_PROTOCOL (76) + +====================================================================== +========== Function 77, Subfunction 0, Create futex object =========== +====================================================================== +Parameters: + * eax = 77 - function number + * ebx = 0 - subfunction number + * ecx = pointer to futex dword +Returned value: + * eax = futex handle, 0 on error +Remarks: + * Use subfunction 1 to destroy the futex. + The kernel destroys the futexes automatically when the process + terminates. +====================================================================== +========= Function 77, Subfunction 1, Destroy futex object =========== +====================================================================== +Parameters: + * eax = 77 - function number + * ebx = 1 - subfunction number + * ecx = futex handle +Returned value: + * eax = 0 - successfull, -1 on error +Remarks: + * The futex handle must have been created by subfunction 0 + +====================================================================== +=============== Function 77, Subfunction 2, Futex wait =============== +====================================================================== +Parameters: + * eax = 77 - function number + * ebx = 2 - subfunction number + * ecx = futex handle + * edx = control value + * esi = timeout in system ticks or 0 for infinity +Returned value: + * eax = 0 - successfull, -1 on timeout + +Remarks: + * This operation tests that the value at the futex dword still + contains the expected control value, and if so, then sleeps + waiting for a wake operation on the futex. + * The futex handle must have been created by subfunction 0 ====================================================================== =============== Function -1 - terminate thread/process =============== diff --git a/kernel/branches/Kolibri-acpi/fs/fat.inc b/kernel/branches/Kolibri-acpi/fs/fat.inc index 8836e37ff6..a8d2dc4c17 100644 --- a/kernel/branches/Kolibri-acpi/fs/fat.inc +++ b/kernel/branches/Kolibri-acpi/fs/fat.inc @@ -1808,6 +1808,8 @@ fat_Read: mov ebx, [ebx+16] ; buffer push ebx push 0 + test ecx, ecx + jz .done mov eax, [edi+28] sub eax, edx jb .fileEnd @@ -1920,7 +1922,7 @@ fat_Read: jnz .noaccess3 pop ecx xor edx, edx - jcxz .done + jecxz .done jmp .alignedCluster .readEnd: add ecx, edi diff --git a/kernel/branches/Kolibri-acpi/fs/fs_lfn.inc b/kernel/branches/Kolibri-acpi/fs/fs_lfn.inc index ec9730d07c..619dd0e4aa 100644 --- a/kernel/branches/Kolibri-acpi/fs/fs_lfn.inc +++ b/kernel/branches/Kolibri-acpi/fs/fs_lfn.inc @@ -20,6 +20,7 @@ ERROR_FAT_TABLE = 9 ;deprecated ERROR_FS_FAIL = 9 ERROR_ACCESS_DENIED = 10 ERROR_DEVICE = 11 +ERROR_OUT_OF_MEMORY = 12 image_of_eax EQU esp+32 image_of_ebx EQU esp+20 diff --git a/kernel/branches/Kolibri-acpi/fs/ntfs.inc b/kernel/branches/Kolibri-acpi/fs/ntfs.inc index 26fff1cf68..6d9a6ab0a4 100644 --- a/kernel/branches/Kolibri-acpi/fs/ntfs.inc +++ b/kernel/branches/Kolibri-acpi/fs/ntfs.inc @@ -37,6 +37,8 @@ attributeOffset = 14h recordFlags = 16h recordRealSize = 18h recordAllocatedSize = 1ch +baseRecordReference = 20h ; for auxiliary records +baseRecordReuse = 26h newAttributeID = 28h ; attribute header attributeType = 0 @@ -44,9 +46,10 @@ sizeWithHeader = 4 nonResidentFlag = 8 nameLength = 9 nameOffset = 10 +attributeFlags = 12 attributeID = 14 sizeWithoutHeader = 16 -attributeFlags = 16h +indexedFlag = 16h ; non resident attribute header lastVCN = 18h dataRunsOffset = 20h @@ -111,8 +114,8 @@ fileRealSize dd ? ; in bytes indexOffset dd ? nodeLastRead dd ? ntfs_bCanContinue db ? -ntfsNotFound db ? ntfsFolder db ? +ntfsWriteAttr db ? ; Warning: Don't forget to turn off!!! ntfsFragmentCount db ? cur_subnode_size dd ? @@ -143,7 +146,7 @@ ntfs_user_functions: dd ntfs_ReadFile dd ntfs_ReadFolder dd ntfs_CreateFile - dd ntfs_Write + dd ntfs_WriteFile dd ntfs_SetFileEnd dd ntfs_GetFileInfo dd ntfs_SetFileInfo @@ -270,13 +273,10 @@ ntfs_create_partition: mov dword [eax+NTFS.FirstSector], ecx mov ecx, dword [ebp+PARTITION.FirstSector+4] mov dword [eax+NTFS.FirstSector+4], ecx - mov ecx, dword [ebp+PARTITION.Length] - mov dword [eax+NTFS.Length], ecx - mov ecx, dword [ebp+PARTITION.Length+4] - mov dword [eax+NTFS.Length+4], ecx mov ecx, [ebp+PARTITION.Disk] mov [eax+NTFS.Disk], ecx mov [eax+NTFS.FSUserFunctions], ntfs_user_functions + mov [eax+NTFS.ntfsWriteAttr], 0 push ebx ebp esi mov ebp, eax @@ -544,6 +544,7 @@ ntfs_read_frs_sector: ret ntfs_read_attr: +; [ebp+NTFS.ntfsWriteAttr]=1 -> write attribute ; in: ; [ebp+NTFS.ntfs_cur_iRecord] = number of fileRecord ; [ebp+NTFS.ntfs_cur_attr] = attribute type @@ -992,6 +993,18 @@ ntfs_read_attr: sub eax, [ecx+10h] ; first_vbo jb .okret ; eax = cluster, edx = starting sector + cmp [ebp+NTFS.ntfs_cur_attr], 0x80 + jnz .sys + cmp [ebp+NTFS.ntfs_cur_iRecord], 0 + jz .sys + push fs_read64_app + cmp [ebp+NTFS.ntfsWriteAttr], 1 + jnz @f + mov dword[esp], fs_write64_app + jmp @f +.sys: + push fs_read64_sys +@@: sub esp, 10h movzx esi, word [ecx+20h] ; mcb_info_ofs add esi, ecx @@ -1021,15 +1034,7 @@ ntfs_read_attr: mov [ebp+NTFS.ntfsLastRead], eax push ecx xor edx, edx - cmp [ebp+NTFS.ntfs_cur_attr], 0x80 - jnz .sys - cmp [ebp+NTFS.ntfs_cur_iRecord], 0 - jz .sys - call fs_read64_app - jmp .appsys -.sys: - call fs_read64_sys -.appsys: + call dword[esp+18h] pop ecx test eax, eax jnz .errread2 @@ -1044,7 +1049,7 @@ ntfs_read_attr: xor edx, edx cmp [ebp+NTFS.ntfs_cur_size], 0 jnz .readloop - add esp, 10h + add esp, 14h mov eax, [ebp+NTFS.ntfs_cur_tail] test eax, eax jz @f @@ -1055,11 +1060,11 @@ ntfs_read_attr: ret .errread2: pop ecx - add esp, 10h + add esp, 14h stc ret .break: - add esp, 10h ; CF=0 + add esp, 14h ; CF=0 mov [ebp+NTFS.ntfs_bCanContinue], 1 ret @@ -1157,6 +1162,14 @@ ntfs_restore_usa: ret ntfs_decode_mcb_entry: +; in: +; esi -> mcb entry +; esp -> buffer (16 bytes) +; out: +; esi -> next mcb entry +; esp -> data run size +; esp+8 -> cluster (delta) +; CF=0 -> mcb end push eax ecx edi lea edi, [esp+16] xor eax, eax @@ -1211,8 +1224,8 @@ ntfs_find_lfn: ; in: [esi]+[esp+4] = name ; out: ; [ebp+NTFS.ntfs_cur_iRecord] = number of MFT fileRecord -; eax = pointer in parent index node -; CF=1 -> file not found (or just error) +; eax -> index in the parent index node +; CF=1 -> file not found, eax=0 -> error mov [ebp+NTFS.ntfs_cur_iRecord], 5 ; start parse from root cluster .doit2: mov [ebp+NTFS.ntfs_cur_attr], 0x90 ; $INDEX_ROOT @@ -1222,11 +1235,11 @@ ntfs_find_lfn: mov eax, [ebp+NTFS.cur_index_buf] mov [ebp+NTFS.ntfs_cur_buf], eax call ntfs_read_attr + mov eax, 0 jnc @f .ret: ret 4 @@: - xor eax, eax cmp [ebp+NTFS.ntfs_cur_read], 0x20 jc .ret pushad @@ -1345,7 +1358,6 @@ ntfs_find_lfn: add esi, 0x18 jmp .scanloop .notfound: - mov [ebp+NTFS.ntfsNotFound], 1 mov [esp+1Ch], esi .err: popad @@ -1470,7 +1482,6 @@ ntfs_ReadFile: adc edx, 0 shrd eax, edx, 9 pop edx -.zero1: mov [ebp+NTFS.ntfs_cur_offs], eax mov [ebp+NTFS.ntfs_cur_buf], edx mov eax, ecx @@ -1550,7 +1561,7 @@ ntfs_ReadFolder: test eax, eax jz .notfound or ebx, -1 - push 11 + push ERROR_DEVICE jmp .pop_ret .ok: cmp [ebp+NTFS.ntfs_cur_read], 0x20 @@ -1587,7 +1598,7 @@ ntfs_ReadFolder: call ntfs_unlock popad or ebx, -1 - movi eax, 12 + movi eax, ERROR_OUT_OF_MEMORY ret @@: mov [ebp+NTFS.cur_index_buf], eax @@ -1976,42 +1987,64 @@ ntfs_datetime_to_bdfe: ntfs_CreateFolder: mov [ebp+NTFS.ntfsFolder], 1 jmp @f + ntfs_CreateFile: mov [ebp+NTFS.ntfsFolder], 0 @@: cmp byte [esi], 0 jnz @f xor ebx, ebx - movi eax, ERROR_ACCESS_DENIED ; root directory itself + movi eax, ERROR_ACCESS_DENIED ret @@: ; 1. Search file call ntfs_lock - mov [ebp+NTFS.ntfsNotFound], 0 stdcall ntfs_find_lfn, [esp+4] - jnc @f ; found; rewrite + jnc .found cmp [ebp+NTFS.ntfsFragmentCount], 1 - jnz @f ; record fragmented - cmp [ebp+NTFS.ntfsNotFound], 1 - jz .notFound - push ERROR_FS_FAIL - jmp ntfsError -@@: - push ERROR_UNSUPPORTED_FS - jmp ntfsError -.notFound: ; create; check name + jnz ntfsUnsupported ; record fragmented + test eax, eax + jz ntfsFail + jmp .notFound + +.found: ; rewrite + cmp [ebp+NTFS.ntfs_cur_iRecord], 16 + jc ntfsDenied + cmp [ebp+NTFS.ntfsFolder], 1 + jz ntfsDenied + mov [ebp+NTFS.ntfs_cur_attr], 0x80 + mov [ebp+NTFS.ntfs_cur_offs], 0 + mov [ebp+NTFS.ntfs_cur_size], 0 + call ntfs_read_attr + jc ntfsDenied + mov eax, [ebp+NTFS.frs_buffer] + cmp word [eax+baseRecordReuse], 0 + jnz ntfsUnsupported ; auxiliary record + cmp byte [eax+hardLinkCounter], 1 + jnz ntfsUnsupported ; file copying required + mov ecx, [ebp+NTFS.ntfs_attr_offs] + cmp byte [ecx+nonResidentFlag], 1 + jnz ntfsUnsupported ; resident $DATA + mov eax, [ebx+4] + mov edx, [ebx+8] + add eax, [ebx+12] + adc edx, 0 + cmp edx, [ecx+attributeRealSize+4] + jnz ntfsUnsupported + cmp [ecx+attributeRealSize], eax + jnz ntfsUnsupported + jmp ntfs_WriteFile.write + +.notFound: ; create; check path folders cmp dword [esp+4], 0 - jnz .bad + jnz ntfsNotFound cmp byte [esi], 0 - jnz @f -.bad: ; path folder not found - push ERROR_FILE_NOT_FOUND - jmp ntfsError -@@: ; 2. Prepair directory record + jz ntfsNotFound +; 2. Prepare directory record mov ecx, esi @@: ; count characters inc ecx cmp byte [ecx], '/' - jz .bad + jz ntfsNotFound cmp byte [ecx], 0 jnz @b sub ecx, esi @@ -2022,16 +2055,15 @@ ntfs_CreateFile: mov edi, [ebp+NTFS.cur_index_buf] push esi push ecx - cmp dword [edi], 'INDX' ; where are we? + cmp dword [edi], 'INDX' jz .indexRecord - mov esi, [ebp+NTFS.frs_buffer] ; mftRecord + mov esi, [ebp+NTFS.frs_buffer] ; indexRoot mov edx, [esi+recordRealSize] add edx, ecx cmp [esi+recordAllocatedSize], edx jnc @f add esp, 12 - push ERROR_UNSUPPORTED_FS ; indexAllocation required - jmp ntfsError + jmp ntfsUnsupported ; indexAllocation required @@: ; index fits in the indexRoot mov [esi+recordRealSize], edx mov ecx, edx @@ -2043,7 +2075,7 @@ ntfs_CreateFile: mov esi, [esp] add [edi+sizeWithHeader], esi add [edi+sizeWithoutHeader], esi - mov cx, [edi+attributeOffset] + mov cl, [edi+attributeOffset] add edi, ecx add [edi+16+nodeRealSize], esi add [edi+16+nodeAllocatedSize], esi @@ -2055,16 +2087,15 @@ ntfs_CreateFile: jmp .common .indexRecord: - mov edx, [edi+1ch] + mov edx, [edi+28] add edx, ecx - cmp [edi+20h], edx + cmp [edi+32], edx jnc @f add esp, 12 - push ERROR_UNSUPPORTED_FS ; new node required - jmp ntfsError + jmp ntfsUnsupported ; new node required @@: ; index fits in the node - mov [edi+1ch], edx - lea edi, [edi+edx+14h] + mov [edi+28], edx + lea edi, [edi+edx+24-4] .common: mov esi, edi sub esi, [esp] @@ -2124,7 +2155,7 @@ ntfs_CreateFile: @@: ; 3. File data cmp [ebp+NTFS.fileRealSize], 0 jz .mftBitmap - ; One piece free space bitmap search engine +; One piece free space bitmap search engine mov edi, [ebp+NTFS.BitmapBuffer] add edi, [ebp+NTFS.BitmapStart] mov eax, [ebp+NTFS.fileDataSize] @@ -2132,12 +2163,10 @@ ntfs_CreateFile: jz .small push eax ; bitmap dwords add edi, 4 - xor edx, edx .start: mov ecx, [ebp+NTFS.BitmapSize] - mov eax, edi - sub eax, [ebp+NTFS.BitmapBuffer] - sub ecx, eax + add ecx, [ebp+NTFS.BitmapBuffer] + sub ecx, edi shr ecx, 2 @@: xor eax, eax @@ -2159,6 +2188,7 @@ ntfs_CreateFile: jnz .start sub esi, 4 mov eax, [esi] + xor edx, edx bsr edx, eax inc edx push edx ; starting bit @@ -2239,36 +2269,34 @@ ntfs_CreateFile: mov [esp+4], ecx @@: mov edi, [esp] - mov esi, [ebp+NTFS.fileDataSize] - mov edx, [edi] - ror edx, cl + xor eax, eax + dec eax + shr eax, cl + shl eax, cl neg ecx add ecx, 32 - mov eax, -1 - sub esi, ecx - jnc @f - mov esi, ecx ; fits inside - mov ecx, [ebp+NTFS.fileDataSize] - shrd edx, eax, cl - sub esi, ecx - mov ecx, esi - ror edx, cl - mov [edi], edx + sub ecx, [ebp+NTFS.fileDataSize] + jc @f + shl eax, cl ; fits inside dword + shr eax, cl + or [edi], eax jmp .writeData @@: - shrd edx, eax, cl - mov [edi], edx - mov ecx, esi + or [edi], eax + neg ecx + push ecx shr ecx, 5 add edi, 4 + xor eax, eax + dec eax rep stosd - mov ecx, esi + pop ecx and ecx, 31 - mov edx, [edi] - shr edx, cl - shld edx, eax, cl - mov [edi], edx + shr eax, cl + shl eax, cl + not eax + or [edi], eax .writeData: pop edx sub edx, [ebp+NTFS.BitmapBuffer] @@ -2284,10 +2312,7 @@ ntfs_CreateFile: mov ebx, [ebx+16] call fs_write64_app test eax, eax - jz .mftBitmap - push 11 - jmp ntfsError - + jnz ntfsDevice ; 4. MFT record .mftBitmap: ; search for free record mov edi, [ebp+NTFS.mftBitmapBuffer] @@ -2300,14 +2325,9 @@ ntfs_CreateFile: movzx eax, byte [edi] not al bsf ecx, eax - jnz @f - push ERROR_UNSUPPORTED_FS ; no free records - jmp ntfsError -@@: ; mark record - mov al, [edi] - bts eax, ecx - mov [edi], al - ; get record location + jz ntfsUnsupported ; no free records + bts [edi], ecx +; get record location sub edi, [ebp+NTFS.mftBitmapBuffer] shl edi, 3 add edi, ecx @@ -2324,21 +2344,24 @@ ntfs_CreateFile: call ntfs_read_attr cmp [ebp+NTFS.ntfs_cur_read], 0 jnz .mftRecord - ; extend MFT $DATA +; extend MFT $DATA mov eax, [ebp+NTFS.mft_cluster] mul [ebp+NTFS.sectors_per_cluster] - push ERROR_UNSUPPORTED_FS cmp eax, [ebp+NTFS.ntfsLastRead] - jnz ntfsError ; auxiliary record + jnz ntfsUnsupported ; auxiliary record mov edi, [ebp+NTFS.ntfs_attr_offs] mov ebx, [ebp+NTFS.sectors_per_cluster] shl ebx, 9+3 add dword [edi+lastVCN], 8 add [edi+attributeAllocatedSize], ebx + adc byte [edi+attributeAllocatedSize+4], 0 add [edi+attributeRealSize], ebx + adc byte [edi+attributeRealSize+4], 0 add [edi+initialDataSize], ebx - add edi, [edi+dataRunsOffset] - movzx eax, byte [edi] + adc byte [edi+initialDataSize+4], 0 + movzx eax, byte [edi+dataRunsOffset] + add edi, eax + mov al, [edi] inc edi shl eax, 4 shr al, 4 @@ -2348,13 +2371,13 @@ ntfs_CreateFile: add ah, al shr eax, 8 cmp byte [edi+eax], 0 - jnz ntfsError ; $MFT fragmented + jnz ntfsUnsupported ; $MFT fragmented mov al, 8 mov edx, [edi] rol eax, cl rol edx, cl add eax, edx - jc ntfsError + jc ntfsUnsupported ror eax, cl shr edx, cl mov [edi], eax @@ -2364,17 +2387,16 @@ ntfs_CreateFile: and ecx, 7 shr edx, 3 add edx, [ebp+NTFS.BitmapBuffer] - movzx eax, word [edx] - shr eax, cl - jnz ntfsError - mov al, -1 + mov ax, [edx] + shr ax, cl + test al, al + jnz ntfsUnsupported + dec al xchg [edx], al mov [edx+1], al - pop eax - push 12 stdcall kernel_alloc, ebx test eax, eax - jz ntfsError + jz ntfsNoMemory mov ecx, ebx shr ecx, 2 mov edi, eax @@ -2388,8 +2410,6 @@ ntfs_CreateFile: shr ecx, 9 call fs_write64_sys ; clear new records stdcall kernel_free, ebx - pop eax - push 11 mov eax, esi shr eax, 3+9 mov ebx, eax @@ -2400,12 +2420,12 @@ ntfs_CreateFile: xor edx, edx call fs_write64_app ; partition bitmap test eax, eax - jnz ntfsError + jnz ntfsDevice mov eax, [ebp+NTFS.frs_buffer] mov [ebp+NTFS.ntfs_cur_buf], eax call writeRecord ; $MFT test eax, eax - jnz ntfsError + jnz ntfsDevice mov eax, [ebp+NTFS.mftmirr_cluster] mul [ebp+NTFS.sectors_per_cluster] mov ebx, [ebp+NTFS.frs_buffer] @@ -2413,8 +2433,7 @@ ntfs_CreateFile: dec ecx call fs_write64_sys ; $MFTMirr test eax, eax - jnz ntfsError - pop eax + jnz ntfsDevice mov eax, [ebp+NTFS.ntfs_cur_offs] add [ebp+NTFS.ntfsLastRead], eax .mftRecord: @@ -2427,7 +2446,7 @@ ntfs_CreateFile: shr ecx, 2 rep stosd mov edi, [ebp+NTFS.frs_buffer] - ; record header +; record header mov dword[edi], 'FILE' mov byte [edi+updateSequenceOffset], 2ah mov byte [edi+updateSequenceSize], 3 @@ -2439,13 +2458,13 @@ ntfs_CreateFile: rdtsc mov [edi+2ah], ax add edi, 30h - ; $StandardInformation +; $StandardInformation mov byte [edi+attributeType], 10h mov byte [edi+sizeWithHeader], 48h mov byte [edi+sizeWithoutHeader], 30h mov byte [edi+attributeOffset], 18h add edi, 48h - ; $FileName +; $FileName mov byte [edi+attributeType], 30h mov byte [edi+attributeID], 1 mov cx, [esi+indexRawSize] @@ -2454,7 +2473,7 @@ ntfs_CreateFile: add ecx, 8 mov [edi+sizeWithHeader], ecx mov byte [edi+attributeOffset], 18h - mov byte [edi+attributeFlags], 1 + mov byte [edi+indexedFlag], 1 add edi, 18h add esi, 16 sub ecx, 18h @@ -2462,7 +2481,7 @@ ntfs_CreateFile: rep movsd cmp [ebp+NTFS.ntfsFolder], 0 jnz @f - ; $Data +; $Data mov byte [edi+attributeType], 80h cmp [ebp+NTFS.fileRealSize], 0 jz .zeroSize @@ -2497,19 +2516,17 @@ ntfs_CreateFile: mov byte [edi+attributeOffset], 20h mov dword[edi+18h], 490024h ; unicode $I30 mov dword[edi+18h+4], 300033h - add edi, 20h - mov byte [edi+attributeType], 30h - mov byte [edi+collationRule], 1 + mov byte [edi+20h+attributeType], 30h + mov byte [edi+20h+collationRule], 1 mov eax, [ebp+NTFS.sectors_per_cluster] shl eax, 9 - mov [edi+indexRecordSize], eax - mov byte [edi+indexRecordSizeClus], 1 - mov byte [edi+16+indexOffset], 16 - mov byte [edi+16+nodeRealSize], 32 - mov byte [edi+16+nodeAllocatedSize], 32 - mov byte [edi+32+indexAllocatedSize], 16 - mov byte [edi+32+indexFlags], 2 - sub edi, 20h + mov [edi+20h+indexRecordSize], eax + mov byte [edi+20h+indexRecordSizeClus], 1 + mov byte [edi+30h+indexOffset], 16 + mov byte [edi+30h+nodeRealSize], 32 + mov byte [edi+30h+nodeAllocatedSize], 32 + mov byte [edi+40h+indexAllocatedSize], 16 + mov byte [edi+40h+indexFlags], 2 mov al, 3 .writeMftRecord: mov byte [edi+sizeWithHeader], 50h @@ -2520,13 +2537,10 @@ ntfs_CreateFile: mov [ebp+NTFS.ntfs_cur_buf], edi call writeRecord test eax, eax - jz @f - push 11 - jmp ntfsError -@@: + jnz ntfsDevice mov esi, [ebp+PARTITION.Disk] call disk_sync - ; write MFT bitmap +; write MFT bitmap mov eax, [ebp+NTFS.newMftRecord] shr eax, 3+9 mov ebx, eax @@ -2537,10 +2551,8 @@ ntfs_CreateFile: xor edx, edx call fs_write64_sys test eax, eax - jz @f - push 11 - jmp ntfsError -@@: ; 5. Write partition bitmap + jnz ntfsDevice +; 5. Write partition bitmap cmp [ebp+NTFS.ntfsFolder], 0 jnz @f cmp [ebp+NTFS.fileRealSize], 0 @@ -2559,27 +2571,27 @@ ntfs_CreateFile: xor edx, edx call fs_write64_app test eax, eax - jz @f - push 11 - jmp ntfsError + jnz ntfsDevice @@: mov esi, [ebp+PARTITION.Disk] call disk_sync mov edi, [ebp+NTFS.indexOffset] mov eax, [ebp+NTFS.newMftRecord] mov [edi+fileRecordReference], eax - ; 6. Write directory node +; 6. Write directory node mov eax, [ebp+NTFS.nodeLastRead] mov [ebp+NTFS.ntfsLastRead], eax mov eax, [ebp+NTFS.cur_index_buf] mov [ebp+NTFS.ntfs_cur_buf], eax call writeRecord - push eax + test eax, eax + jnz ntfsDevice + mov ebx, [ebp+NTFS.fileRealSize] +ntfsDone: mov esi, [ebp+PARTITION.Disk] call disk_sync call ntfs_unlock - pop eax - mov ebx, [ebp+NTFS.fileRealSize] + xor eax, eax ret writeRecord: @@ -2602,7 +2614,7 @@ writeRecord: mov [esi-2], ax dec ecx jnz @b - ; writing to disk +; writing to disk mov eax, [ebp+NTFS.ntfsLastRead] mov ebx, [ebp+NTFS.ntfs_cur_buf] pop ecx @@ -2612,6 +2624,8 @@ writeRecord: bitmapBuffering: ; Extend BitmapBuffer and read next 32kb of bitmap ; Warning: $Bitmap fragmentation is not foreseen +; if edi -> position in bitmap buffer, +; then ecx = number of buffered dwords left push ebx mov eax, [ebp+NTFS.BitmapTotalSize] cmp eax, [ebp+NTFS.BitmapSize] @@ -2641,9 +2655,8 @@ bitmapBuffering: mov [ebp+NTFS.BitmapSize], eax @@: mov ecx, [ebp+NTFS.BitmapSize] - mov eax, edi - sub eax, [ebp+NTFS.BitmapBuffer] - sub ecx, eax + add ecx, [ebp+NTFS.BitmapBuffer] + sub ecx, edi shr ecx, 2 pop ebx ret @@ -2656,38 +2669,343 @@ bitmapBuffering: .end: add esp, 12 ; double ret push ERROR_DISK_FULL - jmp ntfsError + jmp ntfsOut ;---------------------------------------------------------------- -ntfs_Write: +ntfs_WriteFile: + cmp byte [esi], 0 + jnz @f xor ebx, ebx - mov eax, ERROR_UNSUPPORTED_FS + movi eax, ERROR_ACCESS_DENIED ret +@@: + call ntfs_lock + stdcall ntfs_find_lfn, [esp+4] + jc ntfsNotFound + cmp [ebp+NTFS.ntfs_cur_iRecord], 16 + jc ntfsDenied + mov [ebp+NTFS.ntfs_cur_attr], 0x80 + mov [ebp+NTFS.ntfs_cur_offs], 0 + mov [ebp+NTFS.ntfs_cur_size], 0 + call ntfs_read_attr + jc ntfsDenied + mov eax, [ebp+NTFS.frs_buffer] + cmp word [eax+baseRecordReuse], 0 + jnz ntfsUnsupported ; auxiliary record + cmp byte [eax+hardLinkCounter], 1 + jnz ntfsUnsupported ; file copying required + mov ecx, [ebp+NTFS.ntfs_attr_offs] + cmp byte [ecx+nonResidentFlag], 1 + jnz ntfsUnsupported ; resident $DATA + cmp word [ecx+attributeFlags], 0 + jnz ntfsUnsupported + mov eax, [ebx+4] + mov edx, [ebx+8] + add eax, [ebx+12] + adc edx, 0 + cmp edx, [ecx+attributeRealSize+4] + jc .write + jnz ntfsUnsupported ; end of file + cmp [ecx+attributeRealSize], eax + jc ntfsUnsupported +.write: + mov eax, [ebx+4] + mov edx, [ebx+8] + mov ecx, [ebx+12] + mov esi, [ebx+16] + shrd eax, edx, 9 + test dword[ebx+4], 1FFh + jz .aligned + mov [ebp+NTFS.ntfs_cur_offs], eax + mov [ebp+NTFS.ntfs_cur_size], 1 + lea edi, [ebp+NTFS.ntfs_bitmap_buf] + mov [ebp+NTFS.ntfs_cur_buf], edi + call ntfs_read_attr.continue + jc ntfsDevice + mov eax, [ebx+4] + and eax, 1FFh + add edi, eax + sub eax, [ebp+NTFS.ntfs_cur_read] + neg eax + push ecx + cmp ecx, eax + jb @f + mov ecx, eax +@@: + sub [esp], ecx + rep movsb + push ebx + mov eax, [ebp+NTFS.ntfsLastRead] + lea ebx, [ebp+NTFS.ntfs_bitmap_buf] + mov ecx, 1 + xor edx, edx + call fs_write64_app + pop ebx + pop ecx + test eax, eax + jnz ntfsDevice + test ecx, ecx + jz @f + mov eax, [ebx+4] + mov edx, [ebx+8] + shrd eax, edx, 9 + inc eax +.aligned: + push ecx + shr ecx, 9 + mov [ebp+NTFS.ntfs_cur_offs], eax + mov [ebp+NTFS.ntfs_cur_size], ecx + mov [ebp+NTFS.ntfs_cur_buf], esi + add eax, ecx + push eax + mov [ebp+NTFS.ntfsWriteAttr], 1 + call ntfs_read_attr.continue + mov [ebp+NTFS.ntfsWriteAttr], 0 + pop [ebp+NTFS.ntfs_cur_offs] + pop ecx + jc ntfsDevice + and ecx, 1FFh + jz @f + add esi, [ebp+NTFS.ntfs_cur_read] + mov [ebp+NTFS.ntfs_cur_size], 1 + lea edi, [ebp+NTFS.ntfs_bitmap_buf] + mov [ebp+NTFS.ntfs_cur_buf], edi + call ntfs_read_attr.continue + jc ntfsDevice + rep movsb + push ebx + mov eax, [ebp+NTFS.ntfsLastRead] + lea ebx, [ebp+NTFS.ntfs_bitmap_buf] + mov ecx, 1 + xor edx, edx + call fs_write64_app + pop ebx + test eax, eax + jnz ntfsDevice +@@: + mov ebx, [ebx+12] + jmp ntfsDone + +;---------------------------------------------------------------- +ntfs_Delete: + cmp byte [esi], 0 + jnz @f + xor ebx, ebx + movi eax, ERROR_ACCESS_DENIED + ret +@@: + call ntfs_lock + stdcall ntfs_find_lfn, [esp+4] + jc ntfsNotFound + cmp [ebp+NTFS.ntfs_cur_iRecord], 16 + jc ntfsDenied + cmp [ebp+NTFS.ntfsFragmentCount], 1 + jnz ntfsUnsupported ; record fragmented + test byte [eax+indexFlags], 1 + jnz ntfsUnsupported ; index has a subnode + mov edx, [ebp+NTFS.ntfs_cur_iRecord] + shr edx, 3 + cmp edx, [ebp+NTFS.mftBitmapSize] + jnc ntfsUnsupported +; delete index from the node + movzx edx, word [eax+indexAllocatedSize] + mov edi, [ebp+NTFS.cur_index_buf] + cmp dword [edi], 'INDX' + jz .indexRecord + mov esi, [ebp+NTFS.frs_buffer] ; indexRoot + mov ecx, [esi+recordRealSize] + shr ecx, 2 + rep movsd + mov esi, [ebp+NTFS.cur_index_buf] + mov edi, [ebp+NTFS.ntfs_attr_offs] + sub edi, [ebp+NTFS.frs_buffer] + add edi, esi + sub [edi+sizeWithHeader], edx + sub [edi+sizeWithoutHeader], edx + mov cl, [edi+attributeOffset] + add edi, ecx + sub [edi+16+nodeRealSize], edx + sub [edi+16+nodeAllocatedSize], edx + sub eax, esi + add eax, edi + sub [esi+recordRealSize], edx + mov ecx, [esi+recordRealSize] + jmp @f + +.indexRecord: + sub [edi+28], edx + mov ecx, [edi+28] + add ecx, 24 +@@: + add ecx, [ebp+NTFS.cur_index_buf] + sub ecx, eax + shr ecx, 2 + mov esi, eax + add esi, edx + mov edi, eax + rep movsd + mov eax, [ebp+NTFS.ntfsLastRead] + mov [ebp+NTFS.nodeLastRead], eax +; examine file record + mov [ebp+NTFS.ntfs_cur_attr], 0x80 + mov [ebp+NTFS.ntfs_cur_offs], 0 + mov [ebp+NTFS.ntfs_cur_size], 0 + call ntfs_read_attr + jc .folder + mov esi, [ebp+NTFS.frs_buffer] + cmp word [esi+baseRecordReuse], 0 + jnz ntfsUnsupported ; auxiliary record + cmp byte [esi+hardLinkCounter], 2 + jnc .writeFileRecord ; delete hard link + mov esi, [ebp+NTFS.ntfs_attr_offs] + cmp byte [esi+nonResidentFlag], 0 + jz .writeBitmapMFT + movzx eax, byte [esi+dataRunsOffset] + add esi, eax + xor edi, edi + sub esp, 16 +.clearBitmap: ; "delete" file data + call ntfs_decode_mcb_entry + jnc .mcbEnd + cmp dword[esp+8], 0 + jz .clearBitmap + add edi, [esp+8] + mov ebx, [esp] + mov eax, edi + add eax, ebx + shr eax, 3 + inc eax + cmp eax, [ebp+NTFS.BitmapSize] + jc .buffered + add eax, [ebp+NTFS.BitmapBuffer] + add esp, 16 + push edi + mov edi, eax +@@: + call bitmapBuffering + shl ecx, 2 + js @b + pop edi + sub esp, 16 +.buffered: + push edi + mov ecx, edi + shr edi, 5 + shl edi, 2 + add edi, [ebp+NTFS.BitmapBuffer] + and ecx, 31 + xor eax, eax + dec eax + shr eax, cl + shl eax, cl + neg ecx + add ecx, 32 + sub ecx, ebx + jc @f + shl eax, cl ; fits inside dword + shr eax, cl + not eax + and [edi], eax + jmp .writeBitmap + +@@: + not eax + and [edi], eax + neg ecx + push ecx + shr ecx, 5 + add edi, 4 + xor eax, eax + rep stosd + pop ecx + and ecx, 31 + dec eax + shr eax, cl + shl eax, cl + and [edi], eax +.writeBitmap: + pop edi + mov ecx, edi + add ecx, ebx + add ecx, 4095 + shr ecx, 3+9 + mov eax, edi + shr eax, 3+9 + sub ecx, eax + mov ebx, eax + shl ebx, 9 + add eax, [ebp+NTFS.BitmapLocation] + add ebx, [ebp+NTFS.BitmapBuffer] + xor edx, edx + call fs_write64_app + jmp .clearBitmap + +.mcbEnd: + add esp, 16 + jmp .writeBitmapMFT + +.folder: ; empty? + lea esi, [ebp+NTFS.ntfs_bitmap_buf] + mov [ebp+NTFS.ntfs_cur_buf], esi + mov [ebp+NTFS.ntfs_cur_attr], 0x90 + mov [ebp+NTFS.ntfs_cur_offs], 0 + mov [ebp+NTFS.ntfs_cur_size], 1 + call ntfs_read_attr + cmp [ebp+NTFS.ntfs_cur_read], 48 + jnz ntfsDenied + test byte [esi+32+indexFlags], 1 + jnz ntfsDenied +.writeBitmapMFT: ; "delete" file record + mov eax, [ebp+NTFS.ntfs_cur_iRecord] + mov ecx, eax + shr eax, 3 + and ecx, 7 + mov edi, [ebp+NTFS.mftBitmapBuffer] + btr [edi+eax], ecx + shr eax, 9 + mov ebx, eax + shl ebx, 9 + add eax, [ebp+NTFS.mftBitmapLocation] + add ebx, edi + mov ecx, 1 + xor edx, edx + call fs_write64_sys + mov esi, [ebp+NTFS.frs_buffer] + mov byte [esi+recordFlags], 0 +.writeFileRecord: + dec byte [esi+hardLinkCounter] + mov [ebp+NTFS.ntfs_cur_buf], esi + call writeRecord +; write directory node + mov eax, [ebp+NTFS.nodeLastRead] + mov [ebp+NTFS.ntfsLastRead], eax + mov eax, [ebp+NTFS.cur_index_buf] + mov [ebp+NTFS.ntfs_cur_buf], eax + call writeRecord + test eax, eax + jz ntfsDone + jmp ntfsDevice ;---------------------------------------------------------------- ntfs_SetFileEnd: ntfs_SetFileInfo: -ntfs_Delete: - mov eax, ERROR_UNSUPPORTED_FS + movi eax, ERROR_UNSUPPORTED_FS ret ;---------------------------------------------------------------- ntfs_GetFileInfo: cmp byte [esi], 0 jnz @f - movi eax, 2 + movi eax, ERROR_UNSUPPORTED_FS ret @@: call ntfs_lock stdcall ntfs_find_lfn, [esp+4] - jnc .doit + jnc .found test eax, eax - push ERROR_FILE_NOT_FOUND - jz ntfsError - pop eax - push 11 - jmp ntfsError -.doit: + jz ntfsFail + jmp ntfsNotFound +.found: push esi edi mov esi, eax mov edi, [ebx+16] @@ -2698,8 +3016,25 @@ ntfs_GetFileInfo: xor eax, eax ret -ntfsError: +ntfsUnsupported: + push ERROR_UNSUPPORTED_FS +ntfsOut: call ntfs_unlock xor ebx, ebx pop eax ret +ntfsDevice: + push ERROR_DEVICE + jmp ntfsOut +ntfsNotFound: + push ERROR_FILE_NOT_FOUND + jmp ntfsOut +ntfsDenied: + push ERROR_ACCESS_DENIED + jmp ntfsOut +ntfsFail: + push ERROR_FS_FAIL + jmp ntfsOut +ntfsNoMemory: + push ERROR_OUT_OF_MEMORY + jmp ntfsOut diff --git a/kernel/branches/Kolibri-acpi/gui/button.inc b/kernel/branches/Kolibri-acpi/gui/button.inc index e4e6fc054d..f59de4be89 100644 --- a/kernel/branches/Kolibri-acpi/gui/button.inc +++ b/kernel/branches/Kolibri-acpi/gui/button.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; @@ -8,10 +8,6 @@ $Revision$ -;============================================================================== -;///// public functions /////////////////////////////////////////////////////// -;============================================================================== - button.MAX_BUTTONS = 4095 struct SYS_BUTTON @@ -25,12 +21,11 @@ struct SYS_BUTTON dw ? ends -align 4 -;------------------------------------------------------------------------------ -syscall_button: ;///// system function 8 ////////////////////////////////////// -;------------------------------------------------------------------------------ +;--------------------------------------------------------------- +syscall_button: ;////////////// system function 8 ////////////// +;--------------------------------------------------------------- ;? Define/undefine GUI button object -;------------------------------------------------------------------------------ +;--------------------------------------------------------------- ;; Define button: ;> ebx = pack[16(x), 16(width)] ;> ecx = pack[16(y), 16(height)] @@ -40,12 +35,12 @@ syscall_button: ;///// system function 8 ////////////////////////////////////// ;> 6 (30) = don't draw button ;> 5 (29) = don't draw button frame when pressed ;> esi = button color -; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;; Undefine button: ;> edx = pack[8(flags), 24(button identifier)] ;> flags bits: ;> 7 (31) = 1 -;------------------------------------------------------------------------------ +;--------------------------------------------------------------- ; do we actually need to undefine the button? test edx, 0x80000000 jnz .remove_button @@ -74,13 +69,12 @@ syscall_button: ;///// system function 8 ////////////////////////////////////// pop eax ; basic checks passed, define the button - push ebx ecx edx inc eax mov [edi], ax shl eax, 4 add edi, eax - ; NOTE: this code doesn't rely on SYS_BUTTON struct, please revise it - ; if you change something +; NOTE: this code doesn't rely on SYS_BUTTON struct, +; please revise it, if you change something. mov ax, [CURRENT_TASK] stosw mov ax, dx @@ -94,18 +88,52 @@ syscall_button: ;///// system function 8 ////////////////////////////////////// mov eax, edx shr eax, 16 stosw ; button id number: bits 16-31 - pop edx ecx ebx ; do we also need to draw the button? test edx, 0x40000000 jnz .exit - ; draw button body + and esi, 0xFFFFFF + xor edi, edi + push ebx ecx esi + dec cx + dec cx + cmp [buttontype], 1 + jnz .draw + cmp cx, 65 + jnc .draw - pushad + ; calculate gradient data + mov eax, esi + shl eax, 8 + mov edx, 3 +.calculate: + rol eax, 8 + shl al, 1 + jnc @f + neg al + jnz @f + mov al, 64 +@@: + cmp al, 65 + jc @f + mov al, 64 +@@: + div cl + shl ax, 8 + dec edx + jnz .calculate + mov dl, cl + dec edx + shr edx, 1 + shr eax, 8 + mov edi, eax + mul edx + add esi, eax - ; calculate window-relative coordinates - movzx edi, cx +.draw: ; calculate window-relative coordinates + movzx ebp, cx + dec ebp shr ebx, 16 shr ecx, 16 mov eax, [TASK_BASE] @@ -113,110 +141,73 @@ syscall_button: ;///// system function 8 ////////////////////////////////////// add ecx, [eax - twdw + WDATA.box.top] mov eax, ebx inc eax - shl eax, 16 - mov ax, bx - add ax, word[esp + 16] - dec ax - mov ebx, ecx - shl ebx, 16 - mov bx, cx - - ; calculate initial color - mov ecx, esi - cmp [buttontype], 0 - je @f - call button._.incecx2 - - ; set button height counter - @@: - mov edx, edi - add ebx, 0x00010001 - dec edx - - .next_line: - call button._.button_dececx - push edi - xor edi, edi -; call [draw_line] - call __sys_draw_line - pop edi - add ebx, 0x00010001 - dec edx - jnz .next_line - - popad - - ; draw button frame - - push ebx ecx - - ; calculate window-relative coordinates - shr ebx, 16 - shr ecx, 16 - mov eax, [TASK_BASE] - add ebx, [eax - twdw + WDATA.box.left] - add ecx, [eax - twdw + WDATA.box.top] - - ; top border - mov eax, ebx - shl eax, 16 - mov ax, bx - add ax, [esp + 4] - mov ebx, ecx - shl ebx, 16 - mov bx, cx - push ebx - xor edi, edi - mov ecx, esi - call button._.incecx -; call [draw_line] - call __sys_draw_line - - ; bottom border - movzx edx, word[esp + 4 + 0] - add ebx, edx - shl edx, 16 - add ebx, edx - mov ecx, esi - call button._.dececx -; call [draw_line] - call __sys_draw_line - - ; left border - pop ebx - push edx - mov edx, eax - shr edx, 16 - mov ax, dx mov edx, ebx - shr edx, 16 - mov bx, dx - add bx, [esp + 4 + 0] - pop edx + add dx, [esp+8] + dec edx + mov ebx, ecx mov ecx, esi - call button._.incecx -; call [draw_line] - dec ebx - call __sys_draw_line - - ; right border - mov dx, [esp + 4] - add ax, dx - shl edx, 16 - add eax, edx - add ebx, 0x00010000 - mov ecx, esi - call button._.dececx -; call [draw_line] - call __sys_draw_line - + shr ecx, 1 + and cx, 7F7Fh + push esi + mov esi, edi + xor edi, edi + call hline ; top border + inc ebx + or ecx, 808080h + call hline ; top light line + pop ecx + inc ebx +.next_line: + call hline ; button body + inc ebx + sub ecx, esi + dec ebp + jnz .next_line + shr ecx, 2 + and cx, 3F3Fh + mov ebp, ecx + shl ecx, 1 + add ecx, ebp + call hline ; bottom dark line + inc ebx + sub ecx, ebp + call hline ; bottom border + pop ecx + shr ecx, 1 + inc edx + push edx + mov edx, ebx + sub bx, [esp+4] + dec edx + inc ebx + cmp [buttontype], 0 + jnz @f + dec edx + or ecx, 808080h + call vline ; left light line + inc edx +@@: + and ecx, 7F7F7Fh + dec eax + call vline ; left border + pop eax + call vline ; right border + cmp [buttontype], 0 + jnz @f + mov ebp, ecx + shr ecx, 1 + and cx, 7F7Fh + add ecx, ebp + dec eax + inc ebx + call vline ; right dark line +@@: pop ecx ebx - - .exit: +.exit: ret ; FIXME: mutex needed -syscall_button.remove_button: +.remove_button: and edx, 0x00ffffff mov edi, [BTN_ADDR] mov ebx, [edi] @@ -227,7 +218,7 @@ syscall_button.remove_button: add ecx, -sizeof.SYS_BUTTON add esi, sizeof.SYS_BUTTON - .next_button: +.next_button: dec ebx jz .exit @@ -256,98 +247,28 @@ syscall_button.remove_button: pop ebx jmp .next_button - .exit: - ret - -align 4 -;------------------------------------------------------------------------------ -sys_button_activate_handler: ;///////////////////////////////////////////////// -;------------------------------------------------------------------------------ -;? -;------------------------------------------------------------------------------ +;--------------------------------------------------------------- +sys_button_activate_handler: +sys_button_deactivate_handler: +;--------------------------------------------------------------- ;> eax = pack[8(process slot), 24(button id)] ;> ebx = pack[16(button x coord), 16(button y coord)] ;> cl = mouse button mask this system button was pressed with -;------------------------------------------------------------------------------ - call button._.find_button - or eax, eax - jz .exit - - mov ebx, dword[eax + SYS_BUTTON.id_hi - 2] - call button._.negative_button - - .exit: - ret - -align 4 -;------------------------------------------------------------------------------ -sys_button_deactivate_handler: ;/////////////////////////////////////////////// -;------------------------------------------------------------------------------ -;? -;------------------------------------------------------------------------------ -;> eax = pack[8(process slot), 24(button id)] -;> ebx = pack[16(button x coord), 16(button y coord)] -;> cl = mouse button mask this system button was pressed with -;------------------------------------------------------------------------------ - call button._.find_button - or eax, eax - jz .exit - - mov ebx, dword[eax + SYS_BUTTON.id_hi - 2] - call button._.negative_button - - .exit: - ret - -align 4 -;------------------------------------------------------------------------------ -sys_button_perform_handler: ;////////////////////////////////////////////////// -;------------------------------------------------------------------------------ -;? -;------------------------------------------------------------------------------ -;> eax = pack[8(process slot), 24(button id)] -;> ebx = pack[16(button x coord), 16(button y coord)] -;> cl = mouse button mask this system button was pressed with -;------------------------------------------------------------------------------ - shl eax, 8 - mov al, cl - movzx ebx, byte[BTN_COUNT] - mov [BTN_BUFF + ebx * 4], eax - inc bl - mov [BTN_COUNT], bl - ret - -;============================================================================== -;///// private functions ////////////////////////////////////////////////////// -;============================================================================== - -;------------------------------------------------------------------------------ -button._.find_button: ;//////////////////////////////////////////////////////// -;------------------------------------------------------------------------------ -;? Find system button by specified process slot, id and coordinates -;------------------------------------------------------------------------------ -;> eax = pack[8(process slot), 24(button id)] or 0 -;> ebx = pack[16(button x coord), 16(button y coord)] -;------------------------------------------------------------------------------ -;< eax = pointer to SYS_BUTTON struct or 0 -;------------------------------------------------------------------------------ +;--------------------------------------------------------------- +; find system button by specified process slot, id and coordinates push ecx edx esi edi - mov edx, eax shr edx, 24 and eax, 0x0ffffff - mov edi, [BTN_ADDR] mov ecx, [edi] imul esi, ecx, sizeof.SYS_BUTTON add esi, edi inc ecx add esi, sizeof.SYS_BUTTON - - .next_button: +.next_button: dec ecx - jz .not_found - + jz .popexit add esi, -sizeof.SYS_BUTTON ; does it belong to our process? @@ -367,147 +288,58 @@ button._.find_button: ;//////////////////////////////////////////////////////// cmp ebx, edi jne .next_button - ; okay, return it mov eax, esi - jmp .exit - - .not_found: - xor eax, eax - - .exit: pop edi esi edx ecx - ret + mov ebx, dword[eax + SYS_BUTTON.id_hi - 2] -;------------------------------------------------------------------------------ -button._.dececx: ;///////////////////////////////////////////////////////////// -;------------------------------------------------------------------------------ -;? -;------------------------------------------------------------------------------ - sub cl, 0x20 - jnc @f - xor cl, cl - @@: - sub ch, 0x20 - jnc @f - xor ch, ch - @@: - rol ecx, 16 - sub cl, 0x20 - jnc @f - xor cl, cl - @@: - rol ecx, 16 - ret - -;------------------------------------------------------------------------------ -button._.incecx: ;///////////////////////////////////////////////////////////// -;------------------------------------------------------------------------------ -;? -;------------------------------------------------------------------------------ - add cl, 0x20 - jnc @f - or cl, -1 - @@: - add ch, 0x20 - jnc @f - or ch, -1 - @@: - rol ecx, 16 - add cl, 0x20 - jnc @f - or cl, -1 - @@: - rol ecx, 16 - ret - -;------------------------------------------------------------------------------ -button._.incecx2: ;//////////////////////////////////////////////////////////// -;------------------------------------------------------------------------------ -;? -;------------------------------------------------------------------------------ - add cl, 0x14 - jnc @f - or cl, -1 - @@: - add ch, 0x14 - jnc @f - or ch, -1 - @@: - rol ecx, 16 - add cl, 0x14 - jnc @f - or cl, -1 - @@: - rol ecx, 16 - ret - -;------------------------------------------------------------------------------ -button._.button_dececx: ;////////////////////////////////////////////////////// -;------------------------------------------------------------------------------ -;? -;------------------------------------------------------------------------------ - cmp [buttontype], 1 - jne .finish - - push eax - mov al, 1 - cmp edi, 20 - jg @f - mov al, 2 - - @@: - sub cl, al - jnc @f - xor cl, cl - @@: - sub ch, al - jnc @f - xor ch, ch - @@: - rol ecx, 16 - sub cl, al - jnc @f - xor cl, cl - @@: - rol ecx, 16 - - pop eax - - .finish: - ret - -;------------------------------------------------------------------------------ -button._.negative_button: ;//////////////////////////////////////////////////// -;------------------------------------------------------------------------------ -;? Invert system button border -;------------------------------------------------------------------------------ - ; if requested, do not display button border on press. - test ebx, 0x20000000 - jnz .exit + ; display button border on press? + bt ebx, 29 + jc .exit + ; invert system button border pushad - - xchg esi, eax - + mov esi, eax + mov edi, ebx movzx ecx, [esi + SYS_BUTTON.pslot] shl ecx, 5 add ecx, window_data - mov eax, dword[esi + SYS_BUTTON.left] mov ebx, dword[esi + SYS_BUTTON.top] add eax, [ecx + WDATA.box.left] add ebx, [ecx + WDATA.box.top] - push eax ebx - pop edx ecx + mov ecx, eax + mov edx, ebx + bt edi, 30 + jc @f + inc ax + inc bx + dec cx + dec dx +@@: rol eax, 16 rol ebx, 16 add ax, cx add bx, dx - - mov esi, 0x01000000 + mov esi, 1000000h call draw_rectangle.forced - popad - - .exit: +.exit: + ret +.popexit: + pop edi esi edx ecx + ret + +;--------------------------------------------------------------- +sys_button_perform_handler: +;--------------------------------------------------------------- +;> eax = pack[8(process slot), 24(button id)] +;> ebx = pack[16(button x coord), 16(button y coord)] +;> cl = mouse button mask this system button was pressed with +;--------------------------------------------------------------- + shl eax, 8 + mov al, cl + movzx ebx, byte[BTN_COUNT] + mov [BTN_BUFF + ebx * 4], eax + inc bl + mov [BTN_COUNT], bl ret diff --git a/kernel/branches/Kolibri-acpi/gui/font.inc b/kernel/branches/Kolibri-acpi/gui/font.inc index e15e4905c2..5306cc6b79 100644 --- a/kernel/branches/Kolibri-acpi/gui/font.inc +++ b/kernel/branches/Kolibri-acpi/gui/font.inc @@ -241,7 +241,7 @@ deltaToScreen = 28 .drawPicture: mov eax, -1 repz scasd - jcxz @f + jecxz @f mov eax, edx sub eax, ecx push ecx diff --git a/kernel/branches/Kolibri-acpi/gui/skincode.inc b/kernel/branches/Kolibri-acpi/gui/skincode.inc index 050fed93df..dabe596879 100644 --- a/kernel/branches/Kolibri-acpi/gui/skincode.inc +++ b/kernel/branches/Kolibri-acpi/gui/skincode.inc @@ -101,7 +101,6 @@ parse_skin_data: xor eax, eax cld rep stosd - mov ebx, [ebp+SKIN_HEADER.params] add ebx, [skin_data] mov eax, [ebx+SKIN_PARAMS.skin_height] @@ -127,11 +126,8 @@ parse_skin_data: mov dword[_skinmargins+0], eax mov eax, dword[ebx+SKIN_PARAMS.margin.bottom] mov dword[_skinmargins+4], eax - mov ebx, [ebp+SKIN_HEADER.bitmaps] add ebx, [skin_data] -;-------------------------------------- -align 4 .lp1: cmp dword[ebx], 0 je .end_bitmaps @@ -142,11 +138,8 @@ align 4 xor eax, eax mov edx, skin_active.left.data or ecx, ecx - jnz @f + jnz .next_bitmap mov edx, skin_inactive.left.data -;-------------------------------------- -align 4 -@@: jmp .next_bitmap ;-------------------------------------- align 4 @@ -159,11 +152,8 @@ align 4 neg eax mov edx, skin_active.oper.data or ecx, ecx - jnz @f + jnz .next_bitmap mov edx, skin_inactive.oper.data -;-------------------------------------- -align 4 -@@: jmp .next_bitmap ;-------------------------------------- align 4 @@ -173,12 +163,9 @@ align 4 mov eax, [skin_active.left.width] mov edx, skin_active.base.data or ecx, ecx - jnz @f + jnz .next_bitmap mov eax, [skin_inactive.left.width] mov edx, skin_inactive.base.data -;-------------------------------------- -align 4 -@@: jmp .next_bitmap ;-------------------------------------- align 4 @@ -202,8 +189,6 @@ align 4 .end_bitmaps: mov ebx, [ebp+SKIN_HEADER.buttons] add ebx, [skin_data] -;-------------------------------------- -align 4 .lp2: cmp dword[ebx], 0 je .end_buttons @@ -245,13 +230,10 @@ align 4 ;------------------------------------------------------------------------------ align 4 drawwindow_IV_caption: - mov ebp, skin_active or al, al jnz @f mov ebp, skin_inactive -;-------------------------------------- -align 4 @@: mov esi, [esp+4] mov eax, [esi+WDATA.box.width] ; window width @@ -260,13 +242,10 @@ align 4 mov ecx, [ebp+SKIN_DATA.left.width] shl ecx, 16 add ecx, [_skinh] - mov ebx, [ebp+SKIN_DATA.left.data] or ebx, ebx jz @f call sys_putimage.forced -;-------------------------------------- -align 4 @@: mov esi, [esp+4] mov eax, [esi+WDATA.box.width] @@ -278,9 +257,7 @@ align 4 mov ecx, [ebp+SKIN_DATA.base.width] jecxz .non_base div ecx - inc eax - mov ebx, [ebp+SKIN_DATA.base.data] mov ecx, [ebp+SKIN_DATA.base.width] shl ecx, 16 @@ -288,45 +265,33 @@ align 4 mov edx, [ebp+SKIN_DATA.base.left] sub edx, [ebp+SKIN_DATA.base.width] shl edx, 16 -;-------------------------------------- -align 4 .baseskinloop: shr edx, 16 add edx, [ebp+SKIN_DATA.base.width] shl edx, 16 push eax ebx ecx edx - or ebx, ebx jz @f call sys_putimage.forced -;-------------------------------------- -align 4 @@: pop edx ecx ebx eax dec eax jnz .baseskinloop -;-------------------------------------- -align 4 .non_base: - mov esi, [esp+4] mov edx, [esi+WDATA.box.width] sub edx, [ebp+SKIN_DATA.oper.width] inc edx shl edx, 16 mov ebx, [ebp+SKIN_DATA.oper.data] - mov ecx, [ebp+SKIN_DATA.oper.width] shl ecx, 16 add ecx, [_skinh] - or ebx, ebx jz @f call sys_putimage.forced -;-------------------------------------- -align 4 @@: ret ;------------------------------------------------------------------------------ @@ -334,17 +299,12 @@ align 4 drawwindow_IV: ;param1 - aw_yes pusha - push edx - mov edi, edx - mov ebp, skin_active cmp byte [esp+32+4+4], 0 jne @f mov ebp, skin_inactive -;-------------------------------------- -align 4 @@: mov eax, [edi+WDATA.box.left] shl eax, 16 @@ -362,8 +322,6 @@ align 4 rol ebx, 16 call draw_rectangle mov ecx, 3 -;-------------------------------------- -align 4 _dw3l: add eax, 1*65536-1 add ebx, 0*65536-1 @@ -387,8 +345,6 @@ _dw3l: test [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP jnz @f call draw_rectangle -;-------------------------------------- -align 4 @@: mov eax, [skin_data] cmp [eax], dword 'SKIN' @@ -400,7 +356,6 @@ align 4 inc ecx mov edx, [_skinh] mov edi, [common_colours+4]; standard grab color -; call [drawbar] call vesa20_drawbar jmp draw_clientbar ;-------------------------------------- @@ -408,11 +363,8 @@ align 4 @@: mov al, [esp+32+4+4] call drawwindow_IV_caption -;-------------------------------------- -align 4 draw_clientbar: mov esi, [esp] - mov edx, [esi+WDATA.box.top] ; WORK AREA add edx, 21+5 mov ebx, [esi+WDATA.box.top] @@ -428,10 +380,7 @@ draw_clientbar: mov edi, [esi+WDATA.cl_workarea] test edi, 0x40000000 jnz _noinside2 -; call [drawbar] call vesa20_drawbar -;-------------------------------------- -align 4 _noinside2: mov eax, [skin_data] cmp [eax], dword 'SKIN' @@ -443,39 +392,30 @@ _noinside2: jge no_skin_add_button inc eax mov [edi], ax - shl eax, 4 add eax, edi mov bx, [CURRENT_TASK] mov [eax], bx - - add eax, 2 ; save button id number - mov bx, 1 - mov [eax], bx - add eax, 2 ; x start + mov word [eax+2], 1 ; button id xor ebx, ebx cmp [skin_btn_close.left], 0 - jge _bCx_at_right + jge @f mov ebx, [esp] mov ebx, [ebx+WDATA.box.width] inc ebx -;-------------------------------------- -align 4 -_bCx_at_right: +@@: add ebx, [skin_btn_close.left] - mov [eax], bx - add eax, 2 ; x size + mov word [eax+4], bx ; x start mov ebx, [skin_btn_close.width] dec ebx - mov [eax], bx - add eax, 2 ; y start + mov word [eax+6], bx ; x size mov ebx, [skin_btn_close.top] - mov [eax], bx - add eax, 2 ; y size + mov word [eax+8], bx ; y start mov ebx, [skin_btn_close.height] dec ebx - mov [eax], bx + mov word [eax+10], bx ; y size + bts word [eax+12], 14 ;* minimize button mov edi, [BTN_ADDR] movzx eax, word [edi] @@ -483,43 +423,31 @@ _bCx_at_right: jge no_skin_add_button inc eax mov [edi], ax - shl eax, 4 add eax, edi mov bx, [CURRENT_TASK] mov [eax], bx - - add eax, 2 ; save button id number - mov bx, 65535;999 - mov [eax], bx - add eax, 2 ; x start + mov word [eax+2], -1 ; button id xor ebx, ebx cmp [skin_btn_minimize.left], 0 - jge _bMx_at_right + jge @f mov ebx, [esp] mov ebx, [ebx+WDATA.box.width] inc ebx -;-------------------------------------- -align 4 -_bMx_at_right: +@@: add ebx, [skin_btn_minimize.left] - mov [eax], bx - add eax, 2 ; x size + mov word [eax+4], bx ; x start mov ebx, [skin_btn_minimize.width] dec ebx - mov [eax], bx - add eax, 2 ; y start + mov word [eax+6], bx ; x size mov ebx, [skin_btn_minimize.top] - mov [eax], bx - add eax, 2 ; y size + mov word [eax+8], bx ; y start mov ebx, [skin_btn_minimize.height] dec ebx - mov [eax], bx -;-------------------------------------- -align 4 + mov word [eax+10], bx ; y size + bts word [eax+12], 14 no_skin_add_button: pop edi popa ret 4 -;------------------------------------------------------------------------------ diff --git a/kernel/branches/Kolibri-acpi/hid/mousedrv.inc b/kernel/branches/Kolibri-acpi/hid/mousedrv.inc index 5dda193d88..84038ccf6e 100644 --- a/kernel/branches/Kolibri-acpi/hid/mousedrv.inc +++ b/kernel/branches/Kolibri-acpi/hid/mousedrv.inc @@ -551,9 +551,9 @@ proc set_mouse_data stdcall uses edx, BtnState:dword, XMoving:dword, YMoving:dwo endp ;----------------------------------------------------------------------------- -; 3 = x^2 /2 -; 2 = (x+1)^2 /4 -; 1 = (x+2)^2 /8 +; 3 = (x+1)^2 /4 +; 2 = (x+2)^2 /8 +; 1 = (x+3)^2 /16 align 4 mouse_acceleration: cmp [mouse_delay], 0 @@ -562,13 +562,13 @@ mouse_acceleration: @@: neg eax jl @b + inc eax cmp [mouse_delay], 3 adc eax, 0 cmp [mouse_delay], 2 adc eax, 0 mul al - shr eax, 1 - adc eax, 0 + shr eax, 2 cmp [mouse_delay], 2 jz .2 jnc .3 diff --git a/kernel/branches/Kolibri-acpi/kernel.asm b/kernel/branches/Kolibri-acpi/kernel.asm index f7cdfc94a0..5abb4428a8 100644 --- a/kernel/branches/Kolibri-acpi/kernel.asm +++ b/kernel/branches/Kolibri-acpi/kernel.asm @@ -996,8 +996,6 @@ end if ; mov esi, boot_devices ; call boot_log - call clear_pci_ide_interrupts - include "detect/vortex86.inc" ; Vortex86 SoC detection code stdcall load_pe_driver, szVidintel, 0 @@ -2167,7 +2165,7 @@ sys_end: pusha mov edx, [TASK_BASE] mov edx, [edx+TASKDATA.pid] - call SOCKET_process_end + call socket_process_end popa ;-------------------------------------- mov ecx, [current_slot] @@ -2297,7 +2295,7 @@ sysfn_terminate: ; 18.2 = TERMINATE ; terminate all network sockets it used pusha mov eax, edx - call SOCKET_process_end + call socket_process_end popa ;-------------------------------------- cmp [_display.select_cursor], 0 diff --git a/kernel/branches/Kolibri-acpi/network/ARP.inc b/kernel/branches/Kolibri-acpi/network/ARP.inc index 83ad98e2e2..e71c21fedf 100644 --- a/kernel/branches/Kolibri-acpi/network/ARP.inc +++ b/kernel/branches/Kolibri-acpi/network/ARP.inc @@ -70,14 +70,12 @@ endg -;----------------------------------------------------------------- -; -; ARP_init -; -; This function resets all ARP variables -; -;----------------------------------------------------------------- -macro ARP_init { +;-----------------------------------------------------------------; +; ; +; arp_init: Resets all ARP variables. ; +; ; +;-----------------------------------------------------------------; +macro arp_init { xor eax, eax mov edi, ARP_entries_num @@ -86,13 +84,12 @@ macro ARP_init { } -;--------------------------------------------------------------------------- -; -; ARP_decrease_entry_ttls -; -;--------------------------------------------------------------------------- - -macro ARP_decrease_entry_ttls { +;-----------------------------------------------------------------; +; ; +; arp_decrease_entry_ttls ; +; ; +;-----------------------------------------------------------------; +macro arp_decrease_entry_ttls { local .loop local .exit @@ -135,7 +132,7 @@ local .exit je .response_timeout push esi edi ecx - call ARP_del_entry + call arp_del_entry pop ecx edi esi jmp .next @@ -154,20 +151,21 @@ local .exit } -;----------------------------------------------------------------- -; -; ARP_input -; -; IN: Pointer to buffer in [esp] -; size of buffer in [esp+4] -; packet size (without ethernet header) in ecx -; packet ptr in edx -; device ptr in ebx -; OUT: / -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; arp_input ; +; ; +; IN: [esp] = Pointer to buffer ; +; [esp+4] = size of buffer ; +; ecx = packet size (without ethernet header) ; +; edx = packet ptr ; +; ebx = device ptr ; +; ; +; OUT: / ; +; ; +;-----------------------------------------------------------------; align 4 -ARP_input: +arp_input: ;----------------------------------------- ; Check validity and print some debug info @@ -175,7 +173,7 @@ ARP_input: cmp ecx, sizeof.ARP_header jb .exit - call NET_ptr_to_num4 + call net_ptr_to_num4 cmp edi, -1 jz .exit @@ -294,21 +292,21 @@ ARP_input: .exit: DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_input: exiting\n" - call NET_BUFF_free + call net_buff_free ret -;--------------------------------------------------------------------------- -; -; ARP_output_request -; -; IN: ebx = device ptr -; eax = IP -; OUT: / -; scratched: probably everything -; -;--------------------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; arp_output_request ; +; ; +; IN: ebx = device ptr ; +; eax = IP ; +; ; +; OUT: scratched: probably everything ; +; ; +;-----------------------------------------------------------------; align 4 -ARP_output_request: +arp_output_request: push eax @@ -318,7 +316,7 @@ ARP_output_request: mov ax, ETHER_PROTO_ARP mov ecx, sizeof.ARP_header mov edx, ETH_BROADCAST ; broadcast mac - call ETH_output + call eth_output jz .exit mov [edi + ARP_header.HardwareType], 0x0100 ; Ethernet @@ -333,7 +331,7 @@ ARP_output_request: movsd ; push edi - call NET_ptr_to_num4 + call net_ptr_to_num4 inc [ARP_PACKETS_TX + edi] ; assume we will succeed lea esi, [IP_LIST + edi] ; SenderIP pop edi @@ -354,18 +352,22 @@ ARP_output_request: ret -;----------------------------------------------------------------- -; -; ARP_add_entry (or update) -; -; IN: esi = ptr to entry (can easily be made on the stack) -; edi = device num*4 -; OUT: eax = entry #, -1 on error -; esi = ptr to newly created entry -; -;----------------------------------------------------------------- ; TODO: use a mutex +;-----------------------------------------------------------------; +; ; +; arp_add_entry: Add or update an entry in the ARP table. ; +; ; +; IN: esi = ptr to entry (can easily be made on the stack) ; +; edi = device num*4 ; +; ; +; OUT: eax = entry number on success ; +; eax = -1 on error ; +; esi = ptr to newly created entry ; +; ; +;-----------------------------------------------------------------; align 4 -ARP_add_entry: +arp_add_entry: + +; TODO: use a mutex to lock ARP table DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_add_entry: device=%u\n", edi @@ -421,19 +423,22 @@ ARP_add_entry: ret -;----------------------------------------------------------------- -; -; ARP_del_entry -; -; IN: esi = ptr to arp entry -; edi = device number -; OUT: / -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; arp_del_entry: Remove an entry from the ARP table. ; +; ; +; IN: esi = ptr to arp entry ; +; edi = device number ; +; ; +; OUT: / ; +; ; +;-----------------------------------------------------------------; align 4 -ARP_del_entry: +arp_del_entry: - DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_del_entry: entry=%x entrys=%u\n", esi, [ARP_entries_num + 4*edi] +; TODO: use a mutex to lock ARP table + + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_del_entry: entry=0x%x entrys=%u\n", esi, [ARP_entries_num + 4*edi] DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_del_entry: IP=%u.%u.%u.%u\n", \ [esi + ARP_entry.IP]:1, [esi + ARP_entry.IP + 1]:1, [esi + ARP_entry.IP + 2]:1, [esi + ARP_entry.IP + 3]:1 @@ -463,22 +468,22 @@ ARP_del_entry: -;----------------------------------------------------------------- -; -; ARP_IP_to_MAC -; -; This function translates an IP address to a MAC address -; -; IN: eax = IPv4 address -; edi = device number * 4 -; OUT: eax = -1 on error, -2 means request send -; else, ax = first two bytes of mac (high 16 bits of eax will be 0) -; ebx = last four bytes of mac -; edi = unchanged -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; arp_ip_to_mac: Translate an IP address to a MAC address. ; +; ; +; IN: eax = IPv4 address ; +; edi = device number * 4 ; +; ; +; OUT: eax = -1 on error ; +; eax = -2 when request send ; +; eax = first two bytes of mac on success ; +; ebx = last four bytes of mac on success ; +; edi = unchanged ; +; ; +;-----------------------------------------------------------------; align 4 -ARP_IP_to_MAC: +arp_ip_to_mac: DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_IP_to_MAC: %u.%u", al, ah rol eax, 16 @@ -513,11 +518,11 @@ ARP_IP_to_MAC: pushw ARP_AWAITING_RESPONSE ; status pushd 0 ; mac pushw 0 - pushd eax ; ip + pushd eax ; IP mov esi, esp ; Add it to the list - call ARP_add_entry + call arp_add_entry ; Delete the temporary entry add esp, sizeof.ARP_entry ; clear the entry from stack @@ -534,7 +539,7 @@ ARP_IP_to_MAC: push esi edi mov ebx, [NET_DRV_LIST + edi] - call ARP_output_request + call arp_output_request pop edi esi .found_it: cmp [esi + ARP_entry.Status], ARP_VALID_MAPPING ; Does it have a MAC assigned? @@ -576,21 +581,19 @@ end if ret -;----------------------------------------------------------------- -; -; ARP_API -; -; This function is called by system function 76 -; -; IN: subfunction number in bl -; device number in bh -; ecx, edx, .. depends on subfunction -; -; OUT: ? -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; arp_api: Part of system function 76. ; +; ; +; IN: bl = subfunction number ; +; bh = device number ; +; ecx, edx, .. depends on subfunction ; +; ; +; OUT: depends on subfunction ; +; ; +;-----------------------------------------------------------------; align 4 -ARP_api: +arp_api: movzx eax, bh shl eax, 2 @@ -650,7 +653,7 @@ ARP_api: .write: ; esi = pointer to buffer mov edi, eax - call ARP_add_entry ; out: eax = entry number, -1 on error + call arp_add_entry ; out: eax = entry number, -1 on error ret .remove: @@ -661,12 +664,12 @@ ARP_api: lea esi, [ARP_table + ecx] mov edi, eax shr edi, 2 - call ARP_del_entry + call arp_del_entry ret .send_announce: mov ebx, [NET_DRV_LIST + eax] mov eax, [IP_LIST + eax] - call ARP_output_request ; now send a gratuitous ARP + call arp_output_request ; now send a gratuitous ARP ret diff --git a/kernel/branches/Kolibri-acpi/network/IPv4.inc b/kernel/branches/Kolibri-acpi/network/IPv4.inc index ff5970638e..d86322bb48 100644 --- a/kernel/branches/Kolibri-acpi/network/IPv4.inc +++ b/kernel/branches/Kolibri-acpi/network/IPv4.inc @@ -16,7 +16,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision: 5842 $ +$Revision: 6011 $ IPv4_MAX_FRAGMENTS = 64 IPv4_MAX_ROUTES = 64 @@ -92,14 +92,12 @@ align 4 endg -;----------------------------------------------------------------- -; -; IPv4_init -; -; This function resets all IP variables -; -;----------------------------------------------------------------- -macro IPv4_init { +;-----------------------------------------------------------------; +; ; +; ipv4_init: Resets all IPv4 variables ; +; ; +;-----------------------------------------------------------------; +macro ipv4_init { xor eax, eax mov edi, IP_LIST @@ -109,12 +107,12 @@ macro IPv4_init { } -;----------------------------------------------------------------- -; -; Decrease TimeToLive of all fragment slots -; -;----------------------------------------------------------------- -macro IPv4_decrease_fragment_ttls { +;-----------------------------------------------------------------; +; ; +; Decrease TimeToLive of all fragment slots ; +; ; +;-----------------------------------------------------------------; +macro ipv4_decrease_fragment_ttls { local .loop, .next @@ -141,7 +139,7 @@ local .loop, .next -macro IPv4_checksum ptr { +macro ipv4_checksum ptr { ; This is the fast procedure to create or check an IP header without options ; To create a new checksum, the checksum field must be set to 0 before computation @@ -205,24 +203,22 @@ macro IPv4_checksum ptr { -;----------------------------------------------------------------- -; -; IPv4_input: -; -; Will check if IPv4 Packet isnt damaged -; and call appropriate handler. (TCP/UDP/ICMP/..) -; -; It will also re-construct fragmented packets -; -; IN: Pointer to buffer in [esp] -; pointer to device struct in ebx -; pointer to IPv4 header in edx -; size of IPv4 packet in ecx -; OUT: / -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; ipv4_input: Check if IPv4 Packet isnt damaged and call ; +; appropriate handler. (TCP/UDP/ICMP/..) ; +; We will also re-construct fragmented packets. ; +; ; +; IN: Pointer to buffer in [esp] ; +; pointer to device struct in ebx ; +; pointer to IPv4 header in edx ; +; size of IPv4 packet in ecx ; +; ; +; OUT: / ; +; ; +;-----------------------------------------------------------------; align 4 -IPv4_input: +ipv4_input: DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: packet from %u.%u.%u.%u ",\ [edx + IPv4_header.SourceAddress + 0]:1,[edx + IPv4_header.SourceAddress + 1]:1,\ @@ -231,14 +227,14 @@ IPv4_input: [edx + IPv4_header.DestinationAddress + 0]:1,[edx + IPv4_header.DestinationAddress + 1]:1,\ [edx + IPv4_header.DestinationAddress + 2]:1,[edx + IPv4_header.DestinationAddress + 3]:1 - call NET_ptr_to_num4 + call net_ptr_to_num4 cmp edi, -1 je .invalid_device ;------------------------------- ; re-calculate the checksum - IPv4_checksum edx + ipv4_checksum edx jnz .dump ; if checksum isn't valid then dump packet DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Checksum ok\n" @@ -304,13 +300,13 @@ IPv4_input: add esi, edx ; make esi ptr to data cmp al, IP_PROTO_TCP - je TCP_input + je tcp_input cmp al, IP_PROTO_UDP - je UDP_input + je udp_input cmp al, IP_PROTO_ICMP - je ICMP_input + je icmp_input ;------------------------------- ; Look for a matching RAW socket @@ -347,7 +343,7 @@ IPv4_input: call mutex_lock popa - jmp SOCKET_input + jmp socket_input .dump_unlock: @@ -361,12 +357,12 @@ IPv4_input: .dump: DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: dumping\n" inc [IPv4_packets_dumped + edi] - call NET_BUFF_free + call net_buff_free ret .invalid_device: DEBUGF DEBUG_NETWORK_ERROR, "IPv4_input: packet originated from invalid device\n" - call NET_BUFF_free + call net_buff_free ret @@ -390,7 +386,7 @@ IPv4_input: DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Middle fragment packet received!\n" - call IPv4_find_fragment_slot + call ipv4_find_fragment_slot cmp esi, -1 je .dump @@ -455,7 +451,7 @@ IPv4_input: .is_last_fragment: DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Last fragment packet received!\n" - call IPv4_find_fragment_slot + call ipv4_find_fragment_slot cmp esi, -1 je .dump @@ -546,7 +542,7 @@ IPv4_input: push [edx + IPv4_FRAGMENT_entry.NextPtr] ; Set edx to the next pointer push edx ; Push pointer to fragment onto stack DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Next Fragment: 0x%x\n", edx - call NET_BUFF_free ; free the previous fragment buffer (this uses the value from stack) + call net_buff_free ; free the previous fragment buffer (this uses the value from stack) pop edx ebx eax cmp edx, -1 ; Check if it is last fragment in chain jne .rebuild_packet_loop @@ -571,16 +567,17 @@ IPv4_input: -;----------------------------------------------------------------- -; -; find fragment slot -; -; IN: pointer to fragmented packet in edx -; OUT: pointer to slot in esi, -1 on error -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; ipv4_find_fragment_slot ; +; ; +; IN: pointer to fragmented packet in edx ; +; ; +; OUT: pointer to slot in esi, -1 on error ; +; ; +;-----------------------------------------------------------------; align 4 -IPv4_find_fragment_slot: +ipv4_find_fragment_slot: ;;; TODO: the RFC says we should check protocol number too @@ -607,26 +604,27 @@ IPv4_find_fragment_slot: ret -;------------------------------------------------------------------ -; -; IPv4_output -; -; IN: al = protocol -; ah = TTL -; ebx = device ptr (or 0 to let IP layer decide) -; ecx = data length -; edx = Source IP -; edi = Destination IP -; -; OUT: eax = pointer to buffer start / 0 on error -; ebx = device ptr (send packet through this device) -; ecx = data length -; edx = size of complete frame -; edi = start of IPv4 payload -; -;------------------------------------------------------------------ +;------------------------------------------------------------------; +; ; +; ipv4_output ; +; ; +; IN: al = protocol ; +; ah = TTL ; +; ebx = device ptr (or 0 to let IP layer decide) ; +; ecx = data length ; +; edx = Source IP ; +; edi = Destination IP ; +; ; +; OUT: eax = pointer to buffer start ; +; eax = 0 on error ; +; ebx = device ptr (send packet through this device) ; +; ecx = data length ; +; edx = size of complete frame ; +; edi = start of IPv4 payload ; +; ; +;------------------------------------------------------------------; align 4 -IPv4_output: +ipv4_output: DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_output: size=%u ip=0x%x\n", ecx, eax @@ -635,12 +633,12 @@ IPv4_output: push ecx ax edi mov eax, edi - call IPv4_route ; outputs device number in edi, dest ip in eax, source IP in edx + call ipv4_route ; outputs device number in edi, dest ip in eax, source IP in edx push edx test edi, edi jz .loopback - call ARP_IP_to_MAC + call arp_ip_to_mac test eax, 0xffff0000 ; error bits jnz .arp_error push ebx ; push the mac onto the stack @@ -653,7 +651,7 @@ IPv4_output: mov ecx, [esp + 6 + 8 + 2] add ecx, sizeof.IPv4_header mov edx, esp - call ETH_output + call eth_output jz .eth_error add esp, 6 ; pop the mac out of the stack @@ -674,7 +672,7 @@ IPv4_output: pop ecx - IPv4_checksum edi + ipv4_checksum edi add edi, sizeof.IPv4_header DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_output: success!\n" ret @@ -704,33 +702,33 @@ IPv4_output: mov ecx, [esp + 10] add ecx, sizeof.IPv4_header mov edi, AF_INET4 - call LOOP_output + call loop_output jmp .continue -;------------------------------------------------------------------ -; -; IPv4_output_raw -; -; IN: eax = socket ptr -; ecx = data length -; esi = data ptr -; -; OUT: eax = -1 on error -; -;------------------------------------------------------------------ +;------------------------------------------------------------------; +; ; +; ipv4_output_raw ; +; ; +; IN: eax = socket ptr ; +; ecx = data length ; +; esi = data ptr ; +; ; +; OUT: eax = -1 on error ; +; ; +;------------------------------------------------------------------; align 4 -IPv4_output_raw: +ipv4_output_raw: DEBUGF 1,"IPv4_output_raw: size=%u ptr=%x socket=%x\n", ecx, esi, eax sub esp, 8 push esi eax - call IPv4_route - call ARP_IP_to_MAC + call ipv4_route + call arp_ip_to_mac test eax, 0xffff0000 ; error bits jnz .arp_error @@ -744,7 +742,7 @@ IPv4_output_raw: mov ecx, [esp + 6 + 4] add ecx, sizeof.IPv4_header mov edx, esp - call ETH_output + call eth_output jz .error add esp, 6 ; pop the mac @@ -772,7 +770,7 @@ IPv4_output_raw: ; [edi + IPv4_header.SourceAddress] ; [edi + IPv4_header.DestinationAddress] - IPv4_checksum edi ;;;; todo: checksum for IP packet with options! + ipv4_checksum edi ;;;; todo: checksum for IP packet with options! add edi, sizeof.IPv4_header DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_output_raw: device=%x\n", ebx call [ebx + NET_DEVICE.transmit] @@ -791,17 +789,18 @@ IPv4_output_raw: ret -;-------------------------------------------------------- -; -; -; IN: [esp] = pointer to buffer containing ipv4 packet to be fragmented -; edi = pointer to ip header in that buffer -; ebx = device ptr -; -; OUT: / -; -;-------------------------------------------------------- -proc IPv4_fragment stdcall buffer +;-----------------------------------------------------------------; +; ; +; ipv4_fragment ; +; ; +; IN: [esp] = ptr to packet buffer to fragment ; +; edi = ptrr to ip header in that buffer ; +; ebx = device ptr ; +; ; +; OUT: / ; +; ; +;-----------------------------------------------------------------; +proc ipv4_fragment stdcall buffer locals offset dd ? @@ -910,22 +909,24 @@ endp -;--------------------------------------------------------------------------- -; -; IPv4_route -; -; IN: eax = Destination IP -; ebx = outgoing device / 0 -; edx = Source IP -; OUT: eax = Destination IP (or gateway IP) -; edx = Source IP -; edi = device number*4 -; DESTROYED: -; ecx -; -;--------------------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; ipv4_route ; +; ; +; IN: eax = Destination IP ; +; ebx = outgoing device / 0 ; +; edx = Source IP ; +; ; +; OUT: eax = Destination IP (or gateway IP) ; +; edx = Source IP ; +; edi = device number*4 ; +; ; +; DESTROYED: ; +; ecx ; +; ; +;-----------------------------------------------------------------; align 4 -IPv4_route: ; TODO: return error if no valid route found +ipv4_route: ; TODO: return error if no valid route found test ebx, ebx jnz .got_device @@ -961,7 +962,7 @@ IPv4_route: ; TODO: return error if no valid route found .got_device: ; Validate device ptr and convert to device number - call NET_ptr_to_num4 + call net_ptr_to_num4 cmp edi, -1 je .fail @@ -982,32 +983,35 @@ IPv4_route: ; TODO: return error if no valid route found -;--------------------------------------------------------------------------- -; -; IPv4_get_frgmnt_num -; -; IN: / -; OUT: fragment number in ax -; -;--------------------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; ipv4_get_frgmnt_num ; +; ; +; IN: / ; +; ; +; OUT: ax = fragment number ; +; ; +;-----------------------------------------------------------------; align 4 -IPv4_get_frgmnt_num: +ipv4_get_frgmnt_num: xor ax, ax ;;; TODO: replace this with real code ret -;----------------------------------------------------------------- -; -; IPv4_connect -; -; IN: eax = socket pointer -; OUT: eax = 0 ok / -1 error -; ebx = error code -; -;------------------------- +;-----------------------------------------------------------------; +; ; +; ipv4_connect ; +; ; +; IN: eax = socket pointer ; +; ; +; OUT: eax = 0 on success ; +; eax = -1 on error ; +; ebx = error code on error ; +; ; +;-----------------------------------------------------------------; align 4 -IPv4_connect: +ipv4_connect: push eax edx lea ecx, [eax + SOCKET.mutex] @@ -1031,21 +1035,19 @@ IPv4_connect: ret -;--------------------------------------------------------------------------- -; -; IPv4_API -; -; This function is called by system function 75 -; -; IN: subfunction number in bl -; device number in bh -; ecx, edx, .. depends on subfunction -; -; OUT: -; -;--------------------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; ipv4_API: Part of system function 76. ; +; ; +; IN: bl = subfunction number ; +; bh = device number ; +; ecx, edx, .. depends on subfunction ; +; ; +; OUT: depends on subfunction ; +; ; +;-----------------------------------------------------------------; align 4 -IPv4_api: +ipv4_api: movzx eax, bh shl eax, 2 @@ -1096,9 +1098,9 @@ IPv4_api: mov ebx, [NET_DRV_LIST + eax] mov eax, [IP_LIST + eax] - call ARP_output_request ; now send a gratuitous ARP + call arp_output_request ; now send a gratuitous ARP - call NET_send_event + call net_send_event xor eax, eax ret @@ -1108,7 +1110,7 @@ IPv4_api: .write_dns: mov [DNS_LIST + eax], ecx - call NET_send_event + call net_send_event xor eax, eax ret @@ -1125,7 +1127,7 @@ IPv4_api: or ecx, ebx mov [BROADCAST_LIST + eax], ecx - call NET_send_event + call net_send_event xor eax, eax ret @@ -1136,6 +1138,6 @@ IPv4_api: .write_gateway: mov [GATEWAY_LIST + eax], ecx - call NET_send_event + call net_send_event xor eax, eax ret \ No newline at end of file diff --git a/kernel/branches/Kolibri-acpi/network/IPv6.inc b/kernel/branches/Kolibri-acpi/network/IPv6.inc index 93bcdd1ab3..bda3af46f4 100644 --- a/kernel/branches/Kolibri-acpi/network/IPv6.inc +++ b/kernel/branches/Kolibri-acpi/network/IPv6.inc @@ -14,7 +14,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision: 5522 $ +$Revision: 6011 $ struct IPv6_header @@ -45,14 +45,12 @@ align 4 endg -;----------------------------------------------------------------- -; -; IPv6_init -; -; This function resets all IP variables -; -;----------------------------------------------------------------- -macro IPv6_init { +;-----------------------------------------------------------------; +; ; +; ipv6_init: Resets all IPv6 variables ; +; ; +;-----------------------------------------------------------------; +macro ipv6_init { xor eax, eax mov edi, IPv6 @@ -63,25 +61,23 @@ macro IPv6_init { -;----------------------------------------------------------------- -; -; IPv6_input: -; -; Will check if IPv6 Packet isnt damaged -; and call appropriate handler. (TCP/UDP/ICMP/..) -; -; It will also re-construct fragmented packets -; -; IN: Pointer to buffer in [esp] -; size of buffer in [esp+4] -; pointer to device struct in ebx -; pointer to IPv6 header in edx -; size of IPv6 packet in ecx -; OUT: / -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; ipv6_input: Check if IPv6 Packet isnt damaged and call ; +; appropriate handler. (TCP/UDP/ICMP/..) ; +; We will also re-construct fragmented packets ; +; ; +; IN: [esp] = ptr to buffer ; +; [esp+4] = size of buffer ; +; ebx = ptr to device struct ; +; edx = ptr to IPv6 header ; +; ecx = size of IPv6 packet ; +; ; +; OUT: / ; +; ; +;-----------------------------------------------------------------; align 4 -IPv6_input: +ipv6_input: DEBUGF DEBUG_NETWORK_VERBOSE, "IPv6_input from: %x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x\n",\ [edx + IPv6_header.SourceAddress + 0]:2,[edx + IPv6_header.SourceAddress + 1]:2,\ @@ -147,7 +143,7 @@ IPv6_input: .dump: DEBUGF DEBUG_NETWORK_VERBOSE, "IPv6_input - dumping\n" - call NET_BUFF_free + call net_buff_free ret .dump_options: @@ -245,21 +241,19 @@ IPv6_input: -;--------------------------------------------------------------------------- -; -; IPv6_API -; -; This function is called by system function 75 -; -; IN: subfunction number in bl -; device number in bh -; ecx, edx, .. depends on subfunction -; -; OUT: -; -;--------------------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; ipv6_api: Part of system function 76 ; +; ; +; IN: bl = subfunction number ; +; bh = device number ; +; ecx, edx, .. depends on subfunction ; +; ; +; OUT: depends on subfunction ; +; ; +;-----------------------------------------------------------------; align 4 -IPv6_api: +ipv6_api: movzx eax, bh shl eax, 2 diff --git a/kernel/branches/Kolibri-acpi/network/PPPoE.inc b/kernel/branches/Kolibri-acpi/network/PPPoE.inc index eecbd0b4a8..e436634532 100644 --- a/kernel/branches/Kolibri-acpi/network/PPPoE.inc +++ b/kernel/branches/Kolibri-acpi/network/PPPoE.inc @@ -14,7 +14,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision: 5522 $ +$Revision: 6011 $ struct PPPoE_frame @@ -33,37 +33,33 @@ align 4 endg -;----------------------------------------------------------------- -; -; PPPoE_init -; -; This function resets all IP variables -; -;----------------------------------------------------------------- -macro PPPoE_init { +;-----------------------------------------------------------------; +; ; +; pppoe_init: Reset all pppoe variables ; +; ; +;-----------------------------------------------------------------; +macro pppoe_init { - call PPPoE_stop_connection + call pppoe_stop_connection } -;----------------------------------------------------------------- -; -; PPPoE discovery input -; -; Handler of received Ethernet packet with type = Discovery -; -; -; IN: Pointer to buffer in [esp] -; size of buffer in [esp+4] -; pointer to device struct in ebx -; pointer to PPP header in edx -; size of PPP packet in ecx -; OUT: / -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; pppoe_discovery_input ; +; ; +; IN: [esp] = ptr to buffer ; +; [esp+4] = size of buffer ; +; ebx = ptr to device struct ; +; ecx = size of PPP packet ; +; edx = ptr to PPP header ; +; ; +; OUT: / ; +; ; +;-----------------------------------------------------------------; align 4 -PPPoE_discovery_input: +pppoe_discovery_input: DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_discovery_input\n" @@ -97,7 +93,7 @@ PPPoE_discovery_input: mov ecx, [esp + 4] mov esi, [esp] - jmp SOCKET_input + jmp socket_input .dump: pusha @@ -106,22 +102,21 @@ PPPoE_discovery_input: popa DEBUGF DEBUG_NETWORK_VERBOSE, 'PPPoE_discovery_input: dumping\n' - call NET_BUFF_free + call net_buff_free ret -;-------------------------------------- -; -; Send discovery packet -; -; IN: eax = socket pointer -; ecx = number of bytes to send -; esi = pointer to data -; -;-------------------------------------- - +;-----------------------------------------------------------------; +; ; +; pppoe_discovery_output ; +; ; +; IN: eax = socket pointer ; +; ecx = number of bytes to send ; +; esi = pointer to data ; +; ; +;-----------------------------------------------------------------; align 4 -PPPoE_discovery_output: +pppoe_discovery_output: DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_discovery_output: socket=%x buffer=%x size=%d\n", eax, esi, ecx @@ -147,7 +142,7 @@ PPPoE_discovery_output: ; Create packet. push ecx esi - stdcall kernel_alloc, 1500 +;;;; FIXME stdcall kernel_alloc, 1500 pop esi ecx test eax, eax jz .bad @@ -185,23 +180,21 @@ PPPoE_discovery_output: ret -;----------------------------------------------------------------- -; -; PPPoE session input -; -; Handler of received Ethernet packet with type = Session -; -; -; IN: Pointer to buffer in [esp] -; size of buffer in [esp+4] -; pointer to device struct in ebx -; pointer to PPP header in edx -; size of PPP packet in ecx -; OUT: / -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; pppoe_session_input ; +; ; +; IN: [esp] = ptr to buffer ; +; [esp+4] = size of buffer ; +; ebx = ptr to device struct ; +; edx = ptr to PPP header ; +; ecx = size of PPP packet ; +; ; +; OUT: / ; +; ; +;-----------------------------------------------------------------; align 4 -PPPoE_session_input: +pppoe_session_input: cmp [edx + PPPoE_frame.VersionAndType], 0x11 jne .dump @@ -221,38 +214,39 @@ PPPoE_session_input: add edx, PPPoE_frame.Payload + 2 cmp ax, PPP_PROTO_IPv4 - je IPv4_input + je ipv4_input ; cmp ax, PPP_PROTO_IPv6 -; je IPv6_input +; je ipv6_input - jmp PPPoE_discovery_input ; Send LCP,CHAP,CBCP,... packets to the PPP dialer + jmp pppoe_discovery_input ; Send LCP,CHAP,CBCP,... packets to the PPP dialer DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_input: Unknown protocol=%x\n", ax .dump: DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_input: dumping\n" - call NET_BUFF_free + call net_buff_free ret -;----------------------------------------------------------------- -; -; PPPoE_output -; -; IN: ax = protocol -; ebx = device ptr -; ecx = packet size -; -; OUT: eax = buffer start / 0 on error -; ebx = device ptr -; ecx = packet size -; edx = size of complete buffer -; edi = start of PPP payload -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; pppoe_output ; +; ; +; IN: ax = protocol ; +; ebx = device ptr ; +; ecx = packet size ; +; ; +; OUT: eax = buffer start ; +; eax = 0 on error ; +; ebx = device ptr ; +; ecx = packet size ; +; edx = size of complete buffer ; +; edi = start of PPP payload ; +; ; +;-----------------------------------------------------------------; align 4 -PPPoE_output: +pppoe_output: DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_output: size=%u device=%x\n", ecx, ebx @@ -262,7 +256,7 @@ PPPoE_output: mov ax, ETHER_PROTO_PPP_SESSION add ecx, PPPoE_frame.Payload + 2 lea edx, [PPPoE_MAC] - call ETH_output + call eth_output jz .eth_error sub ecx, PPPoE_frame.Payload @@ -287,8 +281,8 @@ PPPoE_output: xor eax, eax ret - -PPPoE_start_connection: +align 4 +pppoe_start_connection: DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_start_connection: %x\n", cx @@ -308,7 +302,7 @@ PPPoE_start_connection: align 4 -PPPoE_stop_connection: +pppoe_stop_connection: DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_stop_connection\n" @@ -320,21 +314,19 @@ PPPoE_stop_connection: ret -;--------------------------------------------------------------------------- -; -; PPPoE API -; -; This function is called by system function 75 -; -; IN: subfunction number in bl -; device number in bh -; ecx, edx, .. depends on subfunction -; -; OUT: -; -;--------------------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; pppoe_api: Part of system function 76 ; +; ; +; IN: subfunction number in bl ; +; device number in bh ; +; ecx, edx, .. depends on subfunction ; +; ; +; OUT: ; +; ; +;-----------------------------------------------------------------; align 4 -PPPoE_api: +pppoe_api: movzx eax, bh shl eax, 2 @@ -345,8 +337,8 @@ PPPoE_api: jmp dword [.table + 4*ebx] .table: - dd PPPoE_start_connection ; 0 - dd PPPoE_stop_connection ; 1 + dd pppoe_start_connection ; 0 + dd pppoe_stop_connection ; 1 .number = ($ - .table) / 4 - 1 .error: diff --git a/kernel/branches/Kolibri-acpi/network/ethernet.inc b/kernel/branches/Kolibri-acpi/network/ethernet.inc index e69889c552..4df83493e4 100644 --- a/kernel/branches/Kolibri-acpi/network/ethernet.inc +++ b/kernel/branches/Kolibri-acpi/network/ethernet.inc @@ -14,7 +14,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision: 5522 $ +$Revision: 6011 $ ETH_FRAME_MINIMUM = 60 ETH_QUEUE_SIZE = 255 @@ -50,10 +50,10 @@ align 4 ETH_input_event dd ? endg -macro ETH_init { +macro eth_init { movi ebx, 1 - mov ecx, ETH_process_input + mov ecx, eth_process_input call new_sys_threads test eax, eax jns @f @@ -62,20 +62,18 @@ macro ETH_init { } -;----------------------------------------------------------------- -; -; ETH_input -; -; This function is called by ethernet drivers, -; It pushes the received ethernet packets onto the ethernet input queue -; -; IN: [esp] = Pointer to buffer -; -; OUT: / -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; eth_input: This function is called by ethernet drivers. ; +; Push the received ethernet packet onto the ethernet input queue.; +; ; +; IN: [esp] = Pointer to buffer ; +; ; +; OUT: / ; +; ; +;-----------------------------------------------------------------; align 4 -ETH_input: +eth_input: pop eax pushf @@ -109,14 +107,22 @@ ETH_input: DEBUGF DEBUG_NETWORK_ERROR, "ETH incoming queue is full, discarding packet!\n" popf push eax - call NET_BUFF_free + call net_buff_free ret - +;-----------------------------------------------------------------; +; ; +; eth_process_input: Process packets from ethernet input queue. ; +; ; +; IN: / ; +; ; +; OUT: / ; +; ; +;-----------------------------------------------------------------; align 4 -ETH_process_input: +eth_process_input: xor esi, esi mov ecx, MANUAL_DESTROY @@ -163,44 +169,46 @@ ETH_process_input: ; Place protocol handlers here cmp ax, ETHER_PROTO_IPv4 - je IPv4_input + je ipv4_input cmp ax, ETHER_PROTO_ARP - je ARP_input + je arp_input ; cmp ax, ETHER_PROTO_IPv6 -; je IPv6_input +; je ipv6_input ; cmp ax, ETHER_PROTO_PPP_DISCOVERY -; je PPPoE_discovery_input +; je pppoe_discovery_input ; cmp ax, ETHER_PROTO_PPP_SESSION -; je PPPoE_session_input +; je pppoe_session_input DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_input: Unknown packet type=%x\n", ax .dump: DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_input: dumping\n" - call NET_BUFF_free + call net_buff_free ret -;----------------------------------------------------------------- -; -; ETH_output -; -; IN: ax = protocol -; ebx = device ptr -; ecx = payload size -; edx = pointer to destination mac -; -; OUT: eax = start of net frame / 0 on error -; ebx = device ptr -; ecx = payload size -; edi = start of payload -; -;----------------------------------------------------------------- + + +;-----------------------------------------------------------------; +; ; +; eth_output ; +; ; +; IN: ax = protocol ; +; ebx = device ptr ; +; ecx = payload size ; +; edx = pointer to destination mac ; +; ; +; OUT: eax = start of net frame / 0 on error ; +; ebx = device ptr ; +; ecx = payload size ; +; edi = start of payload ; +; ; +;-----------------------------------------------------------------; align 4 -ETH_output: +eth_output: DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_output: size=%u device=%x\n", ecx, ebx @@ -211,7 +219,7 @@ ETH_output: push ax edx add ecx, sizeof.ETH_header + NET_BUFF.data - stdcall NET_BUFF_alloc, ecx + stdcall net_buff_alloc, ecx test eax, eax jz .out_of_ram mov [eax + NET_BUFF.type], NET_BUFF_ETH @@ -257,21 +265,19 @@ ETH_output: -;----------------------------------------------------------------- -; -; ETH_API -; -; This function is called by system function 76 -; -; IN: subfunction number in bl -; device number in bh -; ecx, edx, .. depends on subfunction -; -; OUT: -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; eth_api: Part of system function 76. ; +; ; +; IN: bl = subfunction number ; +; bh = device number ; +; ecx, edx, .. depends on subfunction ; +; ; +; OUT: depends on subfunction ; +; ; +;-----------------------------------------------------------------; align 4 -ETH_api: +eth_api: cmp bh, NET_DEVICES_MAX ja .error diff --git a/kernel/branches/Kolibri-acpi/network/icmp.inc b/kernel/branches/Kolibri-acpi/network/icmp.inc index c3cabca200..5ec85024ca 100644 --- a/kernel/branches/Kolibri-acpi/network/icmp.inc +++ b/kernel/branches/Kolibri-acpi/network/icmp.inc @@ -20,70 +20,69 @@ $Revision$ ; ICMP types & codes -ICMP_ECHOREPLY = 0 ; echo reply message +ICMP_ECHOREPLY = 0 ; echo reply message ICMP_UNREACH = 3 -ICMP_UNREACH_NET = 0 ; bad net -ICMP_UNREACH_HOST = 1 ; bad host -ICMP_UNREACH_PROTOCOL = 2 ; bad protocol -ICMP_UNREACH_PORT = 3 ; bad port -ICMP_UNREACH_NEEDFRAG = 4 ; IP_DF caused drop -ICMP_UNREACH_SRCFAIL = 5 ; src route failed -ICMP_UNREACH_NET_UNKNOWN = 6 ; unknown net -ICMP_UNREACH_HOST_UNKNOWN = 7 ; unknown host -ICMP_UNREACH_ISOLATED = 8 ; src host isolated -ICMP_UNREACH_NET_PROHIB = 9 ; prohibited access -ICMP_UNREACH_HOST_PROHIB = 10 ; ditto -ICMP_UNREACH_TOSNET = 11 ; bad tos for net -ICMP_UNREACH_TOSHOST = 12 ; bad tos for host -ICMP_UNREACH_FILTER_PROHIB = 13 ; admin prohib -ICMP_UNREACH_HOST_PRECEDENCE = 14 ; host prec vio. -ICMP_UNREACH_PRECEDENCE_CUTOFF = 15 ; prec cutoff +ICMP_UNREACH_NET = 0 ; bad net +ICMP_UNREACH_HOST = 1 ; bad host +ICMP_UNREACH_PROTOCOL = 2 ; bad protocol +ICMP_UNREACH_PORT = 3 ; bad port +ICMP_UNREACH_NEEDFRAG = 4 ; IP_DF caused drop +ICMP_UNREACH_SRCFAIL = 5 ; src route failed +ICMP_UNREACH_NET_UNKNOWN = 6 ; unknown net +ICMP_UNREACH_HOST_UNKNOWN = 7 ; unknown host +ICMP_UNREACH_ISOLATED = 8 ; src host isolated +ICMP_UNREACH_NET_PROHIB = 9 ; prohibited access +ICMP_UNREACH_HOST_PROHIB = 10 ; ditto +ICMP_UNREACH_TOSNET = 11 ; bad tos for net +ICMP_UNREACH_TOSHOST = 12 ; bad tos for host +ICMP_UNREACH_FILTER_PROHIB = 13 ; admin prohib +ICMP_UNREACH_HOST_PRECEDENCE = 14 ; host prec vio. +ICMP_UNREACH_PRECEDENCE_CUTOFF = 15 ; prec cutoff -ICMP_SOURCEQUENCH = 4 ; Packet lost, slow down +ICMP_SOURCEQUENCH = 4 ; Packet lost, slow down -ICMP_REDIRECT = 5 ; shorter route, codes: -ICMP_REDIRECT_NET = 0 ; for network -ICMP_REDIRECT_HOST = 1 ; for host -ICMP_REDIRECT_TOSNET = 2 ; for tos and net -ICMP_REDIRECT_TOSHOST = 3 ; for tos and host +ICMP_REDIRECT = 5 ; shorter route, codes: +ICMP_REDIRECT_NET = 0 ; for network +ICMP_REDIRECT_HOST = 1 ; for host +ICMP_REDIRECT_TOSNET = 2 ; for tos and net +ICMP_REDIRECT_TOSHOST = 3 ; for tos and host -ICMP_ALTHOSTADDR = 6 ; alternate host address -ICMP_ECHO = 8 ; echo service -ICMP_ROUTERADVERT = 9 ; router advertisement -ICMP_ROUTERADVERT_NORMAL = 0 ; normal advertisement -ICMP_ROUTERADVERT_NOROUTE_COMMON= 16 ; selective routing +ICMP_ALTHOSTADDR = 6 ; alternate host address +ICMP_ECHO = 8 ; echo service +ICMP_ROUTERADVERT = 9 ; router advertisement +ICMP_ROUTERADVERT_NORMAL = 0 ; normal advertisement +ICMP_ROUTERADVERT_NOROUTE_COMMON= 16 ; selective routing -ICMP_ROUTERSOLICIT = 10 ; router solicitation -ICMP_TIMXCEED = 11 ; time exceeded, code: -ICMP_TIMXCEED_INTRANS = 0 ; ttl==0 in transit -ICMP_TIMXCEED_REASS = 1 ; ttl==0 in reass +ICMP_ROUTERSOLICIT = 10 ; router solicitation +ICMP_TIMXCEED = 11 ; time exceeded, code: +ICMP_TIMXCEED_INTRANS = 0 ; ttl==0 in transit +ICMP_TIMXCEED_REASS = 1 ; ttl==0 in reass -ICMP_PARAMPROB = 12 ; ip header bad -ICMP_PARAMPROB_ERRATPTR = 0 ; error at param ptr -ICMP_PARAMPROB_OPTABSENT = 1 ; req. opt. absent -ICMP_PARAMPROB_LENGTH = 2 ; bad length +ICMP_PARAMPROB = 12 ; ip header bad +ICMP_PARAMPROB_ERRATPTR = 0 ; error at param ptr +ICMP_PARAMPROB_OPTABSENT = 1 ; req. opt. absent +ICMP_PARAMPROB_LENGTH = 2 ; bad length -ICMP_TSTAMP = 13 ; timestamp request -ICMP_TSTAMPREPLY = 14 ; timestamp reply -ICMP_IREQ = 15 ; information request -ICMP_IREQREPLY = 16 ; information reply -ICMP_MASKREQ = 17 ; address mask request -ICMP_MASKREPLY = 18 ; address mask reply -ICMP_TRACEROUTE = 30 ; traceroute -ICMP_DATACONVERR = 31 ; data conversion error -ICMP_MOBILE_REDIRECT = 32 ; mobile host redirect -ICMP_IPV6_WHEREAREYOU = 33 ; IPv6 where-are-you -ICMP_IPV6_IAMHERE = 34 ; IPv6 i-am-here -ICMP_MOBILE_REGREQUEST = 35 ; mobile registration req -ICMP_MOBILE_REGREPLY = 36 ; mobile registreation reply -ICMP_SKIP = 39 ; SKIP - -ICMP_PHOTURIS = 40 ; Photuris -ICMP_PHOTURIS_UNKNOWN_INDEX = 1 ; unknown sec index -ICMP_PHOTURIS_AUTH_FAILED = 2 ; auth failed -ICMP_PHOTURIS_DECRYPT_FAILED = 3 ; decrypt failed +ICMP_TSTAMP = 13 ; timestamp request +ICMP_TSTAMPREPLY = 14 ; timestamp reply +ICMP_IREQ = 15 ; information request +ICMP_IREQREPLY = 16 ; information reply +ICMP_MASKREQ = 17 ; address mask request +ICMP_MASKREPLY = 18 ; address mask reply +ICMP_TRACEROUTE = 30 ; traceroute +ICMP_DATACONVERR = 31 ; data conversion error +ICMP_MOBILE_REDIRECT = 32 ; mobile host redirect +ICMP_IPV6_WHEREAREYOU = 33 ; IPv6 where-are-you +ICMP_IPV6_IAMHERE = 34 ; IPv6 i-am-here +ICMP_MOBILE_REGREQUEST = 35 ; mobile registration req +ICMP_MOBILE_REGREPLY = 36 ; mobile registreation reply +ICMP_SKIP = 39 ; SKIP +ICMP_PHOTURIS = 40 ; Photuris +ICMP_PHOTURIS_UNKNOWN_INDEX = 1 ; unknown sec index +ICMP_PHOTURIS_AUTH_FAILED = 2 ; auth failed +ICMP_PHOTURIS_DECRYPT_FAILED = 3 ; decrypt failed struct ICMP_header @@ -107,13 +106,13 @@ endg -;----------------------------------------------------------------- -; -; ICMP_init -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; ICMP_init ; +; ; +;-----------------------------------------------------------------; -macro ICMP_init { +macro icmp_init { xor eax, eax mov edi, ICMP_PACKETS_TX @@ -123,25 +122,23 @@ macro ICMP_init { } -;----------------------------------------------------------------- -; -; ICMP_input: -; -; This procedure will send reply's to ICMP echo's -; and insert packets into sockets when needed -; -; IN: Pointer to buffer in [esp] -; ebx = pointer to device struct -; ecx = ICMP Packet size -; edx = ptr to IPv4 header -; esi = ptr to ICMP Packet data -; edi = interface number*4 -; -; OUT: / -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; icmp_input: Send a reply's to an ICMP echo or insert packets ; +; into socket. ; +; ; +; IN: [esp] = ptr to buffer ; +; ebx = ptr to device struct ; +; ecx = ICMP Packet size ; +; edx = ptr to IPv4 header ; +; esi = ptr to ICMP Packet data ; +; edi = interface number*4 ; +; ; +; OUT: / ; +; ; +;-----------------------------------------------------------------; align 4 -ICMP_input: +icmp_input: DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input\n" @@ -204,7 +201,7 @@ ICMP_input: call mutex_lock popa - jmp SOCKET_input + jmp socket_input @@ -274,7 +271,7 @@ ICMP_input: test eax, eax jnz @f DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP transmit failed\n" - call NET_ptr_to_num4 + call net_ptr_to_num4 inc [ICMP_PACKETS_TX + edi] @@: ret @@ -293,26 +290,26 @@ ICMP_input: .dump: DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input: dumping\n" - call NET_BUFF_free + call net_buff_free ret if 0 -;----------------------------------------------------------------- -; -; ICMP_output -; -; IN: eax = dest ip -; bh = type -; bl = code -; ecx = data length -; edx = source ip -; esi = data offset -; edi = identifier shl 16 + sequence number -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; icmp_output ; +; ; +; IN: eax = dest ip ; +; bh = type ; +; bl = code ; +; ecx = data length ; +; edx = source ip ; +; esi = data offset ; +; edi = identifier shl 16 + sequence number ; +; ; +;-----------------------------------------------------------------; align 4 -ICMP_output: +icmp_output: DEBUGF DEBUG_NETWORK_VERBOSE, "Creating ICMP Packet\n" @@ -364,17 +361,17 @@ end if -;----------------------------------------------------------------- -; -; ICMP_output_raw -; -; IN: eax = socket ptr -; ecx = data length -; edx = data pointer -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; icmp_output_raw ; +; ; +; IN: eax = socket ptr ; +; ecx = data length ; +; edx = data pointer ; +; ; +;-----------------------------------------------------------------; align 4 -ICMP_output_raw: +icmp_output_raw: DEBUGF DEBUG_NETWORK_VERBOSE, "Creating ICMP Packet for socket %x, data ptr=%x\n", eax, edx @@ -384,7 +381,7 @@ ICMP_output_raw: mov edi, [eax + IP_SOCKET.RemoteIP] mov al, [eax + IP_SOCKET.ttl] mov ah, IP_PROTO_ICMP - call IPv4_output + call ipv4_output jz .fail pop esi @@ -407,7 +404,7 @@ ICMP_output_raw: call [ebx + NET_DEVICE.transmit] test eax, eax jnz @f - call NET_ptr_to_num4 + call net_ptr_to_num4 inc [ICMP_PACKETS_TX + edi] @@: ret @@ -422,21 +419,19 @@ ICMP_output_raw: -;----------------------------------------------------------------- -; -; ICMP_API -; -; This function is called by system function 75 -; -; IN: subfunction number in bl -; device number in bh -; ecx, edx, .. depends on subfunction -; -; OUT: -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; icmp_api: Part of system function 76. ; +; ; +; IN: bl = subfunction number ; +; bh = device number ; +; ecx, edx, .. depends on subfunction ; +; ; +; OUT: depends on subfunction ; +; ; +;-----------------------------------------------------------------; align 4 -ICMP_api: +icmp_api: movzx eax, bh shl eax, 2 diff --git a/kernel/branches/Kolibri-acpi/network/loopback.inc b/kernel/branches/Kolibri-acpi/network/loopback.inc index d15c418558..2e14833424 100644 --- a/kernel/branches/Kolibri-acpi/network/loopback.inc +++ b/kernel/branches/Kolibri-acpi/network/loopback.inc @@ -14,7 +14,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision: 5976 $ +$Revision: 6011 $ iglobal align 4 @@ -27,7 +27,7 @@ LOOPBACK_DEVICE: .unload dd .dummy_fn .reset dd .dummy_fn - .transmit dd LOOP_input + .transmit dd loop_input .bytes_tx dq 0 .bytes_rx dq 0 @@ -45,11 +45,11 @@ LOOPBACK_DEVICE: endg -macro LOOP_init { +macro loop_init { local .fail mov ebx, LOOPBACK_DEVICE - call NET_add_device + call net_add_device cmp eax, -1 je .fail @@ -63,7 +63,7 @@ local .fail ;-----------------------------------------------------------------; ; ; -; LOOP_input ; +; loop_input ; ; ; ; IN: [esp+4] = Pointer to buffer ; ; ; @@ -71,7 +71,7 @@ local .fail ; ; ;-----------------------------------------------------------------; align 4 -LOOP_input: +loop_input: mov eax, [esp+4] @@ -95,19 +95,19 @@ LOOP_input: ; Place protocol handlers here cmp eax, AF_INET4 - je IPv4_input + je ipv4_input DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: Unknown packet type=%x\n", eax .dump: DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: dumping\n" - call NET_BUFF_free + call net_buff_free ret ;-----------------------------------------------------------------; ; ; -; LOOP_output ; +; loop_output ; ; ; ; IN: ecx = packet size ; ; edi = address family ; @@ -119,7 +119,7 @@ LOOP_input: ; ; ;-----------------------------------------------------------------; align 4 -LOOP_output: +loop_output: DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_output\n" @@ -128,7 +128,7 @@ LOOP_output: push ecx edi add ecx, NET_BUFF.data - stdcall NET_BUFF_alloc, ecx + stdcall net_buff_alloc, ecx test eax, eax jz .out_of_ram diff --git a/kernel/branches/Kolibri-acpi/network/socket.inc b/kernel/branches/Kolibri-acpi/network/socket.inc index bf67c3faee..c77dcffce0 100644 --- a/kernel/branches/Kolibri-acpi/network/socket.inc +++ b/kernel/branches/Kolibri-acpi/network/socket.inc @@ -207,10 +207,10 @@ endg ;-----------------------------------------------------------------; ; ; -; SOCKET_init ; +; socket_init ; ; ; ;-----------------------------------------------------------------; -macro SOCKET_init { +macro socket_init { xor eax, eax mov edi, net_sockets @@ -251,24 +251,24 @@ sys_socket: mov dword[esp+20], 0 ; Set error code to 0 cmp ebx, 255 - jz SOCKET_debug + jz socket_debug cmp ebx, .number ja .error jmp dword [.table + 4*ebx] .table: - dd SOCKET_open ; 0 - dd SOCKET_close ; 1 - dd SOCKET_bind ; 2 - dd SOCKET_listen ; 3 - dd SOCKET_connect ; 4 - dd SOCKET_accept ; 5 - dd SOCKET_send ; 6 - dd SOCKET_receive ; 7 - dd SOCKET_set_opt ; 8 - dd SOCKET_get_opt ; 9 - dd SOCKET_pair ; 10 + dd socket_open ; 0 + dd socket_close ; 1 + dd socket_bind ; 2 + dd socket_listen ; 3 + dd socket_connect ; 4 + dd socket_accept ; 5 + dd socket_send ; 6 + dd socket_receive ; 7 + dd socket_set_opt ; 8 + dd socket_get_opt ; 9 + dd socket_pair ; 10 .number = ($ - .table) / 4 - 1 .error: @@ -279,7 +279,7 @@ sys_socket: ;-----------------------------------------------------------------; ; ; -; SOCKET_open: Create a new socket. ; +; socket_open: Create a new socket. ; ; ; ; IN: ecx = domain ; ; edx = type ; @@ -291,12 +291,12 @@ sys_socket: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_open: +socket_open: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_open: domain=%u type=%u protocol=%x ", ecx, edx, esi push ecx edx esi - call SOCKET_alloc + call socket_alloc pop esi edx ecx test eax, eax jz .nobuffs @@ -339,7 +339,7 @@ SOCKET_open: .no_ppp: .unsupported: push eax - call SOCKET_free + call socket_free pop eax mov dword[esp+20], EOPNOTSUPP mov dword[esp+32], -1 @@ -366,19 +366,19 @@ align 4 pop eax mov [eax + SOCKET.Protocol], IP_PROTO_UDP - mov [eax + SOCKET.snd_proc], SOCKET_send_udp - mov [eax + SOCKET.rcv_proc], SOCKET_receive_dgram - mov [eax + SOCKET.connect_proc], UDP_connect + mov [eax + SOCKET.snd_proc], socket_send_udp + mov [eax + SOCKET.rcv_proc], socket_receive_dgram + mov [eax + SOCKET.connect_proc], udp_connect ret align 4 .tcp: mov [eax + SOCKET.Protocol], IP_PROTO_TCP - mov [eax + SOCKET.snd_proc], SOCKET_send_tcp - mov [eax + SOCKET.rcv_proc], SOCKET_receive_stream - mov [eax + SOCKET.connect_proc], TCP_connect + mov [eax + SOCKET.snd_proc], socket_send_tcp + mov [eax + SOCKET.rcv_proc], socket_receive_stream + mov [eax + SOCKET.connect_proc], tcp_connect - TCP_init_socket eax + tcp_init_socket eax ret @@ -388,9 +388,9 @@ align 4 init_queue (eax + SOCKET_QUEUE_LOCATION) ; Set up data receiving queue pop eax - mov [eax + SOCKET.snd_proc], SOCKET_send_ip - mov [eax + SOCKET.rcv_proc], SOCKET_receive_dgram - mov [eax + SOCKET.connect_proc], IPv4_connect + mov [eax + SOCKET.snd_proc], socket_send_ip + mov [eax + SOCKET.rcv_proc], socket_receive_dgram + mov [eax + SOCKET.connect_proc], ipv4_connect ret @@ -400,9 +400,9 @@ align 4 init_queue (eax + SOCKET_QUEUE_LOCATION) ; Set up data receiving queue pop eax - mov [eax + SOCKET.snd_proc], SOCKET_send_icmp - mov [eax + SOCKET.rcv_proc], SOCKET_receive_dgram - mov [eax + SOCKET.connect_proc], IPv4_connect + mov [eax + SOCKET.snd_proc], socket_send_icmp + mov [eax + SOCKET.rcv_proc], socket_receive_dgram + mov [eax + SOCKET.connect_proc], ipv4_connect ret align 4 @@ -411,14 +411,14 @@ align 4 init_queue (eax + SOCKET_QUEUE_LOCATION) ; Set up data receiving queue pop eax - mov [eax + SOCKET.snd_proc], SOCKET_send_pppoe - mov [eax + SOCKET.rcv_proc], SOCKET_receive_dgram + mov [eax + SOCKET.snd_proc], socket_send_pppoe + mov [eax + SOCKET.rcv_proc], socket_receive_dgram ret ;-----------------------------------------------------------------; ; ; -; SOCKET_bind: Bind to a local port. ; +; socket_bind: Bind to a local port. ; ; ; ; IN: ecx = socket number ; ; edx = pointer to sockaddr struct ; @@ -430,11 +430,11 @@ align 4 ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_bind: +socket_bind: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_bind: socknum=%u sockaddr=%x length=%u\n", ecx, edx, esi - call SOCKET_num_to_ptr + call socket_num_to_ptr test eax, eax jz .invalid @@ -444,10 +444,10 @@ SOCKET_bind: cmp [eax + UDP_SOCKET.LocalPort], 0 ; Socket can only be bound once jnz .invalid - cmp word [edx], AF_INET4 + cmp word[edx], AF_INET4 je .af_inet4 - cmp word [edx], AF_LOCAL + cmp word[edx], AF_LOCAL je .af_local .notsupp: @@ -479,18 +479,17 @@ SOCKET_bind: .tcp: .udp: - pushd [edx + 4] ; First, fill in the IP popd [eax + IP_SOCKET.LocalIP] mov bx, [edx + 2] ; Did caller specify a local port? test bx, bx jnz .just_check - call SOCKET_find_port ; Nope, find an ephemeral one + call socket_find_port ; Nope, find an ephemeral one jmp .done .just_check: - call SOCKET_check_port ; Yes, check if it's still available + call socket_check_port ; Yes, check if it's still available jz .addrinuse ; ZF is set by socket_check_port on error .done: @@ -511,7 +510,7 @@ SOCKET_bind: ;-----------------------------------------------------------------; ; ; -; SOCKET_connect: Connect to the remote host. ; +; socket_connect: Connect to the remote host. ; ; ; ; IN: ecx = socket number ; ; edx = pointer to sockaddr struct ; @@ -523,11 +522,11 @@ SOCKET_bind: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_connect: +socket_connect: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_connect: socknum=%u sockaddr=%x length=%u\n", ecx, edx, esi - call SOCKET_num_to_ptr + call socket_num_to_ptr test eax, eax jz .invalid @@ -572,7 +571,7 @@ connect_notsupp: ;-----------------------------------------------------------------; ; ; -; SOCKET_listen: Listen for incoming connections. ; +; socket_listen: Listen for incoming connections. ; ; ; ; IN: ecx = socket number ; ; edx = backlog in edx ; @@ -583,11 +582,11 @@ connect_notsupp: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_listen: +socket_listen: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_listen: socknum=%u backlog=%u\n", ecx, edx - call SOCKET_num_to_ptr + call socket_num_to_ptr test eax, eax jz .invalid @@ -641,7 +640,7 @@ SOCKET_listen: ;-----------------------------------------------------------------; ; ; -; SOCKET_accept: Accept an incoming connection. ; +; socket_accept: Accept an incoming connection. ; ; ; ; IN: ecx = socket number (of listening socket) ; ; edx = ptr to sockaddr struct ; @@ -653,11 +652,11 @@ SOCKET_listen: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_accept: +socket_accept: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_accept: socknum=%u sockaddr=%x length=%u\n", ecx, edx, esi - call SOCKET_num_to_ptr + call socket_num_to_ptr test eax, eax jz .invalid @@ -677,7 +676,7 @@ SOCKET_accept: mov eax, [esi] ; Verify that it is (still) a valid socket - call SOCKET_check + call socket_check jz .invalid ; Change sockets thread owner ID to that of the current thread @@ -694,7 +693,7 @@ SOCKET_accept: test [eax + SOCKET.options], SO_NONBLOCK jnz .wouldblock - call SOCKET_block + call socket_block jmp .loop .wouldblock: @@ -714,7 +713,7 @@ SOCKET_accept: ;-----------------------------------------------------------------; ; ; -; SOCKET_close: Close the socket (and connection). ; +; socket_close: Close the socket (and connection). ; ; ; ; IN: ecx = socket number ; ; ; @@ -724,11 +723,11 @@ SOCKET_accept: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_close: +socket_close: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_close: socknum=%u\n", ecx - call SOCKET_num_to_ptr + call socket_num_to_ptr test eax, eax jz .invalid @@ -738,7 +737,7 @@ SOCKET_close: test [eax + SOCKET.state], SS_BLOCKED ; Is the socket still in blocked state? jz @f - call SOCKET_notify ; Unblock it. + call socket_notify ; Unblock it. @@: cmp [eax + SOCKET.Domain], AF_INET4 @@ -748,15 +747,15 @@ SOCKET_close: je .tcp .free: - call SOCKET_free + call socket_free ret .tcp: - call TCP_usrclosed + call tcp_usrclosed test eax, eax jz @f - call TCP_output ; If connection is not closed yet, send the FIN + call tcp_output ; If connection is not closed yet, send the FIN @@: ret @@ -769,7 +768,7 @@ SOCKET_close: ;-----------------------------------------------------------------; ; ; -; SOCKET_receive: Receive some data from the remote end. ; +; socket_receive: Receive some data from the remote end. ; ; ; ; IN: ecx = socket number ; ; edx = addr to application buffer ; @@ -783,11 +782,11 @@ SOCKET_close: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_receive: +socket_receive: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: socknum=%u bufaddr=%x buflength=%u flags=%x\n", ecx, edx, esi, edi - call SOCKET_num_to_ptr + call socket_num_to_ptr test eax, eax jz .invalid @@ -808,7 +807,7 @@ SOCKET_receive: test [eax + SOCKET.options], SO_NONBLOCK jnz .return_err - call SOCKET_block + call socket_block jmp .loop @@ -825,14 +824,14 @@ SOCKET_receive: .last_data: test ecx, ecx jz .return - call SOCKET_notify ; Call me again! + call socket_notify ; Call me again! jmp .return align 4 -SOCKET_receive_dgram: +socket_receive_dgram: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: DGRAM\n" @@ -868,11 +867,11 @@ SOCKET_receive_dgram: rep movsd .nd: - call NET_BUFF_free + call net_buff_free pop ecx eax ; return number of bytes copied to application cmp [eax + SOCKET_QUEUE_LOCATION + queue.size], 0 je @f - call SOCKET_notify ; Queue another network event + call socket_notify ; Queue another network event @@: xor ebx, ebx ; errorcode = 0 (no error) ret @@ -900,7 +899,7 @@ SOCKET_receive_dgram: align 4 -SOCKET_receive_local: +socket_receive_local: ; does this socket have a PID yet? cmp [eax + SOCKET.PID], 0 @@ -913,12 +912,12 @@ SOCKET_receive_local: mov [eax + SOCKET.TID], ebx ; currently TID = PID in kolibrios :( @@: - mov [eax + SOCKET.rcv_proc], SOCKET_receive_stream + mov [eax + SOCKET.rcv_proc], socket_receive_stream ; ... continue to SOCKET_receive_stream align 4 -SOCKET_receive_stream: +socket_receive_stream: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: STREAM\n" @@ -934,8 +933,8 @@ SOCKET_receive_stream: push eax add eax, STREAM_SOCKET.rcv - call SOCKET_ring_read ; copy data from kernel buffer to application buffer - call SOCKET_ring_free ; free read memory + call socket_ring_read ; copy data from kernel buffer to application buffer + call socket_ring_free ; free read memory pop eax cmp [eax + STREAM_SOCKET.rcv + RING_BUFFER.size], 0 @@ -944,7 +943,7 @@ SOCKET_receive_stream: ret .more_data: - call SOCKET_notify ; Queue another network event + call socket_notify ; Queue another network event xor ebx, ebx ; errorcode = 0 (no error) ret @@ -962,7 +961,7 @@ SOCKET_receive_stream: ;-----------------------------------------------------------------; ; ; -; SOCKET_send: Send some data to the remote end. ; +; socket_send: Send some data to the remote end. ; ; ; ; IN: ecx = socket number ; ; edx = pointer to data ; @@ -975,11 +974,11 @@ SOCKET_receive_stream: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_send: +socket_send: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: socknum=%u data ptr=%x length=%u flags=%x\n", ecx, edx, esi, edi - call SOCKET_num_to_ptr + call socket_num_to_ptr test eax, eax jz .invalid @@ -995,12 +994,12 @@ SOCKET_send: align 4 -SOCKET_send_udp: +socket_send_udp: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: UDP\n" mov [esp+32], ecx - call UDP_output + call udp_output cmp eax, -1 je .error ret @@ -1012,19 +1011,19 @@ SOCKET_send_udp: align 4 -SOCKET_send_tcp: +socket_send_tcp: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: TCP\n" push eax add eax, STREAM_SOCKET.snd - call SOCKET_ring_write + call socket_ring_write pop eax mov [esp+32], ecx mov [eax + SOCKET.errorcode], 0 push eax - call TCP_output ; FIXME: this doesnt look pretty, does it? + call tcp_output ; FIXME: this doesnt look pretty, does it? pop eax mov eax, [eax + SOCKET.errorcode] mov [esp+20], eax @@ -1032,12 +1031,12 @@ SOCKET_send_tcp: align 4 -SOCKET_send_ip: +socket_send_ip: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: IPv4\n" mov [esp+32], ecx - call IPv4_output_raw + call ipv4_output_raw cmp eax, -1 je .error ret @@ -1049,12 +1048,12 @@ SOCKET_send_ip: align 4 -SOCKET_send_icmp: +socket_send_icmp: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: ICMP\n" mov [esp+32], ecx - call ICMP_output_raw + call icmp_output_raw cmp eax, -1 je .error ret @@ -1066,14 +1065,14 @@ SOCKET_send_icmp: align 4 -SOCKET_send_pppoe: +socket_send_pppoe: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: PPPoE\n" mov [esp+32], ecx mov ebx, [eax + SOCKET.device] - call PPPoE_discovery_output ; FIXME: errorcodes + call pppoe_discovery_output ; FIXME: errorcodes cmp eax, -1 je .error ret @@ -1086,7 +1085,7 @@ SOCKET_send_pppoe: align 4 -SOCKET_send_local: +socket_send_local: ; does this socket have a PID yet? cmp [eax + SOCKET.PID], 0 @@ -1098,29 +1097,29 @@ SOCKET_send_local: mov [eax + SOCKET.PID], ebx mov [eax + SOCKET.TID], ebx ; currently TID = PID in kolibrios :( @@: - mov [eax + SOCKET.snd_proc], SOCKET_send_local_ + mov [eax + SOCKET.snd_proc], socket_send_local_initialized align 4 -SOCKET_send_local_: +socket_send_local_initialized: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: LOCAL\n" ; get the other side's socket and check if it still exists mov eax, [eax + SOCKET.device] - call SOCKET_check + call socket_check jz .invalid ; allright, shove in the data! push eax add eax, STREAM_SOCKET.rcv - call SOCKET_ring_write + call socket_ring_write pop eax ; return the number of written bytes (or errorcode) to application mov [esp+32], ecx ; and notify the other end - call SOCKET_notify + call socket_notify ret @@ -1132,7 +1131,7 @@ SOCKET_send_local_: ;-----------------------------------------------------------------; ; ; -; SOCKET_get_options: Read a socket option ; +; socket_get_opt: Read a socket option ; ; ; ; IN: ecx = socket number ; ; edx = pointer to socket options struct ; @@ -1143,7 +1142,7 @@ SOCKET_send_local_: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_get_opt: +socket_get_opt: ; FIXME: ; At moment, uses only pseudo-optname -2 for get last_ack_number for TCP. @@ -1152,7 +1151,7 @@ SOCKET_get_opt: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_get_opt\n" - call SOCKET_num_to_ptr + call socket_num_to_ptr test eax, eax jz .invalid @@ -1194,7 +1193,7 @@ SOCKET_get_opt: ;-----------------------------------------------------------------; ; ; -; SOCKET_set_options: Set a socket option. ; +; socket_set_options: Set a socket option. ; ; ; ; IN: ecx = socket number ; ; edx = pointer to socket options struct ; @@ -1205,11 +1204,11 @@ SOCKET_get_opt: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_set_opt: +socket_set_opt: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_set_opt\n" - call SOCKET_num_to_ptr + call socket_num_to_ptr test eax, eax jz .invalid @@ -1272,7 +1271,7 @@ SOCKET_set_opt: ;-----------------------------------------------------------------; ; ; -; SOCKET_pair: Allocate a pair of linked local sockets. ; +; socket_pair: Allocate a pair of linked local sockets. ; ; ; ; IN: / ; ; ; @@ -1283,11 +1282,11 @@ SOCKET_set_opt: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_pair: +socket_pair: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_pair\n" - call SOCKET_alloc + call socket_alloc test eax, eax jz .nomem1 mov [esp+32], edi ; application's eax @@ -1295,12 +1294,12 @@ SOCKET_pair: mov [eax + SOCKET.Domain], AF_LOCAL mov [eax + SOCKET.Type], SOCK_STREAM mov [eax + SOCKET.Protocol], 0 ;;; CHECKME - mov [eax + SOCKET.snd_proc], SOCKET_send_local - mov [eax + SOCKET.rcv_proc], SOCKET_receive_local + mov [eax + SOCKET.snd_proc], socket_send_local + mov [eax + SOCKET.rcv_proc], socket_receive_local mov [eax + SOCKET.PID], 0 mov ebx, eax - call SOCKET_alloc + call socket_alloc test eax, eax jz .nomem2 mov [esp+20], edi ; application's ebx @@ -1308,8 +1307,8 @@ SOCKET_pair: mov [eax + SOCKET.Domain], AF_LOCAL mov [eax + SOCKET.Type], SOCK_STREAM mov [eax + SOCKET.Protocol], 0 ;;; CHECKME - mov [eax + SOCKET.snd_proc], SOCKET_send_local - mov [eax + SOCKET.rcv_proc], SOCKET_receive_local + mov [eax + SOCKET.snd_proc], socket_send_local + mov [eax + SOCKET.rcv_proc], socket_receive_local mov [eax + SOCKET.PID], 0 ; Link the two sockets to eachother @@ -1317,12 +1316,12 @@ SOCKET_pair: mov [ebx + SOCKET.device], eax lea eax, [eax + STREAM_SOCKET.rcv] - call SOCKET_ring_create + call socket_ring_create test eax, eax jz .nomem2 lea eax, [ebx + STREAM_SOCKET.rcv] - call SOCKET_ring_create + call socket_ring_create test eax, eax jz .nomem2 @@ -1330,11 +1329,11 @@ SOCKET_pair: .nomem2: mov eax, [esp+20] - call SOCKET_free + call socket_free .nomem1: mov eax, [esp+32] - call SOCKET_free + call socket_free mov dword[esp+32], -1 mov dword[esp+20], ENOMEM @@ -1344,7 +1343,7 @@ SOCKET_pair: ;-----------------------------------------------------------------; ; ; -; SOCKET_debug: Copy socket variables to application buffer. ; +; socket_debug: Copy socket variables to application buffer. ; ; ; ; IN: ecx = socket number ; ; edx = pointer to application buffer ; @@ -1355,7 +1354,7 @@ SOCKET_pair: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_debug: +socket_debug: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_debug\n" @@ -1364,7 +1363,7 @@ SOCKET_debug: test ecx, ecx jz .returnall - call SOCKET_num_to_ptr + call socket_num_to_ptr test eax, eax jz .invalid @@ -1407,7 +1406,7 @@ SOCKET_debug: ;-----------------------------------------------------------------; ; ; -; SOCKET_find_port: ; +; socket_find_port: ; ; Fill in the local port number for TCP and UDP sockets ; ; This procedure always works because the number of sockets is ; ; limited to a smaller number then the number of possible ports ; @@ -1418,7 +1417,7 @@ SOCKET_debug: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_find_port: +socket_find_port: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_find_port\n" @@ -1459,7 +1458,7 @@ SOCKET_find_port: add bh, 1 adc bl, 0 - call SOCKET_check_port + call socket_check_port jz .findit ret @@ -1467,11 +1466,10 @@ SOCKET_find_port: ;-----------------------------------------------------------------; ; ; -; SOCKET_check_port (to be used with AF_INET only!) ; -; ; +; socket_check_port: (to be used with AF_INET only!) ; ; Checks if a local port number is unused ; ; If the proposed port number is unused, it is filled in in the ; -; socket structure ; +; socket structure. ; ; ; ; IN: eax = socket ptr ; ; bx = proposed socket number (network byte order) ; @@ -1480,7 +1478,7 @@ SOCKET_find_port: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_check_port: +socket_check_port: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_check_port: " @@ -1530,7 +1528,7 @@ SOCKET_check_port: ;-----------------------------------------------------------------; ; ; -; SOCKET_input: Update a (stateless) socket with received data. ; +; socket_input: Update a (stateless) socket with received data. ; ; ; ; Note: The socket's mutex should already be set ! ; ; ; @@ -1543,7 +1541,7 @@ SOCKET_check_port: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_input: +socket_input: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_input: socket=%x, data=%x size=%u\n", eax, esi, ecx @@ -1551,7 +1549,7 @@ SOCKET_input: push esi mov esi, esp - add_to_queue (eax + SOCKET_QUEUE_LOCATION), SOCKET_QUEUE_SIZE, sizeof.socket_queue_entry, SOCKET_input.full + add_to_queue (eax + SOCKET_QUEUE_LOCATION), SOCKET_QUEUE_SIZE, sizeof.socket_queue_entry, .full DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_input: success\n" add esp, sizeof.socket_queue_entry @@ -1561,7 +1559,7 @@ SOCKET_input: call mutex_unlock popa - jmp SOCKET_notify + jmp socket_notify .full: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_input: socket %x is full!\n", eax @@ -1572,13 +1570,13 @@ SOCKET_input: popa add esp, 8 - call NET_BUFF_free + call net_buff_free ret ;-----------------------------------------------------------------; ; ; -; SOCKET_ring_create: Create a ringbuffer for sockets. ; +; socket_ring_create: Create a ringbuffer for sockets. ; ; ; ; IN: eax = ptr to ring struct ; ; ; @@ -1587,7 +1585,7 @@ SOCKET_input: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_ring_create: +socket_ring_create: push esi mov esi, eax @@ -1623,7 +1621,7 @@ SOCKET_ring_create: ;-----------------------------------------------------------------; ; ; -; SOCKET_ring_write: Write data to ring buffer. ; +; socket_ring_write: Write data to ring buffer. ; ; ; ; IN: eax = ptr to ring struct ; ; ecx = data size ; @@ -1633,7 +1631,7 @@ SOCKET_ring_create: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_ring_write: +socket_ring_write: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ring_write: ringbuff=%x ptr=%x size=%u\n", eax, esi, ecx @@ -1693,7 +1691,7 @@ SOCKET_ring_write: ;-----------------------------------------------------------------; ; ; -; SOCKET_ring_read: Read from ring buffer ; +; socket_ring_read: Read from ring buffer ; ; ; ; IN: eax = ring struct ptr ; ; ecx = bytes to read ; @@ -1708,7 +1706,7 @@ SOCKET_ring_write: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_ring_read: +socket_ring_read: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ring_read: ringbuff=%x ptr=%x size=%u offset=%x\n", eax, edi, ecx, edx @@ -1767,7 +1765,7 @@ SOCKET_ring_read: ;-----------------------------------------------------------------; ; ; -; SOCKET_ring_free: Free data from a ringbuffer ; +; socket_ring_free: Free data from a ringbuffer. ; ; ; ; IN: eax = ptr to ring struct ; ; ecx = data size ; @@ -1776,7 +1774,7 @@ SOCKET_ring_read: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_ring_free: +socket_ring_free: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ring_free: %u bytes from ring %x\n", ecx, eax @@ -1817,7 +1815,7 @@ SOCKET_ring_free: ;-----------------------------------------------------------------; ; ; -; SOCKET_block: Suspend the thread attached to a socket. ; +; socket_block: Suspend the thread attached to a socket. ; ; ; ; IN: eax = socket ptr ; ; ; @@ -1825,7 +1823,7 @@ SOCKET_ring_free: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_block: +socket_block: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_block: %x\n", eax @@ -1859,7 +1857,7 @@ SOCKET_block: ;-----------------------------------------------------------------; ; ; -; SOCKET_notify: Wake up socket owner thread. ; +; socket_notify: Wake up socket owner thread. ; ; ; ; IN: eax = socket ptr ; ; ; @@ -1867,11 +1865,11 @@ SOCKET_block: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_notify: +socket_notify: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: %x\n", eax - call SOCKET_check + call socket_check jz .error ; Find the associated thread's TASK_DATA @@ -1927,10 +1925,9 @@ SOCKET_notify: ;-----------------------------------------------------------------; ; ; -; SOCKET_alloc: ; -; Allocate memory for socket and put new socket into the list. ; -; Newly created socket is initialized with calling PID and socket ; -; number. ; +; socket_alloc: Allocate memory for socket and put new socket ; +; into the list. Newly created socket is initialized with calling ; +; PID and given a socket number. ; ; ; ; IN: / ; ; ; @@ -1940,7 +1937,7 @@ SOCKET_notify: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_alloc: +socket_alloc: push ebx @@ -2045,9 +2042,8 @@ SOCKET_alloc: ;-----------------------------------------------------------------; ; ; -; SOCKET_free: ; -; Free socket data memory and remove socket from the list. ; -; Caller should lock and unlock socket_mutex. ; +; socket_free: Free socket data memory and remove socket from ; +; the list. Caller should lock and unlock socket_mutex. ; ; ; ; IN: eax = socket ptr ; ; ; @@ -2055,11 +2051,11 @@ SOCKET_alloc: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_free: +socket_free: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_free: %x\n", eax - call SOCKET_check + call socket_check jz .error push ebx @@ -2117,7 +2113,7 @@ SOCKET_free: ;-----------------------------------------------------------------; ; ; -; SOCKET_fork: Create a child socket. ; +; socket_fork: Create a child socket. ; ; ; ; IN: ebx = socket number ; ; ; @@ -2126,7 +2122,7 @@ SOCKET_free: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_fork: +socket_fork: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_fork: %x\n", ebx @@ -2137,7 +2133,7 @@ SOCKET_fork: ; Allocate new socket push ebx - call SOCKET_alloc + call socket_alloc pop ebx test eax, eax jz .fail @@ -2160,7 +2156,7 @@ SOCKET_fork: ; Notify owner of parent socket push eax mov eax, ebx - call SOCKET_notify + call socket_notify pop eax ret @@ -2175,7 +2171,7 @@ SOCKET_fork: ;-----------------------------------------------------------------; ; ; -; SOCKET_num_to_ptr: Get socket structure address by its number. ; +; socket_num_to_ptr: Get socket structure address by its number. ; ; ; ; IN: ecx = socket number ; ; ; @@ -2184,7 +2180,7 @@ SOCKET_fork: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_num_to_ptr: +socket_num_to_ptr: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_num_to_ptr: num=%u ", ecx @@ -2222,7 +2218,7 @@ SOCKET_num_to_ptr: ;-----------------------------------------------------------------; ; ; -; SOCKET_ptr_to_num: Get socket number by its address. ; +; socket_ptr_to_num: Get socket number by its address. ; ; ; ; IN: eax = socket ptr ; ; ; @@ -2232,11 +2228,11 @@ SOCKET_num_to_ptr: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_ptr_to_num: +socket_ptr_to_num: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ptr_to_num: ptr=%x ", eax - call SOCKET_check + call socket_check jz .error mov eax, [eax + SOCKET.Number] @@ -2251,7 +2247,7 @@ SOCKET_ptr_to_num: ;-----------------------------------------------------------------; ; ; -; SOCKET_check: Checks if the given ptr is really a socket ptr. ; +; socket_check: Checks if the given ptr is really a socket ptr. ; ; ; ; IN: eax = socket ptr ; ; ; @@ -2260,7 +2256,7 @@ SOCKET_ptr_to_num: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_check: +socket_check: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_check: %x\n", eax @@ -2291,7 +2287,7 @@ SOCKET_check: ;-----------------------------------------------------------------; ; ; -; SOCKET_check_owner: Check if the caller app owns the socket. ; +; socket_check_owner: Check if the caller app owns the socket. ; ; ; ; IN: eax = socket ptr ; ; ; @@ -2299,7 +2295,7 @@ SOCKET_check: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_check_owner: +socket_check_owner: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_check_owner: %x\n", eax @@ -2316,10 +2312,9 @@ SOCKET_check_owner: ;-----------------------------------------------------------------; ; ; -; SOCKET_process_end: ; -; Kernel calls this function when a certain process ends. ; -; This function will check if the process had any open sockets, ; -; and update them accordingly (clean up). ; +; socket_process_end: Kernel calls this function when a certain ; +; process ends. This function will check if the process had any ; +; open sockets and update them accordingly (clean up). ; ; ; ; IN: edx = pid ; ; ; @@ -2327,7 +2322,7 @@ SOCKET_check_owner: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_process_end: +socket_process_end: ret ; FIXME @@ -2368,11 +2363,11 @@ SOCKET_process_end: cmp [eax + SOCKET.Protocol], IP_PROTO_TCP jne .free - call TCP_disconnect + call tcp_disconnect jmp .closed .free: - call SOCKET_free + call socket_free .closed: popa @@ -2394,7 +2389,7 @@ SOCKET_process_end: ;-----------------------------------------------------------------; ; ; -; SOCKET_is_connecting: Update socket state. ; +; socket_is_connecting: Update socket state. ; ; ; ; IN: eax = socket ptr ; ; ; @@ -2402,7 +2397,7 @@ SOCKET_process_end: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_is_connecting: +socket_is_connecting: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_is_connecting: %x\n", eax @@ -2414,7 +2409,7 @@ SOCKET_is_connecting: ;-----------------------------------------------------------------; ; ; -; SOCKET_is_connected: Update socket state. ; +; socket_is_connected: Update socket state. ; ; ; ; IN: eax = socket ptr ; ; ; @@ -2422,20 +2417,20 @@ SOCKET_is_connecting: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_is_connected: +socket_is_connected: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_is_connected: %x\n", eax and [eax + SOCKET.state], not (SS_ISCONNECTING + SS_ISDISCONNECTING + SS_ISCONFIRMING) or [eax + SOCKET.state], SS_ISCONNECTED - jmp SOCKET_notify + jmp socket_notify ;-----------------------------------------------------------------; ; ; -; SOCKET_is_disconnecting: Update socket state. ; +; socket_is_disconnecting: Update socket state. ; ; ; ; IN: eax = socket ptr ; ; ; @@ -2443,19 +2438,19 @@ SOCKET_is_connected: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_is_disconnecting: +socket_is_disconnecting: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_is_disconnecting: %x\n", eax and [eax + SOCKET.state], not (SS_ISCONNECTING) or [eax + SOCKET.state], SS_ISDISCONNECTING + SS_CANTRCVMORE + SS_CANTSENDMORE - jmp SOCKET_notify + jmp socket_notify ;-----------------------------------------------------------------; ; ; -; SOCKET_is_disconnected: Update socket state. ; +; socket_is_disconnected: Update socket state. ; ; ; ; IN: eax = socket ptr ; ; ; @@ -2463,19 +2458,19 @@ SOCKET_is_disconnecting: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_is_disconnected: +socket_is_disconnected: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_is_disconnected: %x\n", eax and [eax + SOCKET.state], not (SS_ISCONNECTING + SS_ISCONNECTED + SS_ISDISCONNECTING) or [eax + SOCKET.state], SS_CANTRCVMORE + SS_CANTSENDMORE - jmp SOCKET_notify + jmp socket_notify ;-----------------------------------------------------------------; ; ; -; SOCKET_cant_recv_more: Update socket state. ; +; socket_cant_recv_more: Update socket state. ; ; ; ; IN: eax = socket ptr ; ; ; @@ -2483,18 +2478,18 @@ SOCKET_is_disconnected: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_cant_recv_more: +socket_cant_recv_more: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_cant_recv_more: %x\n", eax or [eax + SOCKET.state], SS_CANTRCVMORE - jmp SOCKET_notify + jmp socket_notify ;-----------------------------------------------------------------; ; ; -; SOCKET_cant_send_more: Update socket state. ; +; socket_cant_send_more: Update socket state. ; ; ; ; IN: eax = socket ptr ; ; ; @@ -2502,13 +2497,13 @@ SOCKET_cant_recv_more: ; ; ;-----------------------------------------------------------------; align 4 -SOCKET_cant_send_more: +socket_cant_send_more: DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_cant_send_more: %x\n", eax or [eax + SOCKET.state], SS_CANTSENDMORE mov [eax + SOCKET.snd_proc], .notconn - jmp SOCKET_notify + jmp socket_notify .notconn: mov dword[esp+20], ENOTCONN diff --git a/kernel/branches/Kolibri-acpi/network/stack.inc b/kernel/branches/Kolibri-acpi/network/stack.inc index 5f0d7b90d8..8f1554cb51 100644 --- a/kernel/branches/Kolibri-acpi/network/stack.inc +++ b/kernel/branches/Kolibri-acpi/network/stack.inc @@ -163,8 +163,8 @@ NET_HWACC_TCP_IPv4_IN = 1 shl 0 NET_HWACC_TCP_IPv4_OUT = 1 shl 1 ; Network frame types -NET_BUFF_LOOPBACK = 0 -NET_BUFF_ETH = 1 +NET_BUFF_LOOPBACK = 0 +NET_BUFF_ETH = 1 struct NET_DEVICE @@ -258,16 +258,14 @@ align 4 endg -;----------------------------------------------------------------- -; -; stack_init -; -; This function calls all network init procedures -; -; IN: / -; OUT: / -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; stack_init: Initialize all network variables ; +; ; +; IN: / ; +; OUT: / ; +; ; +;-----------------------------------------------------------------; align 4 stack_init: @@ -294,21 +292,21 @@ stack_init: mov ecx, (NET_DEVICES_MAX + 1) rep stosd - ETH_init + eth_init - PPPoE_init + pppoe_init - IPv4_init -; IPv6_init - ICMP_init + ipv4_init +; ipv6_init + icmp_init - ARP_init - UDP_init - TCP_init + arp_init + udp_init + tcp_init - SOCKET_init + socket_init - LOOP_init + loop_init mov [net_tmr_count], 0 ret @@ -329,16 +327,14 @@ proc stack_handler_has_work? endp -;----------------------------------------------------------------- -; -; stack_handler -; -; This function is called in kernel loop -; -; IN: / -; OUT: / -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; stack_handler: Network handlers called from os_loop. ; +; ; +; IN: / ; +; OUT: / ; +; ; +;-----------------------------------------------------------------; align 4 stack_handler: @@ -354,13 +350,13 @@ stack_handler: test [net_10ms], 0x0f ; 160ms jnz .exit - TCP_timer_160ms + tcp_timer_160ms test [net_10ms], 0x3f ; 640ms jnz .exit - ARP_decrease_entry_ttls - IPv4_decrease_fragment_ttls + arp_decrease_entry_ttls + ipv4_decrease_fragment_ttls xor edx, edx mov eax, [TCP_timer1_event] @@ -373,7 +369,8 @@ stack_handler: align 4 -proc NET_BUFF_alloc stdcall, buffersize +proc net_buff_alloc stdcall, buffersize + cmp [buffersize], NET_BUFFER_SIZE ja .too_large @@ -387,27 +384,27 @@ proc NET_BUFF_alloc stdcall, buffersize spin_unlock_irqrestore - DEBUGF DEBUG_NETWORK_VERBOSE, "net alloc: 0x%x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "net_buff_alloc: 0x%x\n", eax ret .out_of_mem: spin_unlock_irqrestore xor eax, eax - DEBUGF DEBUG_NETWORK_ERROR, "NET_BUFF_alloc: out of mem!\n" + DEBUGF DEBUG_NETWORK_ERROR, "net_buff_alloc: out of mem!\n" ret .too_large: xor eax, eax - DEBUGF DEBUG_NETWORK_ERROR, "NET_BUFF_alloc: too large!\n" + DEBUGF DEBUG_NETWORK_ERROR, "net_buff_alloc: too large!\n" ret endp align 4 -proc NET_BUFF_free stdcall, buffer +proc net_buff_free stdcall, buffer - DEBUGF DEBUG_NETWORK_VERBOSE, "net free: 0x%x\n", [buffer] + DEBUGF DEBUG_NETWORK_VERBOSE, "net_buff_free: 0x%x\n", [buffer] spin_lock_irqsave @@ -423,14 +420,14 @@ endp align 4 -NET_link_changed: +net_link_changed: - DEBUGF DEBUG_NETWORK_VERBOSE, "NET_link_changed device=0x%x status=0x%x\n", ebx, [ebx + NET_DEVICE.link_state] + DEBUGF DEBUG_NETWORK_VERBOSE, "net_link_changed device=0x%x status=0x%x\n", ebx, [ebx + NET_DEVICE.link_state] align 4 -NET_send_event: +net_send_event: - DEBUGF DEBUG_NETWORK_VERBOSE, "NET_send_event\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "net_send_event\n" ; Send event to all applications push edi ecx @@ -446,21 +443,20 @@ NET_send_event: -;----------------------------------------------------------------- -; -; NET_add_device: -; -; This function is called by the network drivers, -; to register each running NIC to the kernel -; -; IN: Pointer to device structure in ebx -; OUT: Device num in eax, -1 on error -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; net_add_device: Called by network driver to register interface. ; +; ; +; IN: ebx = ptr to device structure ; +; ; +; OUT: eax = device num on success ; +; eax = -1 on error ; +; ; +;-----------------------------------------------------------------; align 4 -NET_add_device: +net_add_device: - DEBUGF DEBUG_NETWORK_VERBOSE, "NET_Add_Device: %x\n", ebx ;;; TODO: use mutex to lock net device list + DEBUGF DEBUG_NETWORK_VERBOSE, "net_add_device: %x\n", ebx ;;; TODO: use mutex to lock net device list cmp [NET_RUNNING], NET_DEVICES_MAX jae .error @@ -495,7 +491,7 @@ NET_add_device: inc [NET_RUNNING] ; Indicate that one more network device is up and running - call NET_send_event + call net_send_event DEBUGF DEBUG_NETWORK_VERBOSE, "Device number: %u\n", eax ret @@ -507,19 +503,17 @@ NET_add_device: -;----------------------------------------------------------------- -; -; NET_Remove_Device: -; -; This function is called by network drivers, -; to unregister network devices from the kernel -; -; IN: Pointer to device structure in ebx -; OUT: eax: -1 on error -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; net_remove_device: Called by network driver to unregister dev. ; +; ; +; IN: ebx = ptr to device ; +; ; +; OUT: eax: -1 on error ; +; ; +;-----------------------------------------------------------------; align 4 -NET_remove_device: +net_remove_device: cmp [NET_RUNNING], 0 je .error @@ -541,7 +535,7 @@ NET_remove_device: mov dword [edi-4], eax dec [NET_RUNNING] - call NET_send_event + call net_send_event xor eax, eax ret @@ -552,25 +546,27 @@ NET_remove_device: -;----------------------------------------------------------------- -; -; NET_ptr_to_num -; -; IN: ebx = ptr to device struct -; OUT: edi = -1 on error, device number otherwise -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; net_ptr_to_num ; +; ; +; IN: ebx = ptr to device struct ; +; ; +; OUT: edi = device number ; +; edi = -1 on error ; +; ; +;-----------------------------------------------------------------; align 4 -NET_ptr_to_num: +net_ptr_to_num: - call NET_ptr_to_num4 + call net_ptr_to_num4 ror edi, 2 ; If -1, stay -1 ; valid device numbers have last two bits 0, so do just shr ret align 4 -NET_ptr_to_num4: ; Todo, place number in device structure so we only need to verify? +net_ptr_to_num4: ; Todo, place number in device structure so we only need to verify? test ebx, ebx jz .fail @@ -595,21 +591,17 @@ NET_ptr_to_num4: ; Todo, place number in device structure so we o pop ecx ret -;----------------------------------------------------------------- -; -; checksum_1 -; -; This is the first of two functions needed to calculate a checksum. -; -; IN: edx = start offset for semi-checksum -; esi = pointer to data -; ecx = data size -; OUT: edx = semi-checksum -; -; -; Code was optimized by diamond -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; checksum_1: Calculate semi-checksum for network packets. ; +; ; +; IN: edx = start offset for semi-checksum ; +; esi = pointer to data ; +; ecx = data size ; +; ; +; OUT: edx = semi-checksum ; +; ; +;-----------------------------------------------------------------; align 4 checksum_1: @@ -679,16 +671,15 @@ checksum_1: .end: ret -;----------------------------------------------------------------- -; -; checksum_2 -; -; This function calculates the final ip/tcp/udp checksum for you -; -; IN: edx = semi-checksum -; OUT: dx = checksum (in INET byte order) -; -;----------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; checksum_2: Calculate the final ip/tcp/udp checksum. ; +; ; +; IN: edx = semi-checksum ; +; ; +; OUT: dx = checksum (in INET byte order) ; +; ; +;-----------------------------------------------------------------; align 4 checksum_2: @@ -713,11 +704,11 @@ checksum_2: -;---------------------------------------------------------------- -; -; System function to work with network devices (74) -; -;---------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; System function 74: Low level access to network devices. ; +; ; +;-----------------------------------------------------------------; align 4 sys_network: @@ -736,7 +727,7 @@ sys_network: and esi, 0x0000ff00 shr esi, 6 - cmp dword [esi + NET_DRV_LIST], 0 ; check if driver is running + cmp dword[esi + NET_DRV_LIST], 0 ; check if driver is running je .doesnt_exist mov eax, [esi + NET_DRV_LIST] @@ -809,16 +800,16 @@ sys_network: ret .bytes_tx: - mov ebx, dword [eax + NET_DEVICE.bytes_tx + 4] + mov ebx, dword[eax + NET_DEVICE.bytes_tx + 4] mov [esp+20], ebx - mov eax, dword [eax + NET_DEVICE.bytes_tx] + mov eax, dword[eax + NET_DEVICE.bytes_tx] mov [esp+32], eax ret .bytes_rx: - mov ebx, dword [eax + NET_DEVICE.bytes_rx + 4] + mov ebx, dword[eax + NET_DEVICE.bytes_rx + 4] mov [esp+20], ebx - mov eax, dword [eax + NET_DEVICE.bytes_rx] + mov eax, dword[eax + NET_DEVICE.bytes_rx] mov [esp+32], eax ret @@ -834,11 +825,11 @@ sys_network: -;---------------------------------------------------------------- -; -; System function to work with protocols (76) -; -;---------------------------------------------------------------- +;-----------------------------------------------------------------; +; ; +; System function 76: Low level access to protocol handlers. ; +; ; +;-----------------------------------------------------------------; align 4 sys_protocols: cmp bh, NET_DEVICES_MAX ; Check if device number exists @@ -856,28 +847,28 @@ sys_protocols: shr eax, 16 ; cmp ax, API_ETH - je ETH_api + je eth_api cmp ax, API_IPv4 - je IPv4_api + je ipv4_api cmp ax, API_ICMP - je ICMP_api + je icmp_api cmp ax, API_UDP - je UDP_api + je udp_api cmp ax, API_TCP - je TCP_api + je tcp_api cmp ax, API_ARP - je ARP_api + je arp_api cmp ax, API_PPPOE - je PPPoE_api + je pppoe_api cmp ax, API_IPv6 - je IPv6_api + je ipv6_api add esp, 4 ; if we reached here, no function was called, so we need to balance stack diff --git a/kernel/branches/Kolibri-acpi/network/tcp.inc b/kernel/branches/Kolibri-acpi/network/tcp.inc index 4de1c981cc..bbe8b5740b 100644 --- a/kernel/branches/Kolibri-acpi/network/tcp.inc +++ b/kernel/branches/Kolibri-acpi/network/tcp.inc @@ -206,7 +206,7 @@ endg ; TCP_init: Resets all TCP variables. ; ; ; ;-----------------------------------------------------------------; -macro TCP_init { +macro tcp_init { xor eax, eax mov edi, TCP_segments_tx @@ -219,7 +219,7 @@ macro TCP_init { init_queue TCP_queue movi ebx, 1 - mov ecx, TCP_process_input + mov ecx, tcp_process_input call new_sys_threads test eax, eax jns @f @@ -227,7 +227,7 @@ macro TCP_init { @@: movi ebx, 1 - mov ecx, TCP_timer_640ms + mov ecx, tcp_timer_640ms call new_sys_threads test eax, eax jns @f @@ -246,7 +246,7 @@ include 'tcp_output.inc' ;------------------------------------------------------------------; ; ; -; TCP_api: This function is called by system function 76 ; +; tcp_api: Part of system function 76 ; ; ; ; IN: bl = subfunction number ; ; bh = device number ; @@ -256,7 +256,7 @@ include 'tcp_output.inc' ; ; ;------------------------------------------------------------------; align 4 -TCP_api: +tcp_api: movzx eax, bh shl eax, 2 diff --git a/kernel/branches/Kolibri-acpi/network/tcp_input.inc b/kernel/branches/Kolibri-acpi/network/tcp_input.inc index 0fc0e57155..3c33d9abcf 100644 --- a/kernel/branches/Kolibri-acpi/network/tcp_input.inc +++ b/kernel/branches/Kolibri-acpi/network/tcp_input.inc @@ -14,7 +14,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision: 5976 $ +$Revision: 6011 $ ;-----------------------------------------------------------------; ; ; @@ -31,7 +31,7 @@ $Revision: 5976 $ ; ; ;-----------------------------------------------------------------; align 4 -TCP_input: +tcp_input: ; record the current time push [timer_ticks] ; in 1/100 seconds @@ -57,17 +57,17 @@ TCP_input: pop edi DEBUGF DEBUG_NETWORK_VERBOSE, "TCP incoming queue is full, discarding packet!\n" - call NET_ptr_to_num4 + call net_ptr_to_num4 inc [TCP_segments_missed + edi] add esp, sizeof.TCP_queue_entry - 4 - call NET_BUFF_free + call net_buff_free ret align 4 -proc TCP_process_input +proc tcp_process_input locals dataoffset dd ? @@ -111,7 +111,7 @@ endl push ecx esi pushw [esi + TCP_header.Checksum] mov [esi + TCP_header.Checksum], 0 - TCP_checksum (edi+IPv4_header.SourceAddress), (edi+IPv4_header.DestinationAddress) + tcp_checksum (edi+IPv4_header.SourceAddress), (edi+IPv4_header.DestinationAddress) pop cx ; previous checksum cmp cx, dx pop edx ecx @@ -234,7 +234,7 @@ endl popa push ecx edx esi edi - call SOCKET_fork + call socket_fork pop edi esi edx ecx test eax, eax @@ -312,7 +312,7 @@ endl lodsw rol ax, 8 DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Maxseg=%u\n", eax - call TCP_mss + call tcp_mss @@: jmp .opt_loop @@ -473,7 +473,7 @@ endl pusha mov ecx, eax lea eax, [ebx + STREAM_SOCKET.snd] - call SOCKET_ring_free + call socket_ring_free popa ; Update RTT estimators @@ -483,7 +483,7 @@ endl mov eax, [timestamp] sub eax, [ebx + TCP_SOCKET.ts_ecr] inc eax - call TCP_xmit_timer + call tcp_xmit_timer jmp .rtt_done .no_timestamp_rtt: @@ -493,7 +493,7 @@ endl cmp eax, [ebx + TCP_SOCKET.t_rtseq] jbe .rtt_done mov eax, [ebx + TCP_SOCKET.t_rtt] - call TCP_xmit_timer + call tcp_xmit_timer .rtt_done: ; update window pointers @@ -511,10 +511,10 @@ endl ; Awaken waiting processes mov eax, ebx - call SOCKET_notify + call socket_notify ; Generate more output - call TCP_output + call tcp_output jmp .drop_no_socket @@ -540,11 +540,11 @@ endl mov esi, [dataoffset] add esi, edx lea eax, [ebx + STREAM_SOCKET.rcv] - call SOCKET_ring_write ; Add the data to the socket buffer + call socket_ring_write ; Add the data to the socket buffer add [ebx + TCP_SOCKET.RCV_NXT], ecx ; Update sequence number with number of bytes we have copied mov eax, ebx - call SOCKET_notify + call socket_notify or [ebx + TCP_SOCKET.t_flags], TF_DELACK ; Set delayed ack flag @@ -661,7 +661,7 @@ endl jz .not_terminated mov eax, ebx - call TCP_close + call tcp_close inc [TCPS_rcvafterclose] jmp .respond_seg_reset @@ -691,7 +691,7 @@ endl ; cmp edx, [edx + TCP_header.SequenceNumber] ; add edx, 64000 ; TCP_ISSINCR FIXME mov eax, ebx - call TCP_close + call tcp_close jmp .findpcb ; FIXME: skip code for unscaling window, ... .no_new_request: @@ -779,14 +779,14 @@ endl mov [ebx + TCP_SOCKET.t_state], TCPS_CLOSED ;;; TODO: update stats (tcp drops) mov eax, ebx - call TCP_close + call tcp_close jmp .drop_no_socket .rst_close: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Closing with reset\n" mov eax, ebx - call TCP_close + call tcp_close jmp .drop_no_socket .no_rst: @@ -799,7 +799,7 @@ endl mov eax, ebx mov ebx, ECONNRESET - call TCP_drop + call tcp_drop jmp .drop_with_reset .not_syn_full: @@ -824,7 +824,7 @@ endl ;;; TODO: update stats mov eax, ebx - call SOCKET_is_connected + call socket_is_connected mov [ebx + TCP_SOCKET.t_state], TCPS_ESTABLISHED ; Do window scaling? @@ -838,7 +838,7 @@ endl pop word [ebx + TCP_SOCKET.SND_SCALE] @@: - call TCP_reassemble + call tcp_reassemble mov eax, [edx + TCP_header.SequenceNumber] dec eax @@ -916,7 +916,7 @@ endl ; retransmit missing segment mov eax, [esp] - call TCP_output + call tcp_output ; Lock the socket again mov ecx, [esp] @@ -955,7 +955,7 @@ endl ; retransmit missing segment mov eax, [esp] - call TCP_output + call tcp_output ; Lock the socket again mov ecx, [esp] @@ -1005,7 +1005,7 @@ endl mov eax, [timestamp] sub eax, [ebx + TCP_SOCKET.ts_ecr] inc eax - call TCP_xmit_timer + call tcp_xmit_timer jmp .rtt_done_ ; If no timestamp but transmit timer is running and timed sequence number was acked, @@ -1020,7 +1020,7 @@ endl mov eax, [ebx + TCP_SOCKET.t_rtt] test eax, eax jz .rtt_done_ - call TCP_xmit_timer + call tcp_xmit_timer .rtt_done_: @@ -1085,7 +1085,7 @@ endl mov ecx, [ebx + STREAM_SOCKET.snd.size] lea eax, [ebx + STREAM_SOCKET.snd] sub [ebx + TCP_SOCKET.SND_WND], ecx - call SOCKET_ring_free + call socket_ring_free pop ebx edx ecx DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: our FIN is acked\n" @@ -1097,7 +1097,7 @@ endl push ecx edx ebx mov ecx, edi lea eax, [ebx + STREAM_SOCKET.snd] - call SOCKET_ring_free + call socket_ring_free pop ebx sub [ebx + TCP_SOCKET.SND_WND], ecx pop edx ecx @@ -1109,7 +1109,7 @@ endl .wakeup: mov eax, ebx - call SOCKET_notify + call socket_notify ; Update TCPS mov eax, [edx + TCP_header.AckNumber] @@ -1147,7 +1147,7 @@ endl test [ebx + SOCKET.state], SS_CANTRCVMORE jnz @f mov eax, ebx - call SOCKET_is_disconnected + call socket_is_disconnected mov [ebx + TCP_SOCKET.timer_timed_wait], TCP_time_max_idle or [ebx + TCP_SOCKET.timer_flags], timer_flag_wait @@: @@ -1160,11 +1160,11 @@ endl mov [ebx + TCP_SOCKET.t_state], TCPS_TIMED_WAIT mov eax, ebx - call TCP_cancel_timers + call tcp_cancel_timers mov [ebx + TCP_SOCKET.timer_timed_wait], 2 * TCP_time_MSL or [ebx + TCP_SOCKET.timer_flags], timer_flag_wait mov eax, ebx - call SOCKET_is_disconnected + call socket_is_disconnected jmp .ack_processed .ack_la: @@ -1177,7 +1177,7 @@ endl pop ebx mov eax, ebx - call TCP_close + call tcp_close jmp .drop_no_socket .ack_tw: @@ -1224,8 +1224,8 @@ align 4 mov [ebx + TCP_SOCKET.ISS], eax mov [ebx + TCP_SOCKET.SND_NXT], eax - TCP_sendseqinit ebx - TCP_rcvseqinit ebx + tcp_sendseqinit ebx + tcp_rcvseqinit ebx mov [ebx + TCP_SOCKET.t_state], TCPS_SYN_RECEIVED or [ebx + TCP_SOCKET.t_flags], TF_ACKNOW @@ -1233,12 +1233,12 @@ align 4 or [ebx + TCP_SOCKET.timer_flags], timer_flag_keepalive lea eax, [ebx + STREAM_SOCKET.snd] - call SOCKET_ring_create + call socket_ring_create test eax, eax jz .drop lea eax, [ebx + STREAM_SOCKET.rcv] - call SOCKET_ring_create + call socket_ring_create test eax, eax jz .drop @@ -1246,7 +1246,7 @@ align 4 pusha mov eax, ebx - call SOCKET_notify + call socket_notify popa jmp .trim @@ -1278,7 +1278,7 @@ align 4 mov eax, ebx mov ebx, ECONNREFUSED - call TCP_drop + call tcp_drop jmp .drop @@: @@ -1306,7 +1306,7 @@ align 4 push [edx + TCP_header.SequenceNumber] pop [ebx + TCP_SOCKET.IRS] - TCP_rcvseqinit ebx + tcp_rcvseqinit ebx or [ebx + TCP_SOCKET.t_flags], TF_ACKNOW @@ -1324,7 +1324,7 @@ align 4 ; set socket state to connected push eax mov eax, ebx - call SOCKET_is_connected + call socket_is_connected pop eax mov [ebx + TCP_SOCKET.t_state], TCPS_ESTABLISHED @@ -1334,8 +1334,8 @@ align 4 cmp eax, TF_REQ_SCALE or TF_RCVD_SCALE jne .no_scaling - mov ax, word [ebx + TCP_SOCKET.requested_s_scale] - mov word [ebx + TCP_SOCKET.SND_SCALE], ax + mov ax, word[ebx + TCP_SOCKET.requested_s_scale] + mov word[ebx + TCP_SOCKET.SND_SCALE], ax .no_scaling: ;;; TODO: reassemble packets queue @@ -1343,7 +1343,7 @@ align 4 mov eax, [ebx + TCP_SOCKET.t_rtt] test eax, eax je .trim - call TCP_xmit_timer + call tcp_xmit_timer jmp .trim .simultaneous_open: @@ -1485,13 +1485,13 @@ align 4 mov esi, [dataoffset] add esi, edx lea eax, [ebx + STREAM_SOCKET.rcv] - call SOCKET_ring_write ; Add the data to the socket buffer + call socket_ring_write ; Add the data to the socket buffer add [ebx + TCP_SOCKET.RCV_NXT], ecx ; Update sequence number with number of bytes we have copied popa ; Wake up the sleeping process mov eax, ebx - call SOCKET_notify + call socket_notify jmp .data_done @@ -1501,7 +1501,7 @@ align 4 ; Uh-oh, some data is out of order, lets call TCP reassemble for help - call TCP_reassemble + call tcp_reassemble ; Generate ACK immediately, to let the other end know that a segment was received out of order, ; and to tell it what sequence number is expected. This aids the fast-retransmit algorithm. @@ -1522,7 +1522,7 @@ align 4 DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: First FIN for this connection\n" mov eax, ebx - call SOCKET_cant_recv_more + call socket_cant_recv_more or [ebx + TCP_SOCKET.t_flags], TF_ACKNOW inc [ebx + TCP_SOCKET.RCV_NXT] @@ -1556,8 +1556,8 @@ align 4 .fin_wait2: mov [ebx + TCP_SOCKET.t_state], TCPS_TIMED_WAIT mov eax, ebx - call TCP_cancel_timers - call SOCKET_is_disconnected + call tcp_cancel_timers + call socket_is_disconnected .fin_timed: mov [ebx + TCP_SOCKET.timer_timed_wait], 2 * TCP_time_MSL @@ -1583,12 +1583,12 @@ align 4 .need_output: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: need output\n" - call TCP_output + call tcp_output .done: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: dumping\n" - call NET_BUFF_free + call net_buff_free jmp .loop @@ -1621,7 +1621,7 @@ align 4 test [edx + TCP_header.Flags], TH_RST jnz .done - ;;; if its a multicast/broadcast, also drop +; TODO: if its a multicast/broadcast, also drop test [edx + TCP_header.Flags], TH_ACK jnz .respond_ack @@ -1636,14 +1636,14 @@ align 4 .respond_ack: push ebx mov cl, TH_RST - call TCP_respond + call tcp_respond pop ebx jmp .destroy_new_socket .respond_syn: push ebx mov cl, TH_RST + TH_ACK - call TCP_respond + call tcp_respond pop ebx jmp .destroy_new_socket @@ -1660,7 +1660,7 @@ align 4 test [edx + TCP_header.Flags], TH_RST jnz .drop_no_socket - ;;; TODO: if its a multicast/broadcast, also drop +; TODO: if its a multicast/broadcast, also drop test [edx + TCP_header.Flags], TH_ACK jnz .respond_seg_ack @@ -1673,13 +1673,13 @@ align 4 .respond_seg_ack: mov cl, TH_RST xor ebx, ebx ; FIXME: find a way to get the receiving device ptr - call TCP_respond_segment + call tcp_respond_segment jmp .drop_no_socket .respond_seg_syn: mov cl, TH_RST + TH_ACK xor ebx, ebx ; FIXME: find a way to get the receiving device ptr - call TCP_respond_segment + call tcp_respond_segment jmp .drop_no_socket ;------------------------------------------------ @@ -1701,7 +1701,7 @@ align 4 jz .drop_no_socket mov eax, ebx - call SOCKET_free + call socket_free ;------------------ ; Drop the segment @@ -1709,7 +1709,7 @@ align 4 .drop_no_socket: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Drop (no socket)\n" - call NET_BUFF_free + call net_buff_free jmp .loop endp diff --git a/kernel/branches/Kolibri-acpi/network/tcp_output.inc b/kernel/branches/Kolibri-acpi/network/tcp_output.inc index 1025504a0f..b2076622bd 100644 --- a/kernel/branches/Kolibri-acpi/network/tcp_output.inc +++ b/kernel/branches/Kolibri-acpi/network/tcp_output.inc @@ -14,11 +14,11 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision: 5584 $ +$Revision: 6011 $ ;-----------------------------------------------------------------; ; ; -; TCP_output ; +; tcp_output ; ; ; ; IN: eax = socket pointer ; ; ; @@ -26,7 +26,7 @@ $Revision: 5584 $ ; ; ;-----------------------------------------------------------------; align 4 -proc TCP_output +proc tcp_output locals temp_bits db ? @@ -72,7 +72,7 @@ endl mov ecx, [eax + TCP_SOCKET.SND_CWND] ; @@: ; - call TCP_outflags ; flags in dl + call tcp_outflags ; flags in dl ;------------------------ ; data being forced out ? @@ -279,7 +279,7 @@ endl DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_output: Entering persist state\n" mov [eax + TCP_SOCKET.t_rxtshift], 0 - call TCP_set_persist + call tcp_set_persist @@: ;---------------------------- @@ -509,7 +509,7 @@ endl mov edi, [eax + IP_SOCKET.RemoteIP] ; dest ip mov al, [eax + IP_SOCKET.ttl] mov ah, IP_PROTO_TCP - call IPv4_output + call ipv4_output jz .ip_error ;------------------------------------------ @@ -549,7 +549,7 @@ endl add [eax + TCP_SOCKET.SND_NXT], ecx ; update sequence number sub edx, [eax + TCP_SOCKET.SND_UNA] ; offset add eax, STREAM_SOCKET.snd - call SOCKET_ring_read + call socket_ring_read .nodata: pop edi pop esi ; begin of data @@ -606,7 +606,7 @@ endl test [ebx + NET_DEVICE.hwacc], NET_HWACC_TCP_IPv4_OUT jnz .checksum_ok - TCP_checksum (eax + IP_SOCKET.LocalIP), (eax + IP_SOCKET.RemoteIP) + tcp_checksum (eax + IP_SOCKET.LocalIP), (eax + IP_SOCKET.RemoteIP) .checksum_ok: mov [esi + TCP_header.Checksum], dx @@ -624,7 +624,7 @@ endl pop ecx pop eax - call NET_ptr_to_num4 + call net_ptr_to_num4 inc [TCP_segments_tx + edi] inc [TCPS_sndtotal] @@ -658,7 +658,7 @@ endl ; Check if we need more output test [temp_bits], TCP_BIT_SENDALOT - jnz TCP_output.again + jnz tcp_output.again DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_send: success!\n" diff --git a/kernel/branches/Kolibri-acpi/network/tcp_subr.inc b/kernel/branches/Kolibri-acpi/network/tcp_subr.inc index cf843e125e..3e409614e3 100644 --- a/kernel/branches/Kolibri-acpi/network/tcp_subr.inc +++ b/kernel/branches/Kolibri-acpi/network/tcp_subr.inc @@ -14,14 +14,14 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision: 5584 $ +$Revision: 6011 $ align 4 iglobal TCP_backoff db 0,1,2,3,4,5,6,6,6,6,6,6,6 endg -macro TCP_checksum IP1, IP2 { +macro tcp_checksum IP1, IP2 { ;------------- ; Pseudoheader @@ -60,9 +60,9 @@ macro TCP_checksum IP1, IP2 { -macro TCP_sendseqinit ptr { +macro tcp_sendseqinit ptr { - push edi ;;;; i dont like this static use of edi + push edi ;;;; FIXME: i dont like this static use of edi mov edi, [ptr + TCP_SOCKET.ISS] mov [ptr + TCP_SOCKET.SND_UP], edi mov [ptr + TCP_SOCKET.SND_MAX], edi @@ -74,7 +74,7 @@ macro TCP_sendseqinit ptr { -macro TCP_rcvseqinit ptr { +macro tcp_rcvseqinit ptr { push edi mov edi, [ptr + TCP_SOCKET.IRS] @@ -87,7 +87,7 @@ macro TCP_rcvseqinit ptr { -macro TCP_init_socket socket { +macro tcp_init_socket socket { mov [socket + TCP_SOCKET.t_maxseg], TCP_mss_default mov [socket + TCP_SOCKET.t_flags], TF_REQ_SCALE or TF_REQ_TSTMP @@ -106,7 +106,7 @@ macro TCP_init_socket socket { ;-----------------------------------------------------------------; ; ; -; TCP_pull_out_of_band ; +; tcp_pull_out_of_band ; ; ; ; IN: eax = ? ; ; ebx = socket ptr ; @@ -116,9 +116,9 @@ macro TCP_init_socket socket { ; ; ;-----------------------------------------------------------------; align 4 -TCP_pull_out_of_band: +tcp_pull_out_of_band: - DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_pull_out_of_band\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "tcp_pull_out_of_band\n" ;;;; 1282-1305 @@ -128,7 +128,7 @@ TCP_pull_out_of_band: ;-----------------------------------------------------------------; ; ; -; TCP_drop ; +; tcp_drop ; ; ; ; IN: eax = socket ptr ; ; ebx = error number ; @@ -137,9 +137,9 @@ TCP_pull_out_of_band: ; ; ;-----------------------------------------------------------------; align 4 -TCP_drop: ; FIXME CHECKME TODO +tcp_drop: ; FIXME CHECKME TODO - DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_drop: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "tcp_drop: %x\n", eax cmp [eax + TCP_SOCKET.t_state], TCPS_SYN_RECEIVED jb .no_syn_received @@ -147,12 +147,12 @@ TCP_drop: ; FIXME CHECKME TODO mov [eax + TCP_SOCKET.t_state], TCPS_CLOSED push eax - call TCP_output + call tcp_output pop eax ;;; TODO: update stats - jmp TCP_close + jmp tcp_close .no_syn_received: @@ -167,7 +167,7 @@ TCP_drop: ; FIXME CHECKME TODO ;-----------------------------------------------------------------; ; ; -; TCP_disconnect ; +; tcp_disconnect ; ; ; ; IN: eax = socket ptr ; ; ; @@ -175,22 +175,22 @@ TCP_drop: ; FIXME CHECKME TODO ; ; ;-----------------------------------------------------------------; align 4 -TCP_disconnect: +tcp_disconnect: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_disconnect: %x\n", eax cmp [eax + TCP_SOCKET.t_state], TCPS_ESTABLISHED - jb TCP_close ; Connection not yet synchronised, just get rid of the socket + jb tcp_close ; Connection not yet synchronised, just get rid of the socket ; TODO: implement LINGER - call SOCKET_is_disconnecting - call TCP_usrclosed + call socket_is_disconnecting + call tcp_usrclosed test eax, eax jz @f push eax - call TCP_output + call tcp_output pop eax @@: ret @@ -198,7 +198,7 @@ TCP_disconnect: ;-----------------------------------------------------------------; ; ; -; TCP_close ; +; tcp_close ; ; ; ; IN: eax = socket ptr ; ; ; @@ -206,15 +206,15 @@ TCP_disconnect: ; ; ;-----------------------------------------------------------------; align 4 -TCP_close: +tcp_close: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_close: %x\n", eax ;;; TODO: update RTT and mean deviation ;;; TODO: update slow start threshold - call SOCKET_is_disconnected - call SOCKET_free + call socket_is_disconnected + call socket_free xor eax, eax ret @@ -223,7 +223,7 @@ TCP_close: ;-----------------------------------------------------------------; ; ; -; TCP_outflags ; +; tcp_outflags ; ; ; ; IN: eax = socket ptr ; ; ; @@ -231,10 +231,10 @@ TCP_close: ; ; ;-----------------------------------------------------------------; align 4 -TCP_outflags: +tcp_outflags: mov edx, [eax + TCP_SOCKET.t_state] - movzx edx, byte [edx + .flaglist] + movzx edx, byte[edx + .flaglist] DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_outflags: socket=%x flags=%x\n", eax, dl @@ -270,7 +270,7 @@ TCP_outflags: ; ; ;-----------------------------------------------------------------; align 4 -TCP_respond: +tcp_respond: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_respond_socket: socket=%x flags=%x\n", ebx, cl @@ -284,7 +284,7 @@ TCP_respond: mov ah, IP_PROTO_TCP mov ecx, sizeof.TCP_header mov ebx, [ebx + IP_SOCKET.device] - call IPv4_output + call ipv4_output jz .error pop esi cx push eax @@ -320,7 +320,7 @@ TCP_respond: sub edi, sizeof.TCP_header mov ecx, sizeof.TCP_header xchg esi, edi - TCP_checksum (edi + IP_SOCKET.LocalIP), (edi + IP_SOCKET.RemoteIP) + tcp_checksum (edi + IP_SOCKET.LocalIP), (edi + IP_SOCKET.RemoteIP) mov [esi+TCP_header.Checksum], dx ;-------------------- @@ -329,7 +329,7 @@ TCP_respond: call [ebx + NET_DEVICE.transmit] test eax, eax jnz @f - call NET_ptr_to_num4 + call net_ptr_to_num4 inc [TCP_segments_tx + edi] @@: ret @@ -343,7 +343,7 @@ TCP_respond: ;-----------------------------------------------------------------; ; ; -; TCP_respond_segment ; +; tcp_respond_segment ; ; ; ; IN: ebx = device ptr ; ; edx = segment ptr (a previously received segment) ; @@ -354,7 +354,7 @@ TCP_respond: ; ; ;-----------------------------------------------------------------; align 4 -TCP_respond_segment: +tcp_respond_segment: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_respond_segment: frame=%x flags=%x\n", edx, cl @@ -366,7 +366,7 @@ TCP_respond_segment: mov edi, [edi + IPv4_header.SourceAddress] mov ecx, sizeof.TCP_header mov ax, IP_PROTO_TCP shl 8 + 128 - call IPv4_output + call ipv4_output jz .error pop esi cx @@ -399,7 +399,7 @@ TCP_respond_segment: lea esi, [edi - sizeof.TCP_header] mov ecx, sizeof.TCP_header - TCP_checksum (esi - sizeof.IPv4_header + IPv4_header.DestinationAddress),\ ; FIXME + tcp_checksum (esi - sizeof.IPv4_header + IPv4_header.DestinationAddress),\ ; FIXME (esi - sizeof.IPv4_header + IPv4_header.SourceAddress) mov [esi + TCP_header.Checksum], dx @@ -409,7 +409,7 @@ TCP_respond_segment: call [ebx + NET_DEVICE.transmit] test eax, eax jnz @f - call NET_ptr_to_num4 + call net_ptr_to_num4 inc [TCP_segments_tx + edi] @@: ret @@ -421,7 +421,7 @@ TCP_respond_segment: ret -macro TCPT_RANGESET timer, value, min, max { +macro tcpt_rangeset timer, value, min, max { local .min local .max @@ -448,11 +448,11 @@ local .done ;-----------------------------------------------------------------; ; ; -; TCP_set_persist ; +; tcp_set_persist ; ; ; ;-----------------------------------------------------------------; align 4 -TCP_set_persist: +tcp_set_persist: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_set_persist\n" @@ -473,7 +473,7 @@ TCP_set_persist: ; Start/restart persistance timer. - TCPT_RANGESET [eax + TCP_SOCKET.timer_persist], ebx, TCP_time_pers_min, TCP_time_pers_max + tcpt_rangeset [eax + TCP_SOCKET.timer_persist], ebx, TCP_time_pers_min, TCP_time_pers_max or [ebx + TCP_SOCKET.timer_flags], timer_flag_persist pop ebx @@ -489,7 +489,7 @@ TCP_set_persist: ;-----------------------------------------------------------------; ; ; -; TCP_xmit_timer: Calculate new smoothed RTT. ; +; tcp_xmit_timer: Calculate new smoothed RTT. ; ; ; ; IN: eax = rtt ; ; ebx = socket ptr ; @@ -498,7 +498,7 @@ TCP_set_persist: ; ; ;-----------------------------------------------------------------; align 4 -TCP_xmit_timer: +tcp_xmit_timer: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_xmit_timer: socket=0x%x rtt=%d0ms\n", ebx, eax @@ -563,7 +563,7 @@ TCP_xmit_timer: ;-----------------------------------------------------------------; ; ; -; TCP_mss: Update maximum segment size ; +; tcp_mss: Update maximum segment size ; ; ; ; IN: eax = max segment size ; ; ebx = socket ptr ; @@ -572,7 +572,7 @@ TCP_xmit_timer: ; ; ;-----------------------------------------------------------------; align 4 -TCP_mss: +tcp_mss: cmp eax, 1420 ; FIXME jbe @f @@ -587,7 +587,7 @@ TCP_mss: ;-----------------------------------------------------------------; ; ; -; TCP_reassemble ; +; tcp_reassemble ; ; ; ; IN: ebx = socket ptr ; ; edx = segment ptr ; @@ -596,7 +596,7 @@ TCP_mss: ; ; ;-----------------------------------------------------------------; align 4 -TCP_reassemble: +tcp_reassemble: ;;;;; TODO diff --git a/kernel/branches/Kolibri-acpi/network/tcp_timer.inc b/kernel/branches/Kolibri-acpi/network/tcp_timer.inc index f90f32279b..2aaadc5a2b 100644 --- a/kernel/branches/Kolibri-acpi/network/tcp_timer.inc +++ b/kernel/branches/Kolibri-acpi/network/tcp_timer.inc @@ -14,7 +14,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision: 5442 $ +$Revision: 6011 $ timer_flag_retransmission = 1 shl 0 timer_flag_keepalive = 1 shl 1 @@ -23,7 +23,7 @@ timer_flag_persist = 1 shl 3 timer_flag_wait = 1 shl 4 -macro TCP_timer_160ms { +macro tcp_timer_160ms { local .loop local .exit @@ -45,10 +45,7 @@ local .exit push ebx mov cl, TH_ACK - call TCP_respond -; and [ebx + TCP_SOCKET.t_flags], TF_ACKNOW ;; -; mov eax, ebx ;; -; call TCP_output ;; + call tcp_respond pop ebx inc [TCPS_delack] ; update stats @@ -61,7 +58,7 @@ local .exit align 4 -proc TCP_timer_640ms ; TODO: implement timed wait timer! +proc tcp_timer_640ms xor esi, esi mov ecx, MANUAL_DESTROY @@ -77,8 +74,8 @@ proc TCP_timer_640ms ; TODO: implement timed wait timer! add [TCP_sequence_num], 64000 -; scan through all the active TCP sockets, decrementing ALL timers -; When a timer reaches zero, we'll check wheter it was active or not +; Scan through all the active TCP sockets, decrementing all active timers +; When a timer reaches zero, run its handler. mov eax, net_sockets .loop: @@ -95,22 +92,22 @@ proc TCP_timer_640ms ; TODO: implement timed wait timer! inc [eax + TCP_SOCKET.t_idle] - dec [eax + TCP_SOCKET.timer_retransmission] - jnz .check_more2 test [eax + TCP_SOCKET.timer_flags], timer_flag_retransmission jz .check_more2 + dec [eax + TCP_SOCKET.timer_retransmission] + jnz .check_more2 DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: Retransmission timer expired\n", eax push eax - call TCP_output + call tcp_output pop eax .check_more2: - dec [eax + TCP_SOCKET.timer_keepalive] - jnz .check_more3 test [eax + TCP_SOCKET.timer_flags], timer_flag_keepalive jz .check_more3 + dec [eax + TCP_SOCKET.timer_keepalive] + jnz .check_more3 DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: Keepalive expired\n", eax @@ -118,7 +115,7 @@ proc TCP_timer_640ms ; TODO: implement timed wait timer! ja .dont_kill push eax - call TCP_disconnect + call tcp_disconnect pop eax jmp .loop @@ -129,7 +126,7 @@ proc TCP_timer_640ms ; TODO: implement timed wait timer! push eax mov ebx, eax xor cl, cl - call TCP_respond ; send keepalive + call tcp_respond ; send keepalive pop eax mov [eax + TCP_SOCKET.timer_keepalive], TCP_time_keep_interval jmp .check_more3 @@ -138,38 +135,38 @@ proc TCP_timer_640ms ; TODO: implement timed wait timer! mov [eax + TCP_SOCKET.timer_keepalive], TCP_time_keep_idle .check_more3: - dec [eax + TCP_SOCKET.timer_timed_wait] - jnz .check_more5 test [eax + TCP_SOCKET.timer_flags], timer_flag_2msl jz .check_more5 + dec [eax + TCP_SOCKET.timer_timed_wait] + jnz .check_more5 DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: 2MSL timer expired\n", eax .check_more5: - dec [eax + TCP_SOCKET.timer_persist] - jnz .check_more6 test [eax + TCP_SOCKET.timer_flags], timer_flag_persist jz .check_more6 + dec [eax + TCP_SOCKET.timer_persist] + jnz .check_more6 DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: persist timer expired\n", eax - call TCP_set_persist + call tcp_set_persist mov [eax + TCP_SOCKET.t_force], 1 push eax - call TCP_output + call tcp_output pop eax mov [eax + TCP_SOCKET.t_force], 0 .check_more6: - dec [eax + TCP_SOCKET.timer_timed_wait] - jnz .loop test [eax + TCP_SOCKET.timer_flags], timer_flag_wait jz .loop + dec [eax + TCP_SOCKET.timer_timed_wait] + jnz .loop DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: timed wait timer expired\n", eax push [eax + SOCKET.NextPtr] - call TCP_close + call tcp_close pop eax jmp .check_only @@ -187,7 +184,7 @@ endp ; ; ;-----------------------------------------------------------------; align 4 -TCP_cancel_timers: +tcp_cancel_timers: mov [eax + TCP_SOCKET.timer_flags], 0 diff --git a/kernel/branches/Kolibri-acpi/network/tcp_usreq.inc b/kernel/branches/Kolibri-acpi/network/tcp_usreq.inc index efc06ac3fb..c874c70c05 100644 --- a/kernel/branches/Kolibri-acpi/network/tcp_usreq.inc +++ b/kernel/branches/Kolibri-acpi/network/tcp_usreq.inc @@ -14,12 +14,12 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision: 5442 $ +$Revision: 6011 $ ;-----------------------------------------------------------------; ; ; -; TCP_usrclosed ; +; tcp_usrclosed ; ; ; ; IN: eax = socket ptr ; ; ; @@ -27,7 +27,7 @@ $Revision: 5442 $ ; ; ;-----------------------------------------------------------------; align 4 -TCP_usrclosed: +tcp_usrclosed: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_usrclosed: %x\n", eax @@ -51,7 +51,7 @@ TCP_usrclosed: .close: mov [eax + TCP_SOCKET.t_state], TCPS_CLOSED - call TCP_close + call tcp_close pop ebx ret @@ -66,7 +66,7 @@ TCP_usrclosed: ret .disc: - call SOCKET_is_disconnected + call socket_is_disconnected .ret: pop ebx ret @@ -74,7 +74,7 @@ TCP_usrclosed: ;-----------------------------------------------------------------; ; ; -; TCP_connect ; +; tcp_connect ; ; ; ; IN: eax = socket ptr ; ; ; @@ -84,7 +84,7 @@ TCP_usrclosed: ; ; ;-----------------------------------------------------------------; align 4 -TCP_connect: +tcp_connect: test [eax + SOCKET.state], SS_ISCONNECTED jnz .eisconn @@ -112,7 +112,7 @@ TCP_connect: ; Find a local port, if user didnt define one cmp [eax + TCP_SOCKET.LocalPort], 0 jne @f - call SOCKET_find_port + call socket_find_port @@: ; Start the TCP sequence @@ -124,16 +124,16 @@ TCP_connect: pop [eax + TCP_SOCKET.ISS] mov [eax + TCP_SOCKET.timer_keepalive], TCP_time_keep_init - TCP_sendseqinit eax + tcp_sendseqinit eax mov ebx, eax lea eax, [ebx + STREAM_SOCKET.snd] - call SOCKET_ring_create + call socket_ring_create test eax, eax jz .nomem lea eax, [ebx + STREAM_SOCKET.rcv] - call SOCKET_ring_create + call socket_ring_create test eax, eax jz .nomem @@ -142,11 +142,11 @@ TCP_connect: call mutex_unlock pop eax - call SOCKET_is_connecting + call socket_is_connecting ; Now send the SYN packet to remote end push eax - call TCP_output + call tcp_output pop eax .block: @@ -183,14 +183,14 @@ TCP_connect: cmp [eax + TCP_SOCKET.t_state], TCPS_ESTABLISHED je .established - call SOCKET_block + call socket_block jmp .loop .timeout: mov eax, [esp+4] mov [eax + SOCKET.errorcode], ETIMEDOUT and [eax + SOCKET.state], not SS_ISCONNECTING - call SOCKET_notify + call socket_notify ret 4 .fail: diff --git a/kernel/branches/Kolibri-acpi/network/udp.inc b/kernel/branches/Kolibri-acpi/network/udp.inc index 593dc4ee7c..cfb4436270 100644 --- a/kernel/branches/Kolibri-acpi/network/udp.inc +++ b/kernel/branches/Kolibri-acpi/network/udp.inc @@ -38,10 +38,10 @@ endg ;-----------------------------------------------------------------; ; ; -; UDP_init: This function resets all UDP variables ; +; udp_init: This function resets all UDP variables ; ; ; ;-----------------------------------------------------------------; -macro UDP_init { +macro udp_init { xor eax, eax mov edi, UDP_PACKETS_TX @@ -50,7 +50,7 @@ macro UDP_init { } -macro UDP_checksum IP1, IP2 { ; esi = ptr to udp packet, ecx = packet size, destroys: ecx, edx +macro udp_checksum IP1, IP2 { ; esi = ptr to udp packet, ecx = packet size, destroys: ecx, edx ; Pseudoheader mov edx, IP_PROTO_UDP @@ -98,7 +98,7 @@ macro UDP_checksum IP1, IP2 { ; esi = ptr to udp packet, ecx = packet size ;-----------------------------------------------------------------; ; ; -; UDP_input: Inject the UDP data in the application sockets. ; +; udp_input: Inject the UDP data in the application sockets. ; ; ; ; IN: [esp] = ptr to buffer ; ; ebx = ptr to device struct ; @@ -111,7 +111,7 @@ macro UDP_checksum IP1, IP2 { ; esi = ptr to udp packet, ecx = packet size ; ; ;-----------------------------------------------------------------; align 4 -UDP_input: +udp_input: DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: size=%u\n", ecx @@ -123,7 +123,7 @@ UDP_input: ; otherwise, we will re-calculate the checksum and add it to this value, thus creating 0 when it is correct mov eax, edx - UDP_checksum (eax+IPv4_header.SourceAddress), (eax+IPv4_header.DestinationAddress) + udp_checksum (eax+IPv4_header.SourceAddress), (eax+IPv4_header.DestinationAddress) jnz .checksum_mismatch .no_checksum: @@ -194,7 +194,7 @@ UDP_input: sub ecx, sizeof.UDP_header add esi, sizeof.UDP_header - jmp SOCKET_input + jmp socket_input .updateport: pusha @@ -220,14 +220,14 @@ UDP_input: .dump: DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: dumping\n" - call NET_BUFF_free + call net_buff_free ret ;-----------------------------------------------------------------; ; ; -; UDP_output: Create an UDP packet. ; +; udp_output: Create an UDP packet. ; ; ; ; IN: eax = socket pointer ; ; ecx = number of bytes to send ; @@ -238,7 +238,7 @@ UDP_input: ;-----------------------------------------------------------------; align 4 -UDP_output: +udp_output: DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_output: socket=%x bytes=%u data_ptr=%x\n", eax, ecx, esi @@ -256,7 +256,7 @@ UDP_output: mov al, [eax + IP_SOCKET.ttl] mov ah, IP_PROTO_UDP add ecx, sizeof.UDP_header - call IPv4_output + call ipv4_output jz .fail mov [esp + 8], eax ; pointer to buffer start @@ -279,13 +279,13 @@ UDP_output: ; Checksum mov esi, edi mov [edi + UDP_header.Checksum], 0 - UDP_checksum (edi-4), (edi-8) ; FIXME: IPv4 packet could have options.. + udp_checksum (edi-4), (edi-8) ; FIXME: IPv4 packet could have options.. DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_output: sending with device %x\n", ebx call [ebx + NET_DEVICE.transmit] test eax, eax jnz @f - call NET_ptr_to_num4 + call net_ptr_to_num4 inc [UDP_PACKETS_TX + edi] @@: @@ -302,7 +302,7 @@ UDP_output: ;-----------------------------------------------------------------; ; ; -; UDP_connect ; +; udp_connect ; ; ; ; IN: eax = socket pointer ; ; ; @@ -312,11 +312,11 @@ UDP_output: ; ; ;-----------------------------------------------------------------; align 4 -UDP_connect: +udp_connect: test [eax + SOCKET.state], SS_ISCONNECTED jz @f - call UDP_disconnect + call udp_disconnect @@: push eax edx @@ -340,7 +340,7 @@ UDP_connect: ; Find a local port, if user didnt define one cmp [eax + UDP_SOCKET.LocalPort], 0 jne @f - call SOCKET_find_port + call socket_find_port @@: push eax @@ -348,7 +348,7 @@ UDP_connect: call mutex_unlock pop eax - call SOCKET_is_connected + call socket_is_connected xor eax, eax ret @@ -364,11 +364,11 @@ UDP_connect: ; ; ;-----------------------------------------------------------------; align 4 -UDP_disconnect: +udp_disconnect: ; TODO: remove the pending received data - call SOCKET_is_disconnected + call socket_is_disconnected ret @@ -378,7 +378,7 @@ UDP_disconnect: ;-----------------------------------------------------------------; ; ; -; UDP_api: This function is called by system function 76 ; +; UDP_api: Part of system function 76 ; ; ; ; IN: bl = subfunction number in bl ; ; bh = device number in bh ; @@ -388,7 +388,7 @@ UDP_disconnect: ; ; ;-----------------------------------------------------------------; align 4 -UDP_api: +udp_api: movzx eax, bh shl eax, 2