[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Using SYSCALL/SYSRET with a minios kernel



Daniel Stodden <stodden@xxxxxxxxxx> writes:

> On Mon, 2008-02-25 at 02:55 +0100, Goswin von Brederlow wrote:
>> Daniel Stodden <stodden@xxxxxxxxxx> writes:
>> 
>> > Hi.
>> >
>> > On Mon, 2008-02-25 at 00:22 +0100, Goswin von Brederlow wrote: 
>> >> Hi,
>> >> 
>> >> I'm trying to use the SYSCALL/SYSRET opcodes with a minios kernel
>> >> without much success.
>> >...
>> > The PV interface simply does not support STAR/LSTAR. It's that
>> > simple. :) I suppose you want to implement system calls? Check the
>> > HYPERVISOR_set_callbacks() call. The syscall_address parameter presently
>> > remains entirely unused in mini-os. But as far as I could tell
>> > immediately from the source, syscall/sysret appears to be supported by
>> > the general callback mechanism the same way sysenter/sysleave presently
>> > is.
>> >
>> > regards,
>> > daniel
>> 
>> Ok, here is what I did for the callbacks:
>> 
>> --- x86_64.S ---
>> ENTRY(syscall_callback)
>>      int $80
>>      zeroentry do_syscall
>> 
>> --- kernel.c ---
>>   HYPERVISOR_set_callbacks((unsigned long)hypervisor_callback,
>>                         (unsigned long)failsafe_callback,
>>                         (unsigned long)syscall_callback);
>> 
>>   __asm__ __volatile__("syscall");
>> 
>> If I understood you right that should set the RIP to syscall_callback
>> and execute from there.
>
> Mööp! Only when calling in from virtual user mode. Otherwise, you're
> triggering a hypercall service routine, and one might suspect you're
> presently just generating an error condition with that. :)

That sounds verry odd. I'm getting no indication of it from xen.

But ok. How do I test that. Or differently phrased: What is the best
way to go into user space for the verry first time? Do I really have
to create a fake stack frame and call HYPERVISOR_iret?

> BTW: I found building Xen with 'debug=y' generates a helpful comment on
> the console every now and xen.

I did that and added a patch that makes HYPERVISOR_console_io work for
domU so it shows up in "xm dmesg".

>> But still, the syscall opcode does nothing.
>> In case you wonder. The "int $80" is there to crash the domain and
>> tell me it reached that point.
>
> hth,
> daniel

MfG
        Goswin

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.