From 58a419e8555aae778f7ccaedc6c35d4ac0a17f3b Mon Sep 17 00:00:00 2001 From: "Evgeny Grechnikov (Diamond)" Date: Mon, 4 Jun 2007 08:58:32 +0000 Subject: [PATCH] Sysfunction 23v does not require task switch when waiting git-svn-id: svn://kolibrios.org@531 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/sched.inc | 9 +++++- kernel/trunk/gui/event.inc | 55 ++++++++++++------------------------- kernel/trunk/kernel.asm | 6 ++-- kernel/trunk/kernel32.inc | 3 +- 4 files changed, 31 insertions(+), 42 deletions(-) diff --git a/kernel/trunk/core/sched.inc b/kernel/trunk/core/sched.inc index 64a7238d5e..40a76ced5b 100644 --- a/kernel/trunk/core/sched.inc +++ b/kernel/trunk/core/sched.inc @@ -172,7 +172,14 @@ find_next_task: jne .noevents call get_event_for_app test eax, eax - jz .waiting_for_event + jnz @f + 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: diff --git a/kernel/trunk/gui/event.inc b/kernel/trunk/gui/event.inc index 03f2b91e8e..9785103644 100644 --- a/kernel/trunk/gui/event.inc +++ b/kernel/trunk/gui/event.inc @@ -469,53 +469,34 @@ sys_getevent: mov [esp+36],eax ret - -align 4 -sys_wait_event_timeout: - - mov ebx,[timer_ticks] - add ebx,eax - cmp ebx,[timer_ticks] - jna .swfet2 -.swfet1: - call get_event_for_app - test eax,eax - jne .eventoccur_time - call change_task - cmp ebx,[timer_ticks] - jg .swfet1 -.swfet2: - xor eax,eax -.eventoccur_time: - mov [esp+36],eax - ret - - -align 4 - sys_waitforevent: + or eax, 0xFFFFFFFF ; infinite timeout + jmp @f - call get_event_for_app - test eax,eax - jne eventoccur - newwait: +sys_wait_event_timeout: + add eax, [timer_ticks] +@@: + mov ebx, [current_slot] + mov [ebx + APPDATA.wait_timeout], eax + 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, [TASK_BASE] + mov [eax+TASKDATA.state], byte 5 + call change_task - mov eax, [event_sched] - - eventoccur: - mov [esp+36],eax - ret + mov eax, [event_sched] +eventoccur: + mov [esp+36], eax + ret get_event_for_app: pushad mov edi,[TASK_BASE] ; WINDOW REDRAW - test [edi+TASKDATA.event_mask],dword 1 + test [edi+TASKDATA.event_mask], 1 jz no_eventoccur1 ;mov edi,[TASK_BASE] cmp [edi-twdw+WDATA.fl_redraw],byte 0 diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 4dba9826dc..542553052d 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -107,7 +107,7 @@ use16 org 0x0 jmp start_of_code -version db 'Kolibri OS version 0.7.0.0 pre ',13,10,13,10,0 +version db 'Kolibri OS version 0.6.5.0 ',13,10,13,10,0 include "boot/bootstr.inc" ; language-independent boot messages include "boot/preboot.inc" @@ -2286,7 +2286,7 @@ endg iglobal version_inf: - db 0,7,0,0 ; version 0.7.0.0 + db 0,6,5,0 ; version 0.6.5.0 db UID_KOLIBRI db 'Kolibri',0 version_end: @@ -2454,7 +2454,7 @@ sys_getbackground: jnz nogb1 mov eax,[BgrDataWidth] shl eax,16 - mov ax,[BgrDataWidth] + mov ax,[BgrDataHeight] mov [esp+36],eax ret nogb1: diff --git a/kernel/trunk/kernel32.inc b/kernel/trunk/kernel32.inc index a747fd9570..ddfed01481 100644 --- a/kernel/trunk/kernel32.inc +++ b/kernel/trunk/kernel32.inc @@ -127,8 +127,9 @@ struc APPDATA .io_map rd 2 ;+68 .dbg_state dd ? ;+76 .cur_dir dd ? ;+80 + .wait_timeout dd ? ;+84 - db 44 dup(?) ;+84 + db 40 dup(?) ;+88 .wnd_shape dd ? ;+128 .wnd_shape_scale dd ? ;+132