Samuel Thibault wrote:
Barry deFreese, le Thu 21 Dec 2006 00:17:34 -0500, a écrit :
I apologize for keep going on about this but I still don't quite
understand why a seperate struct is needed for i386_fp_regs.
I told you: this permits to easily do what is written in fpu.c:
/*
* Ensure that reserved parts of the environment are 0.
*/
memset(user_fp_state, 0, sizeof(struct i386_fp_save));
user_fp_state->fp_control = ifps->fp_save_state.fp_control;
user_fp_state->fp_status = ifps->fp_save_state.fp_status;
user_fp_state->fp_tag = ifps->fp_save_state.fp_tag;
user_fp_state->fp_eip = ifps->fp_save_state.fp_eip;
user_fp_state->fp_cs = ifps->fp_save_state.fp_cs;
user_fp_state->fp_opcode = ifps->fp_save_state.fp_opcode;
user_fp_state->fp_dp = ifps->fp_save_state.fp_dp;
user_fp_state->fp_ds = ifps->fp_save_state.fp_ds;
*user_fp_regs = ifps->fp_regs;
With separate structs, the last line can be written that way, allowing
the compiler to optimize the copy. For getting the same result without
separate structs, we'd have to call an ugly explicit memcpy().
Samuel
Samuel,
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?
Thanks,
Barry deFreese (aka bddebian)
_______________________________________________
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd