1)fix user_realloc()

2)fix mouse events 


git-svn-id: svn://kolibrios.org@455 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-04-10 12:22:37 +00:00
parent 1db510e6a9
commit 0305115a3b
7 changed files with 62 additions and 51 deletions

View File

@ -321,11 +321,12 @@ sys_pgmap equ (OS_BASE+0x00052000)
new_app_base equ 0;
twdw equ (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
if 0
REG_SS equ (RING0_STACK_SIZE-4)
REG_APP_ESP equ (RING0_STACK_SIZE-8)
REG_EFLAGS equ (RING0_STACK_SIZE-12)
@ -341,6 +342,23 @@ REG_EBP equ (RING0_STACK_SIZE-48)
REG_ESI equ (RING0_STACK_SIZE-52)
REG_EDI equ (RING0_STACK_SIZE-56)
REG_RET equ (RING0_STACK_SIZE-60) ;irq0.return
end if
REG_SS equ (RING0_STACK_SIZE-4)
REG_APP_ESP equ (RING0_STACK_SIZE-8)
REG_EFLAGS equ (RING0_STACK_SIZE-12)
REG_CS equ (RING0_STACK_SIZE-16)
REG_EIP equ (RING0_STACK_SIZE-20)
REG_EAX equ (RING0_STACK_SIZE-24)
REG_ECX equ (RING0_STACK_SIZE-28)
REG_EDX equ (RING0_STACK_SIZE-32)
REG_EBX equ (RING0_STACK_SIZE-36)
REG_ESP equ (RING0_STACK_SIZE-40) ;RING0_STACK_SIZE-20
REG_EBP equ (RING0_STACK_SIZE-44)
REG_ESI equ (RING0_STACK_SIZE-48)
REG_EDI equ (RING0_STACK_SIZE-52)
REG_RET equ (RING0_STACK_SIZE-56) ;irq0.return
PG_UNMAP equ 0x000
PG_MAP equ 0x001

View File

@ -864,16 +864,15 @@ user_realloc:
jnz .nofreeall
mov eax, [page_tabs+ecx*4]
and eax, not 0xFFF
mov edx, [CURRENT_TASK]
shl edx, 8
mov ebx, [SLOT_BASE+APPDATA.mem_size+edx]
mov edx, [current_slot]
mov ebx, [APPDATA.mem_size+edx]
sub ebx, eax
add ebx, 0x1000
or al, FREE_BLOCK
mov [page_tabs+ecx*4], eax
push esi edi
mov esi, [SLOT_BASE+APPDATA.heap_base+edx]
mov edi, [SLOT_BASE+APPDATA.heap_top+edx]
mov esi, [APPDATA.heap_base+edx]
mov edi, [APPDATA.heap_top+edx]
call update_mem_size
call user_normalize
pop edi esi
@ -886,10 +885,9 @@ user_realloc:
shr ebx, 12
sub ebx, edx
push ebx ecx edx
mov edx, [CURRENT_TASK]
shl edx, 8
mov edx, [current_slot]
shl ebx, 12
sub ebx, [SLOT_BASE+APPDATA.mem_size+edx]
sub ebx, [APPDATA.mem_size+edx]
neg ebx
call update_mem_size
pop edx ecx ebx
@ -901,9 +899,8 @@ user_realloc:
shl ebx, 12
jz .ret
push esi
mov esi, [CURRENT_TASK]
shl esi, 8
mov esi, [SLOT_BASE+APPDATA.heap_top+esi]
mov esi, [current_slot]
mov esi, [APPDATA.heap_top+esi]
shr esi, 12
@@:
cmp edx, esi
@ -925,9 +922,8 @@ user_realloc:
ret
.realloc_add:
; get some additional memory
mov eax, [CURRENT_TASK]
shl eax, 8
mov eax, [SLOT_BASE+APPDATA.heap_top+eax]
mov eax, [current_slot]
mov eax, [APPDATA.heap_top+eax]
shr eax, 12
cmp edx, eax
jae .cant_inplace
@ -958,19 +954,17 @@ user_realloc:
cld
rep stosd
pop edi
mov edx, [CURRENT_TASK]
shl edx, 8
mov edx, [current_slot]
shl ebx, 12
add ebx, [SLOT_BASE+APPDATA.mem_size+edx]
add ebx, [APPDATA.mem_size+edx]
call update_mem_size
pop eax edx ecx
ret
.cant_inplace:
push esi edi
mov eax, [CURRENT_TASK]
shl eax, 8
mov esi, [SLOT_BASE+APPDATA.heap_base+eax]
mov edi, [SLOT_BASE+APPDATA.heap_top+eax]
mov eax, [current_slot]
mov esi, [APPDATA.heap_base+eax]
mov edi, [APPDATA.heap_top+eax]
shr esi, 12
shr edi, 12
sub ebx, ecx
@ -1009,7 +1003,6 @@ user_realloc:
inc esi
mov eax, esi
shl eax, 12
sub eax, new_app_base
push eax
mov eax, [page_tabs+ecx*4]
and eax, not 0xFFF
@ -1030,10 +1023,9 @@ user_realloc:
dec edx
jnz @b
push ebx
mov edx, [CURRENT_TASK]
shl edx, 8
mov edx, [current_slot]
shl ebx, 12
add ebx, [SLOT_BASE+APPDATA.mem_size+edx]
add ebx, [APPDATA.mem_size+edx]
call update_mem_size
pop ebx
@@:

View File

@ -13,7 +13,7 @@ $Revision: 434 $
align 32
irq0:
pushfd
; pushfd
pushad
mov ax, app_data ;
mov ds, ax
@ -40,7 +40,7 @@ irq0:
mov [DONT_SWITCH], byte 0
popad
popfd
; popfd
iretd
.change_task:
@ -60,7 +60,7 @@ irq0:
.return:
popad
popfd
; popfd
iretd
@ -197,6 +197,7 @@ do_change_task:
shl ebx, 8
add ebx, SLOT_BASE
mov [current_slot], ebx
shl esi, 8
add esi, SLOT_BASE

View File

@ -1018,7 +1018,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\
mov [ebx+REG_ECX], eax
mov [ebx+REG_EAX], eax
mov [ebx+REG_EFL_2], dword 0x1002
; mov [ebx+REG_EFL_2], dword 0x1002
mov eax, [esi+0x08] ;app_eip
mov [ebx+REG_EIP], eax ;app_entry

View File

@ -319,6 +319,8 @@ windowtypechanged rd 1
hd_entries rd 1 ;unused ? 0xfe10
;* start code - Mario79
mouse_active rd 1
mouse_pause rd 1
MouseTickCounter rd 1
ps2_mouse_detected rb 1

View File

@ -574,20 +574,20 @@ get_event_for_app:
no_eventoccur3:
;mov edi,[TASK_BASE] ; mouse event
test [edi+TASKDATA.event_mask],dword 00100000b
jz no_mouse_event
mov eax,[current_slot]
test [eax+APPDATA.event_mask],dword 00100000b
mov eax, [CURRENT_TASK]
shl eax, 8
test [eax+SLOT_BASE+APPDATA.event_mask],dword 00100000b
jz no_mouse_event
and [eax+APPDATA.event_mask],dword 0xffffffff-00100000b
and [eax+SLOT_BASE+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],dword 16
jz no_eventoccur5

View File

@ -657,6 +657,7 @@ include 'vmodeld.inc'
mov [CURRENT_TASK],dword 1
mov [TASK_COUNT],dword 1
mov [current_slot], SLOT_BASE+256
mov [TASK_BASE],dword TASK_DATA
mov [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
mov [TASK_DATA+TASKDATA.pid], 1 ; process id number
mov [TASK_DATA+TASKDATA.mem_start], 0 ; process base address
@ -3322,9 +3323,6 @@ checkpixel:
pop edx eax
ret
uglobal
mouse_active db 0
endg
iglobal
cpustring db '/RD/1/CPU',0
endg
@ -3346,6 +3344,7 @@ checkmisc:
xor edx,edx ; no flags
call fs_RamdiskExecute.flags
mov [ctrl_alt_del], 0
nocpustart:
cmp [mouse_active], 1
jne mouse_not_active
@ -3354,11 +3353,10 @@ checkmisc:
mov ecx, [TASK_COUNT]
set_mouse_event:
add edi, 256
or [edi+SLOT_BASE+APPDATA.event_mask], dword 00100000b
or [edi+SLOT_BASE+APPDATA.event_mask], dword 100000b
loop set_mouse_event
mouse_not_active:
cmp [REDRAW_BACKGROUND],byte 0 ; background update ?
jz nobackgr
cmp [background_defined], 0