Rev 114 | Rev 118 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 114 | Rev 115 | ||
---|---|---|---|
Line 226... | Line 226... | ||
226 | 226 | ||
227 | ; test if debugging |
227 | ; test if debugging |
228 | cli |
228 | cli |
229 | mov eax, [0x3000] |
229 | mov eax, [0x3000] |
230 | shl eax, 8 |
230 | shl eax, 8 |
231 | mov eax, [0x80000+eax+0xAC] |
231 | mov eax, [0x80000+eax+APPDATA.debugger_slot] |
232 | test eax, eax |
232 | test eax, eax |
233 | jnz .debug |
233 | jnz .debug |
234 | sti |
234 | sti |
235 | ; not debuggee => say error and terminate |
235 | ; not debuggee => say error and terminate |
236 | add esp, 28h |
236 | add esp, 28h |
237 | movzx eax, bl |
237 | movzx eax, bl |
238 | mov [error_interrupt], eax |
238 | mov [error_interrupt], eax |
Line 239... | Line 239... | ||
239 | call show_error_parameters |
239 | call show_error_parameters |
240 | 240 | ||
Line 241... | Line 241... | ||
241 | mov edx, [0x3010] |
241 | mov edx, [0x3010] |
Line 242... | Line 242... | ||
242 | mov [edx + 0xA], byte 4 |
242 | mov [edx + TASKDATA.state], byte 4 |
243 | 243 | ||
244 | jmp change_task |
244 | jmp change_task |
245 | 245 | ||
246 | .debug: |
246 | .debug: |
247 | ; we are debugged process, notify debugger and suspend ourself |
247 | ; we are debugged process, notify debugger and suspend ourself |
248 | ; eax=debugger PID |
248 | ; eax=debugger PID |
249 | cld |
249 | cld |
250 | movzx ecx, bl |
250 | movzx ecx, bl |
251 | push ecx |
251 | push ecx |
252 | mov ecx, [0x3010] |
252 | mov ecx, [0x3010] |
253 | push dword [ecx+4] ; PID of current process |
253 | push dword [ecx+TASKDATA.pid] ; PID of current process |
254 | push 12 |
254 | push 12 |
255 | pop ecx |
255 | pop ecx |
256 | push 1 ; 1=exception |
256 | push 1 ; 1=exception |
257 | call debugger_notify |
257 | call debugger_notify |
258 | pop ecx |
258 | pop ecx |
259 | pop ecx |
259 | pop ecx |
260 | pop ecx |
260 | pop ecx |
261 | mov edx, [0x3010] |
261 | mov edx, [0x3010] |
Line 262... | Line 262... | ||
262 | mov byte [edx+0xA], 1 ; suspended |
262 | mov byte [edx+TASKDATA.state], 1 ; suspended |
Line 276... | Line 276... | ||
276 | mov ds, ax |
276 | mov ds, ax |
277 | mov es, ax |
277 | mov es, ax |
Line 278... | Line 278... | ||
278 | 278 | ||
279 | mov eax, [prev_user_of_fpu] |
279 | mov eax, [prev_user_of_fpu] |
280 | shl eax, 8 |
280 | shl eax, 8 |
281 | add eax, 0x80000 + 0x10 |
281 | add eax, 0x80000 + APPDATA.fpu_save_area |
Line 282... | Line 282... | ||
282 | fsave [eax] |
282 | fsave [eax] |
283 | 283 | ||
284 | mov eax, [0x3000] |
284 | mov eax, [0x3000] |
285 | mov [prev_user_of_fpu], eax |
285 | mov [prev_user_of_fpu], eax |
286 | shl eax, 8 |
286 | shl eax, 8 |
287 | add eax, 0x80000 |
287 | add eax, 0x80000 |
288 | cmp [eax + 0x7f], byte 0 |
288 | cmp [eax + APPDATA.is_fpu_saved], 0 |
289 | je @f |
289 | je @f |
290 | frstor [eax+0x10] |
290 | frstor [eax+APPDATA.fpu_save_area] |
291 | @@: |
291 | @@: |
292 | mov [eax + 0x7f], byte 1 |
292 | mov [eax + APPDATA.is_fpu_saved], 1 |
Line 293... | Line 293... | ||
293 | restore_ring3_context |
293 | restore_ring3_context |
294 | iret |
294 | iret |
Line 336... | Line 336... | ||
336 | show_error_parameters: |
336 | show_error_parameters: |
Line 337... | Line 337... | ||
337 | 337 | ||
338 | mov [write_error_to],process_pid+43 |
338 | mov [write_error_to],process_pid+43 |
339 | mov eax,[0x3000] |
339 | mov eax,[0x3000] |
340 | shl eax, 5 |
340 | shl eax, 5 |
341 | mov eax,[0x3000+4+eax] |
341 | mov eax,[0x3000+TASKDATA.pid+eax] |
Line 342... | Line 342... | ||
342 | call writehex |
342 | call writehex |
343 | 343 | ||
344 | mov [write_error_to],process_error+43 |
344 | mov [write_error_to],process_error+43 |
Line 554... | Line 554... | ||
554 | set_application_table_status: |
554 | set_application_table_status: |
555 | push eax |
555 | push eax |
Line 556... | Line 556... | ||
556 | 556 | ||
557 | mov eax,[0x3000] |
557 | mov eax,[0x3000] |
558 | shl eax, 5 |
558 | shl eax, 5 |
559 | add eax,0x3000+4 |
559 | add eax,0x3000+TASKDATA.pid |
Line 560... | Line 560... | ||
560 | mov eax,[eax] |
560 | mov eax,[eax] |
Line 561... | Line 561... | ||
561 | 561 | ||
Line 569... | Line 569... | ||
569 | clear_application_table_status: |
569 | clear_application_table_status: |
570 | push eax |
570 | push eax |
Line 571... | Line 571... | ||
571 | 571 | ||
572 | mov eax,[0x3000] |
572 | mov eax,[0x3000] |
573 | shl eax, 5 |
573 | shl eax, 5 |
574 | add eax,0x3000+4 |
574 | add eax,0x3000+TASKDATA.pid |
Line 575... | Line 575... | ||
575 | mov eax,[eax] |
575 | mov eax,[eax] |
576 | 576 | ||
577 | cmp eax,[application_table_status] |
577 | cmp eax,[application_table_status] |
Line 674... | Line 674... | ||
674 | app_i_end dd 0x0 |
674 | app_i_end dd 0x0 |
675 | app_mem dd 0x0 |
675 | app_mem dd 0x0 |
676 | app_esp dd 0x0 |
676 | app_esp dd 0x0 |
677 | app_i_param dd 0x0 |
677 | app_i_param dd 0x0 |
678 | app_i_icon dd 0x0 |
678 | app_i_icon dd 0x0 |
679 | app_mem_pos dd 0x0 |
679 | ;app_mem_pos dd 0x0 |
680 | appl_path dd 0x0 |
680 | appl_path dd 0x0 |
681 | appl_path_size dd 0x0 |
681 | appl_path_size dd 0x0 |
682 | endg |
682 | endg |
Line 683... | Line 683... | ||
683 | 683 | ||
684 | iglobal |
684 | ;iglobal |
685 | hd_app_string db 'HDAPP ' |
685 | ;hd_app_string db 'HDAPP ' |
686 | process_loading db 'K : Process - loading ',13,10,0 |
686 | ;process_loading db 'K : Process - loading ',13,10,0 |
687 | process_running db 'K : Process - done',13,10,0 |
687 | ;process_running db 'K : Process - done',13,10,0 |
688 | first_gdt_search dd 0x2 |
688 | ;first_gdt_search dd 0x2 |
Line 689... | Line 689... | ||
689 | endg |
689 | ;endg |
Line 690... | Line 690... | ||
690 | 690 | ||
Line 810... | Line 810... | ||
810 | mov [esi+WDATA.box.width], 5 |
810 | mov [esi+WDATA.box.width], 5 |
811 | mov eax,[0xFE04] |
811 | mov eax,[0xFE04] |
812 | mov [esi+WDATA.box.top],eax |
812 | mov [esi+WDATA.box.top],eax |
813 | mov [esi+WDATA.box.height], 5 |
813 | mov [esi+WDATA.box.height], 5 |
814 | xor eax, eax |
814 | xor eax, eax |
815 | mov [esi+16],eax |
815 | mov [esi+WDATA.cl_workarea],eax |
816 | mov [esi+20],eax |
816 | mov [esi+WDATA.cl_titlebar],eax |
817 | mov [esi+24],eax |
817 | mov [esi+WDATA.cl_frames],eax |
818 | mov [esi+28],eax |
818 | mov dword [esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn |
819 | lea edi, [esi-window_data+draw_data] |
819 | lea edi, [esi-window_data+draw_data] |
820 | mov ecx,32/4 |
820 | mov ecx,32/4 |
821 | rep stosd |
821 | rep stosd |
822 | popa |
822 | popa |
Line 823... | Line 823... | ||
823 | 823 | ||
824 | ; debuggee test |
824 | ; debuggee test |
825 | pushad |
825 | pushad |
826 | mov edi, esi |
826 | mov edi, esi |
827 | shl edi, 5 |
827 | shl edi, 5 |
828 | mov eax, [0x80000+edi*8+0xAC] |
828 | mov eax, [0x80000+edi*8+APPDATA.debugger_slot] |
829 | test eax, eax |
829 | test eax, eax |
830 | jz .nodebug |
830 | jz .nodebug |
831 | push 8 |
831 | push 8 |
832 | pop ecx |
832 | pop ecx |
833 | push dword [0x3000+edi+0x4] ; PID |
833 | push dword [0x3000+edi+TASKDATA.pid] ; PID |
834 | push 2 |
834 | push 2 |
835 | call debugger_notify |
835 | call debugger_notify |
836 | pop ecx |
836 | pop ecx |
837 | pop ecx |
837 | pop ecx |
Line 848... | Line 848... | ||
848 | popa |
848 | popa |
Line 849... | Line 849... | ||
849 | 849 | ||
850 | pusha ; name to spaces |
850 | pusha ; name to spaces |
851 | mov edi,esi |
851 | mov edi,esi |
852 | shl edi,8 |
852 | shl edi,8 |
853 | add edi,0x80000 |
853 | add edi,0x80000+APPDATA.app_name |
854 | mov ecx,11 |
854 | mov ecx,11 |
855 | mov eax,' ' |
855 | mov eax,' ' |
856 | rep stosb |
856 | rep stosb |
Line 867... | Line 867... | ||
867 | cmp eax, 1 |
867 | cmp eax, 1 |
868 | jbe .nothing_to_activate |
868 | jbe .nothing_to_activate |
869 | lea esi, [0xc400+eax*2] |
869 | lea esi, [0xc400+eax*2] |
870 | movzx edi, word [esi] ; edi = process |
870 | movzx edi, word [esi] ; edi = process |
871 | shl edi, 5 |
871 | shl edi, 5 |
872 | cmp [0x3000 + edi + 0xa], byte 9 ; skip dead slots |
872 | cmp [0x3000 + edi + TASKDATA.state], byte 9 ; skip dead slots |
873 | je .check_next_window |
873 | je .check_next_window |
874 | add edi, window_data |
874 | add edi, window_data |
875 | call waredraw |
875 | call waredraw |
876 | .nothing_to_activate: |
876 | .nothing_to_activate: |
877 | popad |
877 | popad |
Line 894... | Line 894... | ||
894 | @@: |
894 | @@: |
895 | pop esi |
895 | pop esi |
Line 896... | Line 896... | ||
896 | 896 | ||
897 | pusha ; remove all irq reservations |
897 | pusha ; remove all irq reservations |
898 | mov eax,esi |
898 | mov eax,esi |
899 | shl eax, 5 ;imul edx,0x20 |
899 | shl eax, 5 |
900 | mov eax,[edx+0x3000+4] |
900 | mov eax,[edx+0x3000+TASKDATA.pid] |
901 | mov edi,irq_owner |
901 | mov edi,irq_owner |
902 | mov ecx,16 |
902 | mov ecx,16 |
903 | newirqfree: |
903 | newirqfree: |
904 | scasd |
904 | scasd |
Line 909... | Line 909... | ||
909 | popa |
909 | popa |
Line 910... | Line 910... | ||
910 | 910 | ||
911 | 911 | ||
912 | pusha ; remove all port reservations |
912 | pusha ; remove all port reservations |
913 | mov edx,esi |
913 | mov edx,esi |
914 | shl edx, 5 ;imul edx,0x20 |
914 | shl edx, 5 |
Line 915... | Line 915... | ||
915 | add edx,0x3000 |
915 | add edx,0x3000 |
Line 916... | Line 916... | ||
916 | mov edx,[edx+4] |
916 | mov edx,[edx+TASKDATA.pid] |
Line 954... | Line 954... | ||
954 | rmpr9: |
954 | rmpr9: |
Line 955... | Line 955... | ||
955 | 955 | ||
956 | popa |
956 | popa |
957 | mov edi,esi ; do not run this process slot |
957 | mov edi,esi ; do not run this process slot |
958 | shl edi, 5 |
958 | shl edi, 5 |
959 | mov [edi+0x300A],byte 9 |
959 | mov [edi+0x3000 + TASKDATA.state],byte 9 |
960 | ; debugger test - terminate all debuggees |
960 | ; debugger test - terminate all debuggees |
961 | mov eax, 2 |
961 | mov eax, 2 |
962 | mov ecx, 0x80000+2*0x100+0xAC |
962 | mov ecx, 0x80000+2*0x100+APPDATA.debugger_slot |
963 | .xd0: |
963 | .xd0: |
964 | cmp eax, [0x3004] |
964 | cmp eax, [0x3004] |
965 | ja .xd1 |
965 | ja .xd1 |
966 | cmp dword [ecx], esi |
966 | cmp dword [ecx], esi |