I'm continuing my project of converting Mini-X so that it runs on Minix
3 with slow progress being made.
I have a question regarding the main graphics task for Mini-X.
Originally this task would have been compiled as part of the Kernel but of
course we now want it in user space so some changes have to be made but I am
a bit stuck.

The simple changes I have made so far are as follows:-

case DISK_READ: r = do_read(&mess); break; ------> case DEV_READ: r =
do_read(&mess); break;
case DISK_DEV_WRITE: r = do_write(&mess); break; ----> case DEV_WRITE: r
= do_write(&mess); break;
if (user_phys == 0) return E_BAD_ADDR; ----> if (user_phys == 0) return

This gets rid of a few errors but I still have:-

exec cc -w -c -I ../include/ graphics.c
"graphics.c", line 99: unknown selector PROC_NR
"graphics.c", line 110: unknown selector REP_PROC_NR
"graphics.c", line 133: illegal use of selector PROC_NR
"graphics.c", line 162: illegal use of selector PROC_NR
make in /home/lynton/mini-x/graphics: Exit code 1

What is the best thing to do with PROC_NR and REP_PROC_NR ?
Also is phys_copy the same as it always was ?

I have attached parts of the code of interest in the hope some pointers can
be offered.

Thanks in advance.


Code below

/*================================================= ==========================*
* graphics_task *
*================================================= ==========================*/PUBLIC void graphics_task(){ int r, caller, proc_nr; buf_phys = umap(proc_ptr, D, buf, sizeof(buf)); inited = GR_FALSE; while (TRUE) { receive(ANY, &mess); if (mess.m_source < 0) panic("Graphics task got message from ", mess.m_source); caller = mess.m_source; proc_nr = mess.PROC_NR; <---------------- switch (mess.m_type) { case DEV_READ: r = do_read(&mess); break; case DEV_WRITE: r = do_write(&mess); break; default: r = EINVAL; break; } mess.m_type = TASK_REPLY; mess.REP_PROC_NR = proc_nr; <------------------ mess.REP_STATUS = r; send(caller, &mess); }}/*================================================= ==========================* * do_write * *================================================= ==========================*/PRIVATE int do_write(m_ptr)register message *m_ptr; /* pointer to the newly arrived message */{ int cc; int r; PRIVATE phys_bytes user_phys; /* physical address of user buf */ /* Make sure write count is between defined minimum and maximum sizes. */ cc = m_ptr->COUNT; if ((cc < sizeof(GR_MSG_HEADER)) || (cc > GR_MAX_SIZEOF_MSG)) return EINVAL; /* Validate and return physical address of user buffer */ user_phys = numap(m_ptr->PROC_NR, (vir_bytes) m_ptr->ADDRESS, (vir_bytes)cc); <--------------- if (user_phys == 0) return EFAULT; /* Read in the complete message */ phys_copy(user_phys, buf_phys, (phys_bytes) cc); /* Execute the commands in it */ r = domessage(buf, cc); if (r) return r; return cc;}