use linker to align fpu state save area

This commit is contained in:
Ben Gras
2012-04-19 15:06:47 +02:00
parent 093c949274
commit a149be43fc
11 changed files with 45 additions and 81 deletions

View File

@@ -22,8 +22,6 @@
static void adjust_proc_slot(struct proc *rp, struct proc *from_rp);
static void adjust_priv_slot(struct priv *privp, struct priv
*from_privp);
static void swap_fpu_state(struct proc *a_rp, struct proc *b_orig_rp,
struct proc *b_copy_rp);
static void swap_proc_slot_pointer(struct proc **rpp, struct proc
*src_rp, struct proc *dst_rp);
@@ -110,10 +108,6 @@ int do_update(struct proc * caller, message * m_ptr)
adjust_priv_slot(priv(src_rp), &orig_src_priv);
adjust_priv_slot(priv(dst_rp), &orig_dst_priv);
/* Swap FPU state. Can only be done after adjusting the process slots. */
swap_fpu_state(src_rp, dst_rp, &orig_dst_proc);
swap_fpu_state(dst_rp, src_rp, &orig_src_proc);
/* Swap global process slot addresses. */
swap_proc_slot_pointer(get_cpulocal_var_ptr(ptproc), src_rp, dst_rp);
@@ -152,11 +146,6 @@ static void adjust_proc_slot(struct proc *rp, struct proc *from_rp)
priv(rp)->s_proc_nr = from_rp->p_nr;
rp->p_caller_q = from_rp->p_caller_q;
#if (_MINIX_CHIP == _CHIP_INTEL)
/* Preserve FPU pointer. */
rp->p_fpu_state.fpu_save_area_p = from_rp->p_fpu_state.fpu_save_area_p;
#endif
/* preserve scheduling */
rp->p_scheduler = from_rp->p_scheduler;
#ifdef CONFIG_SMP
@@ -179,26 +168,6 @@ static void adjust_priv_slot(struct priv *privp, struct priv *from_privp)
privp->s_alarm_timer = from_privp->s_alarm_timer;
}
/*===========================================================================*
* swap_fpu_state *
*===========================================================================*/
static void swap_fpu_state(struct proc *a_rp, struct proc *b_orig_rp,
struct proc *b_copy_rp)
{
/* Copy the FPU state from process B's copied slot, using B's original FPU
* save area alignment, into process A's slot.
*/
#if (_MINIX_CHIP == _CHIP_INTEL)
int align;
align = (int) ((char *) b_orig_rp->p_fpu_state.fpu_save_area_p -
(char *) &b_orig_rp->p_fpu_state.fpu_image);
memcpy(a_rp->p_fpu_state.fpu_save_area_p,
b_copy_rp->p_fpu_state.fpu_image + align, FPU_XFP_SIZE);
#endif
}
/*===========================================================================*
* swap_proc_slot_pointer *
*===========================================================================*/