Re: [Qemu-discuss] How to check cpu running mode?

2018-08-21 Thread krishnaLee
Jakob,
I know very  few things about write low level asm-code and compile it,I should 
collect more informations if I want to continue,
may be I should using some debugger to observe the  various registers and avoid 
writing this code.




but thank you very much,
krishna.








At 2018-08-21 07:31:04, "Jakob Bohm"  wrote:
>On 18/08/2018 05:59, krishnaLee wrote:
>> 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=0x7E9;   //0x7e9f598&~0x
>> int64* segment_descriptor_address=(int64*)(int64) 
>> (*(0x7E9+0x7*8*2));  //GDTR_base+CS_selector_index* 
>> sizeof(Segment_Descriptor*2)
>> if((*segment_descriptor_address)_L_BIT)
>> {
>> //it is 64bit mode
>> }else
>> {
>> //it is Compatibility mode
>> }
>> 
>> 
>> thank you,
>> krishna
>
>Detecting if the CPU is in long mode (i.e. is running 64 bit code!) is
>not useful if you are not going to write low level assembler or similar
>code that does something different depending on it.
>
>Because "being in long mode" means "running a 64 bit program or OS
>kernel" and similar for the other cases my (completely untested) example
>code tried to detect.
>
>So most of the time, this is a difference you choose up front, not
>something you detect.
>
>
>
>Enjoy
>
>Jakob
>-- 
>Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
>Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
>This public discussion message is non-binding and may contain errors.
>WiseMo - Remote Service Management for PCs, Phones and Embedded


Re: [Qemu-discuss] Monitor mode with -display curses

2018-08-21 Thread Alberto Garcia
On Mon, Aug 20, 2018 at 06:15:21PM +0200, Vincenzo Romano wrote:

> Is there a way to get to the monitor commands when using the option
> "-display curses"?

Yes, you can use a socket, e.g:

  $QEMU -monitor unix:path=/path/to/socket,server,nowait

and to connect to it:

  socat UNIX-CONNECT:/path/to/socket STDIO

You can connect to the QMP monitor the same way, just use -qmp instead
of -monitor.

See the documenation of "-serial" on the QEMU manpage for more
examples.

Berto



Re: [Qemu-discuss] Monitor mode with -display curses

2018-08-21 Thread Vincenzo Romano
But I would then get "just" the monitor. Not the console.
I need both.
Thanks anyway.

2018-08-21 14:20 GMT+02:00 Alberto Garcia :
> On Mon, Aug 20, 2018 at 06:15:21PM +0200, Vincenzo Romano wrote:
>
>> Is there a way to get to the monitor commands when using the option
>> "-display curses"?
>
> Yes, you can use a socket, e.g:
>
>   $QEMU -monitor unix:path=/path/to/socket,server,nowait
>
> and to connect to it:
>
>   socat UNIX-CONNECT:/path/to/socket STDIO
>
> You can connect to the QMP monitor the same way, just use -qmp instead
> of -monitor.
>
> See the documenation of "-serial" on the QEMU manpage for more
> examples.
>
> Berto
>



-- 
Vincenzo Romano - NotOrAnd.IT
Information Technologies
--
NON QVIETIS MARIBVS NAVTA PERITVS



Re: [Qemu-discuss] Monitor mode with -display curses

2018-08-21 Thread Alberto Garcia
On Tue, Aug 21, 2018 at 09:17:39PM +0200, Vincenzo Romano wrote:
> But I would then get "just" the monitor. Not the console.
> I need both.
> Thanks anyway.

I'm not sure if I'm following you... if you have '-display curses'
you'll already have the guest console on the terminal emulator where
you're running QEMU.

If you want to have both the console and the monitor in the same place
you can try with -nographic. This way you have the guest serial port
and the monitor in the same place and you can switch between them
(press 'C-a h' for help). You need to pass console=ttyS0 to the guest
kernel.

Berto