views:

302

answers:

1

Why did Windows 64 choose to require xmm6 and xmm7 to be saved/restored?

In Windows 32, you could write assembly routines which clobbered xmm0...xmm7. But if you take that same assembly code and run it in Windows 64, it will usually cause an application fault because VS2007 stores double-precision values in xmm6 and xmm7.

It seemed to me that since X64 has 16 xmm registers xmm0...xmm15 (whereas X32 only has 8 xmm registers), then Microsoft could have chosen to allow users to clobber xmm0..xmm7 (so that they could reuse assembly routines from Win32 without thinking about it) but require users to save/restore xmm8...xmm15.

So, to satisfy my own curiousity, why did Windows 64 choose to require xmm6 and xmm7 to be saved/restored?

+1  A: 

Interesting question. I found this: Win64 Structured Exception Handling, which states that XMM6 to XMM15 must be saved/restored, but doesn't say why.

Wikipedia says that the Microsoft x64 calling convention uses XMM0 - XMM3, which implies that the others are assumed to be preserved. Again, it doesn't say why.

Roger Lipscombe