retire BIOS_SEG and umap_bios

. readbios call is now a physical copy with range check in
	  the kernel call instead of BIOS_SEG+umap_bios
	. requires all access to physical memory in bios range to go
	  through sys_readbios
	. drivers/dpeth: wasn't using it
	. adjusted printer
This commit is contained in:
Ben Gras
2012-05-09 18:34:40 +02:00
parent b611e4c226
commit cfb2d7bca5
10 changed files with 23 additions and 80 deletions

View File

@@ -15,14 +15,25 @@
*===========================================================================*/
int do_readbios(struct proc * caller, message * m_ptr)
{
struct vir_addr src, dst;
src.segment = BIOS_SEG;
struct vir_addr src, dst;
vir_bytes len = m_ptr->RDB_SIZE, limit;
src.segment = PHYS_SEG;
dst.segment = D;
src.offset = m_ptr->RDB_ADDR;
dst.offset = (vir_bytes) m_ptr->RDB_BUF;
src.proc_nr_e = NONE;
dst.proc_nr_e = m_ptr->m_source;
limit = src.offset + len - 1;
#define VINRANGE(v, a, b) ((a) <= (v) && (v) <= (b))
#define SUBRANGE(a,b,c,d) (VINRANGE((a), (c), (d)) && VINRANGE((b),(c),(d)))
#define USERRANGE(a, b) SUBRANGE(src.offset, limit, (a), (b))
if(!USERRANGE(BIOS_MEM_BEGIN, BIOS_MEM_END) &&
!USERRANGE(BASE_MEM_TOP, UPPER_MEM_END))
return EPERM;
return virtual_copy_vmcheck(caller, &src, &dst, m_ptr->RDB_SIZE);
}

View File

@@ -308,30 +308,6 @@ 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 *
*===========================================================================*/
@@ -737,9 +713,7 @@ struct vir_addr *dst_addr; /* destination virtual address */
vir_bytes bytes; /* # of bytes to copy */
int vmcheck; /* if nonzero, can return VMSUSPEND */
{
/* Copy bytes from virtual address src_addr to virtual address dst_addr.
* Virtual addresses can be in ABS, LOCAL_SEG, or BIOS_SEG.
*/
/* Copy bytes from virtual address src_addr to virtual address dst_addr. */
struct vir_addr *vir_addr[2]; /* virtual source and destination address */
phys_bytes phys_addr[2]; /* absolute source and destination */
int seg_index;
@@ -760,8 +734,7 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */
struct proc *p;
type = vir_addr[i]->segment & SEGMENT_TYPE;
if((type != PHYS_SEG && type != BIOS_SEG) &&
isokendpt(vir_addr[i]->proc_nr_e, &proc_nr))
if((type != PHYS_SEG) && isokendpt(vir_addr[i]->proc_nr_e, &proc_nr))
p = proc_addr(proc_nr);
else
p = NULL;
@@ -789,11 +762,6 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */
bytes, i);
}
break;
#if _MINIX_CHIP == _CHIP_INTEL
case BIOS_SEG:
phys_addr[i] = umap_bios(vir_addr[i]->offset, bytes );
break;
#endif
case PHYS_SEG:
phys_addr[i] = vir_addr[i]->offset;
break;
@@ -917,25 +885,6 @@ void arch_pre_exec(struct proc *pr, const u32_t ip, const u32_t sp)
pr->p_reg.sp = sp;
}
/*===========================================================================*
* arch_umap *
*===========================================================================*/
int arch_umap(const struct proc *pr, vir_bytes offset, vir_bytes count,
int seg, phys_bytes *addr)
{
switch(seg) {
case BIOS_SEG:
*addr = umap_bios(offset, count);
return OK;
}
/* This must be EINVAL; the umap fallback function in
* lib/syslib/alloc_util.c depends on it to detect an
* older kernel (as opposed to mapping error).
*/
return EINVAL;
}
/* VM reports page directory slot we're allowed to use freely. */
void i386_freepde(const int pde)
{