Kernel: arch-related cleanup
- move umap_bios() into arch-specific code - move proc.p_fpu_state access into arch-specific blocks
This commit is contained in:
parent
204ae72525
commit
9cca9d7566
5 changed files with 34 additions and 30 deletions
|
@ -308,6 +308,30 @@ static void vm_enable_paging(void)
|
|||
write_cr4(cr4);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* umap_bios *
|
||||
*===========================================================================*/
|
||||
phys_bytes umap_bios(vir_addr, bytes)
|
||||
vir_bytes vir_addr; /* virtual address in BIOS segment */
|
||||
vir_bytes bytes; /* # of bytes to be copied */
|
||||
{
|
||||
/* Calculate the physical memory address at the BIOS. Note: currently, BIOS
|
||||
* address zero (the first BIOS interrupt vector) is not considered as an
|
||||
* error here, but since the physical address will be zero as well, the
|
||||
* calling function will think an error occurred. This is not a problem,
|
||||
* since no one uses the first BIOS interrupt vector.
|
||||
*/
|
||||
|
||||
/* Check all acceptable ranges. */
|
||||
if (vir_addr >= BIOS_MEM_BEGIN && vir_addr + bytes <= BIOS_MEM_END)
|
||||
return (phys_bytes) vir_addr;
|
||||
else if (vir_addr >= BASE_MEM_TOP && vir_addr + bytes <= UPPER_MEM_END)
|
||||
return (phys_bytes) vir_addr;
|
||||
|
||||
printf("Warning, error in umap_bios, virtual address 0x%lx\n", vir_addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* umap_local *
|
||||
*===========================================================================*/
|
||||
|
|
|
@ -156,6 +156,7 @@ void proc_init(void)
|
|||
set_idle_name(ip->p_name, i);
|
||||
}
|
||||
|
||||
#if (_MINIX_CHIP == _CHIP_INTEL)
|
||||
for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) {
|
||||
/*
|
||||
* FXSR requires 16-byte alignment of memory image, but
|
||||
|
@ -172,6 +173,7 @@ void proc_init(void)
|
|||
rp->p_fpu_state.fpu_save_area_p =
|
||||
(void *) aligned_fp_area;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void switch_address_space_idle(void)
|
||||
|
|
|
@ -90,7 +90,6 @@ void system_init(void);
|
|||
umap_local(proc_addr(proc_nr), D, (vir_addr), (bytes))
|
||||
void clear_endpoint(struct proc *rc);
|
||||
void clear_ipc_refs(struct proc *rc, int caller_ret);
|
||||
phys_bytes umap_bios(vir_bytes vir_addr, vir_bytes bytes);
|
||||
void kernel_call_resume(struct proc *p);
|
||||
int sched_proc(struct proc *rp, int priority, int quantum, int cpu);
|
||||
|
||||
|
@ -169,6 +168,7 @@ int data_copy_vmcheck(struct proc *, endpoint_t from, vir_bytes
|
|||
from_addr, endpoint_t to, vir_bytes to_addr, size_t bytes);
|
||||
void alloc_segments(struct proc *rp);
|
||||
void vm_stop(void);
|
||||
phys_bytes umap_bios(vir_bytes vir_addr, vir_bytes bytes);
|
||||
phys_bytes umap_local(register struct proc *rp, int seg, vir_bytes
|
||||
vir_addr, vir_bytes bytes);
|
||||
phys_bytes umap_virtual(struct proc* rp, int seg, vir_bytes vir_addr,
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* send_sig: send a signal directly to a system process
|
||||
* cause_sig: take action to cause a signal to occur via a signal mgr
|
||||
* sig_delay_done: tell PM that a process is not sending
|
||||
* umap_bios: map virtual address in BIOS_SEG to physical
|
||||
* get_randomness: accumulate randomness in a buffer
|
||||
* clear_endpoint: remove a process' ability to send and receive messages
|
||||
* sched_proc: schedule a process
|
||||
|
@ -455,33 +454,6 @@ void sig_delay_done(struct proc *rp)
|
|||
cause_sig(proc_nr(rp), SIGSNDELAY);
|
||||
}
|
||||
|
||||
#if _MINIX_CHIP == _CHIP_INTEL
|
||||
|
||||
/*===========================================================================*
|
||||
* umap_bios *
|
||||
*===========================================================================*/
|
||||
phys_bytes umap_bios(vir_addr, bytes)
|
||||
vir_bytes vir_addr; /* virtual address in BIOS segment */
|
||||
vir_bytes bytes; /* # of bytes to be copied */
|
||||
{
|
||||
/* Calculate the physical memory address at the BIOS. Note: currently, BIOS
|
||||
* address zero (the first BIOS interrupt vector) is not considered as an
|
||||
* error here, but since the physical address will be zero as well, the
|
||||
* calling function will think an error occurred. This is not a problem,
|
||||
* since no one uses the first BIOS interrupt vector.
|
||||
*/
|
||||
|
||||
/* Check all acceptable ranges. */
|
||||
if (vir_addr >= BIOS_MEM_BEGIN && vir_addr + bytes <= BIOS_MEM_END)
|
||||
return (phys_bytes) vir_addr;
|
||||
else if (vir_addr >= BASE_MEM_TOP && vir_addr + bytes <= UPPER_MEM_END)
|
||||
return (phys_bytes) vir_addr;
|
||||
|
||||
printf("Warning, error in umap_bios, virtual address 0x%x\n", vir_addr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*===========================================================================*
|
||||
* clear_ipc *
|
||||
*===========================================================================*/
|
||||
|
|
|
@ -145,13 +145,17 @@ int do_update(struct proc * caller, message * m_ptr)
|
|||
*===========================================================================*/
|
||||
static void adjust_proc_slot(struct proc *rp, struct proc *from_rp)
|
||||
{
|
||||
/* Preserve endpoints, slot numbers, priv structure, IPC, FPU pointer. */
|
||||
/* Preserve endpoints, slot numbers, priv structure, and IPC. */
|
||||
rp->p_endpoint = from_rp->p_endpoint;
|
||||
rp->p_nr = from_rp->p_nr;
|
||||
rp->p_priv = from_rp->p_priv;
|
||||
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;
|
||||
|
@ -184,6 +188,7 @@ static void swap_fpu_state(struct proc *a_rp, struct proc *b_orig_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 -
|
||||
|
@ -191,6 +196,7 @@ static void swap_fpu_state(struct proc *a_rp, struct proc *b_orig_rp,
|
|||
|
||||
memcpy(a_rp->p_fpu_state.fpu_save_area_p,
|
||||
b_copy_rp->p_fpu_state.fpu_image + align, FPU_XFP_SIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
|
Loading…
Reference in a new issue