xenctx: Add 16 bit output

This output happens on !guest_protected_mode.  The cpu is in 16 bit
mode in this case.

For example:

$ xenctx 4
cs:eip: f000:0000d61b
flags: 00000002 nz
ss:esp: 0000:00001fee
eax: 0000ffc2   ebx: 00000049   ecx: 00000049   edx: ffffffff
esi: 00000000   edi: 00000010   ebp: 00001ff0
 ds:     e000    es:     0040    fs:     0000    gs:     0000
Code (instr addr 000fd61b)
04 67 66 8b 70 08 67 66 8b 68 0c 67 66 8b 58 10 67 66 8b 50 14 <67> 66 8b 48 18 67 8e 40 02 67 ff

Stack:
 8e30 0000 0246 812f 0000 0206 80e7 0080 0080

$ xenctx 4 -d 0x00001fee -m 0x00001fee -l 1
Memory (address 1fee):
 8e30 0000 0246 812f 0000 0206 80e7 0080 0080 c2c2 c2c2 c2c2 c2c2 c2c2 c2c2 c2c2

Stack:
 8e30 0000 0246 812f 0000 0206 80e7 0080 0080

Signed-off-by: Don Slutz <dslutz@verizon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
Don Slutz authored and Ian Campbell committed 2014-04-04 09:28:09 +01:00
1 parent 3e4b7e0c83
commit 701ce4a698
1 file changed
+9 -3
+9 -3
View File
@@ -47,6 +47,7 @@ typedef enum type_of_addr_ {
static const uint64_t cr_reg_mask[5] = { [2] = ~UINT64_C(0) };
static const uint64_t dr_reg_mask[8] = { [0 ... 3] = ~UINT64_C(0) };
typedef unsigned long long guest_word_t;
#define FMT_16B_WORD "%04llx"
#define FMT_32B_WORD "%08llx"
#define FMT_64B_WORD "%016llx"
/* Word-length of the guest's own data structures */
@@ -57,11 +58,13 @@ int guest_protected_mode = 1;
#elif defined(__arm__)
#define NO_TRANSLATION
typedef uint64_t guest_word_t;
#define FMT_16B_WORD "%04llx"
#define FMT_32B_WORD "%08llx"
#define FMT_64B_WORD "%016llx"
#elif defined(__aarch64__)
#define NO_TRANSLATION
typedef uint64_t guest_word_t;
#define FMT_16B_WORD "%04llx"
#define FMT_32B_WORD "%08llx"
#define FMT_64B_WORD "%016llx"
#endif
@@ -479,7 +482,7 @@ static void print_ctx(vcpu_guest_context_any_t *ctx)
{
if (ctxt_word_size == 4)
print_ctx_32(&ctx->x32);
else if (guest_word_size == 4)
else if (guest_word_size != 8)
print_ctx_32on64(&ctx->x64);
else
print_ctx_64(&ctx->x64);
@@ -749,7 +752,9 @@ static guest_word_t read_mem_word(vcpu_guest_context_any_t *ctx, int vcpu,
static void print_stack_word(guest_word_t word, int width)
{
if (width == 4)
if (width == 2)
printf(FMT_16B_WORD, word);
else if (width == 4)
printf(FMT_32B_WORD, word);
else
printf(FMT_64B_WORD, word);
@@ -984,8 +989,9 @@ static void dump_ctx(int vcpu)
perror("xc_domain_hvm_getcontext_partial");
return;
}
guest_word_size = (cpuctx.msr_efer & 0x400) ? 8 : 4;
guest_protected_mode = (cpuctx.cr0 & CR0_PE);
guest_word_size = (cpuctx.msr_efer & 0x400) ? 8 :
guest_protected_mode ? 4 : 2;
/* HVM guest context records are always host-sized */
if (xc_version(xenctx.xc_handle, XENVER_capabilities, &xen_caps) != 0) {
perror("xc_version");
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.