105b261ecSmrg/**************************************************************************** 205b261ecSmrg* 305b261ecSmrg* Realmode X86 Emulator Library 405b261ecSmrg* 505b261ecSmrg* Copyright (C) 1996-1999 SciTech Software, Inc. 605b261ecSmrg* Copyright (C) David Mosberger-Tang 705b261ecSmrg* Copyright (C) 1999 Egbert Eich 805b261ecSmrg* 905b261ecSmrg* ======================================================================== 1005b261ecSmrg* 1105b261ecSmrg* Permission to use, copy, modify, distribute, and sell this software and 1205b261ecSmrg* its documentation for any purpose is hereby granted without fee, 1305b261ecSmrg* provided that the above copyright notice appear in all copies and that 1405b261ecSmrg* both that copyright notice and this permission notice appear in 1505b261ecSmrg* supporting documentation, and that the name of the authors not be used 1605b261ecSmrg* in advertising or publicity pertaining to distribution of the software 1705b261ecSmrg* without specific, written prior permission. The authors makes no 1805b261ecSmrg* representations about the suitability of this software for any purpose. 1905b261ecSmrg* It is provided "as is" without express or implied warranty. 2005b261ecSmrg* 2105b261ecSmrg* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 2205b261ecSmrg* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 2305b261ecSmrg* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 2405b261ecSmrg* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 2505b261ecSmrg* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 2605b261ecSmrg* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 2705b261ecSmrg* PERFORMANCE OF THIS SOFTWARE. 2805b261ecSmrg* 2905b261ecSmrg* ======================================================================== 3005b261ecSmrg* 3105b261ecSmrg* Language: ANSI C 3205b261ecSmrg* Environment: Any 3305b261ecSmrg* Developer: Kendall Bennett 3405b261ecSmrg* 3505b261ecSmrg* Description: This file contains the code to handle debugging of the 3605b261ecSmrg* emulator. 3705b261ecSmrg* 3805b261ecSmrg****************************************************************************/ 3905b261ecSmrg 4005b261ecSmrg#include "x86emu/x86emui.h" 4105b261ecSmrg#include <stdio.h> 4205b261ecSmrg#include <string.h> 4305b261ecSmrg#include <stdarg.h> 441b5d61b8Smrg#ifndef NO_SYS_HEADERS 4505b261ecSmrg#include <stdlib.h> 4605b261ecSmrg#endif 4705b261ecSmrg 4805b261ecSmrg/*----------------------------- Implementation ----------------------------*/ 4905b261ecSmrg 5005b261ecSmrg#ifdef DEBUG 5105b261ecSmrg 5235c4bbdfSmrgstatic void print_encoded_bytes(u16 s, u16 o); 5335c4bbdfSmrgstatic void print_decoded_instruction(void); 5435c4bbdfSmrgstatic int parse_line(char *s, int *ps, int *n); 5535c4bbdfSmrg 5605b261ecSmrg/* should look something like debug's output. */ 5735c4bbdfSmrgvoid 5835c4bbdfSmrgX86EMU_trace_regs(void) 5905b261ecSmrg{ 6035c4bbdfSmrg if (DEBUG_TRACE()) { 6135c4bbdfSmrg x86emu_dump_regs(); 6205b261ecSmrg } 6335c4bbdfSmrg if (DEBUG_DECODE() && !DEBUG_DECODE_NOPRINT()) { 6435c4bbdfSmrg printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip); 6535c4bbdfSmrg print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip); 6635c4bbdfSmrg print_decoded_instruction(); 6705b261ecSmrg } 6805b261ecSmrg} 6905b261ecSmrg 7035c4bbdfSmrgvoid 7135c4bbdfSmrgX86EMU_trace_xregs(void) 7205b261ecSmrg{ 7335c4bbdfSmrg if (DEBUG_TRACE()) { 7435c4bbdfSmrg x86emu_dump_xregs(); 7505b261ecSmrg } 7605b261ecSmrg} 7705b261ecSmrg 7835c4bbdfSmrgvoid 7935c4bbdfSmrgx86emu_just_disassemble(void) 8005b261ecSmrg{ 8105b261ecSmrg /* 8205b261ecSmrg * This routine called if the flag DEBUG_DISASSEMBLE is set kind 8305b261ecSmrg * of a hack! 8405b261ecSmrg */ 8535c4bbdfSmrg printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip); 8635c4bbdfSmrg print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip); 8735c4bbdfSmrg print_decoded_instruction(); 8805b261ecSmrg} 8905b261ecSmrg 9035c4bbdfSmrgstatic void 9135c4bbdfSmrgdisassemble_forward(u16 seg, u16 off, int n) 9205b261ecSmrg{ 9335c4bbdfSmrg X86EMU_sysEnv tregs; 9435c4bbdfSmrg int i; 9535c4bbdfSmrg u8 op1; 9635c4bbdfSmrg 9705b261ecSmrg /* 9805b261ecSmrg * hack, hack, hack. What we do is use the exact machinery set up 9905b261ecSmrg * for execution, except that now there is an additional state 10005b261ecSmrg * flag associated with the "execution", and we are using a copy 10105b261ecSmrg * of the register struct. All the major opcodes, once fully 10205b261ecSmrg * decoded, have the following two steps: TRACE_REGS(r,m); 10305b261ecSmrg * SINGLE_STEP(r,m); which disappear if DEBUG is not defined to 10405b261ecSmrg * the preprocessor. The TRACE_REGS macro expands to: 10505b261ecSmrg * 10635c4bbdfSmrg * if (debug&DEBUG_DISASSEMBLE) 10705b261ecSmrg * {just_disassemble(); goto EndOfInstruction;} 10805b261ecSmrg * if (debug&DEBUG_TRACE) trace_regs(r,m); 10905b261ecSmrg * 11035c4bbdfSmrg * ...... and at the last line of the routine. 11105b261ecSmrg * 11205b261ecSmrg * EndOfInstruction: end_instr(); 11305b261ecSmrg * 11405b261ecSmrg * Up to the point where TRACE_REG is expanded, NO modifications 11505b261ecSmrg * are done to any register EXCEPT the IP register, for fetch and 11605b261ecSmrg * decoding purposes. 11705b261ecSmrg * 11805b261ecSmrg * This was done for an entirely different reason, but makes a 11905b261ecSmrg * nice way to get the system to help debug codes. 12005b261ecSmrg */ 12135c4bbdfSmrg tregs = M; 12205b261ecSmrg tregs.x86.R_IP = off; 12305b261ecSmrg tregs.x86.R_CS = seg; 12435c4bbdfSmrg 12505b261ecSmrg /* reset the decoding buffers */ 12605b261ecSmrg tregs.x86.enc_str_pos = 0; 12705b261ecSmrg tregs.x86.enc_pos = 0; 12835c4bbdfSmrg 12905b261ecSmrg /* turn on the "disassemble only, no execute" flag */ 13005b261ecSmrg tregs.x86.debug |= DEBUG_DISASSEMBLE_F; 13135c4bbdfSmrg 13205b261ecSmrg /* DUMP NEXT n instructions to screen in straight_line fashion */ 13305b261ecSmrg /* 13405b261ecSmrg * This looks like the regular instruction fetch stream, except 13505b261ecSmrg * that when this occurs, each fetched opcode, upon seeing the 13605b261ecSmrg * DEBUG_DISASSEMBLE flag set, exits immediately after decoding 13705b261ecSmrg * the instruction. XXX --- CHECK THAT MEM IS NOT AFFECTED!!! 13805b261ecSmrg * Note the use of a copy of the register structure... 13905b261ecSmrg */ 14035c4bbdfSmrg for (i = 0; i < n; i++) { 14135c4bbdfSmrg op1 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++)); 14235c4bbdfSmrg (x86emu_optab[op1]) (op1); 14305b261ecSmrg } 14405b261ecSmrg /* end major hack mode. */ 14505b261ecSmrg} 14605b261ecSmrg 14735c4bbdfSmrgvoid 14835c4bbdfSmrgx86emu_check_ip_access(void) 14905b261ecSmrg{ 15005b261ecSmrg /* NULL as of now */ 15105b261ecSmrg} 15205b261ecSmrg 15335c4bbdfSmrgvoid 15435c4bbdfSmrgx86emu_check_sp_access(void) 15505b261ecSmrg{ 15605b261ecSmrg} 15705b261ecSmrg 15835c4bbdfSmrgvoid 15935c4bbdfSmrgx86emu_check_mem_access(u32 dummy) 16005b261ecSmrg{ 16135c4bbdfSmrg /* check bounds, etc */ 16205b261ecSmrg} 16305b261ecSmrg 16435c4bbdfSmrgvoid 16535c4bbdfSmrgx86emu_check_data_access(uint dummy1, uint dummy2) 16605b261ecSmrg{ 16735c4bbdfSmrg /* check bounds, etc */ 16805b261ecSmrg} 16905b261ecSmrg 17035c4bbdfSmrgvoid 17135c4bbdfSmrgx86emu_inc_decoded_inst_len(int x) 17205b261ecSmrg{ 17335c4bbdfSmrg M.x86.enc_pos += x; 17405b261ecSmrg} 17505b261ecSmrg 17635c4bbdfSmrgvoid 1771b5d61b8Smrgx86emu_decode_printf(const char *x, ...) 17805b261ecSmrg{ 1791b5d61b8Smrg va_list ap; 18035c4bbdfSmrg char temp[100]; 18135c4bbdfSmrg 1821b5d61b8Smrg va_start(ap, x); 1831b5d61b8Smrg vsnprintf(temp, sizeof(temp), x, ap); 1841b5d61b8Smrg va_end(ap); 18535c4bbdfSmrg sprintf(M.x86.decoded_buf + M.x86.enc_str_pos, "%s", temp); 18635c4bbdfSmrg M.x86.enc_str_pos += strlen(temp); 18705b261ecSmrg} 18805b261ecSmrg 18935c4bbdfSmrgvoid 19035c4bbdfSmrgx86emu_end_instr(void) 19105b261ecSmrg{ 19235c4bbdfSmrg M.x86.enc_str_pos = 0; 19335c4bbdfSmrg M.x86.enc_pos = 0; 19405b261ecSmrg} 19505b261ecSmrg 19635c4bbdfSmrgstatic void 19735c4bbdfSmrgprint_encoded_bytes(u16 s, u16 o) 19805b261ecSmrg{ 19905b261ecSmrg int i; 20005b261ecSmrg char buf1[64]; 20135c4bbdfSmrg 20235c4bbdfSmrg for (i = 0; i < M.x86.enc_pos; i++) { 20335c4bbdfSmrg sprintf(buf1 + 2 * i, "%02x", fetch_data_byte_abs(s, o + i)); 20405b261ecSmrg } 20535c4bbdfSmrg printk("%-20s", buf1); 20605b261ecSmrg} 20705b261ecSmrg 20835c4bbdfSmrgstatic void 20935c4bbdfSmrgprint_decoded_instruction(void) 21005b261ecSmrg{ 21135c4bbdfSmrg printk("%s", M.x86.decoded_buf); 21205b261ecSmrg} 21305b261ecSmrg 21435c4bbdfSmrgvoid 21535c4bbdfSmrgx86emu_print_int_vect(u16 iv) 21605b261ecSmrg{ 21735c4bbdfSmrg u16 seg, off; 21805b261ecSmrg 21935c4bbdfSmrg if (iv > 256) 22035c4bbdfSmrg return; 22135c4bbdfSmrg seg = fetch_data_word_abs(0, iv * 4); 22235c4bbdfSmrg off = fetch_data_word_abs(0, iv * 4 + 2); 22335c4bbdfSmrg printk("%04x:%04x ", seg, off); 22405b261ecSmrg} 22505b261ecSmrg 22635c4bbdfSmrgvoid 22735c4bbdfSmrgX86EMU_dump_memory(u16 seg, u16 off, u32 amt) 22805b261ecSmrg{ 22935c4bbdfSmrg u32 start = off & 0xfffffff0; 23035c4bbdfSmrg u32 end = (off + 16) & 0xfffffff0; 23135c4bbdfSmrg u32 i; 23235c4bbdfSmrg 23335c4bbdfSmrg while (end <= off + amt) { 23435c4bbdfSmrg printk("%04x:%04x ", seg, start); 23535c4bbdfSmrg for (i = start; i < off; i++) 23635c4bbdfSmrg printk(" "); 23735c4bbdfSmrg for (; i < end; i++) 23835c4bbdfSmrg printk("%02x ", fetch_data_byte_abs(seg, i)); 23935c4bbdfSmrg printk("\n"); 24035c4bbdfSmrg start = end; 24135c4bbdfSmrg end = start + 16; 24235c4bbdfSmrg } 24305b261ecSmrg} 24405b261ecSmrg 24535c4bbdfSmrgvoid 24635c4bbdfSmrgx86emu_single_step(void) 24705b261ecSmrg{ 24805b261ecSmrg char s[1024]; 24905b261ecSmrg int ps[10]; 25005b261ecSmrg int ntok; 25105b261ecSmrg int cmd; 25205b261ecSmrg int done; 25335c4bbdfSmrg int segment; 25405b261ecSmrg int offset; 25505b261ecSmrg static int breakpoint; 25605b261ecSmrg static int noDecode = 1; 25735c4bbdfSmrg 25835c4bbdfSmrg if (DEBUG_BREAK()) { 25935c4bbdfSmrg if (M.x86.saved_ip != breakpoint) { 26035c4bbdfSmrg return; 26135c4bbdfSmrg } 26235c4bbdfSmrg else { 26335c4bbdfSmrg M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F; 26435c4bbdfSmrg M.x86.debug |= DEBUG_TRACE_F; 26535c4bbdfSmrg M.x86.debug &= ~DEBUG_BREAK_F; 26635c4bbdfSmrg print_decoded_instruction(); 26735c4bbdfSmrg X86EMU_trace_regs(); 26835c4bbdfSmrg } 26935c4bbdfSmrg } 27035c4bbdfSmrg done = 0; 27135c4bbdfSmrg offset = M.x86.saved_ip; 27205b261ecSmrg while (!done) { 27305b261ecSmrg printk("-"); 27435c4bbdfSmrg (void)fgets(s, 1023, stdin); 27505b261ecSmrg cmd = parse_line(s, ps, &ntok); 27635c4bbdfSmrg switch (cmd) { 27735c4bbdfSmrg case 'u': 27835c4bbdfSmrg disassemble_forward(M.x86.saved_cs, (u16) offset, 10); 27905b261ecSmrg break; 28035c4bbdfSmrg case 'd': 28135c4bbdfSmrg if (ntok == 2) { 28235c4bbdfSmrg segment = M.x86.saved_cs; 28335c4bbdfSmrg offset = ps[1]; 28435c4bbdfSmrg X86EMU_dump_memory(segment, (u16) offset, 16); 28535c4bbdfSmrg offset += 16; 28635c4bbdfSmrg } 28735c4bbdfSmrg else if (ntok == 3) { 28835c4bbdfSmrg segment = ps[1]; 28935c4bbdfSmrg offset = ps[2]; 29035c4bbdfSmrg X86EMU_dump_memory(segment, (u16) offset, 16); 29135c4bbdfSmrg offset += 16; 29235c4bbdfSmrg } 29335c4bbdfSmrg else { 29435c4bbdfSmrg segment = M.x86.saved_cs; 29535c4bbdfSmrg X86EMU_dump_memory(segment, (u16) offset, 16); 29635c4bbdfSmrg offset += 16; 29735c4bbdfSmrg } 29805b261ecSmrg break; 29935c4bbdfSmrg case 'c': 30035c4bbdfSmrg M.x86.debug ^= DEBUG_TRACECALL_F; 30105b261ecSmrg break; 30235c4bbdfSmrg case 's': 30335c4bbdfSmrg M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F; 30405b261ecSmrg break; 30535c4bbdfSmrg case 'r': 30635c4bbdfSmrg X86EMU_trace_regs(); 30705b261ecSmrg break; 30835c4bbdfSmrg case 'x': 30935c4bbdfSmrg X86EMU_trace_xregs(); 31005b261ecSmrg break; 31135c4bbdfSmrg case 'g': 31205b261ecSmrg if (ntok == 2) { 31305b261ecSmrg breakpoint = ps[1]; 31435c4bbdfSmrg if (noDecode) { 31535c4bbdfSmrg M.x86.debug |= DEBUG_DECODE_NOPRINT_F; 31635c4bbdfSmrg } 31735c4bbdfSmrg else { 31835c4bbdfSmrg M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F; 31935c4bbdfSmrg } 32035c4bbdfSmrg M.x86.debug &= ~DEBUG_TRACE_F; 32135c4bbdfSmrg M.x86.debug |= DEBUG_BREAK_F; 32235c4bbdfSmrg done = 1; 32305b261ecSmrg } 32405b261ecSmrg break; 32535c4bbdfSmrg case 'q': 32635c4bbdfSmrg M.x86.debug |= DEBUG_EXIT; 32735c4bbdfSmrg return; 32835c4bbdfSmrg case 'P': 32935c4bbdfSmrg noDecode = (noDecode) ? 0 : 1; 33035c4bbdfSmrg printk("Toggled decoding to %s\n", (noDecode) ? "FALSE" : "TRUE"); 33135c4bbdfSmrg break; 33235c4bbdfSmrg case 't': 33335c4bbdfSmrg case 0: 33405b261ecSmrg done = 1; 33505b261ecSmrg break; 33635c4bbdfSmrg } 33705b261ecSmrg } 33805b261ecSmrg} 33905b261ecSmrg 34035c4bbdfSmrgint 34135c4bbdfSmrgX86EMU_trace_on(void) 34205b261ecSmrg{ 34335c4bbdfSmrg return M.x86.debug |= DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F; 34405b261ecSmrg} 34505b261ecSmrg 34635c4bbdfSmrgint 34735c4bbdfSmrgX86EMU_trace_off(void) 34805b261ecSmrg{ 34935c4bbdfSmrg return M.x86.debug &= ~(DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F); 35005b261ecSmrg} 35105b261ecSmrg 35235c4bbdfSmrgstatic int 35335c4bbdfSmrgparse_line(char *s, int *ps, int *n) 35405b261ecSmrg{ 35505b261ecSmrg int cmd; 35605b261ecSmrg 35705b261ecSmrg *n = 0; 35835c4bbdfSmrg while (*s == ' ' || *s == '\t') 35935c4bbdfSmrg s++; 36005b261ecSmrg ps[*n] = *s; 36105b261ecSmrg switch (*s) { 36235c4bbdfSmrg case '\n': 36305b261ecSmrg *n += 1; 36405b261ecSmrg return 0; 36535c4bbdfSmrg default: 36605b261ecSmrg cmd = *s; 36705b261ecSmrg *n += 1; 36805b261ecSmrg } 36905b261ecSmrg 37035c4bbdfSmrg while (1) { 37135c4bbdfSmrg while (*s != ' ' && *s != '\t' && *s != '\n') 37235c4bbdfSmrg s++; 37335c4bbdfSmrg 37435c4bbdfSmrg if (*s == '\n') 37535c4bbdfSmrg return cmd; 37635c4bbdfSmrg 37735c4bbdfSmrg while (*s == ' ' || *s == '\t') 37835c4bbdfSmrg s++; 37935c4bbdfSmrg 38035c4bbdfSmrg sscanf(s, "%x", &ps[*n]); 38135c4bbdfSmrg *n += 1; 38235c4bbdfSmrg } 38305b261ecSmrg} 38405b261ecSmrg 38535c4bbdfSmrg#endif /* DEBUG */ 38605b261ecSmrg 38735c4bbdfSmrgvoid 38835c4bbdfSmrgx86emu_dump_regs(void) 38905b261ecSmrg{ 39035c4bbdfSmrg printk("\tAX=%04x ", M.x86.R_AX); 39135c4bbdfSmrg printk("BX=%04x ", M.x86.R_BX); 39235c4bbdfSmrg printk("CX=%04x ", M.x86.R_CX); 39335c4bbdfSmrg printk("DX=%04x ", M.x86.R_DX); 39435c4bbdfSmrg printk("SP=%04x ", M.x86.R_SP); 39535c4bbdfSmrg printk("BP=%04x ", M.x86.R_BP); 39635c4bbdfSmrg printk("SI=%04x ", M.x86.R_SI); 39735c4bbdfSmrg printk("DI=%04x\n", M.x86.R_DI); 39835c4bbdfSmrg printk("\tDS=%04x ", M.x86.R_DS); 39935c4bbdfSmrg printk("ES=%04x ", M.x86.R_ES); 40035c4bbdfSmrg printk("SS=%04x ", M.x86.R_SS); 40135c4bbdfSmrg printk("CS=%04x ", M.x86.R_CS); 40235c4bbdfSmrg printk("IP=%04x ", M.x86.R_IP); 40335c4bbdfSmrg if (ACCESS_FLAG(F_OF)) 40435c4bbdfSmrg printk("OV "); /* CHECKED... */ 40535c4bbdfSmrg else 40635c4bbdfSmrg printk("NV "); 40735c4bbdfSmrg if (ACCESS_FLAG(F_DF)) 40835c4bbdfSmrg printk("DN "); 40935c4bbdfSmrg else 41035c4bbdfSmrg printk("UP "); 41135c4bbdfSmrg if (ACCESS_FLAG(F_IF)) 41235c4bbdfSmrg printk("EI "); 41335c4bbdfSmrg else 41435c4bbdfSmrg printk("DI "); 41535c4bbdfSmrg if (ACCESS_FLAG(F_SF)) 41635c4bbdfSmrg printk("NG "); 41735c4bbdfSmrg else 41835c4bbdfSmrg printk("PL "); 41935c4bbdfSmrg if (ACCESS_FLAG(F_ZF)) 42035c4bbdfSmrg printk("ZR "); 42135c4bbdfSmrg else 42235c4bbdfSmrg printk("NZ "); 42335c4bbdfSmrg if (ACCESS_FLAG(F_AF)) 42435c4bbdfSmrg printk("AC "); 42535c4bbdfSmrg else 42635c4bbdfSmrg printk("NA "); 42735c4bbdfSmrg if (ACCESS_FLAG(F_PF)) 42835c4bbdfSmrg printk("PE "); 42935c4bbdfSmrg else 43035c4bbdfSmrg printk("PO "); 43135c4bbdfSmrg if (ACCESS_FLAG(F_CF)) 43235c4bbdfSmrg printk("CY "); 43335c4bbdfSmrg else 43435c4bbdfSmrg printk("NC "); 43535c4bbdfSmrg printk("\n"); 43605b261ecSmrg} 43705b261ecSmrg 43835c4bbdfSmrgvoid 43935c4bbdfSmrgx86emu_dump_xregs(void) 44005b261ecSmrg{ 44135c4bbdfSmrg printk("\tEAX=%08x ", M.x86.R_EAX); 44235c4bbdfSmrg printk("EBX=%08x ", M.x86.R_EBX); 44335c4bbdfSmrg printk("ECX=%08x ", M.x86.R_ECX); 44435c4bbdfSmrg printk("EDX=%08x \n", M.x86.R_EDX); 44535c4bbdfSmrg printk("\tESP=%08x ", M.x86.R_ESP); 44635c4bbdfSmrg printk("EBP=%08x ", M.x86.R_EBP); 44735c4bbdfSmrg printk("ESI=%08x ", M.x86.R_ESI); 44835c4bbdfSmrg printk("EDI=%08x\n", M.x86.R_EDI); 44935c4bbdfSmrg printk("\tDS=%04x ", M.x86.R_DS); 45035c4bbdfSmrg printk("ES=%04x ", M.x86.R_ES); 45135c4bbdfSmrg printk("SS=%04x ", M.x86.R_SS); 45235c4bbdfSmrg printk("CS=%04x ", M.x86.R_CS); 45335c4bbdfSmrg printk("EIP=%08x\n\t", M.x86.R_EIP); 45435c4bbdfSmrg if (ACCESS_FLAG(F_OF)) 45535c4bbdfSmrg printk("OV "); /* CHECKED... */ 45635c4bbdfSmrg else 45735c4bbdfSmrg printk("NV "); 45835c4bbdfSmrg if (ACCESS_FLAG(F_DF)) 45935c4bbdfSmrg printk("DN "); 46035c4bbdfSmrg else 46135c4bbdfSmrg printk("UP "); 46235c4bbdfSmrg if (ACCESS_FLAG(F_IF)) 46335c4bbdfSmrg printk("EI "); 46435c4bbdfSmrg else 46535c4bbdfSmrg printk("DI "); 46635c4bbdfSmrg if (ACCESS_FLAG(F_SF)) 46735c4bbdfSmrg printk("NG "); 46835c4bbdfSmrg else 46935c4bbdfSmrg printk("PL "); 47035c4bbdfSmrg if (ACCESS_FLAG(F_ZF)) 47135c4bbdfSmrg printk("ZR "); 47235c4bbdfSmrg else 47335c4bbdfSmrg printk("NZ "); 47435c4bbdfSmrg if (ACCESS_FLAG(F_AF)) 47535c4bbdfSmrg printk("AC "); 47635c4bbdfSmrg else 47735c4bbdfSmrg printk("NA "); 47835c4bbdfSmrg if (ACCESS_FLAG(F_PF)) 47935c4bbdfSmrg printk("PE "); 48035c4bbdfSmrg else 48135c4bbdfSmrg printk("PO "); 48235c4bbdfSmrg if (ACCESS_FLAG(F_CF)) 48335c4bbdfSmrg printk("CY "); 48435c4bbdfSmrg else 48535c4bbdfSmrg printk("NC "); 48635c4bbdfSmrg printk("\n"); 48705b261ecSmrg} 488