/kernel/branches/net/drivers/sb16/CONFIG.INC |
---|
22,7 → 22,7 |
small_buffer equ 32768 |
full_buffer equ 65536 |
sb_buffer_size equ small_buffer ; FIX ring buffer overlapped events issue; full_buffer |
sb_buffer_size equ full_buffer |
__supported_buffer_sizes fix <small_buffer, full_buffer> |
/kernel/branches/net/kernel.asm |
---|
61,8 → 61,7 |
USE_COM_IRQ equ 1 ; make irq 3 and irq 4 available for PCI devices |
; Enabling the next line will enable serial output console |
;debug_com_base equ 0x3f8 ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used |
debug_com_base equ 0x3f8 ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used, comment this line out to disable |
include "proc32.inc" |
include "kglobals.inc" |
238,8 → 237,8 |
mov edi,0x2F0000 |
mov ecx,0x10000 / 4 |
rep movsd |
mov edi,0x1000 |
mov ecx,0xf000 / 4 |
xor edi, edi |
mov ecx,0x10000 / 4 |
rep stosd |
call test_cpu |
454,8 → 453,8 |
; LOAD IDT |
call build_interrupt_table ;lidt is executed |
;lidt [idtreg] |
call build_interrupt_table |
lidt [idtreg] |
call init_kernel_heap |
stdcall kernel_alloc, RING0_STACK_SIZE+512 |
549,8 → 548,9 |
mov [BgrDrawMode],eax |
mov [BgrDataWidth],eax |
mov [BgrDataHeight],eax |
mov [mem_BACKGROUND], 4 |
mov [img_background], static_background_data |
mov [mem_BACKGROUND],4095 |
stdcall kernel_alloc, [mem_BACKGROUND] |
mov [img_background], eax |
mov [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE |
674,8 → 674,8 |
xor eax, eax |
mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data |
mov dword [SLOT_BASE+APPDATA.exc_handler], eax |
mov dword [SLOT_BASE+APPDATA.except_mask], eax |
mov dword [SLOT_BASE+APPDATA.fpu_handler], eax |
mov dword [SLOT_BASE+APPDATA.sse_handler], eax |
; name for OS/IDLE process |
696,8 → 696,8 |
cld |
rep movsd |
mov dword [SLOT_BASE+256+APPDATA.exc_handler], eax |
mov dword [SLOT_BASE+256+APPDATA.except_mask], eax |
mov dword [SLOT_BASE+256+APPDATA.fpu_handler], eax |
mov dword [SLOT_BASE+256+APPDATA.sse_handler], eax |
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET |
mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx |
724,36 → 724,19 |
mov esi,boot_tsc |
call boot_log |
cli |
rdtsc ;call _rdtsc |
call _rdtsc |
mov ecx,eax |
mov esi,250 ; wait 1/4 a second |
call delay_ms |
rdtsc ;call _rdtsc |
call _rdtsc |
sti |
sub eax,ecx |
shl eax,2 |
mov [CPU_FREQ],eax ; save tsc / sec |
; mov ebx, 1000000 |
; div ebx |
; ¢®®¡é¥-â® ¯à®¨§¢®¤¨â¥«ì®áâì ¢ ¤ ®¬ ª®ªà¥â®¬ ¬¥á⥠|
; ᮢ¥à襮 ¥ªà¨â¨ç , ® çâ®¡ë § âªãâì «î¡¨â¥«¥© |
; ®¯â¨¬¨§¨àãîé¨å ª®¬¯¨«ïâ®à®¢ ... |
mov edx, 2251799814 |
mul edx |
shr edx, 19 |
mov [stall_mcs], edx |
; PRINT CPU FREQUENCY |
mov esi, boot_cpufreq |
call boot_log |
mov ebx, 1000000 |
div ebx |
mov [stall_mcs], eax |
mov ebx, edx |
movzx ecx, word [boot_y] |
add ecx, (10+17*6) shl 16 - 10 ; 'CPU frequency is ' |
mov edx, 0xFFFFFF |
mov edi, 1 |
mov eax, 0x00040000 |
call display_number_force |
; SET VARIABLES |
call set_variables |
762,7 → 745,7 |
;call detect_devices |
stdcall load_driver, szPS2MDriver |
; stdcall load_driver, szCOM_MDriver |
stdcall load_driver, szCOM_MDriver |
mov esi,boot_setmouse |
call boot_log |
806,7 → 789,9 |
stdcall map_page,tss._io_map_1,\ |
(tss._io_map_1-OS_BASE), PG_MAP |
mov ax,[OS_BASE+0x10000+bx_from_load] |
; LOAD FIRST APPLICATION |
cli |
1004,30 → 989,58 |
; MAIN OS LOOP END ; |
; ; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
align 4 |
checkidle: |
pushad |
cmp [check_idle_semaphore],0 |
jne no_idle_state |
call change_task |
jmp idle_loop_entry |
mov eax,[idlemem] |
mov ebx,[timer_ticks] ;[0xfdf0] |
cmp eax,ebx |
jnz idle_exit |
call _rdtsc |
mov ecx,eax |
idle_loop: |
cmp eax,[idlemem] ; eax == [timer_ticks] |
jne idle_exit |
rdtsc ;call _rdtsc |
mov ecx,eax |
hlt |
rdtsc ;call _rdtsc |
cmp [check_idle_semaphore],0 |
jne idle_loop_exit |
mov eax,[timer_ticks] ;[0xfdf0] |
cmp ebx,eax |
jz idle_loop |
idle_loop_exit: |
mov [idlemem],eax |
call _rdtsc |
sub eax,ecx |
add [idleuse],eax |
idle_loop_entry: |
mov eax,[timer_ticks] ; eax = [timer_ticks] |
cmp [check_idle_semaphore],0 |
je idle_loop |
dec [check_idle_semaphore] |
mov ebx,[idleuse] |
add ebx,eax |
mov [idleuse],ebx |
popad |
ret |
idle_exit: |
mov [idlemem],eax ; eax == [timer_ticks] |
mov ebx,[timer_ticks] ;[0xfdf0] |
mov [idlemem],ebx |
call change_task |
popad |
ret |
no_idle_state: |
dec [check_idle_semaphore] |
mov ebx,[timer_ticks] ;[0xfdf0] |
mov [idlemem],ebx |
call change_task |
popad |
ret |
uglobal |
idlemem dd 0x0 |
idleuse dd 0x0 |
1133,6 → 1146,7 |
mov [BTN_ADDR],dword BUTTON_INFO ; address of button list |
;!! IP 04.02.2005: |
mov [next_usage_update], 100 |
mov byte [DONT_SWITCH], 0 ; change task if possible |
ret |
1292,7 → 1306,6 |
xor edx,edx |
call division_64_bits |
div ebx |
hexletters = __fdo_hexdigits |
add edx,hexletters |
mov dl,[edx] |
mov [edi],dl |
2248,9 → 2261,8 |
uglobal |
; bgrchanged dd 0x0 |
align 4 |
bgrlock db 0 |
bgrlockpid dd 0 |
bgrlock db 0 |
endg |
sys_background: |
2262,9 → 2274,10 |
cmp edx,0 |
je sbgrr |
@@: |
;;Maxis use atomic bts for mutexes 4.4.2009 |
bts dword [bgrlock], 0 |
jnc @f |
mov al, 1 |
xchg [bgrlock], al |
test al, al |
jz @f |
call change_task |
jmp @b |
@@: |
2274,11 → 2287,7 |
pushad |
; return memory for old background |
mov eax, [img_background] |
cmp eax, static_background_data |
jz @f |
stdcall kernel_free, eax |
@@: |
stdcall kernel_free, [img_background] |
; calculate RAW size |
xor eax,eax |
inc eax |
2297,18 → 2306,9 |
; get memory for new background |
stdcall kernel_alloc, eax |
test eax, eax |
jz .memfailed |
jz .exit_mem |
mov [img_background], eax |
jmp .exit |
.memfailed: |
; revert to static monotone data |
mov [img_background], static_background_data |
xor eax, eax |
inc eax |
mov [BgrDataWidth], eax |
mov [BgrDataHeight], eax |
mov [mem_BACKGROUND], 4 |
.exit: |
.exit_mem: |
popad |
mov [bgrlock], 0 |
2320,25 → 2320,20 |
cmp ebx,2 ; SET PIXEL |
jnz nosb2 |
mov eax, [img_background] |
test ecx, ecx |
jz @f |
cmp eax, static_background_data |
jz .ret |
@@: |
mov ebx, [mem_BACKGROUND] |
add ebx, 4095 |
and ebx, -4096 |
sub ebx, 4 |
cmp ecx, ebx |
ja .ret |
ja @F |
mov eax,[img_background] |
mov ebx,[eax+ecx] |
and ebx,0xFF000000 ;255*256*256*256 |
and edx,0x00FFFFFF ;255*256*256+255*256+255 |
add edx,ebx |
mov [eax+ecx],edx |
.ret: |
@@: |
ret |
nosb2: |
2368,13 → 2363,6 |
cmp ebx,5 ; BLOCK MOVE TO BGR |
jnz nosb5 |
cmp [img_background], static_background_data |
jnz @f |
test edx, edx |
jnz .fin |
cmp esi, 4 |
ja .fin |
@@: |
; bughere |
mov eax, ecx |
mov ebx, edx |
2387,17 → 2375,16 |
cmp ebx, 6 |
jnz nosb6 |
;;Maxis use atomic bts for mutex 4.4.2009 |
@@: |
bts dword [bgrlock], 0 |
jnc @f |
mov al, 1 |
xchg [bgrlock], al |
test al, al |
jz @f |
call change_task |
jmp @b |
@@: |
mov eax, [CURRENT_TASK] |
mov [bgrlockpid], eax |
cmp [img_background], static_background_data |
jz .nomem |
stdcall user_alloc, [mem_BACKGROUND] |
mov [esp+32], eax |
test eax, eax |
2498,24 → 2485,19 |
cmp eax,2 ; PIXEL |
jnz nogb2 |
mov eax, [img_background] |
test ebx, ebx |
jz @f |
cmp eax, static_background_data |
jz .ret |
@@: |
mov ecx, [mem_BACKGROUND] |
add ecx, 4095 |
and ecx, -4096 |
sub ecx, 4 |
cmp ebx, ecx |
ja .ret |
ja @F |
mov eax,[img_background] |
mov eax,[ebx+eax] |
and eax, 0xFFFFFF |
mov [esp+36],eax |
.ret: |
@@: |
ret |
nogb2: |
3101,6 → 3083,8 |
call check_window_position |
call set_window_clientbox |
push ecx esi edi ; save for window fullscreen/resize |
;mov esi,edi |
3149,8 → 3133,6 |
mov [BTN_COUNT],byte 0 ; empty button buffer |
newd: |
call set_window_clientbox |
mov [edi+WDATA.fl_redraw],byte 0 ; no redraw |
mov edx,edi |
3667,6 → 3649,14 |
calculatebackground: ; background |
; all black |
mov edi, [img_background] ;IMG_BACKGROUND ; set background to black |
xor eax, eax |
mov ecx, 1023 ;0x0fff00 / 4 |
cld |
rep stosd |
mov edi,display_data ; set os to use all pixels |
mov eax,0x01010101 |
mov ecx,1280*1024 / 4 |
3715,9 → 3705,7 |
set_app_param: |
mov edi, [TASK_BASE] |
mov eax, [edi + TASKDATA.event_mask] |
mov [edi + TASKDATA.event_mask], ebx |
mov [esp+32], eax |
ret |
4660,7 → 4648,7 |
ret |
if used _rdtsc |
_rdtsc: |
bt [cpu_caps], CAPS_TSC |
jnc ret_rdtsc |
4670,7 → 4658,6 |
mov edx,0xffffffff |
mov eax,0xffffffff |
ret |
end if |
rerouteirqs: |
5363,7 → 5350,7 |
sys_apm: |
cmp word [apm_vf], 0 ; Check APM BIOS enable |
jne @f |
or [esp + 48], byte 1 ; error |
or [esp + 56], byte 1 ; error |
mov [esp + 36], dword 8 ; 32-bit protected-mode interface not supported |
ret |
5373,7 → 5360,7 |
cmp al, 3 |
ja @f |
and [esp + 48], byte 0xfe ; emulate func 0..3 as func 0 |
and [esp + 56], byte 0xfe ; emulate func 0..3 as func 0 |
mov eax, [apm_vf] |
mov [esp + 36], eax |
shr eax, 16 |
5403,8 → 5390,8 |
mov [esp + 32], ecx |
mov [esp + 36], eax |
setc al |
and [esp + 48], byte 0xfe |
or [esp + 48], al |
and [esp + 56], byte 0xfe |
or [esp + 56], al |
ret |
5456,7 → 5443,7 |
out 0x21, al |
out 0xA1, al |
if 0 |
if 1 |
mov word [OS_BASE+0x467+0],pr_mode_exit |
mov word [OS_BASE+0x467+2],0x1000 |
5469,7 → 5456,6 |
out 0x64,al |
hlt |
jmp $-1 |
else |
cmp byte [OS_BASE + 0x9030], 2 |
5521,72 → 5507,6 |
jmp no_acpi_power_off |
.fadt_found: |
; ebx is linear address of FADT |
mov edi, [ebx+40] ; physical address of the DSDT |
lea eax, [ebp+4000h] |
stdcall map_page, eax, edi, PG_MAP |
lea eax, [ebp+5000h] |
lea esi, [edi+0x1000] |
stdcall map_page, eax, esi, PG_MAP |
and esi, 0xFFF |
sub edi, esi |
cmp dword [esi+ebp+4000h], 'DSDT' |
jnz no_acpi_power_off |
mov eax, [esi+ebp+4004h] ; DSDT length |
sub eax, 36+4 |
jbe no_acpi_power_off |
add esi, 36 |
.scan_dsdt: |
cmp dword [esi+ebp+4000h], '_S5_' |
jnz .scan_dsdt_cont |
cmp byte [esi+ebp+4000h+4], 12h ; DefPackage opcode |
jnz .scan_dsdt_cont |
mov dl, [esi+ebp+4000h+6] |
cmp dl, 4 ; _S5_ package must contain 4 bytes |
; ...in theory; in practice, VirtualBox has 2 bytes |
ja .scan_dsdt_cont |
cmp dl, 1 |
jb .scan_dsdt_cont |
lea esi, [esi+ebp+4000h+7] |
xor ecx, ecx |
cmp byte [esi], 0 ; 0 means zero byte, 0Ah xx means byte xx |
jz @f |
cmp byte [esi], 0xA |
jnz no_acpi_power_off |
inc esi |
mov cl, [esi] |
@@: |
inc esi |
cmp dl, 2 |
jb @f |
cmp byte [esi], 0 |
jz @f |
cmp byte [esi], 0xA |
jnz no_acpi_power_off |
inc esi |
mov ch, [esi] |
@@: |
jmp do_acpi_power_off |
.scan_dsdt_cont: |
inc esi |
cmp esi, 0x1000 |
jb @f |
sub esi, 0x1000 |
add edi, 0x1000 |
push eax |
lea eax, [ebp+4000h] |
stdcall map_page, eax, edi, PG_MAP |
push PG_MAP |
lea eax, [edi+1000h] |
push eax |
lea eax, [ebp+5000h] |
push eax |
stdcall map_page |
pop eax |
@@: |
dec eax |
jnz .scan_dsdt |
jmp no_acpi_power_off |
do_acpi_power_off: |
mov edx, [ebx+48] |
test edx, edx |
jz .nosmi |
5598,13 → 5518,10 |
test al, 1 |
jz @b |
.nosmi: |
and cx, 0x0707 |
shl cx, 2 |
or cx, 0x2020 |
mov edx, [ebx+64] |
in ax, dx |
and ax, 203h |
or ah, cl |
or ax, 3C00h |
out dx, ax |
mov edx, [ebx+68] |
test edx, edx |
5611,7 → 5528,7 |
jz @f |
in ax, dx |
and ax, 203h |
or ah, ch |
or ax, 3C00h |
out dx, ax |
@@: |
jmp $ |
5630,7 → 5547,6 |
out 0x64,al |
hlt |
jmp $-1 |
scan_rsdp: |
add eax, OS_BASE |
5662,3 → 5578,4 |
uglobals_size = $ - endofcode |
diff16 "end of kernel code",0,$ |
/kernel/branches/net/fs/fat32.inc |
---|
1062,6 → 1062,14 |
mov eax, ERROR_ACCESS_DENIED |
ret |
.noaccess_3: |
add esp,4 |
.noaccess_1: |
add esp,4 |
.noaccess_4: |
add esp,4*5 |
jmp .noaccess_2 |
@@: |
call hd_find_lfn |
jnc .found |
1125,9 → 1133,9 |
push ebx |
mov ebx, edx |
call hd_read |
pop ebx |
cmp [hd_error],0 |
jne .noaccess_1 |
pop ebx |
add edx, 512 |
sub ecx, 512 |
jmp .skip |
1136,10 → 1144,11 |
push eax ebx |
mov ebx, buffer |
call hd_read |
cmp [hd_error],0 |
jne .noaccess_3 |
mov eax, ebx |
pop ebx |
cmp [hd_error],0 |
jne .noaccess_3 |
add eax, ebx |
push ecx |
add ecx, ebx |
1162,14 → 1171,9 |
mov eax, [cluster_tmp] |
call get_FAT |
cmp [hd_error],0 |
jne .noaccess_1 |
jne .noaccess_4 |
jmp .new_cluster |
.noaccess_3: |
pop eax |
.noaccess_1: |
pop eax |
push 11 |
.done: |
mov ebx, edx |
pop eax edx ecx edi |
/kernel/branches/net/fs/part_set.inc |
---|
383,13 → 383,9 |
mov [FAT_START],eax ; fat_start = partition_start + reserved |
movzx eax,byte [ebx+0xd] ; sectors per cluster |
test eax,eax |
jz problem_fat_dec_count |
mov [SECTORS_PER_CLUSTER],eax |
movzx ecx,word [ebx+0xb] ; bytes per sector |
cmp ecx,0x200 |
jnz problem_fat_dec_count |
mov [BYTES_PER_SECTOR],ecx |
movzx eax,word [ebx+0x11] ; count of rootdir entries (=0 fat32) |
/kernel/branches/net/blkdev/cd_drv.inc |
---|
681,7 → 681,6 |
;* ChannelNumber - íîìåð êàíàëà; * |
;* DiskNumber - íîìåð äèñêà íà êàíàëå. * |
;************************************************* |
align 4 |
check_ATAPI_device_event: |
pusha |
mov eax,[timer_ticks] |
/kernel/branches/net/blkdev/flp_drv.inc |
---|
282,7 → 282,6 |
;***************************************** |
;* ÏÐÎÂÅÐÊÀ ÇÀÄÅÐÆÊÈ ÂÛÊËÞ×ÅÍÈß ÌÎÒÎÐÀ * |
;***************************************** |
align 4 |
check_fdd_motor_status: |
cmp [fdd_motor_status],0 |
je end_check_fdd_motor_status_1 |
/kernel/branches/net/boot/bootcode.inc |
---|
815,12 → 815,9 |
dec al |
mov [boot_dev], al |
; GET MEMORY MAP |
include 'detect/biosmem.inc' |
; READ DISKETTE TO MEMORY |
cmp [boot_dev],0 |
; cmp [boot_dev],0 |
jne no_sys_on_floppy |
mov si,diskload |
call print |
/kernel/branches/net/boot/booteng.inc |
---|
104,7 → 104,7 |
_bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ',13,10,0 |
remark1 db "Default values were selected to match most of configurations, but not all.",0 |
remark2 db "If you have CRT-monitor, enable VRR in the item [c].",0 |
remark2 db "If you have LCD-monitor, disable VRR in the item [c] - you do not need it.",0 |
remark3 db "If the system does not boot, try to disable the item [b].",0 |
remarks dw remark1, remark2, remark3 |
num_remarks = 3 |
/kernel/branches/net/boot/bootet.inc |
---|
109,7 → 109,7 |
loader_block_error db "Alglaaduri andmed vigased, ei saa jätkata. Peatatud.",0 |
remark1 db "Default values were selected to match most of configurations, but not all.",0 |
remark2 db "If you have CRT-monitor, enable VRR in the item [c].",0 |
remark2 db "If you have LCD-monitor, disable VRR in the item [c] - you do not need it.",0 |
remark3 db "If the system does not boot, try to disable the item [b].",0 |
remarks dw remark1, remark2, remark3 |
num_remarks = 3 |
/kernel/branches/net/boot/bootge.inc |
---|
114,7 → 114,7 |
loader_block_error db "Bootloader Daten ungueltig, Kann nicht fortfahren. Angehalten.",0 |
remark1 db "Default values were selected to match most of configurations, but not all.",0 |
remark2 db "If you have CRT-monitor, enable VRR in the item [c].",0 |
remark2 db "If you have LCD-monitor, disable VRR in the item [c] - you do not need it.",0 |
remark3 db "If the system does not boot, try to disable the item [b].",0 |
remarks dw remark1, remark2, remark3 |
num_remarks = 3 |
/kernel/branches/net/boot/bootru.inc |
---|
85,7 → 85,7 |
remark1 db " ç¥¨ï ¯® 㬮«ç ¨î ¢ë¡à ë ¤«ï 㤮¡á⢠¡®«ìè¨á⢠, ® ¥ ¢á¥å.",0 |
remark2 db " ᫨ ã á -¬®¨â®à, ¢ª«îç¨â¥ VRR ¢ ¯ãªâ¥ [c].",0 |
remark2 db " ᫨ ã á LCD-¬®¨â®à, ®âª«îç¨â¥ VRR ¢ ¯ãªâ¥ [c] - ® ¬ ¥ 㦥.",0 |
remark3 db " ᫨ ã á ¥ £à㧨âáï á¨á⥬ , ¯®¯à®¡ã©â¥ ®âª«îç¨âì ¯ãªâ [b].",0 |
remarks dw remark1, remark2, remark3 |
num_remarks = 3 |
/kernel/branches/net/build.bat |
---|
1,5 → 1,5 |
@echo off |
cls |
set languages=en ru ge et |
set drivers=sound sis infinity ensoniq ps2mouse com_mouse uart ati2d vmode |
set targets=all kernel drivers skins clean |
74,33 → 74,6 |
) |
cd .. |
move bin\drivers\vmode.obj bin\drivers\vmode.mdr |
kpack >nul 2>&1 |
if %errorlevel%==9009 goto :Error_KpackFailed |
echo * |
echo ############################################## |
echo * |
echo Kpack KolibriOS drivers? |
echo * |
set /P res=[y/n]? |
if "%res%"=="y" ( |
echo * |
echo Compressing system |
echo * |
for %%a in (bin\drivers\*.obj) do ( |
echo ================== kpack %%a |
kpack %%a |
if not %errorlevel%==0 goto :Error_KpackFailed |
) |
) |
goto :eof |
122,21 → 95,11 |
:Error_FasmFailed |
echo error: fasm execution failed |
erase lang.inc >nul 2>&1 |
echo. |
erase lang.inc |
pause |
exit 1 |
:Error_KpackFailed |
echo *** NOTICE *** |
echo If you want to pack all applications you may |
echo place "kpack" in accessible directory or system %PATH%. |
echo You can get this tool from KolibriOS distribution kit. |
pause |
exit 1 |
:Exit_OK |
echo. |
echo all operations have been done |
echo all operations has been done |
pause |
exit 0 |
/kernel/branches/net/const.inc |
---|
186,7 → 186,7 |
OS_BASE equ 0x80000000 |
window_data equ (OS_BASE+0x0001000) |
window_data equ OS_BASE |
CURRENT_TASK equ (OS_BASE+0x0003000) |
TASK_COUNT equ (OS_BASE+0x0003004) |
331,7 → 331,7 |
new_app_base equ 0; |
twdw equ 0x2000 ;(CURRENT_TASK-window_data) |
twdw equ 0x3000 ;(CURRENT_TASK-window_data) |
std_application_base_address equ new_app_base |
RING0_STACK_SIZE equ (0x2000 - 512) ;512 áàéò äëÿ êîíòåêñòà FPU |
469,9 → 469,8 |
.state dd ? ;internal flags |
.code dd ? |
rd 5 |
.size = $ - .magic |
.codesize = $ - .code |
} |
EVENT_SIZE equ 52 |
virtual at 0 |
EVENT EVENT |
688,3 → 687,4 |
virtual at 0 |
CSYM COFF_SYM |
end virtual |
/kernel/branches/net/core/debug.inc |
---|
414,3 → 414,62 |
or byte [SLOT_BASE+eax+APPDATA.event_mask+1], 1 ; set flag 100h |
.ret: |
ret |
debug_exc: |
test byte [esp+8+2], 2 |
jnz v86_debug_exc |
; int 1 = #DB |
save_ring3_context |
cld |
mov ax, app_data ;os_data |
mov ds, ax |
mov es, ax |
mov eax, dr6 |
push eax |
xor eax, eax |
mov dr6, eax |
; test if debugging |
cli |
mov eax, [current_slot] |
mov eax, [eax+APPDATA.debugger_slot] |
test eax, eax |
jnz .debug |
sti |
; not debuggee => say error and terminate |
add esp, 0x20+4 |
mov [error_interrupt], 1 |
call show_error_parameters |
mov edx, [TASK_BASE] |
mov byte [edx+TASKDATA.state], 4 |
jmp change_task |
.debug: |
; we are debugged process, notify debugger and suspend ourself |
; eax=debugger PID |
pop edx |
mov ebx, dr7 |
mov cl, not 1 |
.l1: |
test bl, 1 |
jnz @f |
and dl, cl |
@@: |
shr ebx, 2 |
add cl, cl |
inc ecx |
cmp cl, not 10h |
jnz .l1 |
push edx ; DR6 image |
mov ecx, [TASK_BASE] |
push dword [ecx+TASKDATA.pid] ; PID |
push 12 |
pop ecx |
push 3 ; 3 = debug exception |
call debugger_notify |
pop ecx |
pop ecx |
pop ecx |
mov edx, [TASK_BASE] |
mov byte [edx+TASKDATA.state], 1 ; suspended |
call change_task |
restore_ring3_context |
iretd |
/kernel/branches/net/core/exports.inc |
---|
131,11 → 131,11 |
dd szGetPid , get_pid |
dd szCreateObject , create_kernel_object |
dd szDestroyObject , destroy_kernel_object |
dd szCreateEvent , create_event ;see EVENT.inc for specification |
dd szRaiseEvent , raise_event ;see EVENT.inc for specification |
dd szWaitEvent , wait_event ;see EVENT.inc for specification |
dd szDestroyEvent , destroy_event ;see EVENT.inc for specification |
dd szClearEvent , clear_event ;see EVENT.inc for specification |
dd szCreateEvent , create_event |
dd szRaiseEvent , raise_event |
dd szWaitEvent , wait_event |
dd szDestroyEvent , destroy_event |
dd szClearEvent , clear_event |
dd szLoadCursor , load_cursor ;stdcall |
148,7 → 148,7 |
dd szSysMsgBoardChar , sys_msg_board |
dd szGetCurrentTask , get_curr_task |
dd szLoadFile , load_file ;retval eax, ebx |
dd szSendEvent , send_event ;see EVENT.inc for specification |
dd szSendEvent , send_event |
dd szSetMouseData , set_mouse_data ;stdcall |
dd szSleep , delay_ms |
dd szGetTimerTicks , get_timer_ticks |
170,3 → 170,4 |
dd 0 ;terminator, must be zero |
endg |
/kernel/branches/net/core/fpu.inc |
---|
142,7 → 142,7 |
ret |
align 4 |
except_7: ;#NM exception handler |
e7: ;#NM exception handler |
save_ring3_context |
clts |
mov ax, app_data ; |
181,3 → 181,108 |
iglobal |
fpu_owner dd 0 |
endg |
reg_eip equ ebp+4 |
reg_cs equ ebp+8 |
reg_eflags equ ebp+12 |
reg_esp equ ebp+16 |
reg_ss equ ebp+20 |
align 4 |
except_16: ;fpu native exceptions handler |
test byte [esp+8+2], 2 |
jnz v86_except_16 |
push ebp |
mov ebp, esp |
push eax |
push ebx |
push ecx |
push edx |
mov ebx, [CURRENT_TASK] |
shl ebx, 8 |
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_handler] |
test eax, eax |
jz .default |
mov ecx, [reg_eip] |
mov edx, [reg_esp] |
sub edx, 4 |
mov [edx], ecx |
mov [reg_esp], edx |
mov dword [reg_eip], eax |
pop edx |
pop ecx |
pop ebx |
pop eax |
leave |
iretd |
.default: |
pop edx |
pop ecx |
pop ebx |
pop eax |
leave |
save_ring3_context ;debugger support |
mov bl, 16 |
jmp exc_c |
align 4 |
except_19: ;sse exceptions handler |
test byte [esp+8+2], 2 |
jnz v86_except_19 |
push ebp |
mov ebp, esp |
push eax |
push ebx |
push ecx |
push edx |
mov ebx, [current_slot] |
mov eax, [ebx+APPDATA.sse_handler] |
test eax, eax |
jz .default |
mov ecx, [reg_eip] |
mov edx, [reg_esp] |
sub edx, 4 |
mov [edx], ecx |
mov [reg_esp], edx |
mov dword [reg_eip], eax |
pop edx |
pop ecx |
pop ebx |
pop eax |
leave |
iretd |
.default: |
pop edx |
pop ecx |
pop ebx |
pop eax |
leave |
save_ring3_context ;debugger support |
mov bl, 19 |
jmp exc_c |
restore reg_eip |
restore reg_cs |
restore reg_eflags |
restore reg_esp |
restore reg_ss |
/kernel/branches/net/core/heap.inc |
---|
91,7 → 91,7 |
align 4 |
proc init_kernel_heap |
mov ecx, 64 |
mov ecx, 64/4 |
mov edi, mem_block_list |
xor eax, eax |
cld |
138,9 → 138,8 |
mov [ebx+list_bk], eax |
mov [ebx+block_base], HEAP_BASE+4096*MEM_BLOCK_SIZE |
mov ecx, [pg_data.kernel_pages] |
shl ecx, 12 |
sub ecx, HEAP_BASE+4096*MEM_BLOCK_SIZE |
mov ecx, [MEM_AMOUNT] |
sub ecx, (HEAP_BASE - OS_BASE + 4096*MEM_BLOCK_SIZE) |
mov [heap_size], ecx |
mov [heap_free], ecx |
mov [ebx+block_size], ecx |
153,7 → 152,7 |
mov byte [mem_block_map], 0xFC |
and [heap_mutex], 0 |
mov [heap_blocks], 4095 |
mov [free_blocks], 4094 |
mov [free_blocks], 4095 |
ret |
endp |
/kernel/branches/net/core/memory.inc |
---|
453,7 → 453,7 |
@@: |
call alloc_page |
test eax, eax |
jz .exit_pop |
jz .exit |
stdcall map_page_table, edi, eax |
491,9 → 491,6 |
jb @B |
jmp .update_size |
.exit_pop: |
pop edi |
pop esi |
.exit: |
xor eax, eax |
inc eax |
547,15 → 544,23 |
align 4 |
; Now it is called from core/sys32::exc_c (see stack frame there) |
proc page_fault_handler |
test byte [esp+12+2], 2 |
jnz v86_page_fault |
.err_code equ ebp+32 |
.err_addr equ ebp-4 |
push ebx ;save exception number (#PF) |
pushad |
mov ebp, esp |
mov ebx, cr2 |
push ebx ;that is locals: .err_addr = cr2 |
mov eax, cr2 |
push eax |
mov ax, app_data |
mov ds, ax |
mov es, ax |
inc [pg_data.pages_faults] |
; push eax |
566,9 → 571,10 |
; pop edx |
; pop eax |
mov eax, [pf_err_code] |
mov ebx, [.err_addr] |
mov eax, [.err_code] |
cmp ebx, OS_BASE ;ebx == .err_addr |
cmp ebx, OS_BASE |
jb .user_space ;ñòðàíèöà â ïàìÿòè ïðèëîæåíèÿ ; |
cmp ebx, page_tabs |
577,7 → 583,7 |
cmp ebx, kernel_tabs |
jb .alloc;.app_tabs ;òàáëèöû ñòðàíèö ïðèëîæåíèÿ ; |
;ïðîñòî ñîçäàäèì îäíó |
if 0 ;ïîêà ýòî ïðîñòî ëèøíåå |
cmp ebx, LFB_BASE |
jb .core_tabs ;òàáëèöû ñòðàíèö ÿäðà |
;Îøèáêà |
585,13 → 591,8 |
;îáëàñòü LFB |
;Îøèáêà |
jmp .fail |
end if |
.core_tabs: |
.fail: ;simply return to caller |
mov esp, ebp |
pop ebx ;restore exception number (#PF) |
ret |
align 4 |
.user_space: |
test eax, PG_MAP |
jnz .err_access ;Ñòðàíèöà ïðèñóòñòâóåò |
614,32 → 615,33 |
test eax, eax |
jz .fail |
stdcall map_page,[.err_addr],eax,dword PG_UW |
stdcall map_page,[ebp-4],eax,dword PG_UW |
mov edi, [.err_addr] |
mov edi, [ebp-4] |
and edi, 0xFFFFF000 |
mov ecx, 1024 |
xor eax, eax |
;cld ;caller is duty for this |
cld |
rep stosd |
.exit: ;iret with repeat fault instruction |
add esp,12 ;clear in stack: locals(.err_addr) + #PF + ret_to_caller |
restore_ring3_context |
.exit: |
mov esp, ebp |
popad |
add esp, 4 |
iretd |
.err_access = .fail |
.err_access: |
;íèêîãäà íå ïðîèñõîäèò |
;jmp .fail |
jmp .fail |
.kernel_space: |
test eax, PG_MAP |
jz .fail ;ñòðàíèöà íå ïðèñóòñòâóåò |
test eax,12 ;U/S (+below) |
test eax, 4 ;U/S |
jnz .fail ;ïðèëîæåíèå îáðàòèëîñü ê ïàìÿòè |
;ÿäðà |
;test eax, 8 |
;jnz .fail ;óñòàíîâëåí çàðåçåðâèðîâàííûé áèò |
test eax, 8 |
jnz .fail ;óñòàíîâëåí çàðåçåðâèðîâàííûé áèò |
;â òàáëèöàõ ñòðàíèö. äîáàâëåíî â P4/Xeon |
;ïîïûòêà çàïèñè â çàùèù¸ííóþ ñòðàíèöó ÿäðà |
658,7 → 660,7 |
jz .fail |
push eax |
stdcall map_page,[.err_addr],eax,dword PG_SW |
stdcall map_page,[ebp-4],eax,dword PG_SW |
pop eax |
mov edi, [.err_addr] |
and edi, -4096 |
672,9 → 674,26 |
add esi, [default_io_map] |
mov ecx, 4096/4 |
;cld ;caller is duty for this |
cld |
rep movsd |
jmp .exit |
;íå îáðàáàòûâàåì. Îøèáêà |
.core_tabs: |
.fail: |
mov esp, ebp |
popad |
add esp, 4 |
; iretd |
save_ring3_context ;debugger support |
mov bl, 14 |
jmp exc_c |
iretd |
endp |
align 4 |
964,29 → 983,29 |
align 4 |
sysfn_meminfo: |
; add ecx, new_app_base |
cmp ecx, OS_BASE |
; add ebx, new_app_base |
cmp ebx, OS_BASE |
jae .fail |
mov eax, [pg_data.pages_count] |
mov [ecx], eax |
mov [ebx], eax |
shl eax, 12 |
mov [esp+32], eax |
mov eax, [pg_data.pages_free] |
mov [ecx+4], eax |
mov eax, [pg_data.pages_faults] |
mov [ecx+8], eax |
mov eax, [heap_size] |
mov [ecx+12], eax |
mov eax, [heap_free] |
mov [ecx+16], eax |
mov [esp+36], eax |
mov ecx, [pg_data.pages_free] |
mov [ebx+4], ecx |
mov edx, [pg_data.pages_faults] |
mov [ebx+8], edx |
mov esi, [heap_size] |
mov [ebx+12], esi |
mov edi, [heap_free] |
mov [ebx+16], edi |
mov eax, [heap_blocks] |
mov [ecx+20], eax |
mov eax, [free_blocks] |
mov [ecx+24], eax |
mov [ebx+20], eax |
mov ecx, [free_blocks] |
mov [ebx+24], ecx |
ret |
.fail: |
mov dword [esp+32], -1 |
mov dword [esp+36], -1 |
ret |
align 4 |
995,17 → 1014,15 |
dd f68.12 |
dd f68.13 |
dd f68.14 |
dd f68.fail ;moved to f68.24 |
dd f68.15 |
dd f68.16 |
dd f68.17 |
dd f68.fail ;moved to f68.25 |
dd f68.18 |
dd f68.19 |
dd f68.20 |
dd f68.21 |
dd f68.22 |
dd f68.23 |
dd f68.24 |
dd f68.25 |
align 4 |
f68: |
1015,7 → 1032,7 |
cmp eax, 11 |
jb .fail |
cmp eax, 25 |
cmp eax, 23 |
ja .fail |
jmp dword [f68call+eax*4-11*4] |
1034,16 → 1051,14 |
.14: |
cmp ebx, OS_BASE |
jae .fail |
mov edi,ebx |
call get_event_ex |
stdcall get_event_ex, ebx, ecx |
mov [esp+36], eax |
ret |
.24: |
mov eax, [current_slot] |
xchg ebx, [eax+APPDATA.exc_handler] |
xchg ecx, [eax+APPDATA.except_mask] |
mov [esp+36], ebx ; reg_eax+8 |
mov [esp+24], ecx ; reg_ebx+8 |
.15: |
mov ecx, [current_slot] |
mov eax, [ecx+APPDATA.fpu_handler] |
mov [ecx+APPDATA.fpu_handler], ebx |
mov [esp+36], eax |
ret |
.16: |
test ebx, ebx |
1057,15 → 1072,12 |
call srv_handlerEx ;ebx |
mov [esp+36], eax |
ret |
.25: |
cmp ebx,32 |
jae .fail |
mov eax, [current_slot] |
btr [eax+APPDATA.except_mask],ebx |
setc byte[esp+36] |
jecxz @f |
bts [eax+APPDATA.except_mask],ebx |
@@: ret |
.18: |
mov ecx, [current_slot] |
mov eax, [ecx+APPDATA.sse_handler] |
mov [ecx+APPDATA.sse_handler], ebx |
mov [esp+36], eax |
ret |
.19: |
cmp ebx, OS_BASE |
jae .fail |
1306,3 → 1318,6 |
.fail: |
ret |
endp |
/kernel/branches/net/core/sched.inc |
---|
16,35 → 16,74 |
align 32 |
irq0: |
pushad |
Mov ds, ax, app_data |
mov ax, app_data ; |
mov ds, ax |
mov es, ax |
inc [timer_ticks] |
; cmp dword[CURRENT_TASK], 1 |
; jnz @f |
; mov eax, [esp + 32] |
; cmp eax, idle_loop + 1 |
; jz @f |
; DEBUGF 1, "K : OOOPS! EAX = 0x%x\n", eax |
; @@: |
inc dword [timer_ticks] |
mov eax, [timer_ticks] |
call playNote ; <<<--- Speaker driver |
sub eax,[next_usage_update] |
cmp eax,100 |
cmp eax,[next_usage_update] |
jb .nocounter |
add [next_usage_update],100 |
add eax,100 |
mov [next_usage_update],eax |
call updatecputimes |
.nocounter: |
cmp [DONT_SWITCH], byte 1 |
jne .change_task |
mov al,0x20 ; send End Of Interrupt signal |
out 0x20,al |
btr dword[DONT_SWITCH], 0 |
jc .return |
mov dx,0x20 |
out dx,al |
mov [DONT_SWITCH], byte 0 |
popad |
iretd |
.change_task: |
call update_counters |
call find_next_task |
jz .return ; if there is only one running process |
mov ecx, eax |
mov al,0x20 ; send End Of Interrupt signal |
mov dx,0x20 |
out dx,al |
test ecx, ecx ; if there is only one running process |
jnz .return |
call do_change_task |
.return: |
popad |
; popfd |
iretd |
align 4 |
change_task: |
pushfd |
cli |
pushad |
call update_counters |
if 0 |
; \begin{Mario79} ; <- must be refractoried, if used... |
; \begin{Mario79} |
cmp [dma_task_switched], 1 |
jne .find_next_task |
mov [dma_task_switched], 0 |
57,152 → 96,195 |
jmp @f |
.find_next_task: |
; \end{Mario79} |
end if |
call find_next_task |
jz .return ; the same task -> skip switch |
@@: mov byte[DONT_SWITCH], 1 |
test eax, eax ; the same task -> skip switch |
jnz .return |
@@: |
mov [DONT_SWITCH],byte 1 |
call do_change_task |
.return: |
popad |
popfd |
ret |
uglobal |
align 4 |
; far_jump: |
; .offs dd ? |
; .sel dw ? |
context_counter dd 0 ;noname & halyavin |
next_usage_update dd 0 |
timer_ticks dd 0 |
; prev_slot dd ? |
; event_sched dd ? |
far_jump: |
.offs dd ? |
.sel dw ? |
context_counter dd ? ;noname & halyavin |
next_usage_update dd ? |
timer_ticks dd ? |
prev_slot dd ? |
event_sched dd ? |
endg |
align 4 |
update_counters: |
mov edi, [TASK_BASE] |
mov ebx, [edi+TASKDATA.counter_add] ; time stamp counter add |
rdtsc |
sub eax, [edi+TASKDATA.counter_add] ; time stamp counter add |
add [edi+TASKDATA.counter_sum], eax ; counter sum |
sub eax, ebx |
add eax, [edi+TASKDATA.counter_sum] ; counter sum |
mov [edi+TASKDATA.counter_sum], eax |
ret |
align 4 |
updatecputimes: |
xor eax,eax |
xchg eax,[idleuse] |
mov [idleusesec],eax |
mov ecx, [TASK_COUNT] |
mov edi, TASK_DATA |
.newupdate: |
xor eax,eax |
xchg eax,[edi+TASKDATA.counter_sum] |
mov [edi+TASKDATA.cpu_usage],eax |
add edi,0x20 |
loop .newupdate |
ret |
align 4 |
; Find next task to execute |
; result: ebx = number of the selected task |
; eax = 1 if the task is the same |
; edi = address of the data for the task in ebx |
; [0x3000] = ebx and [0x3010] = edi |
; corrupts other regs |
find_next_task: |
;info: |
; Find next task to execute |
;retval: |
; ebx = address of the APPDATA for the selected task (slot-base) |
; esi = previous slot-base ([current_slot] at the begin) |
; edi = address of the TASKDATA for the selected task |
; ZF = 1 if the task is the same |
;warning: |
; [CURRENT_TASK] = bh , [TASK_BASE] = edi -- as result |
; [current_slot] is not set to new value (ebx)!!! |
;scratched: eax,ecx |
call update_counters ; edi := [TASK_BASE] |
Mov esi, ebx, [current_slot] |
.loop: |
cmp bh,[TASK_COUNT] |
mov ebx, [CURRENT_TASK] |
mov edi, [TASK_BASE] |
mov [prev_slot], ebx |
.waiting_for_termination: |
.waiting_for_reuse: |
.waiting_for_event: |
.suspended: |
cmp ebx, [TASK_COUNT] |
jb @f |
xor bh, bh |
mov edi,CURRENT_TASK |
@@: inc bh ; ebx += APPDATA.size |
add edi,0x20 ; edi += TASKDATA.size |
mov al, [edi+TASKDATA.state] |
xor ebx, ebx |
@@: |
add edi,0x20 |
inc ebx |
mov al, byte [edi+TASKDATA.state] |
test al, al |
jz .found ; state == 0 |
jz .found |
cmp al, 1 |
jz .suspended |
cmp al, 2 |
jz .suspended |
cmp al, 3 |
je .waiting_for_termination |
cmp al, 4 |
je .waiting_for_termination |
cmp al, 9 |
je .waiting_for_reuse |
mov [CURRENT_TASK],ebx |
mov [TASK_BASE],edi |
cmp al, 5 |
jne .loop ; state == 1,2,3,4,9 |
; state == 5 |
pushad ; more freedom for [APPDATA.wait_test] |
call [ebx+APPDATA.wait_test] |
mov [esp+28],eax |
popad |
or eax,eax |
jne .noevents |
call get_event_for_app |
test eax, eax |
jnz @f |
; testing for timeout |
mov ecx, [timer_ticks] |
sub ecx, [ebx+APPDATA.wait_begin] |
cmp ecx, [ebx+APPDATA.wait_timeout] |
jb .loop |
@@: mov [ebx+APPDATA.wait_param], eax ; retval for wait |
mov [edi+TASKDATA.state], 0 |
mov eax, ebx |
shl eax, 8 |
mov eax, [SLOT_BASE + APPDATA.wait_timeout + eax] |
cmp eax, [timer_ticks] |
jae .waiting_for_event |
xor eax, eax |
@@: |
mov [event_sched], eax |
mov [edi+TASKDATA.state], byte 0 |
.noevents: |
.found: |
mov [CURRENT_TASK],bh |
mov [CURRENT_TASK],ebx |
mov [TASK_BASE],edi |
rdtsc ;call _rdtsc |
mov [edi+TASKDATA.counter_add],eax ; for next using update_counters |
cmp ebx, esi ;esi - previous slot-base |
mov [edi+TASKDATA.counter_add],eax |
mov esi, [prev_slot] |
xor eax, eax |
cmp ebx, esi |
sete al |
ret |
;TODO: Íàäî áû óáðàòü èñïîëüçîâàíèå do_change_task èç V86... |
; è ïîñëå ýòîãî ïåðåíåñòè îáðàáîòêó TASKDATA.counter_add/sum â do_change_task |
align 4 |
; param |
; ebx = incoming task |
; esi = outcomig task |
do_change_task: |
;param: |
; ebx = address of the APPDATA for incoming task (new) |
;warning: |
; [CURRENT_TASK] and [TASK_BASE] must be changed before (e.g. in find_next_task) |
; [current_slot] is the outcoming (old), and set here to a new value (ebx) |
;scratched: eax,ecx,esi |
mov esi,ebx |
xchg esi,[current_slot] |
; set new stack after saving old |
shl ebx, 8 |
add ebx, SLOT_BASE |
mov [current_slot], ebx |
shl esi, 8 |
add esi, SLOT_BASE |
mov [esi+APPDATA.saved_esp], esp |
mov esp, [ebx+APPDATA.saved_esp] |
; set new thread io-map |
Mov dword [page_tabs+((tss._io_map_0 and -4096) shr 10)],eax,[ebx+APPDATA.io_map] |
Mov dword [page_tabs+((tss._io_map_1 and -4096) shr 10)],eax,[ebx+APPDATA.io_map+4] |
; set new thread memory-map |
mov ecx, APPDATA.dir_table |
mov eax, [ebx+ecx] ;offset>0x7F |
cmp eax, [esi+ecx] ;offset>0x7F |
je @f |
; set thread io map |
mov ecx, [ebx+APPDATA.io_map] |
mov edx, [ebx+APPDATA.io_map+4] |
mov dword [page_tabs+((tss._io_map_0 and -4096) shr 10)], ecx |
mov dword [page_tabs+((tss._io_map_1 and -4096) shr 10)], edx |
mov eax, [ebx+APPDATA.dir_table] |
cmp eax, [esi+APPDATA.dir_table] |
je @F |
mov cr3, eax |
@@: ; set tss.esp0 |
Mov [tss._esp0],eax,[ebx+APPDATA.saved_esp0] |
; set gs selector unconditionally |
Mov gs,ax,graph_data |
; set CR0.TS |
cmp bh, byte[fpu_owner] ;bh == incoming task (new) |
@@: |
mov eax, [ebx+APPDATA.saved_esp0] |
mov [tss._esp0], eax |
mov ax, graph_data |
mov gs, ax |
mov eax, [CURRENT_TASK] |
cmp eax, [fpu_owner] |
clts ;clear a task switch flag |
je @f |
mov eax, cr0 ;and set it again if the owner |
or eax, CR0_TS ;of a fpu has changed |
mov cr0, eax |
@@: ; set context_counter (only for user pleasure ???) |
je @F |
;and set it again if the owner |
mov ecx, cr0 ;of a fpu has changed |
or ecx, CR0_TS |
mov cr0, ecx |
@@: |
inc [context_counter] ;noname & halyavin |
; set debug-registers, if it's necessary |
test byte[ebx+APPDATA.dbg_state], 1 |
jz @f |
test [ebx+APPDATA.dbg_state], 1 |
jnz @F |
ret |
@@: |
mov eax, [ebx+APPDATA.dbg_regs.dr0] |
mov dr0, eax |
mov eax, [ebx+APPDATA.dbg_regs.dr1] |
mov dr1, eax |
mov eax, [ebx+APPDATA.dbg_regs.dr2] |
mov dr2, eax |
mov eax, [ebx+APPDATA.dbg_regs.dr3] |
mov dr3, eax |
xor eax, eax |
mov dr6, eax |
lea esi,[ebx+ecx+APPDATA.dbg_regs-APPDATA.dir_table] ;offset>0x7F |
cld |
macro lodsReg [reg] { |
lodsd |
mov reg,eax |
} lodsReg dr0, dr1, dr2, dr3, dr7 |
purge lodsReg |
@@: ret |
;end. |
mov eax, [ebx+APPDATA.dbg_regs.dr7] |
mov dr7, eax |
ret |
align 4 |
updatecputimes: |
mov eax,[idleuse] |
mov [idleusesec],eax |
mov [idleuse],dword 0 |
mov ecx, [TASK_COUNT] |
mov edi, TASK_DATA |
.newupdate: |
mov ebx,[edi+TASKDATA.counter_sum] |
mov [edi+TASKDATA.cpu_usage],ebx |
mov [edi+TASKDATA.counter_sum],dword 0 |
add edi,0x20 |
dec ecx |
jnz .newupdate |
ret |
if 0 |
struc TIMER |
{ |
.next dd ? |
211,6 → 293,14 |
.arg dd ? |
} |
MAX_PROIRITY 0 ; highest, used for kernel tasks |
MAX_USER_PRIORITY 0 ; highest priority for user processes |
USER_PRIORITY 7 ; default (should correspond to nice 0) |
220,6 → 310,7 |
rdy_head rd 16 |
align 4 |
pick_task: |
239,6 → 330,7 |
inc eax |
jmp .pick |
; param |
; eax= task |
; |
246,6 → 338,7 |
; eax= task |
; ebx= queue |
; ecx= front if 1 or back if 0 |
align 4 |
shed: |
cmp [eax+.tics_left], 0 ;signed compare |
263,6 → 356,7 |
; param |
; eax= task |
align 4 |
enqueue: |
call shed ;eax |
291,3 → 385,4 |
ret |
end if |
/kernel/branches/net/core/sys32.inc |
---|
14,227 → 14,212 |
$Revision: 982 $ |
align 4 ;3A08 |
align 4 |
idtreg: |
dw 8*0x41-1 |
dd idts+8 |
build_interrupt_table: |
mov edi, idts |
mov edi, idts+8 |
mov esi, sys_int |
mov ecx, 0x40 |
mov eax, (10001110b shl 24) + os_code |
@@: movsw ;low word of code-entry |
stosd ;interrupt gate type : os_code selector |
movsw ;high word of code-entry |
@@: |
lodsd |
mov [edi], ax ; lower part of offset |
mov [edi+2], word os_code ; segment selector |
mov ax, word 10001110b shl 8 ; type: interrupt gate |
mov [edi+4], eax |
add edi, 8 |
loop @b |
movsd ;copy low dword of trap gate for int 0x40 |
movsd ;copy high dword of trap gate for int 0x40 |
lidt [esi] |
;mov edi,8*0x40+idts+8 |
mov dword [edi], (i40 and 0xFFFF) or (os_code shl 16) |
mov dword [edi+4], (11101111b shl 8) or (i40 and 0xFFFF0000) |
; type: trap gate |
ret |
iglobal |
align 4 |
msg_sel_ker db "kernel", 0 |
msg_sel_app db "application", 0 |
sys_int: |
;exception handlers addresses (for interrupt gate construction) |
dd e0,e1,e2,e3,e4,e5,e6,except_7 ; SEE: core/fpu.inc |
dd e8,e9,e10,e11,e12,e13,page_fault_exc,e15 |
dd e16, e17,e18, e19 |
times 12 dd unknown_interrupt ;int_20..int_31 |
dd e0,debug_exc,e2,e3 |
dd e4,e5,e6,e7 |
dd e8,e9,e10,e11 |
dd e12,e13,page_fault_handler,e15 |
;interrupt handlers addresses (for interrupt gate construction) |
dd except_16, e17,e18, except_19 |
times 12 dd unknown_interrupt |
dd irq0, irq_serv.irq_1, irq_serv.irq_2 |
if USE_COM_IRQ |
dd irq_serv.irq_3, irq_serv.irq_4 |
else |
dd p_irq3, p_irq4 ;??? íåñòûêîâêà |
dd p_irq3, p_irq4 |
end if |
dd irq_serv.irq_5, p_irq6, irq_serv.irq_7 |
dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10 |
dd irq_serv.irq_11, irq_serv.irq_12, irqD,p_irq14,p_irq15 |
times 16 dd unknown_interrupt ;int_0x30..int_0x3F |
;int_0x40 gate trap (for directly copied) |
dw i40 and 0xFFFF, os_code, 11101111b shl 8, i40 shr 16 |
times 16 dd unknown_interrupt |
idtreg: ; data for LIDT instruction (!!! must be immediately below sys_int data) |
dw 2*($-sys_int-4)-1 |
dd idts ;0x8000B100 |
dw 0 ;ïðîñòî âûðàâíèâàíèå |
msg_fault_sel dd msg_exc_8,msg_exc_u,msg_exc_a,msg_exc_b |
dd msg_exc_c,msg_exc_d,msg_exc_e |
msg_exc_8 db "Double fault", 0 |
msg_exc_u db "Undefined Exception", 0 |
msg_exc_a db "Invalid TSS", 0 |
msg_exc_b db "Segment not present", 0 |
msg_exc_c db "Stack fault", 0 |
msg_exc_d db "General protection fault", 0 |
msg_exc_e db "Page fault", 0 |
msg_sel_ker db "kernel", 0 |
msg_sel_app db "application", 0 |
dd i40 |
endg |
macro save_ring3_context { |
macro save_ring3_context |
{ |
pushad |
} |
macro restore_ring3_context { |
macro restore_ring3_context |
{ |
popad |
} |
macro exc_wo_code [num] { |
; simply return control to interrupted process |
unknown_interrupt: |
iret |
macro exc_wo_code [num] |
{ |
forward |
e#num : |
save_ring3_context |
mov bl, num |
jmp exc_c |
} exc_wo_code 0,1,2,3,4,5,6,15,16,19 |
} |
macro exc_w_code [num] { |
macro exc_w_code [num] |
{ |
forward |
e#num : |
add esp, 4 |
save_ring3_context |
mov bl, num |
jmp exc_c |
} exc_w_code 8,9,10,11,12,13,17,18 |
} |
exc_wo_code 0, 2, 3, 4, 5, 6, 9, 15, 18 |
exc_w_code 8, 10, 11, 12, 13, 14, 17 |
uglobal |
pf_err_code dd ? |
endg |
exc_c: |
mov ax, app_data ;èñêëþ÷åíèå |
mov ds, ax ;çàãðóçèì ïðàâèëüíûå çíà÷åíè |
mov es, ax ;â ðåãèñòðû |
page_fault_exc: ; äóðàêîóñòî÷èâîñòü: ñåëåêòîðû èñïîð÷åíû... |
pop [ss:pf_err_code]; äåéñòâèòåëüíî äî ñëåäóþùåãî #PF |
save_ring3_context |
mov bl,14 |
exc_c: ; èñêëþ÷åíèÿ (âñå, êðîìå 7-ãî - #NM) |
; Ôðýéì ñòåêà ïðè èñêëþ÷åíèè/ïðåðûâàíèè èç 3-ãî êîëüöà + pushad (ò.å., èìåííî çäåñü) |
reg_ss equ esp+0x30 |
reg_esp3 equ esp+0x2C |
reg_eflags equ esp+0x28 |
reg_cs3 equ esp+0x24 |
reg_eip equ esp+0x20 |
; ýòî ôðýéì îò pushad |
reg_eax equ esp+0x1C |
reg_ecx equ esp+0x18 |
reg_edx equ esp+0x14 |
reg_ebx equ esp+0x10 |
reg_esp0 equ esp+0x0C |
reg_ebp equ esp+0x08 |
reg_esi equ esp+0x04 |
reg_edi equ esp+0x00 |
Mov ds,ax,app_data ; çàãðóçèì ïðàâèëüíûå çíà÷åíèÿ |
mov es,ax ; â ñåãìåíòíûå ðåãèñòðû |
cld ; è ïðèâîäèì DF ê ñòàíäàðòó |
movzx ebx,bl |
; redirect to V86 manager? (EFLAGS & 0x20000) != 0? |
test byte[reg_eflags+2],2 |
test byte [esp+20h+8+2], 2 |
jnz v86_exc_c |
cmp bl,14 ; #PF |
jne @f |
call page_fault_handler ; SEE: core/memory.inc |
@@: mov esi, [current_slot] |
btr [esi+APPDATA.except_mask], ebx |
jnc @f |
mov eax,[esi+APPDATA.exc_handler] |
; test if debugging |
cli |
mov eax, [current_slot] |
mov eax, [eax+APPDATA.debugger_slot] |
test eax, eax |
jnz IRetToUserHook |
@@: cli |
mov eax, [esi+APPDATA.debugger_slot] |
test eax, eax |
jnz .debug |
sti |
; not debuggee => say error and terminate |
call show_error_parameters ;; only ONE using, inline ??? |
;mov edx, [TASK_BASE] |
mov [edx + TASKDATA.state], byte 4 ; terminate |
jmp change_task ; stack - here it does not matter at all, SEE: core/shed.inc |
movzx eax, bl |
mov [error_interrupt], eax |
call show_error_parameters |
add esp, 0x20 |
mov edx, [TASK_BASE] |
mov [edx + TASKDATA.state], byte 4 |
jmp change_task |
.debug: |
; we are debugged process, notify debugger and suspend ourself |
; eax=debugger PID |
mov ecx,1 ; debug_message code=other_exception |
cmp bl,1 ; #DB |
jne .notify ; notify debugger and suspend ourself |
mov ebx, dr6 ; debug_message data=DR6_image |
xor edx, edx |
mov dr6, edx |
mov edx, dr7 |
mov cl, not 8 |
.l1: shl dl,2 |
jc @f |
and bl, cl |
@@: sar cl,1 |
jc .l1 |
mov cl, 3 ; debug_message code=debug_exception |
.notify: |
push ebx ; debug_message data |
mov ebx, [TASK_BASE] |
push [ebx+TASKDATA.pid] ; PID |
push ecx ; debug_message code ((here: ecx==1/3)) |
mov cl, 12 ; debug_message size |
call debugger_notify ;; only ONE using, inline ??? SEE: core/debug.inc |
add esp,12 |
cld |
movzx ecx, bl |
push ecx |
mov ecx, [TASK_BASE] |
push dword [ecx+TASKDATA.pid] ; PID of current process |
push 12 |
pop ecx |
push 1 ; 1=exception |
call debugger_notify |
pop ecx |
pop ecx |
pop ecx |
mov edx, [TASK_BASE] |
mov byte [edx+TASKDATA.state], 1 ; suspended |
call change_task ; SEE: core/shed.inc |
call change_task |
restore_ring3_context |
iretd |
IRetToUserHook: |
xchg eax, [reg_eip] |
sub dword[reg_esp3], 8 |
mov edi, [reg_esp3] |
stosd |
mov [edi], ebx |
restore_ring3_context |
unknown_interrupt: |
iretd |
iglobal |
hexletters db '0123456789ABCDEF' |
error_interrupt dd -1 |
endg |
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
show_error_parameters: |
mov edx,[TASK_BASE] ;not scratched below |
DEBUGF 1, "K : Process - forced terminate PID: %x\n", [edx+TASKDATA.pid] |
cmp bl, 0x08 |
jb .l0 |
cmp bl, 0x0e |
jbe .l1 |
.l0: mov bl, 0x09 |
.l1: mov eax,[msg_fault_sel+ebx*4 - 0x08*4] |
DEBUGF 1, "K : %s\n", eax |
mov eax, [reg_cs3+4] |
mov eax,[CURRENT_TASK] |
shl eax, 5 |
DEBUGF 1, "K : Process - forced terminate PID: %x\n", [CURRENT_TASK + TASKDATA.pid + eax] |
mov eax, [error_interrupt] |
cmp al, 0x08 |
jne @f |
DEBUGF 1, "K : Double fault\n" |
jmp defined_error |
@@: |
cmp al, 0x0a |
jne @f |
DEBUGF 1, "K : Invalid TSS\n" |
jmp defined_error |
@@: |
cmp al, 0x0b |
jne @f |
DEBUGF 1, "K : Segment not present\n" |
jmp defined_error |
@@: |
cmp al, 0x0c |
jne @f |
DEBUGF 1, "K : Stack fault\n" |
jmp defined_error |
@@: |
cmp al, 0x0d |
jne @f |
DEBUGF 1, "K : General protection fault\n" |
jmp defined_error |
@@: |
cmp al, 0x0e |
jne @f |
DEBUGF 1, "K : Page fault\n" |
jmp defined_error |
@@: |
DEBUGF 1, "K : Undefined Exception\n" |
defined_error: |
DEBUGF 1, "K : EAX : %x EBX : %x ECX : %x\n", [esp + 0x20], [esp - 12 + 0x20], [esp - 4 + 0x20] |
DEBUGF 1, "K : EDX : %x ESI : %x EDI : %x\n", [esp - 8 + 0x20], [esp - 24 + 0x20], [esp - 28 + 0x20] |
DEBUGF 1, "K : EBP : %x EIP : %x ", [esp - 20 + 0x20], [esp + 4 + 0x20] |
mov eax, [esp + 8 + 0x20] |
mov edi, msg_sel_app |
mov ebx, [reg_esp3+4] |
mov ebx, [esp + 16 + 0x20] |
cmp eax, app_code |
je @f |
mov edi, msg_sel_ker |
mov ebx, [reg_esp0+4] |
@@: DEBUGF 1, "K : EAX : %x EBX : %x ECX : %x\n", [reg_eax+4], [reg_ebx+4], [reg_ecx+4] |
DEBUGF 1, "K : EDX : %x ESI : %x EDI : %x\n", [reg_edx+4], [reg_esi+4], [reg_edi+4] |
DEBUGF 1, "K : EBP : %x EIP : %x ESP : %x\n", [reg_ebp+4], [reg_eip+4], ebx |
DEBUGF 1, "K : Flags : %x CS : %x (%s)\n", [reg_eflags+4], eax, edi |
mov ebx, [esp - 16 + 0x20] |
@@: |
DEBUGF 1, "ESP : %x\nK : Flags : %x CS : %x (%s)\n", ebx, [esp + 12 + 0x20], eax, edi |
ret |
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
restore reg_ss |
restore reg_esp3 |
restore reg_eflags |
restore reg_cs |
restore reg_eip |
restore reg_eax |
restore reg_ecx |
restore reg_edx |
restore reg_ebx |
restore reg_esp0 |
restore reg_ebp |
restore reg_esi |
restore reg_edi |
; irq1 -> hid/keyboard.inc |
macro irqh [num] { |
macro irqh [num] |
{ |
forward |
p_irq#num : |
mov edi, num |
jmp irqhandler |
} |
irqh 2,3,4,5,7,8,9,10,11 |
p_irq6: |
292,18 → 277,26 |
ret |
irqD: |
push eax |
save_ring3_context |
mov ax, app_data ;os_data |
mov ds, ax |
mov es, ax |
mov dx,0xf0 |
mov al,0 |
out 0xf0,al |
out dx,al |
mov dx,0xa0 |
mov al,0x20 |
out 0xa0,al |
out 0x20,al |
pop eax |
out dx,al |
mov dx,0x20 |
out dx,al |
restore_ring3_context |
iret |
irqh 2,3,4,5,7,8,9,10,11 |
irqhandler: |
mov esi,edi ; 1 |
428,8 → 421,8 |
jmp new_sys_threads |
iglobal |
; process_terminating db 'K : Process - terminating',13,10,0 |
; process_terminated db 'K : Process - done',13,10,0 |
process_terminating db 'K : Process - terminating',13,10,0 |
process_terminated db 'K : Process - done',13,10,0 |
msg_obj_destroy db 'K : destroy app object',13,10,0 |
endg |
452,6 → 445,7 |
@@: |
;mov esi,process_terminating |
;call sys_msg_board_str |
DEBUGF 1,"%s",process_terminating |
@@: |
cli |
cmp [application_table_status],0 |
811,6 → 805,7 |
mov [application_table_status],0 |
;mov esi,process_terminated |
;call sys_msg_board_str |
DEBUGF 1,"%s",process_terminated |
add esp, 4 |
ret |
restore .slot |
/kernel/branches/net/core/syscall.inc |
---|
16,7 → 16,8 |
mov ecx, edx |
mov edx, esi |
mov esi, edi |
movzx edi, byte[esp+28 + 4] |
mov edi, [esp+28 + 4] |
and edi,0xff |
call dword [servetable+edi*4] |
ret |
23,6 → 24,21 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; SYSTEM CALL ENTRY ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
align 16 |
i40: |
pushad |
cld |
movzx eax, al |
call dword [servetable2 + eax * 4] |
popad |
iretd |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; SYSENTER ENTRY ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
54,21 → 70,6 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; SYSTEM CALL ENTRY ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
align 16 |
i40: |
pushad |
cld |
movzx eax, al |
call dword [servetable2 + eax * 4] |
popad |
iretd |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; SYSCALL ENTRY ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
94,7 → 95,6 |
mov ecx, [ss:esp+4] |
pop esp |
sysret |
iglobal |
;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; SYSTEM FUNCTIONS TABLE ;; |
175,6 → 175,7 |
dd sys_debug_services ; 69-Debug |
dd file_system_lfn ; 70-Common file system interface, version 2 |
dd syscall_windowsettings ; 71-Window settings |
dd sys_sendwindowmsg ; 72-Send window message |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
255,7 → 256,7 |
dd cross_order ; 69-Debug |
dd cross_order ; 70-Common file system interface, version 2 |
dd cross_order ; 71-Window settings |
dd sys_sendwindowmsg ; 72-Send window message |
dd cross_order ; 72-Send window message |
dd sys_network ; 73-Network stack |
dd sys_socket ; 74-Sockets |
dd sys_protocols ; 75-Protocols |
/kernel/branches/net/core/taskman.inc |
---|
140,6 → 140,7 |
;mov esi, new_process_loading |
;call sys_msg_board_str ; write message to message board |
DEBUGF 1,"%s",new_process_loading |
.wait_lock: |
cmp [application_table_status],0 |
849,6 → 850,7 |
;mov esi,new_process_loading |
;call sys_msg_board_str |
DEBUGF 1,"%s",new_process_loading |
.wait_lock: |
cmp [application_table_status],0 |
je .get_lock |
903,6 → 905,7 |
;mov esi,new_process_running |
;call sys_msg_board_str ;output information about succefull startup |
DEBUGF 1,"%s",new_process_running |
mov [application_table_status],0 ;unlock application_table_status mutex |
mov eax,[process_number] ;set result |
918,15 → 921,18 |
align 4 |
wait_mutex: |
;;Maxis use atomic bts for mutex 4.4.2009 |
push eax |
push ebx |
.do_wait: |
bts dword [ebx],0 |
jnc .locked |
cmp dword [ebx],0 |
je .get_lock |
call change_task |
jmp .do_wait |
.locked: |
.get_lock: |
mov eax, 1 |
xchg eax, [ebx] |
test eax, eax |
jnz .do_wait |
pop ebx |
pop eax |
ret |
955,8 → 961,8 |
shl eax, 8 |
mov [eax+SLOT_BASE+APPDATA.fpu_state], edi |
mov [eax+SLOT_BASE+APPDATA.exc_handler], 0 |
mov [eax+SLOT_BASE+APPDATA.except_mask], 0 |
mov [eax+SLOT_BASE+APPDATA.fpu_handler], 0 |
mov [eax+SLOT_BASE+APPDATA.sse_handler], 0 |
;set default io permission map |
mov [eax+SLOT_BASE+APPDATA.io_map],\ |
1098,6 → 1104,7 |
mov [CURRENT_TASK+ebx+TASKDATA.state], cl |
;mov esi,new_process_running |
;call sys_msg_board_str ;output information about succefull startup |
DEBUGF 1,"%s",new_process_running |
ret |
endp |
/kernel/branches/net/core/v86.inc |
---|
351,6 → 351,27 |
; a protected-mode interrupt handler (typically the general-protection |
; exception handler, which in turn calls the virtual 8086-mode monitor). |
v86_debug_exc: |
pushad |
xor eax, eax |
mov dr6, eax |
mov bl, 1 |
jmp v86_exc_c |
v86_page_fault: |
add esp, 4 |
pushad |
mov bl, 14 |
jmp v86_exc_c |
v86_except_16: |
pushad |
mov bl, 16 |
jmp v86_exc_c |
v86_except_19: |
pushad |
mov bl, 19 |
iglobal |
v86_exc_str1 db 'V86 : unexpected exception ',0 |
v86_exc_str2 db ' at ',0 |
366,12 → 387,11 |
endg |
v86_exc_c: |
mov ax, app_data |
mov ds, ax |
mov es, ax |
; Did we all that we have wanted to do? |
cmp bl,1 |
jne @f |
xor eax, eax |
mov dr6, eax |
@@: mov eax, [esp+v86_regs.size+10h+18h] |
mov eax, [esp+v86_regs.size+10h+18h] |
cmp word [esp+v86_regs.eip], ax |
jnz @f |
shr eax, 16 |
925,11 → 945,12 |
mov cx, [eax*4+2] |
mov word [esi-v86_regs.size+v86_regs.cs], cx |
and byte [esi-v86_regs.size+v86_regs.eflags+1], not 3 |
push ebx |
call update_counters |
lea edi, [ebx + 0x100000000 - SLOT_BASE] |
shr edi, 3 |
add edi, TASK_DATA |
call find_next_task.found |
pop ebx |
sub ebx, SLOT_BASE |
shr ebx, 8 |
mov esi, [CURRENT_TASK] |
call do_change_task |
popad |
iretd |
/kernel/branches/net/data32.inc |
---|
63,7 → 63,6 |
boot_setostask db 'Setting OS task',0 |
boot_allirqs db 'Unmasking all IRQs',0 |
boot_tsc db 'Reading TSC',0 |
boot_cpufreq db 'CPU frequency is ',' ',' MHz',0 |
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0 |
boot_pal_vga db 'Setting VGA 640x480 palette',0 |
boot_failed db 'Failed to start first app',0 |
72,8 → 71,8 |
boot_tasking db 'All set - press ESC to start',0 |
end if |
;new_process_loading db 'K : New Process - loading',13,10,0 |
;new_process_running db 'K : New Process - done',13,10,0 |
new_process_loading db 'K : New Process - loading',13,10,0 |
new_process_running db 'K : New Process - done',13,10,0 |
start_not_enough_memory db 'K : New Process - not enough memory',13,10,0 |
msg_unresolved db 'unresolved ',0 |
90,7 → 89,7 |
;szInfinity db 'INFINITY',0 |
szHwMouse db 'ATI2D',0 |
szPS2MDriver db 'PS2MOUSE',0 |
;szCOM_MDriver db 'COM_MOUSE',0 |
szCOM_MDriver db 'COM_MOUSE',0 |
szUSB db 'USB',0 |
szAtiHW db '/rd/1/drivers/ati2d.drv',0 |
292,6 → 291,7 |
irq_tab rd 16 |
mem_block_map rb 512 |
event_map rb 64 |
mem_block_list rd 64 |
large_block_list rd 31 |
mem_block_mask rd 2 |
314,6 → 314,10 |
page_start rd 1 |
page_end rd 1 |
events rd 1 |
event_start rd 1 |
event_end rd 1 |
event_uid rd 1 |
sys_page_map rd 1 |
os_stack_seg rd 1 |
398,7 → 402,7 |
img_background rd 1 |
mem_BACKGROUND rd 1 |
static_background_data rd 1 |
wraw_bacground_select rb 1 |
cache_ide0: |
cache_ide0_pointer rd 1 |
466,3 → 470,4 |
BiosDiskPartitions rd 80h |
IncludeUGlobals |
/kernel/branches/net/detect/biosmem.inc |
---|
File deleted |
/kernel/branches/net/detect/getcache.inc |
---|
70,26 → 70,15 |
jz .endbd |
mov esi,BiosDiskCaches |
.loopbd: |
push ecx |
movsx ecx,byte [BiosDisksData+ecx*4+2] |
inc ecx |
jz .getbd |
add ecx,ecx |
movzx eax,byte [DRIVE_DATA+1] |
shl eax,cl |
and ah,3 |
cmp ah,1 |
jz .contbd |
pop ecx |
mov byte [BiosDisksData+ecx*4+2], -1 |
push ecx |
.getbd: |
cmp byte [BiosDisksData+ecx*4+2],-1 |
jnz .contbd |
mov eax,[cache_ide0_size] |
mov [esi+cache_ide0_size-cache_ide0],eax |
push ecx |
mov cl,1 |
call get_cache_ide |
pop ecx |
.contbd: |
pop ecx |
add esi,cache_ide1-cache_ide0 |
inc ecx |
cmp ecx,[NumBiosDisks] |
/kernel/branches/net/fdo.inc |
---|
201,6 → 201,7 |
if ~_hex eq ax |
movzx eax,_hex |
end if |
shl eax,16 |
if (_num eq) |
mov edx,4 |
end if |
208,6 → 209,7 |
if ~_hex eq al |
movzx eax,_hex |
end if |
shl eax,24 |
if (_num eq) |
mov edx,2 |
end if |
/kernel/branches/net/gui/button.inc |
---|
423,7 → 423,7 |
; |
; first at 0x10 |
align 4 |
checkbuttons: |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed |
/kernel/branches/net/gui/event.inc |
---|
7,481 → 7,695 |
$Revision: 671 $ |
uglobal |
align 4 |
event_start dd ? |
event_end dd ? |
event_uid dd 0 |
endg |
EV_SPACE = 512 |
FreeEvents = event_start-EVENT.fd ; "âèðòóàëüíûé" event, èñïîëüçóþòñÿ òîëüêî ïîëÿ: |
; FreeEvents.fd=event_start è FreeEvents.bk=event_end |
init_events: |
stdcall kernel_alloc, 512*EVENT_SIZE |
mov [events], eax |
xor eax, eax |
mov [event_uid], eax |
not eax |
mov edi, event_map |
mov [event_start], edi |
mov ecx, 64/4 |
cld |
rep stosd |
mov [event_end], edi |
ret |
align 4 |
init_events: ;; used from kernel.asm |
stdcall kernel_alloc,EV_SPACE*EVENT.size |
or eax,eax |
jz .fail |
; eax - current event, ebx - previos event below |
mov ecx,EV_SPACE ; current - in allocated space |
mov ebx,FreeEvents ; previos - íà÷àëî ñïèñêà |
push ebx ; îíî æå è êîíåö ïîòîì áóäåò |
@@: mov [ebx+EVENT.fd],eax |
mov [eax+EVENT.bk],ebx |
mov ebx,eax ; previos <- current |
add eax,EVENT.size ; new current |
loop @b |
pop eax ; âîò îíî êîíöîì è ñòàëî |
mov [ebx+EVENT.fd],eax |
mov [eax+EVENT.bk],ebx |
.fail: ret |
proc alloc_event |
EVENT_WATCHED equ 0x10000000 ;áèò 28 |
EVENT_SIGNALED equ 0x20000000 ;áèò 29 |
MANUAL_RESET equ 0x40000000 ;áèò 30 |
MANUAL_DESTROY equ 0x80000000 ;áèò 31 |
pushfd |
cli |
mov ebx, [event_start] |
mov ecx, [event_end] |
.l1: |
bsf eax,[ebx] |
jnz .found |
add ebx,4 |
cmp ebx, ecx |
jb .l1 |
popfd |
xor eax,eax |
ret |
.found: |
btr [ebx], eax |
mov [event_start],ebx |
inc [event_uid] |
sub ebx, event_map |
lea eax,[eax+ebx*8] |
lea ebx, [eax+eax*4] |
shl eax,5 |
lea eax,[eax+ebx*4] ;eax*=52 (EVENT_SIZE) |
add eax, [events] |
mov ebx, [event_uid] |
popfd |
ret |
endp |
align 4 |
create_event: ;; EXPORT use |
;info: |
; Ïåðåíîñèì EVENT èç ñïèñêà FreeEvents â ñïèñîê ObjList òåêóùåãî ñëîòà |
; EVENT.state óñòàíàâëèâàåì èç ecx, EVENT.code êîñâåííî èç esi (åñëè esi<>0) |
;param: |
; esi - event data |
; ecx - flags |
;retval: |
; eax - event (=0 => fail) |
; edx - uid |
;scratched: ebx,ecx,esi,edi |
mov ebx,[current_slot] |
add ebx,APP_OBJ_OFFSET |
mov edx,[TASK_BASE] |
mov edx,[edx+TASKDATA.pid] |
free_event: |
sub eax, [events] |
mov ecx, EVENT_SIZE |
mov ebx, event_map |
cdq |
div ecx |
pushfd |
cli |
bts [ebx], eax |
shr eax, 3 |
and eax, not 3 |
add eax, ebx |
cmp [event_start], eax |
ja @f |
popfd |
ret |
@@: |
mov [event_start], eax |
popfd |
ret |
set_event: ;; INTERNAL use !!! don't use for Call |
;info: |
; Áåðåì íîâûé event èç FreeEvents, çàïîëíÿåì åãî ïîëÿ, êàê óêàçàíî â ecx,edx,esi |
; è óñòàíàâëèâàåì â ñïèñîê, óêàçàííûé â ebx. |
; Âîçâðàùàåì ñàì event (â eax), è åãî uid (â edx) |
;param: |
; ebx - start-chain "virtual" event for entry new event Right of him |
; ecx - flags (copied to EVENT.state) |
; edx - pid (copied to EVENT.pid) |
; esi - event data (copied to EVENT.code indirect, =0 => skip) |
;retval: |
; eax - event (=0 => fail) |
; edx - uid |
;scratched: ebx,ecx,esi,edi |
mov eax,FreeEvents |
cmp eax,[eax+EVENT.fd] |
jne @f ; not empty ??? |
pushad |
call init_events |
popad |
jz RemoveEventTo.break ; POPF+RET |
@@: mov eax,[eax+EVENT.fd] |
mov [eax+EVENT.magic],'EVNT' |
mov [eax+EVENT.destroy],destroy_event.internal |
mov [eax+EVENT.state],ecx |
mov [eax+EVENT.pid],edx |
inc [event_uid] |
Mov [eax+EVENT.id],edx,[event_uid] |
or esi,esi |
jz RemoveEventTo |
EVENT_WATCHED equ 0x10000000 |
EVENT_SIGNALED equ 0x20000000 |
MANUAL_RESET equ 0x40000000 |
MANUAL_DESTROY equ 0x80000000 |
; param |
; eax= event data |
; ebx= flags |
; |
; retval |
; eax= event |
; edx= id |
create_event: |
.flags equ esp+4 |
.data equ esp |
push ebx |
push eax |
call alloc_event |
test eax, eax |
jz .fail |
mov [eax+APPOBJ.magic], 'EVNT' |
mov [eax+APPOBJ.destroy], destroy_event.internal |
mov [eax+EVENT.id], ebx |
mov ebx, [CURRENT_TASK] |
shl ebx, 5 |
mov ebx, [CURRENT_TASK+ebx+4] |
mov [eax+APPOBJ.pid], ebx |
mov edx, [.flags] |
mov [eax+EVENT.state], edx |
mov esi, [.data] |
test esi, esi |
jz @F |
lea edi,[eax+EVENT.code] |
mov ecx,EVENT.codesize/4 |
mov ecx, 6 |
cld |
rep movsd |
@@: |
mov ecx, [current_slot] |
add ecx, APP_OBJ_OFFSET |
RemoveEventTo: ;; INTERNAL use !!! don't use for Call |
;param: |
; eax - óêàçàòåëü íà event, ÊÎÒÎÐÛÉ âñòàâëÿåì |
; ebx - óêàçàòåëü íà event, ÏÎÑËÅ êîòîðîãî âñòàâëÿåì |
;scratched: ebx,ecx |
mov ecx,eax ; ecx=eax=Self, ebx=NewLeft |
xchg ecx,[ebx+EVENT.fd] ; NewLeft.fd=Self, ecx=NewRight |
cmp eax,ecx ; ñòîï, ñåáå äóìàþ... |
je .break ; - à íå äóðàê ëè ÿ? |
mov [ecx+EVENT.bk],eax ; NewRight.bk=Self |
xchg ebx,[eax+EVENT.bk] ; Self.bk=NewLeft, ebx=OldLeft |
xchg ecx,[eax+EVENT.fd] ; Self.fd=NewRight, ecx=OldRight |
mov [ebx+EVENT.fd],ecx ; OldLeft.fd=OldRight |
mov [ecx+EVENT.bk],ebx ; OldRight.bk=OldLeft |
.break: popfd |
pushfd |
cli |
mov edx, [ecx+APPOBJ.fd] |
mov [eax+APPOBJ.fd], edx |
mov [eax+APPOBJ.bk], ecx |
mov [ecx+APPOBJ.fd], eax |
mov [edx+APPOBJ.bk], eax |
popfd |
mov edx, [eax+EVENT.id] |
.fail: |
add esp, 8 |
ret |
restore .flags |
restore .data |
; param |
; eax= event |
; ebx= id |
destroy_event: |
cmp [eax+APPOBJ.magic], 'EVNT' |
jne .fail |
cmp [eax+EVENT.id], ebx |
jne .fail |
.internal: |
mov ebx, [eax+APPOBJ.fd] |
mov ecx, [eax+APPOBJ.bk] |
mov [ebx+APPOBJ.bk], ecx |
mov [ecx+APPOBJ.fd], ebx |
.force: |
xor edx, edx ;clear common header |
mov [eax], edx |
mov [eax+4], edx |
mov [eax+8], edx |
mov [eax+12], edx |
mov [eax+16], edx |
call free_event ;release object memory |
.fail: |
ret |
align 4 |
NotDummyTest: ;; INTERNAL use (not returned for fail !!!) |
pop edi |
call DummyTest ; not returned for fail !!! |
mov ebx,eax |
mov eax,[ebx+EVENT.pid] |
push edi |
.small: ; êðèâî êàê-òî... |
pop edi |
pushfd |
cli |
call pid_to_slot ; saved all registers (eax - retval) |
proc send_event stdcall pid:dword, event:dword |
locals |
slot dd ? |
endl |
mov eax, [pid] |
call pid_to_slot |
test eax, eax |
jz .fail |
shl eax,8 |
jz RemoveEventTo.break ; POPF+RET |
jmp edi ; øòàòíûé âîçâðàò |
cmp [SLOT_BASE+eax+APPDATA.ev_count], 32 |
ja .fail |
mov [slot], eax |
call alloc_event |
test eax, eax |
jz .fail |
lea edi, [eax+EVENT.code] |
mov ecx, 6 |
mov esi, [event] |
cld |
rep movsd |
mov ecx, [slot] |
add ecx, SLOT_BASE+APP_EV_OFFSET |
mov [eax+APPOBJ.magic], 'EVNT' |
mov [eax+APPOBJ.destroy], destroy_event |
mov ebx, [pid] |
mov [eax+APPOBJ.pid], ebx |
mov [eax+EVENT.state], EVENT_SIGNALED |
pushfd |
cli ;insert event into |
mov edx, [ecx+APPOBJ.fd] ;events list |
mov [eax+APPOBJ.fd], edx ;and set events flag |
mov [eax+APPOBJ.bk], ecx |
mov [ecx+APPOBJ.fd], eax |
mov [edx+APPOBJ.bk], eax |
inc [ecx+APPDATA.ev_count-APP_EV_OFFSET] |
or [ecx+APPDATA.event_mask-APP_EV_OFFSET], EVENT_EXTENDED |
popfd |
.fail: |
ret |
endp |
; timeout ignored |
align 4 |
raise_event: ;; EXPORT use |
;info: |
; Óñòàíàâëèâàåì äàííûå EVENT.code |
; Åñëè òàì ôëàã EVENT_SIGNALED óæå àêòèâåí - áîëüøå íè÷åãî |
; Èíà÷å: ýòîò ôëàã âçâîäèòñÿ, çà èñêëþ÷åíèåì ñëó÷àÿ íàëè÷èÿ ôëàãà EVENT_WATCHED â edx |
;  ýòîì ñëó÷àå EVENT_SIGNALED âçâîäèòñÿ ëèøü ïðè íàëè÷èå EVENT_WATCHED â ñàìîì ñîáûòèè |
;param: |
; eax - event |
; ebx - uid (for Dummy testing) |
; edx - flags |
; esi - event data (=0 => skip) |
;scratched: ebx,ecx,esi,edi |
call NotDummyTest ; not returned for fail !!! |
or esi,esi |
jz @f |
lea edi,[ebx+EVENT.code] |
mov ecx,EVENT.codesize/4 |
proc get_event_ex stdcall, p_ev:dword, timeout:dword |
.wait: |
mov edx,[current_slot] |
; cmp [SLOT_BASE+edx+APPDATA.ev_count], 0 |
; je .switch |
add edx, APP_EV_OFFSET |
mov eax, [edx+APPOBJ.fd] |
cmp eax, edx |
je .switch |
lea esi, [eax+EVENT.code] |
mov edi, [p_ev] ;copy event data |
mov ecx, 6 |
cld |
rep movsd |
@@: |
test byte[ebx+EVENT.state+3], EVENT_SIGNALED shr 24 |
jnz RemoveEventTo.break ; POPF+RET |
bt edx, 28 ;EVENT_WATCHED |
jnc @f |
test byte[ebx+EVENT.state+3], EVENT_WATCHED shr 24 |
jz RemoveEventTo.break ; POPF+RET |
@@: |
or byte[ebx+EVENT.state+3], EVENT_SIGNALED shr 24 |
add eax,SLOT_BASE+APP_EV_OFFSET |
xchg eax,ebx |
jmp RemoveEventTo |
align 4 |
clear_event: ;; EXPORT use |
;info: |
and dword [edi-24], 0xFF00FFFF ;clear priority field |
; |
;param: |
; eax - event |
; ebx - uid (for Dummy testing) |
;scratched: ebx,ecx |
call NotDummyTest ; not returned for fail !!! |
add eax,SLOT_BASE+APP_OBJ_OFFSET |
and byte[ebx+EVENT.state+3], not((EVENT_SIGNALED+EVENT_WATCHED)shr 24) |
xchg eax,ebx |
jmp RemoveEventTo |
test [eax+EVENT.state], MANUAL_RESET |
jnz .done |
align 4 |
send_event: ;; EXPORT use |
;info: |
; Ñîçäàåò íîâûé EVENT (âûòàñêèâàåò èç ñïèñêà FreeEvents) â ñïèñêå EventList |
; öåëåâîãî ñëîòà (eax=pid), ñ äàííûìè èç esi êîñâåííî, è state=EVENT_SIGNALED |
;param: |
; eax - slots pid, to sending new event |
; esi - pointer to sending data (in code field of new event) |
;retval: |
; eax - event (=0 => fail) |
; edx - uid |
;warning: |
; may be used as CDECL with such prefix... |
; mov esi,[esp+8] |
; mov eax,[esp+4] |
; but not as STDCALL :( |
;scratched: ebx,ecx,esi,edi |
mov edx,eax |
call NotDummyTest.small ; not returned for fail !!! |
lea ebx,[eax+SLOT_BASE+APP_EV_OFFSET] |
mov ecx,EVENT_SIGNALED |
jmp set_event |
pushfd |
cli ;remove event from events |
mov ebx, [eax+APPOBJ.fd] ;list (reset event) |
mov ecx, [eax+APPOBJ.bk] ;and clear events flag |
mov [ebx+APPOBJ.bk], ecx ;if no active events |
mov [ecx+APPOBJ.fd], ebx |
and [eax+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED) |
dec [edx+APPDATA.ev_count-APP_EV_OFFSET] |
jnz @F |
and [edx+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED |
@@: |
popfd |
test [eax+EVENT.state], MANUAL_DESTROY |
jz .destroy |
add edx, (APP_OBJ_OFFSET-APP_EV_OFFSET) |
pushfd |
cli |
mov ebx, [edx+APPOBJ.fd] ;insert event into |
mov [eax+APPOBJ.fd], ebx ;objects list |
mov [eax+APPOBJ.bk], edx |
mov [edx+APPOBJ.fd], eax |
mov [ebx+APPOBJ.bk], eax |
popfd |
.done: |
ret |
.destroy: |
call destroy_event.force |
ret |
.switch: |
mov eax, [TASK_BASE] |
mov [eax+TASKDATA.state], byte 5 |
call change_task |
jmp .wait |
endp |
; param |
; eax= event |
; ebx= id |
align 4 |
DummyTest: ;; INTERNAL use (not returned for fail !!!) |
;param: |
; eax - event |
; ebx - uid (for Dummy testing) |
cmp [eax+EVENT.magic],'EVNT' |
jne @f |
wait_event: |
.event equ esp |
push eax |
.wait: |
cmp [eax+APPOBJ.magic], 'EVNT' |
jne .done |
cmp [eax+EVENT.id],ebx |
je .ret |
@@: pop eax |
xor eax,eax |
.ret: ret |
jne .done |
test [eax+EVENT.state], EVENT_SIGNALED |
jz .switch |
align 4 |
Wait_events: |
or ebx,-1 ; infinite timeout |
Wait_events_ex: |
;info: |
; Îæèäàíèå "àáñòðàêòíîãî" ñîáûòèÿ ÷åðåç ïåðåâîä ñëîòà â 5-þ ïîçèöèþ. |
; Àáñòðàêòíîñòü çàêëþ÷åíà â òîì, ÷òî ôàêò ñîáûòèÿ îïðåäåëÿåòñÿ ôóíêöèåé APPDATA.wait_test, |
; êîòîðàÿ çàäàåòñÿ êëèåíòîì è ìîæåò áûòü ôàêòè÷åñêè ëþáîé. |
; Ýòî ïîçâîëÿåò shed-ó íàäåæíî îïðåäåëèòü ôàêò ñîáûòèÿ, è íå ñîâåðøàòü "õîëîñòûõ" ïåðåêëþ÷åíèé, |
; ïðåäíàçíà÷åííûõ äëÿ ðàçáîðîê òèïà "ñâîé/÷óæîé" âíóòðè çàäà÷è. |
;param: |
; edx - wait_test, êëèåíòñêàÿ ô-ÿ òåñòèðîâàíèÿ (àäðåñ êîäà) |
; ecx - wait_param, äîïîëíèòåëüíûé ïàðàìåòð, âîçìîæíî íåîáõîäèìûé äëÿ [wait_test] |
; ebx - wait_timeout |
;retval: |
; eax - ðåçóëüòàò âûçîâà [wait_test] (=0 => timeout) |
;scratched: esi |
mov esi,[current_slot] |
mov [esi+APPDATA.wait_param],ecx |
pushad |
mov ebx,esi;ïîêà ýòî âîïðîñ, ÷åãî êóäû ñóâàòü.......... |
pushfd ; ýòî ñëåäñòâèå îáùåé êîíöåïöèè: ïóñòü ô-ÿ òåñòèðîâàíèÿ èìååò |
cli ; ïðàâî ðàññ÷èòûâàòü íà çàêðûòûå ïðåðûâàíèÿ, êàê ïðè âûçîâå èç shed |
call edx |
test [eax+EVENT.state], MANUAL_RESET |
jnz .done |
mov edx,[current_slot] |
pushfd |
cli ;remove event from events |
mov ebx, [eax+APPOBJ.fd] ;list (reset event) |
mov ecx, [eax+APPOBJ.bk] ;and clear events flag |
mov [ebx+APPOBJ.bk], ecx ;if no active events |
mov [ecx+APPOBJ.fd], ebx |
dec [edx+APPDATA.ev_count] |
jnz @F |
and [edx+APPDATA.event_mask], not EVENT_EXTENDED |
@@: |
and [eax+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED) |
popfd |
mov [esp+28],eax |
popad |
or eax,eax |
jnz @f ;RET |
mov [esi+APPDATA.wait_test],edx |
mov [esi+APPDATA.wait_timeout],ebx |
Mov [esi+APPDATA.wait_begin],eax,[timer_ticks] |
test [eax+EVENT.state], MANUAL_DESTROY |
jz .destroy |
add edx, APP_OBJ_OFFSET |
pushfd |
cli |
mov ecx, [edx+APPOBJ.fd] ;insert event into |
mov [eax+APPOBJ.fd], ecx ;objects list |
mov [eax+APPOBJ.bk], edx |
mov [edx+APPOBJ.fd], eax |
mov [ecx+APPOBJ.bk], eax |
popfd |
.done: |
add esp, 4 |
ret |
.destroy: |
call destroy_event.force |
add esp, 4 |
ret |
.switch: |
or [eax+EVENT.state], EVENT_WATCHED |
mov eax,[TASK_BASE] |
mov [eax+TASKDATA.state], 5 |
mov [eax+TASKDATA.state], byte 5 |
call change_task |
mov eax,[esi+APPDATA.wait_param] |
@@: ret |
mov eax, [.event] |
jmp .wait |
restore .event |
align 4 |
wait_event: ;; EXPORT use |
;info: |
; Îæèäàíèå ôëàãà EVENT_SIGNALED â ñîâåðøåííî êîíêðåòíîì Event |
; (óñòàíàâëèâàåìîãî, íàäî ïîëàãàòü, ÷åðåç raise_event) |
; Ïðè àêòèâíîì ôëàãå MANUAL_RESET - áîëüøå íè÷åãî |
; Èíà÷å: ôëàãè EVENT_SIGNALED è EVENT_WATCHED ó ïîëó÷åííîãî ñîáûòèÿ ñáðàñûâàþòñÿ, |
; è, ïðè àêòèâíîì MANUAL_DESTROY - ïåðåìåùàåòñÿ â ñïèñîê ObjList òåêóùåãî ñëîòà, |
; à ïðè íå àêòèâíîì - óíè÷òîæàåòñÿ øòàòíî (destroy_event.internal) |
;param: |
; eax - event |
; ebx - uid (for Dummy testing) |
;scratched: ecx,edx,esi |
call DummyTest |
mov ecx,eax ; wait_param |
mov edx, get_event_alone ; wait_test |
call Wait_events ; timeout ignored |
jmp wait_finish |
; param |
; eax= event |
; ebx= id |
; ecx= flags |
; edx= event data |
align 4 |
get_event_ex: ;; f68:14 |
;info: |
; Îæèäàíèå ëþáîãî ñîáûòèÿ â î÷åðåäè EventList òåêóùåãî ñëîòà |
; Äàííûå ñîáûòèÿ code - êîïèðóþòñÿ â ïàìÿòü ïðèëîæåíèÿ (êîñâåííî ïî edi) |
; Ïðè àêòèâíîì ôëàãå MANUAL_RESET - áîëüøå íè÷åãî |
; Èíà÷å: ôëàãè EVENT_SIGNALED è EVENT_WATCHED ó ïîëó÷åííîãî ñîáûòèÿ ñáðàñûâàþòñÿ, |
; è, ïðè àêòèâíîì MANUAL_DESTROY - ïåðåìåùàåòñÿ â ñïèñîê ObjList òåêóùåãî ñëîòà, |
; à ïðè íå àêòèâíîì - óíè÷òîæàåòñÿ øòàòíî (destroy_event.internal) |
;param: |
; edi - àäðåñ â êîäå ïðèëîæåíèÿ äëÿ êîïèðîâàíèÿ äàííûõ èç EVENT.code |
;retval: |
; eax - ñîáñòâåííî EVENT (áóäåì íàçûâàòü ýòî åãî õýíäëîì) |
;scratched: ebx,ecx,edx,esi,edi |
mov edx, get_event_queue ; wait_test |
call Wait_events ; timeout ignored |
lea esi,[eax+EVENT.code] |
mov ecx,EVENT.codesize/4 |
raise_event: |
.event equ esp |
push eax |
cmp [eax+APPOBJ.magic], 'EVNT' |
jne .fail |
cmp [eax+EVENT.id], ebx |
jne .fail |
mov eax, [eax+APPOBJ.pid] |
call pid_to_slot |
test eax, eax |
jz .fail |
mov esi, edx |
test esi, esi |
mov edx, [.event] |
jz @F |
push ecx |
lea edi, [edx+EVENT.code] |
mov ecx, 6 |
cld |
rep movsd |
mov [edi-EVENT.codesize+2],cl ;clear priority field |
wait_finish: |
test byte[eax+EVENT.state+3], MANUAL_RESET shr 24 |
jnz get_event_queue.ret ; RET |
and byte[eax+EVENT.state+3], not((EVENT_SIGNALED+EVENT_WATCHED)shr 24) |
test byte[eax+EVENT.state+3], MANUAL_DESTROY shr 24 |
jz destroy_event.internal |
mov ebx,[current_slot] |
add ebx,APP_OBJ_OFFSET |
pop ecx |
@@: |
test [edx+EVENT.state], EVENT_SIGNALED |
jnz .done |
test ecx, EVENT_WATCHED |
jz @F |
test [edx+EVENT.state], EVENT_WATCHED |
jz .done |
@@: |
shl eax, 8 |
add eax, SLOT_BASE+APP_EV_OFFSET |
pushfd |
cli |
jmp RemoveEventTo |
mov ebx, [edx+APPOBJ.fd] |
mov ecx, [edx+APPOBJ.bk] |
mov [ebx+APPOBJ.bk], ecx |
mov [ecx+APPOBJ.fd], ebx |
mov ecx, [eax+APPOBJ.fd] |
mov [edx+APPOBJ.fd], ecx |
mov [edx+APPOBJ.bk], eax |
mov [eax+APPOBJ.fd], edx |
mov [ecx+APPOBJ.bk], edx |
or [edx+EVENT.state], EVENT_SIGNALED |
inc [eax+APPDATA.ev_count-APP_EV_OFFSET] |
or [eax+APPDATA.event_mask-APP_EV_OFFSET], EVENT_EXTENDED |
popfd |
.fail: |
.done: |
add esp, 4 |
ret |
restore .event |
; param |
; eax= event |
; ebx= id |
align 4 |
destroy_event: ;; EXPORT use |
;info: |
; Ïåðåíîñèì EVENT â ñïèñîê FreeEvents, ÷èñòèì ïîëÿ magic,destroy,pid,id |
;param: |
; eax - event |
; ebx - uid (for Dummy testing) |
;retval: |
; eax - àäðåñ îáúåêòà EVENT (=0 => fail) |
;scratched: ebx,ecx |
call DummyTest ; not returned for fail !!! |
.internal: |
xor ecx,ecx ; clear common header |
clear_event: |
.event equ esp |
push eax |
cmp [eax+APPOBJ.magic], 'EVNT' |
jne .fail |
cmp [eax+EVENT.id], ebx |
jne .fail |
mov eax, [eax+APPOBJ.pid] |
call pid_to_slot |
test eax, eax |
jz .fail |
shl eax, 8 |
add eax, SLOT_BASE+APP_EV_OFFSET |
mov edx, [.event] |
pushfd |
cli |
mov [eax+EVENT.magic],ecx |
mov [eax+EVENT.destroy],ecx |
mov [eax+EVENT.pid],ecx |
mov [eax+EVENT.id],ecx |
mov ebx,FreeEvents |
jmp RemoveEventTo |
cli ;remove event from events |
mov ebx, [edx+APPOBJ.fd] ;list (reset event) |
mov ecx, [edx+APPOBJ.bk] ;and clear events flag |
mov [ebx+APPOBJ.bk], ecx ;if no active events |
mov [ecx+APPOBJ.fd], ebx |
align 4 |
get_event_queue: |
;info: |
; êëèåíòñêàÿ ô-ÿ òåñòèðîâàíèÿ äëÿ get_event_ex |
;warning: |
; -don't use [TASK_BASE],[current_slot],[CURRENT_TASK] - it is not for your slot |
; -may be assumed, that interrupt are disabled |
; -it is not restriction for scratched registers |
;param: |
; ebx - àäðåñ APPDATA ñëîòà òåñòèðîâàíèÿ |
;retval: |
; eax - àäðåñ îáúåêòà EVENT (=0 => fail) |
add ebx,APP_EV_OFFSET |
mov eax,[ebx+APPOBJ.bk] ; âûáèðàåì ñ êîíöà, ïî ïðèíöèïó FIFO |
cmp eax,ebx ; empty ??? |
je get_event_alone.ret0 |
.ret: ret |
and [edx+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED) |
align 4 |
get_event_alone: |
;info: |
; êëèåíòñêàÿ ô-ÿ òåñòèðîâàíèÿ äëÿ wait_event |
;warning: |
; -don't use [TASK_BASE],[current_slot],[CURRENT_TASK] - it is not for your slot |
; -may be assumed, that interrupt are disabled |
; -it is not restriction for scratched registers |
;param: |
; ebx - àäðåñ APPDATA ñëîòà òåñòèðîâàíèÿ |
;retval: |
; eax - àäðåñ îáúåêòà EVENT (=0 => fail) |
mov eax,[ebx+APPDATA.wait_param] |
test byte[eax+EVENT.state+3], EVENT_SIGNALED shr 24 |
jnz .ret |
or byte[eax+EVENT.state+3], EVENT_WATCHED shr 24 |
.ret0: xor eax,eax ; NO event!!! |
.ret: ret |
dec [eax+APPDATA.ev_count-APP_EV_OFFSET] |
jnz @F |
and [eax+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED |
@@: |
add eax, (APP_OBJ_OFFSET-APP_EV_OFFSET) |
align 4 |
sys_sendwindowmsg: ;; f72 |
dec ebx |
jnz .ret ;subfunction==1 ? |
;pushfd ;à íàôèãà? |
cli |
sub ecx,2 |
je .sendkey |
loop .retf |
.sendbtn: |
cmp byte[BTN_COUNT],1 |
jae .result ;overflow |
inc byte[BTN_COUNT] |
mov [BTN_BUFF],edx |
jmp .result |
.sendkey: |
movzx eax,byte[KEY_COUNT] |
cmp al,120 |
jae .result ;overflow |
inc byte[KEY_COUNT] |
mov [KEY_COUNT+1+eax],dl |
.result: |
setae byte[esp+32] ;ñ÷èòàåì, ÷òî èñõîäíî: dword[esp+32]==72 |
.retf: ;popfd |
.ret: ret |
mov ecx, [eax+APPOBJ.fd] ;insert event into |
mov [edx+APPOBJ.fd], ecx ;objects list |
mov [edx+APPOBJ.bk], eax |
mov [eax+APPOBJ.fd], edx |
mov [ecx+APPOBJ.bk], edx |
popfd |
.fail: |
.done: |
add esp, 4 |
ret |
restore .event |
align 4 |
sys_getevent: ;; f11 |
mov ebx,[current_slot] ;ïîêà ýòî âîïðîñ, ÷åãî êóäû ñóâàòü.......... |
pushfd ; ýòî ñëåäñòâèå îáùåé êîíöåïöèè: ïóñòü ô-ÿ òåñòèðîâàíèÿ èìååò |
cli ; ïðàâî ðàññ÷èòûâàòü íà çàêðûòûå ïðåðûâàíèÿ, êàê ïðè âûçîâå èç shed |
sys_getevent: |
call get_event_for_app |
popfd |
mov [esp+32],eax |
ret |
align 4 |
sys_waitforevent: ;; f10 |
or ebx,-1 ; infinite timeout |
sys_wait_event_timeout: ;; f23 |
mov edx,get_event_for_app ; wait_test |
call Wait_events_ex ; ebx - timeout |
sys_waitforevent: |
or ebx, 0xFFFFFFFF ; infinite timeout |
jmp @f |
sys_wait_event_timeout: |
add ebx, [timer_ticks] |
@@: |
mov eax, [current_slot] |
mov [eax + APPDATA.wait_timeout], ebx |
call get_event_for_app |
test eax, eax |
jnz eventoccur |
mov eax, [TASK_BASE] |
mov [eax+TASKDATA.state], byte 5 |
call change_task |
mov eax, [event_sched] |
eventoccur: |
mov [esp+32],eax |
ret |
align 4 |
get_event_for_app: ;; used from f10,f11,f23 |
;info: |
; êëèåíòñêàÿ ô-ÿ òåñòèðîâàíèÿ äëÿ ïðèëîæåíèé (f10,f23) |
;warning: |
; -don't use [TASK_BASE],[current_slot],[CURRENT_TASK] - it is not for your slot |
; -may be assumed, that interrupt are disabled |
; -it is not restriction for scratched registers |
;param: |
; ebx - àäðåñ APPDATA ñëîòà òåñòèðîâàíèÿ |
;retval: |
; eax - íîìåð ñîáûòèÿ (=0 => no events) |
movzx edi,bh ; bh is assumed as [CURRENT_TASK] |
shl edi,5 |
add edi,CURRENT_TASK ; edi is assumed as [TASK_BASE] |
mov ecx,[edi+TASKDATA.event_mask] |
.loop: ; ïîêà íå èñ÷åðïàåì âñå áèòû ìàñêè |
bsr eax,ecx ; íàõîäèì íåíóëåâîé áèò ìàñêè (31 -> 0) |
jz .no_events ; èñ÷åðïàëè âñå áèòû ìàñêè, íî íè÷åãî íå íàøëè ??? |
btr ecx,eax ; ñáðàñûâàåì ïðîâåðÿåìûé áèò ìàñêè |
; ïåðåõîäèì íà îáðàáîò÷èê ýòîãî (eax) áèòà |
cmp eax,16 |
jae .IRQ ; eax=[16..31]=retvals, events irq0..irq15 |
cmp eax,9 |
jae .loop ; eax=[9..15], ignored |
cmp eax,3 |
je .loop ; eax=3, ignored |
ja .FlagAutoReset ; eax=[4..8], retvals=eax+1 |
cmp eax,1 |
jae .BtKy ; eax=[1,2], retvals=eax+1 |
.WndRedraw: ; eax=0, retval WndRedraw=1 |
cmp [edi-twdw+WDATA.fl_redraw],al ;al==0 |
jne .result |
jmp .loop |
.no_events: |
xor eax,eax |
ret |
.IRQ: |
;TODO: ñäåëàòü òàê æå, êàê è äëÿ FlagAutoReset (BgrRedraw,Mouse,IPC,Stack,Debug) |
mov edx,[irq_owner+eax*4-64] ; eax==16+irq |
cmp edx,[edi+TASKDATA.pid] |
jne .loop |
mov edx,eax |
shl edx,12 |
cmp dword[IRQ_SAVE+edx-0x10000],0 ; edx==(16+irq)*0x1000 |
je .loop ; empty ??? |
ret ; retval = eax |
.FlagAutoReset: ; retvals: BgrRedraw=5, Mouse=6, IPC=7, Stack=8, Debug=9 |
btr [ebx+APPDATA.event_mask],eax |
jnc .loop |
.result: ; retval = eax+1 |
sys_sendwindowmsg: |
dec eax |
jnz .ret |
cmp ebx, 3 |
jz .sendbtn |
cmp ebx, 2 |
jnz .ret |
.sendkey: |
pushf |
cli |
movzx eax, byte [KEY_COUNT] |
cmp al, 120 |
jae .overflow |
inc eax |
mov [KEY_COUNT], al |
mov [KEY_COUNT+eax], cl |
jmp .ok |
.overflow: |
popf |
mov dword [esp+36], 1 |
ret |
.BtKy: |
movzx edx,bh |
movzx edx, word[WIN_STACK+edx*2] |
je .Keys ; eax=1, retval Keys=2 |
.Buttons: ; eax=2, retval Buttons=3 |
.sendbtn: |
pushf |
cli |
cmp byte[BTN_COUNT],0 |
je .loop ; empty ??? |
cmp edx,[TASK_COUNT] |
jne .loop ; not Top ??? |
cmp dword[BTN_BUFF],0xFFFF ;-ID for Minimize-Button of Form |
jne .result |
jnz .overflow |
mov byte [BTN_COUNT], 1 |
mov [BTN_BUFF], ecx |
.ok: |
popf |
and dword [esp+36], 0 |
.ret: |
ret |
get_event_for_app: |
pushad |
mov edi,[TASK_BASE] ; WINDOW REDRAW |
test [edi+TASKDATA.event_mask], 1 |
jz no_eventoccur1 |
;mov edi,[TASK_BASE] |
cmp [edi-twdw+WDATA.fl_redraw],byte 0 |
je no_eventoccur1 |
popad |
mov eax,1 |
ret |
no_eventoccur1: |
;mov edi,[TASK_BASE] ; KEY IN BUFFER |
test [edi+TASKDATA.event_mask],dword 2 |
jz no_eventoccur2 |
mov ecx, [CURRENT_TASK] |
movzx edx,word [WIN_STACK+ecx*2] |
mov eax, [TASK_COUNT] |
cmp eax,edx |
jne no_eventoccur2x |
cmp [KEY_COUNT],byte 0 |
je no_eventoccur2x |
eventoccur2: |
popad |
mov eax,2 |
ret |
no_eventoccur2x: |
mov eax, hotkey_buffer |
@@: |
cmp [eax], ecx |
jz eventoccur2 |
add eax, 8 |
cmp eax, hotkey_buffer+120*8 |
jb @b |
no_eventoccur2: |
;mov edi,[TASK_BASE] ; BUTTON IN BUFFER |
test [edi+TASKDATA.event_mask],dword 4 |
jz no_eventoccur3 |
cmp [BTN_COUNT],byte 0 |
je no_eventoccur3 |
mov ecx, [CURRENT_TASK] |
movzx edx, word [WIN_STACK+ecx*2] |
mov eax, [TASK_COUNT] |
cmp eax,edx |
jnz no_eventoccur3 |
popad |
mov eax,[BTN_BUFF] |
cmp eax,65535 |
je no_event_1 |
mov eax,3 |
ret |
no_event_1: |
mov [window_minimize],1 |
dec byte[BTN_COUNT] |
jmp .loop |
.Keys: ; eax==1 |
cmp edx,[TASK_COUNT] |
jne @f ; not Top ??? |
cmp [KEY_COUNT],al ; al==1 |
jae .result ; not empty ??? |
@@: mov edx, hotkey_buffer |
@@: cmp [edx],bh ; bh - slot for testing |
je .result |
add edx,8 |
cmp edx, hotkey_buffer+120*8 |
jb @b |
jmp .loop |
;end. |
mov [BTN_COUNT],byte 0 |
xor eax, eax |
ret |
no_eventoccur3: |
;mov edi,[TASK_BASE] ; mouse event |
mov eax, [CURRENT_TASK] |
shl eax, 8 |
add eax, SLOT_BASE |
test [edi+TASKDATA.event_mask],dword 00100000b |
jz no_mouse_event |
test [eax+APPDATA.event_mask],dword 00100000b |
jz no_mouse_event |
and [eax+APPDATA.event_mask],dword (not 00100000b) |
popad |
mov eax,6 |
ret |
no_mouse_event: |
;mov edi,[TASK_BASE] ; DESKTOP BACKGROUND REDRAW |
test [edi+TASKDATA.event_mask], 16 |
jz no_eventoccur5 |
; cmp [REDRAW_BACKGROUND],byte 2 |
; jnz no_eventoccur5 |
test [eax+APPDATA.event_mask], 16 |
jz no_eventoccur5 |
and [eax+APPDATA.event_mask], not 16 |
popad |
mov eax,5 |
ret |
no_eventoccur5: |
;mov edi,[TASK_BASE] ; IPC |
test [edi+TASKDATA.event_mask],dword 01000000b |
jz no_ipc |
test [eax+APPDATA.event_mask],dword 01000000b |
jz no_ipc |
and [eax+APPDATA.event_mask],dword 0xffffffff-01000000b |
popad |
mov eax,7 |
ret |
no_ipc: |
;mov edi,[TASK_BASE] ; STACK |
test [edi+TASKDATA.event_mask],dword 10000000b |
jz no_stack_event |
test [eax+APPDATA.event_mask],dword 10000000b |
jz no_stack_event |
and [eax+APPDATA.event_mask],dword 0xffffffff-10000000b |
popad |
mov eax,8 |
ret |
no_stack_event: |
test byte [edi+TASKDATA.event_mask+1], 1 ; DEBUG |
jz .test_IRQ |
test byte [eax+APPDATA.event_mask+1], byte 1 |
jz .test_IRQ |
and byte [eax+APPDATA.event_mask+1], not 1 |
popad |
mov eax, 9 |
ret |
;.test_ext: |
; mov eax, [CURRENT_TASK] |
; shl eax, 8 |
; test dword [eax+SLOT_BASE+APPDATA.event_mask], EVENT_EXTENDED |
; jz .test_IRQ |
; popad |
; mov eax, 10 |
; ret |
.test_IRQ: |
cmp dword [edi+TASKDATA.event_mask], 0xFFFF |
jbe no_events |
mov esi,IRQ_SAVE ; IRQ'S AND DATA |
mov ebx,0x00010000 |
xor ecx, ecx |
irq_event_test: |
mov edi,[TASK_BASE] |
test [edi+TASKDATA.event_mask],ebx |
jz no_irq_event |
mov edi,ecx |
shl edi,2 |
add edi,irq_owner |
mov edx,[edi] |
mov eax,[TASK_BASE] |
mov eax,[eax+TASKDATA.pid] |
cmp edx,eax |
jne no_irq_event |
cmp [esi],dword 0 |
jz no_irq_event |
mov eax,ecx |
add eax,16 |
mov [esp+28],eax |
popad |
ret |
no_irq_event: |
add esi,0x1000 |
shl ebx,1 |
inc ecx |
cmp ecx,16 |
jb irq_event_test |
no_events: |
popad |
xor eax, eax |
ret |
/kernel/branches/net/gui/window.inc |
---|
1166,10 → 1166,10 |
ret |
;iglobal |
; window_moving db 'K : Window - move/resize',13,10,0 |
; window_moved db 'K : Window - done',13,10,0 |
;endg |
iglobal |
window_moving db 'K : Window - move/resize',13,10,0 |
window_moved db 'K : Window - done',13,10,0 |
endg |
; check window touch |
align 4 |
1316,10 → 1316,10 |
.continue: |
; push esi |
; mov esi, window_moving |
; call sys_msg_board_str |
; pop esi |
push esi |
mov esi, window_moving |
call sys_msg_board_str |
pop esi |
mov ecx, [timer_ticks] ; double-click ? |
mov edx, ecx |
1684,8 → 1684,8 |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
mov [MOUSE_DOWN],byte 0 ; react to mouse up/down |
; mov esi,window_moved |
; call sys_msg_board_str |
mov esi,window_moved |
call sys_msg_board_str |
popad |
/kernel/branches/net/init.inc |
---|
14,9 → 14,6 |
align 4 |
proc mem_test |
; if we have BIOS with fn E820, skip the test |
cmp dword [BOOT_VAR-OS_BASE + 0x9100], 0 |
jnz .ret |
mov eax, cr0 |
and eax, not (CR0_CD+CR0_NW) |
32,91 → 29,37 |
cmp dword [edi], 'TEST' |
xchg ebx, dword [edi] |
je @b |
mov [MEM_AMOUNT-OS_BASE], edi |
and eax, not (CR0_CD+CR0_NW) ;enable caching |
mov cr0, eax |
inc dword [BOOT_VAR-OS_BASE + 0x9100] |
xor eax, eax |
mov [BOOT_VAR-OS_BASE + 0x9104], eax |
mov [BOOT_VAR-OS_BASE + 0x9108], eax |
mov [BOOT_VAR-OS_BASE + 0x910C], edi |
mov [BOOT_VAR-OS_BASE + 0x9110], eax |
.ret: |
mov eax, edi |
ret |
endp |
align 4 |
proc init_mem |
; calculate maximum allocatable address and number of allocatable pages |
mov edi, BOOT_VAR-OS_BASE + 0x9104 |
mov ecx, [edi-4] |
xor esi, esi ; esi will hold total amount of memory |
xor edx, edx ; edx will hold maximum allocatable address |
.calcmax: |
; round all to pages |
mov eax, [edi] |
test eax, 0xFFF |
jz @f |
neg eax |
and eax, 0xFFF |
add [edi], eax |
adc dword [edi+4], 0 |
sub [edi+8], eax |
sbb dword [edi+12], 0 |
jc .unusable |
@@: |
and dword [edi+8], not 0xFFF |
jz .unusable |
; ignore memory after 4 Gb |
cmp dword [edi+4], 0 |
jnz .unusable |
mov eax, [edi] |
cmp dword [edi+12], 0 |
jnz .overflow |
add eax, [edi+8] |
jnc @f |
.overflow: |
mov eax, 0xFFFFF000 |
@@: |
cmp edx, eax |
jae @f |
mov eax, [MEM_AMOUNT-OS_BASE] |
mov [pg_data.mem_amount-OS_BASE], eax |
shr eax, 12 |
mov edx, eax |
@@: |
sub eax, [edi] |
mov [edi+8], eax |
add esi, eax |
jmp .usable |
.unusable: |
and dword [edi+8], 0 |
.usable: |
add edi, 20 |
loop .calcmax |
.calculated: |
mov [MEM_AMOUNT-OS_BASE], esi |
mov [pg_data.mem_amount-OS_BASE], esi |
shr esi, 12 |
mov [pg_data.pages_count-OS_BASE], esi |
mov [pg_data.pages_count-OS_BASE], eax |
shr eax, 3 |
mov [pg_data.pagemap_size-OS_BASE], eax |
shr edx, 12 |
add edx, 31 |
and edx, not 31 |
shr edx, 3 |
mov [pg_data.pagemap_size-OS_BASE], edx |
add eax, (sys_pgmap-OS_BASE)+4095 |
and eax, not 4095 |
mov [tmp_page_tabs], eax |
add edx, (sys_pgmap-OS_BASE)+4095 |
and edx, not 4095 |
mov [tmp_page_tabs], edx |
mov edx, esi |
and edx, -1024 |
cmp edx, (OS_BASE/4096) |
jbe @F |
mov edx, (OS_BASE/4096) |
jmp .set |
@@: |
cmp edx, (HEAP_BASE+HEAP_MIN_SIZE)/4096 |
cmp edx, (HEAP_MIN_SIZE/4096) |
jae .set |
mov edx, (HEAP_BASE+HEAP_MIN_SIZE)/4096 |
mov edx, (HEAP_MIN_SIZE/4096) |
.set: |
mov [pg_data.kernel_pages-OS_BASE], edx |
shr edx, 10 |
187,63 → 130,14 |
align 4 |
proc init_page_map |
; mark all memory as unavailable |
mov edi, sys_pgmap-OS_BASE |
mov ecx, [pg_data.pagemap_size-OS_BASE] |
shr ecx, 2 |
xor eax, eax |
or eax, -1 |
cld |
rep stosd |
; scan through memory map and mark free areas as available |
mov ebx, BOOT_VAR-OS_BASE + 0x9104 |
mov edx, [ebx-4] |
.scanmap: |
mov ecx, [ebx+8] |
shr ecx, 12 ; ecx = number of pages |
jz .next |
mov edi, [ebx] |
shr edi, 12 ; edi = first page |
mov eax, edi |
neg eax |
shr edi, 5 |
add edi, sys_pgmap-OS_BASE |
and eax, 31 |
jz .startok |
sub ecx, eax |
jbe .onedword |
push ecx |
mov ecx, eax |
xor eax, eax |
inc eax |
shl eax, cl |
dec eax |
or [edi], eax |
add edi, 4 |
pop ecx |
.startok: |
push ecx |
shr ecx, 5 |
or eax, -1 |
rep stosd |
pop ecx |
and ecx, 31 |
not eax |
shl eax, cl |
or [edi], eax |
jmp .next |
.onedword: |
add ecx, eax |
@@: |
dec eax |
bts [edi], eax |
loop @b |
.next: |
add ebx, 20 |
dec edx |
jnz .scanmap |
; mark kernel memory as allocated (unavailable) |
mov ecx, [tmp_page_tabs] |
mov edx, [pg_data.pages_count-OS_BASE] |
shr ecx, 12 |
261,7 → 155,7 |
mov ecx, ebx |
and ecx, 31 |
shl eax, cl |
and [edi], eax |
mov [edi], eax |
add edi, OS_BASE |
mov [page_start-OS_BASE], edi; |
/kernel/branches/net/kernel32.inc |
---|
121,9 → 121,9 |
db 5 dup(?) |
.fpu_state dd ? ;+16 |
.ev_count_ dd ? ;unused ;+20 |
.exc_handler dd ? ;+24 |
.except_mask dd ? ;+28 |
.ev_count dd ? ;+20 |
.fpu_handler dd ? ;+24 |
.sse_handler dd ? ;+28 |
.pl0_stack dd ? ;unused ;+32 |
.heap_base dd ? ;+36 |
.heap_top dd ? ;+40 |
138,11 → 138,9 |
.cur_dir dd ? ;+80 |
.wait_timeout dd ? ;+84 |
.saved_esp0 dd ? ;+88 |
.wait_begin dd ? ;+92 +++ |
.wait_test dd ? ;+96 +++ |
.wait_param dd ? ;+100 +++ |
db 24 dup(?) ;+104 |
db 36 dup(?) ;+92 |
.wnd_shape dd ? ;+128 |
.wnd_shape_scale dd ? ;+132 |
dd ? ;+136 |
/kernel/branches/net/macros.inc |
---|
98,9 → 98,3 |
end if |
} |
; \end{diamond}[29.09.2006] |
macro Mov op1,op2,op3 ; op1 = op2 = op3 |
{ |
mov op2,op3 |
mov op1,op2 |
} |
/kernel/branches/net/makefile |
---|
1,7 → 1,7 |
FASM=fasm |
FLAGS=-m 65536 |
languages=en|ru|ge|et |
drivers_src=sound sis infinity uart ati2d vmode com_mouse |
drivers_src=sound sis infinity ensoniq ps2mouse uart ati2d vmode |
skins_src=default |
.PHONY: all kernel drivers skins clean |
/kernel/branches/net/memmap.inc |
---|
23,18 → 23,13 |
; 0x9046 - word - flags |
; 0:907F byte number of BIOS hard disks |
; 0:9080 Nbytes BIOS hard disks |
; 0:9100 word available physical memory map: number of blocks |
; 0:9104 available physical memory map: blocks |
; |
; Runtime: |
; |
; 0x00000000 -> 0x7FFFFFFF application 2Gb |
; 0x80000000 -> 0FFF physical page zero - do not write |
; (used by int 13h in some configurations) |
; 0x80000000 -> 1FFF window_data - 256 entries |
; |
; 0x80001000 -> 2FFF window_data - 256 entries |
; |
; 0000 dword x start |
; 0004 dword y start |
; 0008 dword x size |
44,6 → 39,8 |
; 0018 dword color of frames |
; 001C dword window flags, +30 = window drawn, +31 redraw flag |
; |
; 2000 -> 2FFF free |
; |
; 3000 -> 4FFF task list - 256 entries |
; |
; 00 dword process count |
73,9 → 70,9 |
; |
; A400 -> B0FF free |
; B100 -> B307 IDT for int_0x00..int_0x40 |
; B100 -> B2FF IDT |
; B308 -> BFFF free |
; B300 -> BFFF free |
; C000 -> C3FF window stack C000 no of windows - all in words |
; C402 -> C7FF window position in stack |
/kernel/branches/net/video/vga.inc |
---|
113,7 → 113,7 |
loop palnew |
ret |
align 4 |
uglobal |
novesachecksum dd 0x0 |
EGA_counter db 0 |
123,7 → 123,7 |
temp: |
.cx dd 0 |
endg |
align 4 |
checkVga_N13: |
cmp [SCR_MODE],dword 0x13 |