initial deleting cross regisres in system calls

git-svn-id: svn://kolibrios.org@671 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Iliya Mihailov (Ghost) 2007-11-12 23:08:54 +00:00
parent 4cc19614ca
commit 4f0542fd62
3 changed files with 332 additions and 428 deletions

View File

@ -7,6 +7,20 @@
$Revision$ $Revision$
; Old style system call converter
align 16
cross_order:
; load all registers in crossed order
mov eax, ebx
mov ebx, ecx
mov ecx, edx
mov edx, esi
mov esi, edi
mov edi, [esp+28 + 4]
and edi,0xff
call dword [servetable+edi*4]
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
@ -14,36 +28,15 @@ $Revision$
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 16 align 16
i40: i40:
; diamond, 27.03.2007: handler does not require disabled interrupts pushad
; so interrupts remain enabled when calling int 0x40 cld
pushad and eax, 0xff
cld call dword [servetable2 + eax * 4]
popad
; mov ax, word app_data iretd
; mov ds, ax
; mov es, ax
; load all registers in crossed order
mov eax, ebx
mov ebx, ecx
mov ecx, edx
mov edx, esi
mov esi, edi
mov edi, [esp+28]
; enable interupts - a task switch or an IRQ _CAN_ interrupt i40 handler
; sti
push eax
and edi,0xff
call dword [servetable+edi*4]
pop eax
popad
iretd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; SYSENTER ENTRY ;; ;; SYSENTER ENTRY ;;
@ -61,17 +54,8 @@ sysenter_entry:
pushad pushad
cld cld
mov eax, ebx and eax, 0xff
mov ebx, ecx call dword [servetable2 + eax * 4]
mov ecx, edx
mov edx, esi
mov esi, edi
mov edi, [esp + 28]
push eax
and edi, 0xff
call dword [servetable + edi * 4]
pop eax
popad popad
;------------------ ;------------------
@ -99,37 +83,15 @@ syscall_entry:
sti sti
push ecx push ecx
mov ecx, [ecx] mov ecx, [ecx]
; mov [ss:sysenter_stack - 4], eax
; mov eax, [ss:CURRENT_TASK]
; shl eax, 8
; mov eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack]
; lea esp, [eax + RING0_STACK_SIZE] ; configure ESP
; mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app
;------------------ ;------------------
pushad pushad
cld cld
; mov ax, word app_data and eax, 0xff
; mov ds, ax call dword [servetable2 + eax * 4]
; mov es, ax
mov eax, ebx
mov ebx, ecx
mov ecx, edx
mov edx, esi
mov esi, edi
mov edi, [esp + 28]
push eax
and edi, 0xff
call dword [servetable + edi * 4]
pop eax
popad popad
;------------------ ;------------------
mov ecx, [ss:esp+4] mov ecx, [ss:esp+4]
pop esp pop esp
sysret sysret
@ -143,45 +105,45 @@ iglobal
dd sys_drawwindow ; 0-DrawWindow dd sys_drawwindow ; 0-DrawWindow
dd syscall_setpixel ; 1-SetPixel dd syscall_setpixel ; 1-SetPixel
dd sys_getkey ; 2-GetKey dd 0
dd sys_clock ; 3-GetTime dd 0
dd syscall_writetext ; 4-WriteText dd syscall_writetext ; 4-WriteText
dd delay_hs ; 5-DelayHs dd delay_hs ; 5-DelayHs
dd syscall_openramdiskfile ; 6-OpenRamdiskFile dd syscall_openramdiskfile ; 6-OpenRamdiskFile
dd syscall_putimage ; 7-PutImage dd 0
dd sys_button ; 8-DefineButton dd sys_button ; 8-DefineButton
dd sys_cpuusage ; 9-GetProcessInfo dd sys_cpuusage ; 9-GetProcessInfo
dd sys_waitforevent ; 10-WaitForEvent dd 0
dd sys_getevent ; 11-CheckForEvent dd 0
dd sys_redrawstat ; 12-BeginDraw and EndDraw dd 0
dd syscall_drawrect ; 13-DrawRect dd 0
dd syscall_getscreensize ; 14-GetScreenSize dd 0
dd sys_background ; 15-bgr dd sys_background ; 15-bgr
dd sys_cachetodiskette ; 16-FlushFloppyCache dd 0
dd sys_getbutton ; 17-GetButton dd 0
dd sys_system ; 18-System Services dd sys_system ; 18-System Services
dd paleholder;undefined_syscall ; 19-reserved dd 0
dd sys_midi ; 20-ResetMidi and OutputMidi dd sys_midi ; 20-ResetMidi and OutputMidi
dd sys_setup ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,. dd sys_setup ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
dd sys_settime ; 22-setting date,time,clock and alarm-clock dd sys_settime ; 22-setting date,time,clock and alarm-clock
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent dd 0
dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist
dd sys_sb16 ; 25-SetSb16 dd sys_sb16 ; 25-SetSb16
dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,. dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
dd undefined_syscall ; 27-reserved dd 0
dd sys_sb16II ; 28-SetSb16 dd sys_sb16II ; 28-SetSb16
dd sys_date ; 29-GetDate dd 0
dd sys_current_directory ; 30-Get/SetCurrentDirectory dd sys_current_directory ; 30-Get/SetCurrentDirectory
dd undefined_syscall ; 31-reserved dd 0
dd syscall_delramdiskfile ; 32-DelRamdiskFile dd syscall_delramdiskfile ; 32-DelRamdiskFile
dd syscall_writeramdiskfile; 33-WriteRamdiskFile dd syscall_writeramdiskfile; 33-WriteRamdiskFile
dd undefined_syscall ; 34-reserved dd 0
dd syscall_getpixel ; 35-GetPixel dd 0
dd syscall_readstring ; 36-ReadString (not yet ready) dd 0
dd readmousepos ; 37-GetMousePosition_ScreenRelative,. dd readmousepos ; 37-GetMousePosition_ScreenRelative,.
dd syscall_drawline ; 38-DrawLine dd syscall_drawline ; 38-DrawLine
dd sys_getbackground ; 39-GetBackgroundSize,ReadBgrData,. dd sys_getbackground ; 39-GetBackgroundSize,ReadBgrData,.
dd set_app_param ; 40-WantEvents dd 0
dd syscall_getirqowner ; 41-GetIrqOwner dd syscall_getirqowner ; 41-GetIrqOwner
dd get_irq_data ; 42-ReadIrqData dd get_irq_data ; 42-ReadIrqData
dd sys_outport ; 43-SendDeviceData dd sys_outport ; 43-SendDeviceData
@ -195,12 +157,12 @@ iglobal
dd syscall_threads ; 51-Threads dd syscall_threads ; 51-Threads
dd stack_driver_stat ; 52-Stack driver status dd stack_driver_stat ; 52-Stack driver status
dd socket ; 53-Socket interface dd socket ; 53-Socket interface
dd user_events ; 54-User events dd 0
dd sound_interface ; 55-Sound interface dd sound_interface ; 55-Sound interface
dd undefined_syscall ; 56-reserved dd 0
dd sys_pcibios ; 57-reserved dd sys_pcibios ; 57-PCI BIOS32
dd file_system ; 58-Common file system interface dd file_system ; 58-Common file system interface
dd undefined_syscall ; 59-reserved dd 0
dd sys_IPC ; 60-Inter Process Communication dd sys_IPC ; 60-Inter Process Communication
dd sys_gs ; 61-Direct graphics access dd sys_gs ; 61-Direct graphics access
dd sys_pci ; 62-PCI functions dd sys_pci ; 62-PCI functions
@ -215,7 +177,86 @@ iglobal
dd syscall_windowsettings ; 71-Window settings dd syscall_windowsettings ; 71-Window settings
dd sys_sendwindowmsg ; 72-Send window message dd sys_sendwindowmsg ; 72-Send window message
times 255 - ( ($-servetable) /4 ) dd undefined_syscall ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; NEW SYSTEM FUNCTIONS TABLE ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 4
servetable2:
dd cross_order ; 0-DrawWindow
dd cross_order ; 1-SetPixel
dd sys_getkey ; 2-GetKey
dd sys_clock ; 3-GetTime
dd cross_order ; 4-WriteText
dd cross_order ; 5-DelayHs
dd cross_order ; 6-OpenRamdiskFile
dd syscall_putimage ; 7-PutImage
dd cross_order ; 8-DefineButton
dd cross_order ; 9-GetProcessInfo
dd sys_waitforevent ; 10-WaitForEvent
dd sys_getevent ; 11-CheckForEvent
dd sys_redrawstat ; 12-BeginDraw and EndDraw
dd syscall_drawrect ; 13-DrawRect
dd syscall_getscreensize ; 14-GetScreenSize
dd cross_order ; 15-bgr
dd sys_cachetodiskette ; 16-FlushFloppyCache
dd sys_getbutton ; 17-GetButton
dd cross_order ; 18-System Services
dd paleholder ; 19-reserved
dd cross_order ; 20-ResetMidi and OutputMidi
dd cross_order ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
dd cross_order ; 22-setting date,time,clock and alarm-clock
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent
dd cross_order ; 24-PlayCdTrack,StopCd and GetCdPlaylist
dd cross_order ; 25-SetSb16
dd cross_order ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
dd undefined_syscall ; 27-reserved
dd cross_order ; 28-SetSb16
dd sys_date ; 29-GetDate
dd cross_order ; 30-Get/SetCurrentDirectory
dd undefined_syscall ; 31-reserved
dd cross_order ; 32-DelRamdiskFile
dd cross_order ; 33-WriteRamdiskFile
dd undefined_syscall ; 34-reserved
dd syscall_getpixel ; 35-GetPixel
dd undefined_syscall ; 36-reserved
dd cross_order ; 37-GetMousePosition_ScreenRelative,.
dd cross_order ; 38-DrawLine
dd cross_order ; 39-GetBackgroundSize,ReadBgrData,.
dd set_app_param ; 40-WantEvents
dd cross_order ; 41-GetIrqOwner
dd cross_order ; 42-ReadIrqData
dd cross_order ; 43-SendDeviceData
dd cross_order ; 44-ProgramIrqs
dd cross_order ; 45-ReserveIrq and FreeIrq
dd cross_order ; 46-ReservePortArea and FreePortArea
dd cross_order ; 47-WriteNum
dd cross_order ; 48-SetRedrawType and SetButtonType
dd cross_order ; 49-Advanced Power Management (APM)
dd cross_order ; 50-Window shape & scale
dd cross_order ; 51-Threads
dd cross_order ; 52-Stack driver status
dd cross_order ; 53-Socket interface
dd undefined_syscall ; 54-reserved
dd cross_order ; 55-Sound interface
dd undefined_syscall ; 56-reserved
dd cross_order ; 57-PCI BIOS32
dd cross_order ; 58-Common file system interface
dd undefined_syscall ; 59-reserved
dd cross_order ; 60-Inter Process Communication
dd cross_order ; 61-Direct graphics access
dd cross_order ; 62-PCI functions
dd cross_order ; 63-System message board
dd cross_order ; 64-Resize application memory usage
dd cross_order ; 65-PutImagePalette
dd cross_order ; 66-Process definitions - keyboard
dd cross_order ; 67-Window move or resize
dd cross_order ; 68-Some internal services
dd cross_order ; 69-Debug
dd cross_order ; 70-Common file system interface, version 2
dd cross_order ; 71-Window settings
dd cross_order ; 72-Send window message
times 255 - ( ($-servetable2) /4 ) dd undefined_syscall
dd sys_end ; -1-end application dd sys_end ; -1-end application
endg endg

View File

@ -467,19 +467,19 @@ restore .event
sys_getevent: sys_getevent:
call get_event_for_app call get_event_for_app
mov [esp+36],eax mov [esp + 32],eax
ret ret
sys_waitforevent: sys_waitforevent:
or eax, 0xFFFFFFFF ; infinite timeout or ebx, 0xFFFFFFFF ; infinite timeout
jmp @f jmp @f
sys_wait_event_timeout: sys_wait_event_timeout:
add eax, [timer_ticks] add ebx, [timer_ticks]
@@: @@:
mov ebx, [current_slot] mov eax, [current_slot]
mov [ebx + APPDATA.wait_timeout], eax mov [eax + APPDATA.wait_timeout], ebx
call get_event_for_app call get_event_for_app
test eax, eax test eax, eax
jnz eventoccur jnz eventoccur
@ -490,7 +490,7 @@ sys_wait_event_timeout:
mov eax, [event_sched] mov eax, [event_sched]
eventoccur: eventoccur:
mov [esp+36], eax mov [esp+32], eax
ret ret
sys_sendwindowmsg: sys_sendwindowmsg:

View File

@ -1034,15 +1034,7 @@ reserve_irqs_ports:
mov [irq_owner+4*14], 1 ; ide I mov [irq_owner+4*14], 1 ; ide I
mov [irq_owner+4*15], 1 ; ide II mov [irq_owner+4*15], 1 ; ide II
; movzx eax,byte [0xf604] ; mouse irq ; RESERVE PORTS
; dec eax
; add eax,mouseirqtable
; movzx eax,byte [eax]
; shl eax,2
; mov [irq_owner+eax],byte 1
; RESERVE PORTS
mov edi,1 ; 0x00-0x2d mov edi,1 ; 0x00-0x2d
mov [RESERVED_PORTS],edi mov [RESERVED_PORTS],edi
shl edi,4 shl edi,4
@ -1071,26 +1063,6 @@ reserve_irqs_ports:
mov [RESERVED_PORTS+edi+4],dword 0xe5 mov [RESERVED_PORTS+edi+4],dword 0xe5
mov [RESERVED_PORTS+edi+8],dword 0xff mov [RESERVED_PORTS+edi+8],dword 0xff
; cmp [0xf604],byte 2 ; com1 mouse -> 0x3f0-0x3ff
; jne ripl1
; inc dword [0x2d0000]
; mov edi,[0x2d0000]
; shl edi,4
; mov [0x2d0000+edi+0],dword 1
; mov [0x2d0000+edi+4],dword 0x3f0
; mov [0x2d0000+edi+8],dword 0x3ff
; ripl1:
; cmp [0xf604],byte 3 ; com2 mouse -> 0x2f0-0x2ff
; jne ripl2
; inc dword [0x2d0000]
; mov edi,[0x2d0000]
; shl edi,4
; mov [0x2d0000+edi+0],dword 1
; mov [0x2d0000+edi+4],dword 0x2f0
; mov [0x2d0000+edi+8],dword 0x2ff
; ripl2:
popad popad
ret ret
@ -1472,22 +1444,6 @@ division_64_bits:
ret ret
draw_num_text: draw_num_text:
; dtext
;
; eax x & y
; ebx color
; ecx start of text
; edx length
; edi 1 force
; mov edi,[CURRENT_TASK]
; shl edi,8
; add ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
; rol eax,16
; add ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
; rol eax,16
mov edx,eax mov edx,eax
mov ecx,64+4 mov ecx,64+4
sub ecx,eax sub ecx,eax
@ -1512,17 +1468,6 @@ draw_num_text:
mov edi, [esp+64+4] mov edi, [esp+64+4]
jmp dtext jmp dtext
read_string:
; eax read_area
; ebx color of letter
; ecx color of background
; edx number of letters to read
; esi [x start]*65536 + [y_start]
ret
align 4 align 4
sys_setup: sys_setup:
@ -2408,51 +2353,23 @@ UID_MENUETOS=1 ;official
UID_KOLIBRI=2 ;russian UID_KOLIBRI=2 ;russian
sys_cachetodiskette: sys_cachetodiskette:
; pushad cmp ebx, 1
; cmp eax,1 jne .no_floppy_a_save
; jne no_write_all_of_ramdisk mov [flp_number], 1
; call fdc_writeramdisk jmp .save_image_on_floppy
; popad .no_floppy_a_save:
; ret cmp ebx, 2
; no_write_all_of_ramdisk: jne .no_floppy_b_save
; cmp eax,2 mov [flp_number], 2
; jne no_write_part_of_ramdisk .save_image_on_floppy:
; call fdc_commitflush call save_image
; popad mov [esp + 32], dword 0
; ret cmp [FDC_Status], 0
; no_write_part_of_ramdisk: je .yes_floppy_save
; cmp eax,3 .no_floppy_b_save:
; jne no_set_fdc mov [esp + 32], dword 1
; call fdc_set .yes_floppy_save:
; popad ret
; ret
; no_set_fdc:
; cmp eax,4
; jne no_get_fdc
; popad
; call fdc_get
; mov [esp+36],ecx
; ret
; no_get_fdc:
; popad
; ret
cmp eax,1
jne no_floppy_a_save
mov [flp_number],1
jmp save_image_on_floppy
no_floppy_a_save:
cmp eax,2
jne no_floppy_b_save
mov [flp_number],2
save_image_on_floppy:
call save_image
mov [esp+36],dword 0
cmp [FDC_Status],0
je yes_floppy_save
no_floppy_b_save:
mov [esp+36],dword 1
yes_floppy_save:
ret
uglobal uglobal
; bgrchanged dd 0x0 ; bgrchanged dd 0x0
@ -2684,71 +2601,67 @@ sys_getbackground:
align 4 align 4
sys_getkey: sys_getkey:
mov [esp+36],dword 1 mov [esp + 32],dword 1
; test main buffer ; test main buffer
mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK
movzx ecx,word [WIN_STACK + ebx * 2] movzx ecx, word [WIN_STACK + ebx * 2]
mov edx,[TASK_COUNT] mov edx, [TASK_COUNT]
cmp ecx,edx cmp ecx, edx
jne .finish jne .finish
cmp [KEY_COUNT],byte 0 cmp [KEY_COUNT], byte 0
je .finish je .finish
movzx eax,byte [KEY_BUFF] movzx eax, byte [KEY_BUFF]
shl eax,8 shl eax, 8
push eax push eax
dec byte [KEY_COUNT] dec byte [KEY_COUNT]
and byte [KEY_COUNT],127 and byte [KEY_COUNT], 127
movzx ecx,byte [KEY_COUNT] movzx ecx, byte [KEY_COUNT]
add ecx,2 add ecx, 2
; mov esi,0xf402 mov eax, KEY_BUFF + 1
; mov edi,0xf401 mov ebx, KEY_BUFF
; cld call memmove
; rep movsb pop eax
mov eax, KEY_BUFF+1
mov ebx, KEY_BUFF
call memmove
pop eax
.ret_eax: .ret_eax:
mov [esp+36],eax mov [esp + 32], eax
ret ret
.finish: .finish:
; test hotkeys buffer ; test hotkeys buffer
mov ecx, hotkey_buffer mov ecx, hotkey_buffer
@@: @@:
cmp [ecx], ebx cmp [ecx], ebx
jz .found jz .found
add ecx, 8 add ecx, 8
cmp ecx, hotkey_buffer+120*8 cmp ecx, hotkey_buffer + 120 * 8
jb @b jb @b
ret ret
.found: .found:
mov ax, [ecx+6] mov ax, [ecx + 6]
shl eax, 16 shl eax, 16
mov ah, [ecx+4] mov ah, [ecx + 4]
mov al, 2 mov al, 2
and dword [ecx+4], 0 and dword [ecx + 4], 0
and dword [ecx], 0 and dword [ecx], 0
jmp .ret_eax jmp .ret_eax
align 4 align 4
sys_getbutton: sys_getbutton:
mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK
mov [esp+36],dword 1 mov [esp + 32], dword 1
movzx ecx, word [WIN_STACK + ebx * 2] movzx ecx, word [WIN_STACK + ebx * 2]
mov edx, [TASK_COUNT] ; less than 256 processes mov edx, [TASK_COUNT] ; less than 256 processes
cmp ecx,edx cmp ecx, edx
jne .exit jne .exit
movzx eax,byte [BTN_COUNT] movzx eax, byte [BTN_COUNT]
test eax,eax test eax, eax
jz .exit jz .exit
mov eax,[BTN_BUFF] mov eax, [BTN_BUFF]
shl eax,8 shl eax, 8
mov [BTN_COUNT],byte 0 mov [BTN_COUNT], byte 0
mov [esp+36],eax mov [esp + 32], eax
.exit: .exit:
ret ret
align 4 align 4
@ -2906,7 +2819,7 @@ sys_clock:
movzx edx,al movzx edx,al
add ecx,edx add ecx,edx
sti sti
mov [esp+36],ecx mov [esp + 32], ecx
ret ret
@ -2915,7 +2828,6 @@ align 4
sys_date: sys_date:
cli cli
@@: mov al, 10 @@: mov al, 10
out 0x70, al out 0x70, al
in al, 0x71 in al, 0x71
@ -2941,81 +2853,69 @@ sys_date:
in al,0x71 in al,0x71
mov cl,al mov cl,al
sti sti
mov [esp+36],ecx mov [esp+32], ecx
ret ret
; redraw status ; redraw status
sys_redrawstat: sys_redrawstat:
cmp ebx, 1
cmp eax,1 jne no_widgets_away
jne no_widgets_away ; buttons away
mov ecx,[CURRENT_TASK]
; buttons away
mov ecx,[CURRENT_TASK]
sys_newba2: sys_newba2:
mov edi,[BTN_ADDR]
mov edi,[BTN_ADDR] cmp [edi], dword 0 ; empty button list ?
cmp [edi],dword 0 ; empty button list ? je end_of_buttons_away
je end_of_buttons_away movzx ebx, word [edi]
inc ebx
movzx ebx,word [edi] mov eax,edi
inc ebx
mov eax,edi
sys_newba: sys_newba:
dec ebx
jz end_of_buttons_away
dec ebx add eax, 0x10
jz end_of_buttons_away cmp cx, [eax]
jnz sys_newba
add eax,0x10 push eax ebx ecx
cmp cx,[eax] mov ecx,ebx
jnz sys_newba inc ecx
shl ecx, 4
mov ebx, eax
add eax, 0x10
call memmove
dec dword [edi]
pop ecx ebx eax
push eax ebx ecx jmp sys_newba2
mov ecx,ebx
inc ecx
shl ecx,4
mov ebx,eax
add eax,0x10
call memmove
dec dword [edi]
pop ecx ebx eax
jmp sys_newba2
end_of_buttons_away: end_of_buttons_away:
ret ret
no_widgets_away: no_widgets_away:
cmp eax,2 cmp ebx, 2
jnz srl1 jnz srl1
mov edx,[TASK_BASE] ; return whole screen draw area for this app mov edx, [TASK_BASE] ; return whole screen draw area for this app
add edx,draw_data-CURRENT_TASK add edx, draw_data - CURRENT_TASK
mov [edx+RECT.left], 0 mov [edx + RECT.left], 0
mov [edx+RECT.top], 0 mov [edx + RECT.top], 0
mov eax,[ScreenWidth] mov eax, [ScreenWidth]
mov [edx+RECT.right],eax mov [edx + RECT.right], eax
mov eax,[ScreenHeight] mov eax, [ScreenHeight]
mov [edx+RECT.bottom],eax mov [edx + RECT.bottom], eax
mov edi,[TASK_BASE] mov edi, [TASK_BASE]
or [edi-twdw+WDATA.fl_wdrawn], 1 ; no new position & buttons from app or [edi - twdw + WDATA.fl_wdrawn], 1 ; no new position & buttons from app
call sys_window_mouse
call sys_window_mouse ret
ret
srl1: srl1:
ret
ret
sys_drawwindow: sys_drawwindow:
@ -3888,12 +3788,8 @@ delay_ms: ; delay in 1/1000 sec
set_app_param: set_app_param:
push edi mov edi, [TASK_BASE]
mov [edi + TASKDATA.event_mask], ebx
mov edi,[TASK_BASE]
mov [edi+TASKDATA.event_mask],eax
pop edi
ret ret
@ -4330,11 +4226,6 @@ drawbackground:
align 4 align 4
syscall_putimage: ; PutImage syscall_putimage: ; PutImage
mov edx,ecx
mov ecx,ebx
mov ebx, eax
sys_putimage: sys_putimage:
test ecx,0x80008000 test ecx,0x80008000
jnz .exit jnz .exit
@ -4771,47 +4662,35 @@ sys_msg_board:
; eax=1 : write : bl byte to write ; eax=1 : write : bl byte to write
; eax=2 : read : ebx=0 -> no data, ebx=1 -> data in al ; eax=2 : read : ebx=0 -> no data, ebx=1 -> data in al
mov ecx,[msg_board_count] mov ecx, [msg_board_count]
cmp eax, 1 cmp eax, 1
jne smbl1 jne .smbl1
mov [msg_board_data+ecx],bl mov [msg_board_data+ecx],bl
inc ecx inc ecx
and ecx, 4095 and ecx, 4095
mov [msg_board_count], ecx mov [msg_board_count], ecx
mov [check_idle_semaphore], 5 mov [check_idle_semaphore], 5
ret ret
smbl1: .smbl1:
cmp eax, 2
cmp eax, 2 jne .smbl2
jne smbl2 test ecx, ecx
test ecx, ecx jz .smbl21
jz smbl21 mov eax, msg_board_data+1
; mov edi, msg_board_data mov ebx, msg_board_data
; mov esi, msg_board_data+1 movzx edx, byte [ebx]
; movzx eax, byte [edi] call memmove
mov eax, msg_board_data+1 dec [msg_board_count]
mov ebx, msg_board_data mov [esp + 36], edx ;eax
movzx edx, byte [ebx] mov [esp + 24], dword 1
call memmove ret
; push ecx .smbl21:
; shr ecx, 2 mov [esp+36], ecx
; cld mov [esp+24], ecx
; rep movsd .smbl2:
; pop ecx ret
; and ecx, 3
; rep movsb
dec [msg_board_count]
mov [esp+36], edx ;eax
mov [esp+24], dword 1
ret
smbl21:
mov [esp+36], ecx
mov [esp+24], ecx
smbl2:
ret
@ -5024,34 +4903,37 @@ align 4
syscall_drawrect: ; DrawRect syscall_drawrect: ; DrawRect
mov edi,ecx mov edi, edx ; color + gradient
and edi,0x80FFFFFF and edi, 0x80FFFFFF
test ax,ax test bx, bx ; x.size
je drectr je .drectr
test bx,bx test cx, cx ; y.size
je drectr je .drectr
movzx ecx,ax
shr eax,16 mov eax, ebx ; bad idea
movzx edx,bx mov ebx, ecx
shr ebx,16
mov esi,[current_slot] movzx ecx, ax ; ecx - x.size
add eax,[esi+APPDATA.wnd_clientbox.left] shr eax, 16 ; eax - x.coord
add ebx,[esi+APPDATA.wnd_clientbox.top] movzx edx, bx ; edx - y.size
add ecx,eax shr ebx, 16 ; ebx - y.coord
add edx,ebx mov esi, [current_slot]
jmp [drawbar]
drectr: add eax, [esi + APPDATA.wnd_clientbox.left]
ret add ebx, [esi + APPDATA.wnd_clientbox.top]
add ecx, eax
add edx, ebx
jmp [drawbar]
.drectr:
ret
align 4 align 4
syscall_getscreensize: ; GetScreenSize syscall_getscreensize: ; GetScreenSize
mov ax, [ScreenWidth]
movzx eax,word[ScreenWidth] shl eax, 16
shl eax,16 mov ax, [ScreenHeight]
mov ax,[ScreenHeight] mov [esp + 32], eax
mov [esp+36],eax ret
ret
align 4 align 4
@ -5137,49 +5019,40 @@ syscall_writeramdiskfile: ; WriteRamdiskFile
align 4 align 4
syscall_getpixel: ; GetPixel syscall_getpixel: ; GetPixel
mov ecx,[ScreenWidth] mov ecx, [ScreenWidth]
inc ecx inc ecx
xor edx,edx xor edx, edx
mov eax, ebx
div ecx div ecx
mov ebx,edx mov ebx, edx
xchg eax,ebx xchg eax, ebx
call dword [GETPIXEL] call dword [GETPIXEL] ; eax - x, ebx - y
mov [esp+36],ecx mov [esp + 32], ecx
ret ret
align 4
syscall_readstring: ; ReadString
mov edi,[TASK_BASE]
add edi,TASKDATA.mem_start
add eax,[edi]
call read_string
mov [esp+36],eax
ret
align 4 align 4
syscall_drawline: ; DrawLine syscall_drawline: ; DrawLine
mov edi,[TASK_BASE] mov edi, [TASK_BASE]
movzx edx,word[edi-twdw+WDATA.box.left] movzx edx, word[edi-twdw+WDATA.box.left]
mov ebp,edx mov ebp, edx
mov esi,[current_slot] mov esi, [current_slot]
add ebp,[esi+APPDATA.wnd_clientbox.left] add ebp, [esi+APPDATA.wnd_clientbox.left]
add dx,word[esi+APPDATA.wnd_clientbox.left] add dx, word[esi+APPDATA.wnd_clientbox.left]
shl edx,16 shl edx, 16
add ebp,edx add ebp, edx
movzx edx,word[edi-twdw+WDATA.box.top] movzx edx, word[edi-twdw+WDATA.box.top]
add eax,ebp add eax, ebp
mov ebp,edx mov ebp, edx
add ebp,[esi+APPDATA.wnd_clientbox.top] add ebp, [esi+APPDATA.wnd_clientbox.top]
add dx,word[esi+APPDATA.wnd_clientbox.top] add dx, word[esi+APPDATA.wnd_clientbox.top]
shl edx,16 shl edx, 16
xor edi,edi xor edi, edi
add edx,ebp add edx, ebp
add ebx,edx add ebx, edx
jmp [draw_line] jmp [draw_line]
align 4 align 4
@ -5237,15 +5110,6 @@ socket: ; Socket interface
align 4 align 4
user_events: ; User event times
mov eax,0x12345678
mov [esp+36],eax
ret
align 4
read_from_hd: ; Read from hd - fn not in use read_from_hd: ; Read from hd - fn not in use
mov edi,[TASK_BASE] mov edi,[TASK_BASE]
@ -5321,8 +5185,7 @@ sys_apm:
align 4 align 4
undefined_syscall: ; Undefined system call undefined_syscall: ; Undefined system call
mov [esp + 32], dword -1
mov [esp+36],dword -1
ret ret
align 4 align 4