All of lore.kernel.org
 help / color / mirror / Atom feed
* Using SYSCALL/SYSRET with a minios kernel
@ 2008-02-24 23:22 Goswin von Brederlow
  2008-02-25  0:01 ` Daniel Stodden
  0 siblings, 1 reply; 8+ messages in thread
From: Goswin von Brederlow @ 2008-02-24 23:22 UTC (permalink / raw)
  To: xen-devel

Hi,

I'm trying to use the SYSCALL/SYSRET opcodes with a minios kernel
without much success.

Going by the manuals (and linux sources) I first have to setup the
STAR and LSTAR registers to define the segment and instruction pointer
to be used for SYSCALL:

	/* 
         * LSTAR and STAR live in a bit strange symbiosis.
         * They both write to the same internal register. STAR allows to set
         * CS/DS but only a 32bit target. LSTAR sets the 64bit rip.
         */ 
        wrmsrl(MSR_STAR,  ((uint64_t)__USER_CS)<<48  | ((uint64_t)__KERNEL_CS)<<32); 
        wrmsrl(MSR_LSTAR, system_call); 


But all that does is give a message on the xen console:

(XEN) traps.c:1467:d137 Domain attempted WRMSR 00000000c0000081 from e023e010:00000000 to e033e033:00000000.
(XEN) traps.c:1467:d137 Domain attempted WRMSR 00000000c0000082 from ffff8300:001e0800 to 00000000:001054c0.


A later
	__asm__ __volatile__("syscall"::);
does nothing while a
	__asm__ __volatile__("sysret"::);
causes a general protection fault:

(XEN) traps.c:405:d137 Unhandled general protection fault fault/trap [#13] in domain 137 on VCPU 0 [ec=0000]
(XEN) domain_crash_sync called from entry.S
(XEN) Domain 137 (vcpu#0) crashed on cpu#0:
(XEN) ----[ Xen-3.0.4-1  x86_64  debug=y  Not tainted ]----
(XEN) CPU:    0
(XEN) RIP:    e033:[<000000000010559f>]
(XEN) RFLAGS: 0000000000000216   CONTEXT: guest
(XEN) rax: fffffffffffffff2   rbx: 0000000001857000   rcx: 000000000010559f
(XEN) rdx: 0000000000000100   rsi: 00000000deadbeef   rdi: 00000000deadbeef
(XEN) rbp: 0000000000000000   rsp: 0000000000108310   r8:  00000000001ff000
(XEN) r9:  0000000001857000   r10: 00000000fffffff9   r11: 0000000000000216
(XEN) r12: 0000000001851000   r13: 0000000000000000   r14: 0000000000000000
(XEN) r15: 0000000000000000   cr0: 000000008005003b   cr4: 00000000000006f0
(XEN) cr3: 00000000268f8000   cr2: 0000000000000000
(XEN) ds: 0000   es: 0000   fs: 0000   gs: 0000   ss: e02b   cs: e033
(XEN) Guest stack trace from rsp=0000000000108310:
(XEN)    000000000010559f 0000000000000216 0000000000000000 000000000010559f
(XEN)    000000000000e030 0000000000010216 0000000000108350 000000000000e02b
(XEN)    0000000000000000 0000000000119000 0000000000000000 00000000001040ba
(XEN)    6f622065736f6f4d 2e2e2e676e69746f 0000000000000a0d 0000000000000000
(XEN)    61727473746f6f42 2e2e2e676e697070 000000000000000a 0000000000000000
(XEN)    0000000000000000 0000000000100010 0000000000119000 0000000000113000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000

Any pointers would be welcome.

MfG
        Goswin

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-02-25 13:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-24 23:22 Using SYSCALL/SYSRET with a minios kernel Goswin von Brederlow
2008-02-25  0:01 ` Daniel Stodden
2008-02-25  1:55   ` Goswin von Brederlow
2008-02-25  2:26     ` Daniel Stodden
2008-02-25 10:04       ` Goswin von Brederlow
2008-02-25 11:08         ` Daniel Stodden
2008-02-25 13:14           ` Goswin von Brederlow
2008-02-25 13:50             ` Daniel Stodden

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.