From 00914357e7721a88f5370a86314b06628d73c164 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Thu, 1 May 2014 14:23:42 +0000 Subject: [PATCH] mtdbg: switching between mmx(default) and fpu registers git-svn-id: svn://kolibrios.org@4914 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/mtdbg/gui.inc | 203 +++++++++++++++++++------------ programs/develop/mtdbg/mtdbg.asm | 32 +++-- 2 files changed, 153 insertions(+), 82 deletions(-) diff --git a/programs/develop/mtdbg/gui.inc b/programs/develop/mtdbg/gui.inc index b48e82fb0c..a2214d7203 100644 --- a/programs/develop/mtdbg/gui.inc +++ b/programs/develop/mtdbg/gui.inc @@ -156,8 +156,42 @@ waitevent: jz keypressed dec eax jnz waitevent - ; button pressed - we have only one button (close) - mcall -1 +;button pressed + mcall 17 + test al, al + jnz waitevent + movzx eax, ah + jmp dword [.jmp_table+eax*4] + +.close: + mcall -1 +.mmx: + movzx edx, [fpu_mode] + xor dl, 1 + mov [fpu_mode], dl + push edx + jnz .fpu + call draw_mmx_regs + jmp .draw_label +.fpu: + call draw_fpu_regs +.draw_label: + pop edx + mov edx, [btn2_tab+edx*4] + mov edi, COLOR_BG_NORMAL + mov ecx, (COLOR_TXT_NORMAL or 0x40000000) + mov esi, 7 + mov ebx, [registers_x_pos_dd] + add ebx, 4*10000h+registers_y_pos+2 + mcall 4 + jmp waitevent + +align 4 +.jmp_table: + dd waitevent + dd .close + dd .mmx + ; TODO: split in more independent function keypressed: @@ -933,7 +967,7 @@ draw_fpu_register_2: ; draw a text string in the window mov eax, 4 - mov esi, 21 + mov esi, 23 mov edx, .str_buf mov edi, COLOR_BG_NORMAL int 0x40 @@ -951,7 +985,28 @@ draw_fpu_register_2: draw_mmx_register_2: + sub esp, 24 + lea edi, [esp+4] + shl ebp, 4 + mov eax, ebp + shl eax, 16-4 + add eax, 'MM0:' + mov [esp], eax + + mov edx, dword [_mm0+ebp+4] + call .hex_2_str + mov al, ' ' + stosb + call .hex_2_str + mov al, ' ' + stosb + + mov edx, dword [_mm0+ebp] + call .hex_2_str + mov al, ' ' + stosb + call .hex_2_str mov ecx, (COLOR_TXT_INACTIVE or 0x40000000) cmp [debuggee_pid], 0 @@ -972,44 +1027,65 @@ draw_mmx_register_2: .scol: mov ecx, (COLOR_TXT_CHANGED or 0x40000000) .cd: - mov eax, ebp - shl eax, 16-4 - add eax, 'MM0=' - push eax ;write label into stack - ; draw a text string in the window mov eax, 4 - mov esi, eax + mov esi, 23 mov edx, esp mov edi, COLOR_BG_NORMAL int 0x40 - - mov esi, ecx - mov [esp], ebx - - mov ecx, dword [_mm0+ebp+4] - rol ecx, 16 - lea edx, [ebx+0x180000] - mov ebx, 0x00040100 - mcall 47 ;word #3 - - shr ecx, 16 - add edx, (4*6+3) shl 16 - mcall 47 ;word #2 - - mov ecx, dword [_mm0+ebp] - rol ecx, 16 - add edx, (4*6+3) shl 16 - mcall 47 ;word #1 - - shr ecx, 16 - add edx, (4*6+3) shl 16 - mcall 47 ;word #0 - - pop ebx - shr ebp, 4 + add esp, 24 + ret + +align 4 +.hex_2_str: + mov ecx, 4 +@@: + xor eax, eax + shld eax, edx, 4 + aaa + adc al, 0x30 + aad 16 + shl edx, 4 + stosb + loop @B + ret + +align 4 +draw_fpu_regs: + push ebp + push 8 + xor ebp, ebp + mov ebx, [registers_x_pos_dd] + add ebx, 2*10000h+registers_y_pos+142 + mov edi, COLOR_BG_NORMAL +.draw_regs: + call draw_fpu_register_2 + add ebx, 10 + inc ebp + dec dword [esp] + jnz .draw_regs + pop eax ;restore stack + pop ebp + ret + +align 4 +draw_mmx_regs: + push ebp + push 8 + xor ebp, ebp + mov ebx, [registers_x_pos_dd] + add ebx, 2*10000h+registers_y_pos+142 +; mov edi, COLOR_BG_NORMAL +.draw_regs: + call draw_mmx_register_2 + add ebx, 10 + inc ebp + dec dword [esp] + jnz .draw_regs + pop eax + pop ebp ret ; TODO add SSE registers @@ -1064,7 +1140,9 @@ draw_reg_title: jz @f mov ecx, (COLOR_TXT_INACTIVE or 0x40000000) @@: - mov edx, aMain + movzx edx, [fpu_mode] + mov edx, [btn2_tab+edx*4] + ; draw a text string in the window mov ebx, [registers_x_pos_dd] add ebx, 4*10000h+registers_y_pos+2 @@ -1142,47 +1220,14 @@ draw_main_registers: mov cl, 7 add esi, _eflags-_eip call draw_register - mov cl, 4 - - ; MMX registers - - push ebp - - push 8 - xor ebp, ebp - mov ebx, [registers_x_pos_dd] - add ebx, 2*10000h+registers_y_pos+142 - -align 4 -.draw_mmx_regs: - - call draw_mmx_register_2 - add ebx, 10 - inc ebp - dec dword [esp] - jnz .draw_mmx_regs - -;FPU registers - - ;int3 - ;nop - - mov [esp], byte 8 - xor ebp, ebp - mov ebx, [registers_x_pos_dd] - add ebx, 2*10000h+registers_y_pos+232 - -align 4 -.draw_fpu_regs: - - call draw_fpu_register_2 - add ebx, 10 - inc ebp - dec dword [esp] - jnz .draw_fpu_regs - pop eax ;restore stack - pop ebp + cmp [fpu_mode], 1 + je .fpu + call draw_mmx_regs + jmp @f +.fpu: + call draw_fpu_regs +@@: mov ecx, COLOR_TXT_INACTIVE cmp [debuggee_pid], 0 jz @f @@ -1774,6 +1819,14 @@ draw_window: mov ecx, (disasm_y_pos-4)*10001h mcall + mov ebx, [registers_x_pos_dd] + add ebx, (4 shl 16) + 42 + mov ecx, (registers_y_pos shl 16) + 11 + mov edx, (1 shl 30)+2 + mov esi, 0x00808080 + mcall 8 + + ; redraw whole window again call redraw_title call draw_registers diff --git a/programs/develop/mtdbg/mtdbg.asm b/programs/develop/mtdbg/mtdbg.asm index 690f10981f..76e9e81d67 100644 --- a/programs/develop/mtdbg/mtdbg.asm +++ b/programs/develop/mtdbg/mtdbg.asm @@ -2245,8 +2245,13 @@ NoPrgLoaded_str db 'No program loaded' NoPrgLoaded_len = $ - NoPrgLoaded_str aRunning db 'Running' aPaused db 'Paused' -aMain db '[ CPU ]' -aSSE db '[ SSE ]' + +aFPU db '[ FPU ]' +aMMX db '[ MMX ]' +aSSE db '[ SSE-32 ]' +aSSE2 db '[ SSE-64 ]' +aMMX128 db '[ MMX128 ]' + aAVX db '[ AVX ]' aMSR db '[ MSR ]' aPoint db 0x1C @@ -2311,10 +2316,13 @@ avx_strs: align 4 n_digits dd 10000000 -debuggee_pid dd 0 -bSuspended db 0 -bAfterGo db 0 -temp_break dd 0 + +btn2_tab dd aFPU + dd aMMX +btn3_tab dd aSSE2 + dd aMMX128 + dd aSSE + reg_mode db 1 @@ -2383,10 +2391,20 @@ prgname_len dd ? IncludeUGlobals +align 4 +debuggee_pid dd ? dbgwnd dd ? +temp_break dd ? + + +fpu_mode db ? +sse_mode db ? +bSuspended db ? +bAfterGo db ? + -messages rb messages_height*messages_width messages_pos dd ? +messages rb messages_height*messages_width cmdline rb cmdline_width+1 cmdline_len dd ?