* [Xenomai-help] Are xmm-registers saved with a (task) context switch @ 2008-06-11 10:26 M. Koehrer 2008-06-11 12:16 ` Gilles Chanteperdrix 0 siblings, 1 reply; 6+ messages in thread From: M. Koehrer @ 2008-06-11 10:26 UTC (permalink / raw) To: xenomai Hi! I want to use the xmm0 register (from the SSE2 extension of a Core2Duo CPU) to do atomic 64bit write/read accesses in 32 bit x86 mode. My question is: Will the xmm[0..7] registers be saved with a task context switch when running Xenomai real time tasks in user space or do I have to take care to save them on the stack before using (and restoring them afterwards). Is it save to use these registers or will they be used by Xenomai (or Linux) internally? Thanks for any answer on that question. Regards Mathias -- Mathias Koehrer mathias_koehrer@domain.hid Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends, mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV Programme und optional 60 Pay TV Sender, einen elektronischen Programmführer mit Movie Star Bewertungen von TV Movie. Außerdem, aktuelle Filmhits und spannende Dokus in der Arcor-Videothek. Infos unter www.arcor.de/tv ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Are xmm-registers saved with a (task) context switch 2008-06-11 10:26 [Xenomai-help] Are xmm-registers saved with a (task) context switch M. Koehrer @ 2008-06-11 12:16 ` Gilles Chanteperdrix 2008-06-11 12:18 ` Gilles Chanteperdrix 0 siblings, 1 reply; 6+ messages in thread From: Gilles Chanteperdrix @ 2008-06-11 12:16 UTC (permalink / raw) To: M. Koehrer; +Cc: xenomai On Wed, Jun 11, 2008 at 12:26 PM, M. Koehrer <mathias_koehrer@domain.hid> wrote: > Hi! > > I want to use the xmm0 register (from the SSE2 extension of a Core2Duo CPU) to do atomic 64bit write/read accesses in > 32 bit x86 mode. > My question is: Will the xmm[0..7] registers be saved with a task context switch when running Xenomai real time tasks in user > space or do I have to take care to save them on the stack before using (and restoring them afterwards). > Is it save to use these registers or will they be used by Xenomai (or Linux) internally? > > Thanks for any answer on that question. The xmm register are saved by the FPU switching routines. Note however, that depending on the x86 you are using the xmm registers are aliased to the FPU register or are separate registers. So, on machines where the xmm registers are aliased to normal FPU registers, you have to do the save restore on your own if you want to use MMX, SSE, or SSE2 and use FPU instructions in the same thread. -- Gilles ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Are xmm-registers saved with a (task) context switch 2008-06-11 12:16 ` Gilles Chanteperdrix @ 2008-06-11 12:18 ` Gilles Chanteperdrix 2008-06-11 12:37 ` [Xenomai-help] Are xmm-registers saved with a (task) context M. Koehrer 0 siblings, 1 reply; 6+ messages in thread From: Gilles Chanteperdrix @ 2008-06-11 12:18 UTC (permalink / raw) To: M. Koehrer; +Cc: xenomai On Wed, Jun 11, 2008 at 2:16 PM, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote: > On Wed, Jun 11, 2008 at 12:26 PM, M. Koehrer <mathias_koehrer@domain.hid> wrote: >> Hi! >> >> I want to use the xmm0 register (from the SSE2 extension of a Core2Duo CPU) to do atomic 64bit write/read accesses in >> 32 bit x86 mode. >> My question is: Will the xmm[0..7] registers be saved with a task context switch when running Xenomai real time tasks in user >> space or do I have to take care to save them on the stack before using (and restoring them afterwards). >> Is it save to use these registers or will they be used by Xenomai (or Linux) internally? >> >> Thanks for any answer on that question. > > The xmm register are saved by the FPU switching routines. Note > however, that depending on the x86 you are using the xmm registers are > aliased to the FPU register or are separate registers. So, on machines > where the xmm registers are aliased to normal FPU registers, you have > to do the save restore on your own if you want to use MMX, SSE, or > SSE2 and use FPU instructions in the same thread. This probably applies to very old CPUs, xmm are separate registers now. -- Gilles ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Are xmm-registers saved with a (task) context 2008-06-11 12:18 ` Gilles Chanteperdrix @ 2008-06-11 12:37 ` M. Koehrer 2008-06-11 12:45 ` Gilles Chanteperdrix 0 siblings, 1 reply; 6+ messages in thread From: M. Koehrer @ 2008-06-11 12:37 UTC (permalink / raw) To: gilles.chanteperdrix, mathias_koehrer; +Cc: xenomai Hi Gilles, thanks for your response. With the MMX registers, you are right. They are actually aliased with the FPU registers. However, the XMM registers (SSE, SSE2) are not aliased. The aliased MMX registers AND the not-aliased XMM registers are available with today's CPUs, i.e. you still have to take card when using MMX registers. (All information according to Intel's 64 and IA-32 Architectures Software Developers Manual, Volume 1, Chapters 9,10,11) >From your mail before I assume that the (not-aliased) XMM registers are saved with the switching routine and can be used without have to save/restore them. Regards Mathias > > The xmm register are saved by the FPU switching routines. Note > > however, that depending on the x86 you are using the xmm registers are > > aliased to the FPU register or are separate registers. So, on machines > > where the xmm registers are aliased to normal FPU registers, you have > > to do the save restore on your own if you want to use MMX, SSE, or > > SSE2 and use FPU instructions in the same thread. > > This probably applies to very old CPUs, xmm are separate registers now. > -- Mathias Koehrer mathias_koehrer@domain.hid Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends, mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV Programme und optional 60 Pay TV Sender, einen elektronischen Programmführer mit Movie Star Bewertungen von TV Movie. Außerdem, aktuelle Filmhits und spannende Dokus in der Arcor-Videothek. Infos unter www.arcor.de/tv ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Are xmm-registers saved with a (task) context 2008-06-11 12:37 ` [Xenomai-help] Are xmm-registers saved with a (task) context M. Koehrer @ 2008-06-11 12:45 ` Gilles Chanteperdrix 2008-06-11 13:09 ` M. Koehrer 0 siblings, 1 reply; 6+ messages in thread From: Gilles Chanteperdrix @ 2008-06-11 12:45 UTC (permalink / raw) To: M. Koehrer; +Cc: xenomai On Wed, Jun 11, 2008 at 2:37 PM, M. Koehrer <mathias_koehrer@domain.hid> wrote: > Hi Gilles, > > thanks for your response. > With the MMX registers, you are right. They are actually aliased with the FPU registers. > However, the XMM registers (SSE, SSE2) are not aliased. > The aliased MMX registers AND the not-aliased XMM registers are available with today's CPUs, > i.e. you still have to take card when using MMX registers. > (All information according to Intel's 64 and IA-32 Architectures > Software Developer's Manual, Volume 1, Chapters 9,10,11) > > From your mail before I assume that the (not-aliased) XMM registers are saved with the switching routine > and can be used without have to save/restore them. Ok. My memories were a bit imprecise. The whole question boils down to know whether the "fxsave" instruction saves the XMM registers. I think it does, but you would probably better check in the documentation. -- Gilles ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Are xmm-registers saved with a (task) context 2008-06-11 12:45 ` Gilles Chanteperdrix @ 2008-06-11 13:09 ` M. Koehrer 0 siblings, 0 replies; 6+ messages in thread From: M. Koehrer @ 2008-06-11 13:09 UTC (permalink / raw) To: gilles.chanteperdrix, mathias_koehrer; +Cc: xenomai Hi Gilles. > Ok. My memories were a bit imprecise. The whole question boils down to > know whether the "fxsave" instruction saves the XMM registers. I think > it does, but you would probably better check in the documentation. Ok, I have looked in the Intel documentation for the FXSAVE operation: "Saves the current state of the x87 FPU, MMX technology, XMM, and MXCSR registers to a 512-byte memory location specified in the destination operand." Thus means, every thing is fine and I can used the XMM registers without risk. Thanks for the support. Mathias -- Mathias Koehrer mathias_koehrer@domain.hid Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends, mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV Programme und optional 60 Pay TV Sender, einen elektronischen Programmführer mit Movie Star Bewertungen von TV Movie. Außerdem, aktuelle Filmhits und spannende Dokus in der Arcor-Videothek. Infos unter www.arcor.de/tv ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-06-11 13:09 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-06-11 10:26 [Xenomai-help] Are xmm-registers saved with a (task) context switch M. Koehrer 2008-06-11 12:16 ` Gilles Chanteperdrix 2008-06-11 12:18 ` Gilles Chanteperdrix 2008-06-11 12:37 ` [Xenomai-help] Are xmm-registers saved with a (task) context M. Koehrer 2008-06-11 12:45 ` Gilles Chanteperdrix 2008-06-11 13:09 ` M. Koehrer
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.