【发布时间】:2013-04-15 17:47:34
【问题描述】:
在破解 Linux 内核时,我注意到它会在执行 FPU 相关任务之前执行 FXSAVE 指令。我知道FXSAVE 指令会将FPU 状态保存到内存中的某个目标,可以通过FXRSTOR 指令恢复。我的问题是我是否可以在执行FXRSTOR 指令之前执行两次FXSAVE。
例如:
char fxsave_region1[512] __attribute__((aligned(16)));
char fxsave_region2[512] __attribute__((aligned(16)));
asm volatile(" fxsave; "::"m"(fxsave_region1));
/* miscellaneous floating point operations */
asm volatile(" fxsave; "::"m"(fxsave_region2)); /* will this work? */
/* some more miscellaneous floating point operations */
asm volatile(" fxrstor; "::"m"(fxsave_region2));
/* even more miscellaneous floating point operations */
asm volatile(" fxrstor; "::"m"(fxsave_region1));
还是只支持一级保存?
【问题讨论】:
标签: c assembly linux-kernel x86 x86-64