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

Re: [Xen-devel] mini-os: x86_64: crash passing double arguments

On Wed, 2014-07-02 at 12:32 +0100, Jan Beulich wrote:
> >>> On 02.07.14 at 13:16, <talex5@xxxxxxxxx> wrote:
> > On 2 July 2014 11:36, Jan Beulich <JBeulich@xxxxxxxx> wrote:
> >>>>> On 02.07.14 at 12:17, <talex5@xxxxxxxxx> wrote:
> >>> Subtracting 8 bytes from thread->sp when creating a new thread fixes
> >>> it (patch attached), but I'm not sure whether this is the right
> >>> solution, or whether there's a problem elsewhere (I know very little
> >>> about x86).
> >>
> >> Considering that this really is kernel code, passing
> >> -mpreferred-stack-boundary=2 to gcc would seem like the better
> >> option to me, or else someone might run into a similar issue again
> >> trying to use %ymm or %zmm registers in their MiniOS incarnation.
> > 
> > Could you explain this a bit further? It looks like using
> > -mpreferred-stack-boundary=2 just means that the code won't compile
> > ("error: -mpreferred-stack-boundary=2 is not between 4 and 12").
> Yeah, I should have written "3" (2 is for ix86). Linux uses 3, so it
> certainly works (but without checking I can't immediately say
> whether that's perhaps tied to the use of -mcmodel=kernel).
> > Although Mini-OS applications run in kernel mode, they can still be
> > full applications, and need to use all the processor's features.
> Right, and that option doesn't preclude that use. It's just that
> the compiler will take care to align the stack suitably in each
> function when it's told that the to be expected alignment is less
> strict than the one needed, or to use instructions not requiring
> full alignment.

Wouldn't it be more efficient to simply arrange that the thread's
initial stack meets the necessary preconditions for the standard
alignments like Thomas has done though? Especially given the trivial
nature of the patch.


Xen-devel mailing list



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