[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-discuss] How to check cpu running mode?
From: |
krishnaLee |
Subject: |
Re: [Qemu-discuss] How to check cpu running mode? |
Date: |
Sat, 18 Aug 2018 11:59:49 +0800 (CST) |
Jakob:
I need more help,just now,I'm trigger a page fault in 64-bit mode,see this
picture:
https://github.com/krishna116/test/blob/master/test-qemu-in-64bit-mode.png
so I can write some system mode code accroding to this information,
but my follow code seems can't get the right answer, is my algorithm wrong?
//this is my algorithm in 64-bit mode:
#define CS_L_BIT 0x1<<(32+22-1)
//CS_selector_index=0x7; //0x38>>3
//GDTR_base=0x7E90000; //0x7e9f598&~0xffff
int64* segment_descriptor_address=(int64*)(int64) (*(0x7E90000+0x7*8*2));
//GDTR_base+CS_selector_index* sizeof(Segment_Descriptor*2)
if((*segment_descriptor_address)&CS_L_BIT)
{
//it is 64bit mode
}else
{
//it is Compatibility mode
}
thank you,
krishna