Barry deFreese, le Thu 21 Dec 2006 09:54:05 -0500, a écrit :
OK, that makes sense, sorry. It just takes a while to get through my
thick skull sometimes. So about my question about adding a struct for
the fxsr stuff. I don't really want to add a union of 4 structs right,
I need two unions of two structs? So I'd have something like this:
union i387_save_struct {
struct i386_fp_save;
struct i386_fpxsr_save;
}
and
union i387_regs_struct {
struct i386_fp_regs;
struct i386_fpxsr_regs;
}
Make sense?
Makes sense, but won't work. Remember that the size of a union is the
size of its biggest member. When you'll put both unions one after the
other in the i386_fpsave_state structure, i386_fp_regs will _not_
be just after i386_fp_save, just because sizeof(i386_fpxsr_save) >
sizeof(i386_fp_save). The union has hence to be before the split into
structures.
Also, about structure, look at the Intel docs: only the XMM register
saving area doesn't have holes.
Samuel