#include "proto.h"
-extern u32_t *vm_pagedirs;
+extern u8_t *vm_pagedirs;
/*===========================================================================*
* arch_do_vmctl *
}
case VMCTL_I386_PAGEDIRS:
{
- vm_pagedirs = (u32_t *) m_ptr->SVMCTL_VALUE;
+ vm_pagedirs = (u8_t *) m_ptr->SVMCTL_VALUE;
return OK;
}
case VMCTL_I386_FREEPDE:
/* legacy PIC */
-_PROTOTYPE(int irq_8259_unmask,(int irq));
-_PROTOTYPE(int irq_8259_mask,(int irq));
+_PROTOTYPE(void irq_8259_unmask,(int irq));
+_PROTOTYPE(void irq_8259_mask,(int irq));
_PROTOTYPE(void irq_handle,(int irq));
#define hw_intr_mask(irq) irq_8259_mask(irq)
#define ICW4_PC_AEOI_SLAVE 0x0B /* not SFNM, buffered, auto EOI, 8086 */
#define ICW4_PC_AEOI_MASTER 0x0F /* not SFNM, buffered, auto EOI, 8086 */
-#define set_vec(nr, addr) ((void)0)
-
/*===========================================================================*
* intr_init *
*===========================================================================*/
I386_PAGE_SIZE * pr->p_nr + \
I386_VM_PT_ENT_SIZE * pi))
-u8_t *vm_pagedirs = NULL;
+PUBLIC u8_t *vm_pagedirs = NULL;
#define NOPDE (-1)
#define PDEMASK(n) (1L << (n))
#define HASPT(procptr) ((procptr)->p_seg.p_cr3 != 0)
-FORWARD _PROTOTYPE( u32_t phys_get32, (vir_bytes v) );
+FORWARD _PROTOTYPE( u32_t phys_get32, (phys_bytes v) );
FORWARD _PROTOTYPE( void vm_enable_paging, (void) );
FORWARD _PROTOTYPE( void set_cr3, (void) );
u32_t phys = 0;
if(seg == MEM_GRANT) {
- phys = umap_grant(rp, vir_addr, bytes);
- } else {
- if(!(linear = umap_local(rp, seg, vir_addr, bytes))) {
+ return umap_grant(rp, vir_addr, bytes);
+ }
+
+ if(!(linear = umap_local(rp, seg, vir_addr, bytes))) {
kprintf("SYSTEM:umap_virtual: umap_local failed\n");
phys = 0;
} else {
if(phys == 0)
minix_panic("vm_lookup returned phys", phys);
}
- }
+
if(phys == 0) {
kprintf("SYSTEM:umap_virtual: lookup failed\n");
NOREC_RETURN(vmlookup, OK);
}
-/* From virtual address v in process p,
- * lookup physical address and assign it to d.
- * If p is NULL, assume it's already a physical address.
- */
-#define LOOKUP(d, p, v, flagsp) { \
- int r; \
- if(!(p)) { (d) = (v); } \
- else { \
- if((r=vm_lookup((p), (v), &(d), flagsp)) != OK) { \
- kprintf("vm_copy: lookup failed of 0x%lx in %d (%s)\n"\
- "kernel stacktrace: ", (v), (p)->p_endpoint, \
- (p)->p_name); \
- util_stacktrace(); \
- return r; \
- } } }
-
/*===========================================================================*
* vm_contiguous *
*===========================================================================*/
*/
while(bytes > 0) {
int pde, t;
- vir_bytes chunk = bytes;
+ vir_bytes chunk = (vir_bytes) bytes;
phys_bytes ptr;
inusepde = NOPDE;
CREATEPDE(((struct proc *) NULL), ptr, ph, chunk, bytes, pde, t);
#endif
}
-PUBLIC arch_phys_map_reply(int index, vir_bytes addr)
+PUBLIC int arch_phys_map_reply(int index, vir_bytes addr)
{
#ifdef CONFIG_APIC
/* if local APIC is enabled */
}
for (sp = BEG_PRIV_ADDR, i = 0; sp < END_PRIV_ADDR; ++sp, ++i) {
sp->s_proc_nr = NONE; /* initialize as free */
- sp->s_id = i; /* priv structure index */
+ sp->s_id = (proc_nr_t) i; /* priv structure index */
ppriv_addr[i] = sp; /* priv ptr from number */
}
ktsb = (reg_t) t_stack;
for (i=0; i < NR_BOOT_PROCS; ++i) {
- int schedulable_proc, proc_nr;
+ int schedulable_proc;
+ proc_nr_t proc_nr;
int ipc_to_m, kcalls;
ip = &image[i]; /* process' attributes */
ipc_to_m = RSYS_M; /* allowed targets */
kcalls = RSYS_KC; /* allowed kernel calls */
}
+ /* Priviliges for ordinary process. */
+ else {
+ NOT_REACHABLE;
+ }
/* Fill in target mask. */
for (j=0; j < NR_SYS_PROCS; j++) {
PRIVATE int deadlock(function, cp, src_dst)
int function; /* trap number */
register struct proc *cp; /* pointer to caller */
-int src_dst; /* src or dst process */
+proc_nr_t src_dst; /* src or dst process */
{
/* Check for deadlock. This can happen if 'caller_ptr' and 'src_dst' have
* a cyclic dependency of blocking send and receive calls. The only cyclic
_PROTOTYPE( void set_sendto_bit, (struct proc *rc, int id) );
_PROTOTYPE( void unset_sendto_bit, (struct proc *rc, int id) );
_PROTOTYPE( void send_sig, (int proc_nr, int sig_nr) );
-_PROTOTYPE( void cause_sig, (int proc_nr, int sig_nr) );
+_PROTOTYPE( void cause_sig, (proc_nr_t proc_nr, int sig_nr) );
_PROTOTYPE( void sig_delay_done, (struct proc *rp) );
_PROTOTYPE( void sys_task, (void) );
#define numap_local(proc_nr, vir_addr, bytes) \
* cause_sig *
*===========================================================================*/
PUBLIC void cause_sig(proc_nr, sig_nr)
-int proc_nr; /* process to be signalled */
+proc_nr_t proc_nr; /* process to be signalled */
int sig_nr; /* signal to be sent */
{
/* A system process wants to send a signal to a process. Examples are:
/* Check for overflow. This would happen for 64K segments and 16-bit
* vir_bytes. Especially copying by the PM on do_fork() is affected.
*/
- if (bytes != (vir_bytes) bytes) return(E2BIG);
+ if (bytes != (phys_bytes) (vir_bytes) bytes) return(E2BIG);
/* Now try to make the actual virtual copy. */
return( virtual_copy_vmcheck(&vir_addr[_SRC_], &vir_addr[_DST_], bytes) );
proc_nr_t proc_nr, proc_nr_e;
int sig_nr = m_ptr->SIG_NUMBER;
- proc_nr_e= m_ptr->SIG_ENDPT;
+ proc_nr_e= (proc_nr_t) m_ptr->SIG_ENDPT;
if (!isokendpt(proc_nr_e, &proc_nr)) return(EINVAL);
if (sig_nr >= _NSIG) return(EINVAL);
{
static cp_grant_t g;
static int proc_nr;
- static struct proc *granter_proc;
+ static const struct proc *granter_proc;
int r, depth = 0;
do {
size_t size, int flag)
{
struct proc *caller, *src, *dst;
- vir_bytes lin_src, lin_dst;
+ phys_bytes lin_src, lin_dst;
src = endpoint_lookup(end_s);
dst = endpoint_lookup(end_d);
caller->p_vmrequest.params.map.vir_d = lin_dst; /* destination addr */
caller->p_vmrequest.params.map.ep_s = end_s; /* source process */
caller->p_vmrequest.params.map.vir_s = lin_src; /* source address */
- caller->p_vmrequest.params.map.length = size;
+ caller->p_vmrequest.params.map.length = (vir_bytes) size;
caller->p_vmrequest.params.map.writeflag = flag;
caller->p_vmrequest.type = VMSTYPE_MAP;
{
endpoint_t grantor = m_ptr->SMAP_EP;
cp_grant_id_t gid = m_ptr->SMAP_GID;
- vir_bytes offset = m_ptr->SMAP_OFFSET;
- int seg = (int)m_ptr->SMAP_SEG;
- vir_bytes address = m_ptr->SMAP_ADDRESS;
- vir_bytes bytes = m_ptr->SMAP_BYTES;
+ vir_bytes offset = (vir_bytes) m_ptr->SMAP_OFFSET;
+ int seg = (int) m_ptr->SMAP_SEG;
+ vir_bytes address = (vir_bytes) m_ptr->SMAP_ADDRESS;
+ vir_bytes bytes = (vir_bytes) m_ptr->SMAP_BYTES;
int flag = m_ptr->SMAP_FLAG;
vir_bytes offset_result;
/*===========================================================================*
* panic *
*===========================================================================*/
-PUBLIC void panic(what, mess,nr)
-char *what;
-char *mess;
-int nr;
+PUBLIC void panic(char *what, char *mess,int nr)
{
/* This function is for when a library call wants to panic.
* The library call calls printf() and tries to exit a process,
/*===========================================================================*
* minix_panic *
*===========================================================================*/
-PUBLIC void minix_panic(mess,nr)
-char *mess;
-int nr;
+PUBLIC void minix_panic(char *mess,int nr)
{
/* The system has run aground of a fatal kernel error. Terminate execution. */
if (minix_panicing++) {