static void do_first_init(dpeth_t *dep, const dp_conf_t *dcp)
{
- if (dep->de_linmem != 0) {
- dep->de_memsegm = BIOS_SEG;
- /* phys2seg(&dep->de_memsegm, &dep->de_memoffs, dep->de_linmem); */
- } else
- dep->de_linmem = 0xFFFF0000;
+ dep->de_linmem = 0xFFFF0000;
/* Make sure statisics are cleared */
memset((void *) &(dep->de_stat), 0, sizeof(eth_stat_t));
#define DEI_DEFAULT 0x8000
phys_bytes de_linmem; /* For boards using shared memory */
- unsigned short de_memsegm;
vir_bytes de_memoffs;
int de_ramsize; /* Size of on board memory */
int de_offset_page; /* Offset of shared memory page */
/* See if there is a printer at all. */
/* Get the base port for first printer. */
- if(sys_vircopy(SELF, BIOS_SEG, LPT1_IO_PORT_ADDR,
- SELF, D, (vir_bytes) &port_base, LPT1_IO_PORT_SIZE) != OK) {
- panic("do_initialize: sys_vircopy failed");
+ if(sys_readbios(LPT1_IO_PORT_ADDR, &port_base, LPT1_IO_PORT_SIZE) != OK) {
+ panic("do_initialize: sys_readbios failed");
}
/* If the port is zero, the parallel port is not available at all. */
system
KILL # 6
UMAP # 14
- VIRCOPY # 15
IRQCTL # 19
DEVIO # 21
VDEVIO # 23
+ READBIOS # 35
;
};
#define D 1 /* proc[i].mem_map[D] is for data */
#define S 2 /* proc[i].mem_map[S] is for stack */
-#define BIOS_SEG 0x0200 /* flags indicating BIOS memory segment */
-
#define PHYS_SEG 0x0400 /* flag indicating entire physical memory */
#define LOCAL_VM_SEG 0x1000 /* same as LOCAL_SEG, but with vm lookup */
int sys_irqctl(int request, int irq_vec, int policy, int *irq_hook_id);
/* Shorthands for sys_vircopy() and sys_physcopy() system calls. */
-#define sys_biosin(bios_vir, dst_vir, bytes) \
- sys_vircopy(SELF, BIOS_SEG, bios_vir, SELF, D, dst_vir, bytes)
-#define sys_biosout(src_vir, bios_vir, bytes) \
- sys_vircopy(SELF, D, src_vir, SELF, BIOS_SEG, bios_vir, bytes)
#define sys_datacopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
sys_vircopy(src_proc, D, src_vir, dst_proc, D, dst_vir, bytes)
#define sys_textcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
*===========================================================================*/
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);
}
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 *
*===========================================================================*/
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;
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;
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;
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)
{
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,
int arch_get_params(char *parm, int max);
int arch_set_params(char *parm, int max);
void arch_pre_exec(struct proc *pr, u32_t, u32_t);
-int arch_umap(const struct proc *pr, vir_bytes, vir_bytes, int,
- phys_bytes *);
int arch_do_vmctl(message *m_ptr, struct proc *p);
int vm_contiguous(const struct proc *targetproc, vir_bytes vir_buf,
size_t count);
int count = m_ptr->CP_NR_BYTES;
int endpt = (int) m_ptr->CP_SRC_ENDPT;
endpoint_t grantee = (endpoint_t) m_ptr->CP_DST_ENDPT;
- int proc_nr, proc_nr_grantee, r;
+ int proc_nr, proc_nr_grantee;
int naughty = 0;
phys_bytes phys_addr = 0, lin_addr = 0;
struct proc *targetpr;
panic("vm_lookup returned zero physical address");
break;
default:
- if((r=arch_umap(targetpr, offset, count, seg_type, &lin_addr))
- != OK)
- return r;
- phys_addr = lin_addr;
+ printf("umap: peculiar type\n");
+ return EINVAL;
}
if(vm_running && vm_lookup_range(targetpr, lin_addr, NULL, count) != count) {