/kernel/branches/Kolibri-acpi/data32.inc |
---|
359,7 → 359,6 |
mem_block_mask rd 2 |
next_memblock rd 1 |
mst MEM_STATE |
pte_valid_mask rd 1 |
375,6 → 374,7 |
align 16 |
_display display_t |
bios_fb FRB |
LFBAddress dd ? |
/kernel/branches/Kolibri-acpi/docs/sysfuncr.txt |
---|
1048,7 → 1048,7 |
* ebx = 19 - номер подфункции |
* ecx = 0 - номер подподфункции |
Возвращаемое значение: |
* eax = текущая скорость мыши |
* eax = текущий делитель скорости |
------------ Подподфункция 1 - установить скорость мыши. ------------- |
Параметры: |
1055,29 → 1055,31 |
* eax = 18 - номер функции |
* ebx = 19 - номер подфункции |
* ecx = 1 - номер подподфункции |
* edx = новое значение скорости |
* edx = новое значение делителя скорости |
Возвращаемое значение: |
* функция не возвращает значения |
Замечание: рекомендуемая скорость = 1, 0 = заблокировать курсор. |
Замечание: рекомендуемый делитель скорости = 4 |
------------- Подподфункция 2 - получить ускорение мыши. ------------- |
---------- Подподфункция 2 - получить чувствительность мыши ---------- |
Параметры: |
* eax = 18 - номер функции |
* ebx = 19 - номер подфункции |
* ecx = 2 - номер подподфункции |
Возвращаемое значение: |
* eax = 0 - выключить, 1 - слабое, 2 - среднее, 3 - сильное |
* eax = текущий коэффициент чувствительности |
------------ Подподфункция 3 - установить ускорение мыши. ------------ |
--------- Подподфункция 3 - установить чувствительность мыши --------- |
Параметры: |
* eax = 18 - номер функции |
* ebx = 19 - номер подфункции |
* ecx = 3 - номер подподфункции |
* edx = 0 - выключить, 1 - слабое, 2 - среднее, 3 - сильное |
* edx = новое значение коэффициента чувствительности |
Возвращаемое значение: |
* функция не возвращает значения |
Замечание: рекомендуемый коэффициент чувствительности = 3 |
-------- Подподфункция 4 - установить положение курсора мыши. -------- |
Параметры: |
* eax = 18 - номер функции |
4537,7 → 4539,7 |
eax - SF_NETWORK_GET (74) |
bl - SSF_LINK_STATUS (10) |
====================================================================== |
======= Функция 75, подфункция 0, Open socket (Открыть сокет). ======= |
============== Функция 75, подфункция 0, Открыть сокет. ============== |
====================================================================== |
Параметры: |
* eax = 75 - номер функции |
4553,7 → 4555,7 |
eax - SF_NETWORK_SOCKET (75) |
bl - SSF_OPEN (0) |
====================================================================== |
======= Функция 75, подфункция 1, Close socket (Закрыть сокет). ====== |
============== Функция 75, подфункция 1, Закрыть сокет. ============== |
====================================================================== |
Параметры: |
* eax = 75 - номер функции |
4664,7 → 4666,7 |
eax - SF_NETWORK_SOCKET (75) |
bl - SSF_RECEIVE (7) |
====================================================================== |
= Функция 75, подфункция 8, Set socket options (Задать опции сокета) = |
=========== Функция 75, подфункция 8, Задать опции сокета. =========== |
====================================================================== |
Параметры: |
* eax = 75 - номер функции |
4685,7 → 4687,7 |
eax - SF_NETWORK_SOCKET (75) |
bl - SSF_SET_OPTIONS (8) |
====================================================================== |
= Функция 75, подфункция 9, Get socket options(Получить опции сокета) |
========== Функция 75, подфункция 9, Получить опции сокета. ========== |
====================================================================== |
Параметры: |
* eax = 75 - номер функции |
4706,14 → 4708,14 |
eax - SF_NETWORK_SOCKET (75) |
bl - SSF_GET_OPTIONS (9) |
====================================================================== |
= Функция 75, подфункция 10, Get socketpair (Получить парный сокет). = |
========== Функция 75, подфункция 10, Получить парный сокет ========== |
====================================================================== |
Параметры: |
* eax = 75 - номер функции |
* bl = 10 - номер подфункции |
Возвращаемое значение: |
* eax = socketnum1, -1 для ошибки |
* ebx = socketnum2, код ошибки в случае ошибки |
* eax = номер первого сокета / -1 для ошибки |
* ebx = номер второго сокета / код ошибки |
---------------------- Константы для регистров: ---------------------- |
eax - SF_NETWORK_SOCKET (75) |
4727,12 → 4729,16 |
* bh = номер устройства |
* bl = номер подфункции |
Ethernet (0) |
Протоколы и подфункции: |
0 - Ethernet: |
0 - Read MAC |
IPv4 (1) |
0 - Read # IP packets sent |
1 - Read # IP packets received |
общие подфункции: |
0 - пакетов послано |
1 - пакетов принято |
1 - IPv4: |
2 - Read IP |
3 - Write IP |
4 - Read DNS |
4742,22 → 4748,13 |
8 - Read gateway |
9 - Write gateway |
ICMP (2) |
0 - Read # ICMP packets sent |
1 - Read # ICMP packets received |
2 - ICMP: |
3 - enable/disable ICMP echo reply |
UDP (3) |
0 - Read # UDP packets sent |
1 - Read # UDP packets received |
3 - UDP |
4 - TCP |
TCP (4) |
0 - Read # TCP packets sent |
1 - Read # TCP packets received |
ARP (5) |
0 - Read # ARP packets sent |
1 - Read # ARP packets received |
5 - ARP: |
2 - Read # ARP entry's |
3 - Read ARP entry |
4 - Add static ARP entry |
4768,6 → 4765,64 |
---------------------- Константы для регистров: ---------------------- |
eax - SF_NETWORK_PROTOCOL (76) |
====================================================================== |
============= Функция 77, подфункция 0, Создать фьютекс. ============= |
====================================================================== |
Параметры: |
* eax = 77 - номер функции |
* ebx = 0 - номер подфункции |
* ecx = указатель на контрольное значение фьютекса (dword) |
Возвращаемое значение: |
* eax = дескриптор фьютекса, 0 при ошибке |
---------------------- Константы для регистров: ---------------------- |
eax - SF_FUTEX (77) |
ebx - SSF_CREATE (0) |
====================================================================== |
============= Функция 77, подфункция 1, Удалить фьютекс. ============= |
====================================================================== |
Параметры: |
* eax = 77 - номер функции |
* ebx = 1 - номер подфункции |
* ecx = дескриптор фьютекса |
Возвращаемое значение: |
* eax = 0 - успешно, -1 при ошибке |
Замечания: |
* Ядро автоматически удаляет фьютексы при завершении процесса. |
---------------------- Константы для регистров: ---------------------- |
eax - SF_FUTEX (77) |
ebx - SSF_DESTROY (1) |
====================================================================== |
================= Функция 77, подфункция 2, Ожидать. ================= |
====================================================================== |
Параметры: |
* eax = 77 - номер функции |
* ebx = 2 - номер подфункции |
* ecx = дескриптор фьютекса |
* edx = контрольное значение |
* esi = таймаут в сотых секунды, 0 - ждать бесконечно |
Возвращаемое значение: |
* eax = 0 - успешно, -1 - таймаут, |
-2 - контрольное значение не соответствует |
---------------------- Константы для регистров: ---------------------- |
eax - SF_FUTEX (77) |
ebx - SSF_WAIT (2) |
====================================================================== |
================ Функция 77, подфункция 3, Разбудить. ================ |
====================================================================== |
Параметры: |
* eax = 77 - номер функции |
* ebx = 3 - номер подфункции |
* ecx = дескриптор фьютекса |
* edx = сколько ожидающих будить (максимум) |
Возвращаемое значение: |
* eax = количество разбуженых |
---------------------- Константы для регистров: ---------------------- |
eax - SF_FUTEX (77) |
ebx - SSF_WAKE (3) |
====================================================================== |
========== Функция -1 - завершить выполнение потока/процесса ========= |
====================================================================== |
Параметры: |
4821,18 → 4876,17 |
==================== Коды ошибок файловой системы ==================== |
====================================================================== |
* 0 = успешно |
* 1 = не определена база и/или раздел жёсткого диска (подфункциями |
7, 8 функции 21) |
* 2 = функция не поддерживается для данной файловой системы |
* 3 = неизвестная файловая система |
* 4 = зарезервировано, никогда не возвращается в текущей реализации |
* 5 = файл не найден |
* 6 = файл закончился |
* 7 = указатель вне памяти приложения |
* 8 = диск заполнен |
* 9 = таблица FAT разрушена |
* 9 = ошибка файловой системы |
* 10 = доступ запрещён |
* 11 = ошибка устройства |
* 12 = файловой системе недостаточно оперативной памяти |
При запуске программы возможны также следующие коды ошибок: |
* 30 = 0x1E = недостаточно памяти |
* 31 = 0x1F = файл не является исполнимым |
/kernel/branches/Kolibri-acpi/docs/sysfuncs.txt |
---|
1041,7 → 1041,7 |
* ebx = 19 - subfunction number |
* ecx = 0 - subsubfunction number |
Returned value: |
* eax = current mouse speed |
* eax = current speed divider |
---------------- Subsubfunction 1 - set mouse speed. ----------------- |
Parameters: |
1048,29 → 1048,31 |
* eax = 18 - function number |
* ebx = 19 - subfunction number |
* ecx = 1 - subsubfunction number |
* edx = new value for speed |
* edx = new value for speed divider |
Returned value: |
* function does not return value |
Remark: recommended speed = 1, 0 = lock the cursor. |
Remark: recommended speed divider = 4 |
------------- Subsubfunction 2 - get mouse acceleration. ------------- |
-------------- Subsubfunction 2 - get mouse sensitivity -------------- |
Parameters: |
* eax = 18 - function number |
* ebx = 19 - subfunction number |
* ecx = 2 - subsubfunction number |
Returned value: |
* eax = 0 - off, 1 - slight, 2 - medium, 3 - intense |
* eax = current sensitivity |
------------- Subsubfunction 3 - set mouse acceleration. ------------- |
-------------- Subsubfunction 3 - set mouse sensitivity -------------- |
Parameters: |
* eax = 18 - function number |
* ebx = 19 - subfunction number |
* ecx = 3 - subsubfunction number |
* edx = 0 - off, 1 - slight, 2 - medium, 3 - intense |
* edx = new value for sensitivity |
Returned value: |
* function does not return value |
Remark: recommended sensitivity = 3 |
----------- Subsubfunction 4 - set mouse pointer position. ----------- |
Parameters: |
* eax = 18 - function number |
4667,7 → 4669,7 |
eax - SF_NETWORK_SOCKET (75) |
bl - SSF_GET_OPTIONS (9) |
====================================================================== |
============ Function 75, Subfunction 10, Get socketpair. =========== |
============ Function 75, Subfunction 10, Get socketpair. ============ |
====================================================================== |
Parameters: |
* eax = 75 - function number |
4688,12 → 4690,16 |
* bh = device number |
* bl = subfunction number |
Ethernet (0) |
Protocols and subfunctions: |
0 - Ethernet: |
0 - Read MAC |
IPv4 (1) |
0 - Read # IP packets sent |
1 - Read # IP packets received |
common subfunctions: |
0 - Read # packets sent |
1 - Read # packets received |
1 - IPv4: |
2 - Read IP |
3 - Write IP |
4 - Read DNS |
4703,22 → 4709,13 |
8 - Read gateway |
9 - Write gateway |
ICMP (2) |
0 - Read # ICMP packets sent |
1 - Read # ICMP packets received |
2 - ICMP: |
3 - enable/disable ICMP echo reply |
UDP (3) |
0 - Read # UDP packets sent |
1 - Read # UDP packets received |
3 - UDP |
4 - TCP |
TCP (4) |
0 - Read # TCP packets sent |
1 - Read # TCP packets received |
ARP (5) |
0 - Read # ARP packets sent |
1 - Read # ARP packets received |
5 - ARP: |
2 - Read # ARP entry's |
3 - Read ARP entry |
4 - Add static ARP entry |
4728,7 → 4725,6 |
---------------------- Constants for registers: ---------------------- |
eax - SF_NETWORK_PROTOCOL (76) |
====================================================================== |
========== Function 77, Subfunction 0, Create futex object =========== |
====================================================================== |
4742,6 → 4738,10 |
* Use subfunction 1 to destroy the futex. |
The kernel destroys the futexes automatically when the process |
terminates. |
---------------------- Constants for registers: ---------------------- |
eax - SF_FUTEX (77) |
ebx - SSF_CREATE (0) |
====================================================================== |
========= Function 77, Subfunction 1, Destroy futex object =========== |
====================================================================== |
4754,6 → 4754,9 |
Remarks: |
* The futex handle must have been created by subfunction 0 |
---------------------- Constants for registers: ---------------------- |
eax - SF_FUTEX (77) |
ebx - SSF_DESTROY (1) |
====================================================================== |
=============== Function 77, Subfunction 2, Futex wait =============== |
====================================================================== |
4773,6 → 4776,9 |
waiting for a wake operation on the futex. |
* The futex handle must have been created by subfunction 0 |
---------------------- Constants for registers: ---------------------- |
eax - SF_FUTEX (77) |
ebx - SSF_WAIT (2) |
====================================================================== |
=============== Function 77, Subfunction 3, Futex wake =============== |
====================================================================== |
4789,6 → 4795,9 |
waiting (e.g., inside futex wait) on the futex dword |
* The futex handle must have been created by subfunction 0 |
---------------------- Constants for registers: ---------------------- |
eax - SF_FUTEX (77) |
ebx - SSF_WAKE (3) |
====================================================================== |
=============== Function -1 - terminate thread/process =============== |
====================================================================== |
4804,6 → 4813,8 |
* This function terminates the current thread. Other thread can be |
killed by call to subfunction 2 of function 18. |
---------------------- Constants for registers: ---------------------- |
eax - SF_TERMINATE_PROCESS (-1) |
====================================================================== |
=========================== List of events =========================== |
====================================================================== |
4841,18 → 4852,17 |
=================== Error codes of the file system =================== |
====================================================================== |
* 0 = success |
* 1 = base and/or partition of a hard disk is not defined |
(by subfunctions 7, 8 of function 21) |
* 2 = function is not supported for the given file system |
* 3 = unknown file system |
* 4 = reserved, is never returned in the current implementation |
* 5 = file not found |
* 6 = end of file, EOF |
* 7 = pointer lies outside of application memory |
* 8 = disk is full |
* 9 = FAT table is destroyed |
* 9 = file system error |
* 10 = access denied |
* 11 = device error |
* 12 = file system requires more memory |
Application start functions can return also following errors: |
* 30 = 0x1E = not enough memory |
* 31 = 0x1F = file is not executable |
/kernel/branches/Kolibri-acpi/fs/ntfs.inc |
---|
1,6 → 1,6 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
/kernel/branches/Kolibri-acpi/hid/mousedrv.inc |
---|
35,8 → 35,8 |
iglobal |
;-------------------------------------- |
align 4 |
mouse_speed_factor dw 1 |
mouse_delay db 1 |
mouse_speed_factor dw 4 |
mouse_delay db 3 |
mouse_doubleclick_delay db 64 |
endg |
480,7 → 480,7 |
;----------------------------------------------------------------------------- |
align 4 |
proc set_mouse_data stdcall uses edx, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword |
proc set_mouse_data stdcall uses ecx edx, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword |
mov eax, [BtnState] |
and eax, 0x3FFFFFFF ; Top 2 bits are used to flag absolute movements |
551,35 → 551,17 |
endp |
;----------------------------------------------------------------------------- |
; 3 = (x+1)^2 /4 |
; 2 = (x+2)^2 /8 |
; 1 = (x+3)^2 /16 |
align 4 |
mouse_acceleration: |
cmp [mouse_delay], 0 |
jz .end |
push eax |
neg ax |
jl mouse_acceleration |
add al, [mouse_delay] |
mul al |
mov cx, [mouse_speed_factor] |
dec ax |
shr ax, cl |
inc ax |
test eax, eax |
jns @f |
neg ax |
@@: |
neg eax |
jl @b |
inc eax |
cmp [mouse_delay], 3 |
adc eax, 0 |
cmp [mouse_delay], 2 |
adc eax, 0 |
mul al |
shr eax, 2 |
cmp [mouse_delay], 2 |
jz .2 |
jnc .3 |
shr eax, 1 |
.2: |
shr eax, 1 |
.3: |
pop edx |
test edx, edx |
jns .end |
neg eax |
.end: |
imul [mouse_speed_factor] |
ret |
/kernel/branches/Kolibri-acpi/kernel.asm |
---|
1,6 → 1,6 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; |
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. |
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. |
;; PROGRAMMING: |
;; Ivan Poddubny |
;; Marat Zakiyanov (Mario79) |
440,45 → 440,13 |
; ----------------------------------------- |
mov al, [BOOT_VARS+BOOT_DMA] ; DMA access |
mov [allow_dma_access], al |
movzx eax, byte [BOOT_VARS+BOOT_BPP] ; bpp |
mov [_display.bits_per_pixel], eax |
mov [_display.vrefresh], 60 |
mov al, [BOOT_VARS+BOOT_DEBUG_PRINT] ; If nonzero, duplicates debug output to the screen |
mov [debug_direct_print], al |
mov al, [BOOT_VARS+BOOT_LAUNCHER_START] ; Start the first app (LAUNCHER) after kernel is loaded? |
mov [launcher_start], al |
movzx eax, word [BOOT_VARS+BOOT_X_RES]; X max |
mov [_display.width], eax |
mov [display_width_standard], eax |
dec eax |
mov [screen_workarea.right], eax |
movzx eax, word [BOOT_VARS+BOOT_Y_RES]; Y max |
mov [_display.height], eax |
mov [display_height_standard], eax |
dec eax |
mov [screen_workarea.bottom], eax |
movzx eax, word [BOOT_VARS+BOOT_VESA_MODE] ; screen mode |
mov dword [SCR_MODE], eax |
; mov eax, [BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add |
; mov [BANK_SWITCH], eax |
mov eax, 640 *4 ; Bytes PerScanLine |
cmp [SCR_MODE], word 0x13 ; 320x200 |
je @f |
cmp [SCR_MODE], word 0x12 ; VGA 640x480 |
je @f |
movzx eax, word[BOOT_VARS+BOOT_PITCH] ; for other modes |
@@: |
mov [_display.lfb_pitch], eax |
mov eax, [_display.width] |
mul [_display.height] |
mov [_display.win_map_size], eax |
call calculate_fast_getting_offset_for_WinMapAddress |
; for Qemu or non standart video cards |
; Unfortunately [BytesPerScanLine] does not always |
; equal to [_display.width] * [ScreenBPP] / 8 |
call calculate_fast_getting_offset_for_LFB |
mov esi, BOOT_VARS+0x9080 |
movzx ecx, byte [esi-1] |
mov [NumBiosDisks], ecx |
485,59 → 453,6 |
mov edi, BiosDisksData |
rep movsd |
setvideomode: |
mov eax, [BOOT_VARS+BOOT_LFB] |
mov [LFBAddress], eax |
cmp word [SCR_MODE], 0x0012 ; VGA (640x480 16 colors) |
je .vga |
cmp word [SCR_MODE], 0x0013 ; MCGA (320*200 256 colors) |
je .32bpp |
cmp byte [_display.bits_per_pixel], 32 |
je .32bpp |
cmp byte [_display.bits_per_pixel], 24 |
je .24bpp |
cmp byte [_display.bits_per_pixel], 16 |
je .16bpp |
; cmp byte [_display.bits_per_pixel], 15 |
; je .15bpp |
.vga: |
mov [PUTPIXEL], VGA_putpixel |
mov [GETPIXEL], Vesa20_getpixel32 ; Conversion buffer is 32 bpp |
mov [_display.bytes_per_pixel], 4 ; Conversion buffer is 32 bpp |
jmp .finish |
; .15bpp: |
; mov [PUTPIXEL], Vesa20_putpixel15 |
; mov [GETPIXEL], Vesa20_getpixel15 |
; mov [_display.bytes_per_pixel], 2 |
; jmp .finish |
.16bpp: |
mov [PUTPIXEL], Vesa20_putpixel16 |
mov [GETPIXEL], Vesa20_getpixel16 |
mov [_display.bytes_per_pixel], 2 |
jmp .finish |
.24bpp: |
mov [PUTPIXEL], Vesa20_putpixel24 |
mov [GETPIXEL], Vesa20_getpixel24 |
mov [_display.bytes_per_pixel], 3 |
jmp .finish |
.32bpp: |
mov [PUTPIXEL], Vesa20_putpixel32 |
mov [GETPIXEL], Vesa20_getpixel32 |
mov [_display.bytes_per_pixel], 4 |
; jmp .finish |
.finish: |
mov [MOUSE_PICTURE], mousepointer |
mov [_display.check_mouse], check_mouse_area_for_putpixel |
mov [_display.check_m_pixel], check_mouse_area_for_getpixel |
; -------- Fast System Call init ---------- |
; Intel SYSENTER/SYSEXIT (AMD CPU support it too) |
bt [cpu_caps], CAPS_SEP |
619,8 → 534,11 |
mov ax, tss0 |
ltr ax |
mov [LFBSize], 0xC00000 |
call init_LFB |
call init_video |
call init_mtrr |
mov [LFBAddress], LFB_BASE |
mov ecx, bios_fb |
call set_framebuffer |
call init_fpu |
call init_malloc |
/kernel/branches/Kolibri-acpi/kernel32.inc |
---|
64,9 → 64,10 |
;include "video/vesa12.inc" ; Vesa 1.2 functions |
include "video/vesa20.inc" ; Vesa 2.0 functions |
include "video/blitter.inc" ; |
include "video/blitter.inc" |
include "video/vga.inc" ; VGA 16 color functions |
include "video/cursors.inc" ; cursors functions |
include "video/framebuffer.inc" ; framebuffer functions |
; Network Interface & TCPIP Stack |
/kernel/branches/Kolibri-acpi/network/IPv4.inc |
---|
1,6 → 1,6 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; IPv4.INC ;; |
939,6 → 939,7 |
test ebx, ebx |
jnz .got_device |
; Broadcast does not need gateway |
cmp eax, 0xffffffff |
je .broadcast |
976,6 → 977,10 |
mov edx, [IP_LIST + edi] ; Source IP |
; Broadcast does not need gateway |
cmp eax, 0xffffffff |
je @f |
; Check if we should route to gateway or not |
mov ebx, [IP_LIST + edi] |
and ebx, [SUBNET_LIST + edi] |
/kernel/branches/Kolibri-acpi/video/framebuffer.inc |
---|
0,0 → 1,216 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; Synhronization for MenuetOS. ;; |
;; Author: Halyavin Andrey, halyavin@land.ru ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 6240 $ |
struct FRB |
list LHEAD |
magic rd 1 |
handle rd 1 |
destroy rd 1 |
width rd 1 |
height rd 1 |
pitch rd 1 |
format rd 1 |
private rd 1 |
pde rd 8 |
ends |
align 4 |
create_framebuffer: |
mov ecx, sizeof.FRB |
call create_object |
test eax, eax |
jz .fail |
mov [eax+FRB.magic], 'FRMB' |
mov [eax+FRB.destroy], 0 |
.fail: |
ret |
align 4 |
init_video: |
mov ebp, bios_fb |
movzx eax, byte [BOOT_VARS+BOOT_BPP] ; bpp |
mov [_display.bits_per_pixel], eax |
mov [_display.vrefresh], 60 |
movzx eax, word [BOOT_VARS+BOOT_X_RES]; X max |
mov [_display.width], eax |
mov [ebp+FRB.width], eax |
mov [display_width_standard], eax |
dec eax |
mov [screen_workarea.right], eax |
movzx eax, word [BOOT_VARS+BOOT_Y_RES]; Y max |
mov [_display.height], eax |
mov [ebp+FRB.height], eax |
mov [display_height_standard], eax |
dec eax |
mov [screen_workarea.bottom], eax |
movzx eax, word [BOOT_VARS+BOOT_VESA_MODE] ; screen mode |
mov dword [SCR_MODE], eax |
mov eax, 640 *4 ; Bytes PerScanLine |
cmp [SCR_MODE], word 0x13 ; 320x200 |
je @f |
cmp [SCR_MODE], word 0x12 ; VGA 640x480 |
je @f |
movzx eax, word[BOOT_VARS+BOOT_PITCH] ; for other modes |
@@: |
mov [_display.lfb_pitch], eax |
mov [ebp+FRB.pitch], eax |
mov eax, [BOOT_VARS+BOOT_LFB] |
mov [LFBAddress], eax |
mov eax, [_display.width] |
mul [_display.height] |
mov [_display.win_map_size], eax |
cmp word [SCR_MODE], 0x0012 ; VGA (640x480 16 colors) |
je .vga |
cmp word [SCR_MODE], 0x0013 ; MCGA (320*200 256 colors) |
je .32bpp |
cmp byte [_display.bits_per_pixel], 32 |
je .32bpp |
cmp byte [_display.bits_per_pixel], 24 |
je .24bpp |
cmp byte [_display.bits_per_pixel], 16 |
je .16bpp |
.vga: |
mov [PUTPIXEL], VGA_putpixel |
mov [GETPIXEL], Vesa20_getpixel32 ; Conversion buffer is 32 bpp |
mov [_display.bytes_per_pixel], 4 ; Conversion buffer is 32 bpp |
jmp .finish |
.16bpp: |
mov [PUTPIXEL], Vesa20_putpixel16 |
mov [GETPIXEL], Vesa20_getpixel16 |
mov [_display.bytes_per_pixel], 2 |
jmp .finish |
.24bpp: |
mov [PUTPIXEL], Vesa20_putpixel24 |
mov [GETPIXEL], Vesa20_getpixel24 |
mov [_display.bytes_per_pixel], 3 |
jmp .finish |
.32bpp: |
mov [PUTPIXEL], Vesa20_putpixel32 |
mov [GETPIXEL], Vesa20_getpixel32 |
mov [_display.bytes_per_pixel], 4 |
.finish: |
mov [MOUSE_PICTURE], mousepointer |
mov [_display.check_mouse], check_mouse_area_for_putpixel |
mov [_display.check_m_pixel], check_mouse_area_for_getpixel |
mov ax, word [SCR_MODE] |
cmp ax, 0x0012 |
je .fake |
cmp ax, 0x0013 |
je .fake |
mov esi, [LFBAddress] |
bt [cpu_caps], CAPS_PSE |
jnc .create_page_tables |
mov edx, 0x00400000 |
or esi, PG_GLOBAL+PDE_LARGE+PAT_WC+PG_UWR |
and esi, [pte_valid_mask] |
mov [ebp+FRB.pde], esi |
add esi, edx |
mov [ebp+FRB.pde+4], esi |
add esi, edx |
mov [ebp+FRB.pde+8], esi |
add esi, edx |
mov [ebp+FRB.pde+12], esi |
add esi, edx |
.ok: |
call calculate_fast_getting_offset_for_WinMapAddress |
; for Qemu or non standart video cards |
; Unfortunately [BytesPerScanLine] does not always |
; equal to [_display.width] * [ScreenBPP] / 8 |
call calculate_fast_getting_offset_for_LFB |
ret |
.create_page_tables: |
add ebp, FRB.pde |
or esi, PG_GLOBAL+PAT_WC+PG_UWR |
and esi, [pte_valid_mask] |
stdcall alloc_kernel_space, 0x1000 |
mov edi, eax |
mov ebx, 4 |
.new_pd: |
call alloc_page |
lea edx, [eax+PG_UWR] |
mov [ebp], edx |
stdcall map_page, edi, eax, PG_SWR |
mov eax, esi |
mov ecx, 1024 |
@@: |
stosd |
add eax, 0x1000 |
loop @B |
add esi, 0x400000 |
add ebp, 4 |
sub edi, 4096 |
dec ebx |
jnz .new_pd |
stdcall free_kernel_space, edi |
jmp .ok |
.fake: |
mov [BOOT_VARS+BOOT_MTRR], byte 2 |
stdcall alloc_kernel_space, 0x1000 |
push eax ;store in stack for subsequent |
mov edi, eax ;free_kernel_space call |
call alloc_page |
lea edx, [eax+PG_UWR] |
mov [ebp+FRB.pde], edx |
; max VGA=640*480*4=1228800 bytes |
; + 32*640*4=81920 bytes for mouse pointer |
stdcall alloc_pages, ((1228800+81920)/4096) |
or eax, PG_GLOBAL+PG_UWR |
and eax, [pte_valid_mask] |
mov ecx, (1228800+81920)/4096 |
@@: |
stosd |
add eax, 0x1000 |
loop @B |
call free_kernel_space |
jmp .ok |
align 4 |
set_framebuffer: |
mov edx, LFB_BASE shr 22 |
mov eax, [ecx+FRB.pde] |
mov dword [master_tab+edx*4], eax |
mov eax, [ecx+FRB.pde+4] |
mov dword [master_tab+edx*4+4], eax |
mov eax, [ecx+FRB.pde+8] |
mov dword [master_tab+edx*4+8], eax |
mov eax, [ecx+FRB.pde+12] |
mov dword [master_tab+edx*4+12], eax |
ret |