do_ipc() rearrangements
this patch does not add or change any functionality of do_ipc(), it only makes things a little cleaner (hopefully). Until now do_ipc() was responsible for handling all ipc calls. The catch is that SENDA is fairly different which results in some ugly code like this typecasting and variables naming which does not make much sense for SENDA and makes the code hard to read. result = mini_senda(caller_ptr, (asynmsg_t *)m_ptr, (size_t)src_dst_e); As it is called directly from assembly, the new do_ipc() takes as input values of 3 registers in reg_t variables (it used to be 4, however, bit_map wasn't used so I removed it), does the checks common to all ipc calls and call the appropriate handler either for do_sync_ipc() (all except SENDA) or mini_senda() (for SENDA) while typecasting the reg_t values correctly. As a result, handling SENDA differences in do_sync_ipc() is no more needed. Also the code that uses msg_size variable is improved a little bit. arch_do_syscall() is simplified too.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <minix/portio.h>
|
||||
#include <minix/cpufeature.h>
|
||||
#include <a.out.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "archconst.h"
|
||||
#include "proto.h"
|
||||
@@ -455,20 +456,11 @@ PUBLIC int arch_set_params(char *params, int size)
|
||||
|
||||
PUBLIC void arch_do_syscall(struct proc *proc)
|
||||
{
|
||||
/* Perform a previously postponed system call.
|
||||
*/
|
||||
int call_nr, src_dst_e;
|
||||
message *m_ptr;
|
||||
long bit_map;
|
||||
|
||||
/* Get the system call parameters from their respective registers. */
|
||||
call_nr = proc->p_reg.cx;
|
||||
src_dst_e = proc->p_reg.retreg;
|
||||
m_ptr = (message *) proc->p_reg.bx;
|
||||
bit_map = proc->p_reg.dx;
|
||||
|
||||
/* do_ipc assumes that it's running because of the current process */
|
||||
assert(proc == proc_ptr);
|
||||
/* Make the system call, for real this time. */
|
||||
proc->p_reg.retreg = do_ipc(call_nr, src_dst_e, m_ptr, bit_map);
|
||||
proc->p_reg.retreg =
|
||||
do_ipc(proc->p_reg.cx, proc->p_reg.retreg, proc->p_reg.bx);
|
||||
}
|
||||
|
||||
PUBLIC struct proc * arch_finish_schedcheck(void)
|
||||
|
||||
@@ -396,7 +396,6 @@ ipc_entry:
|
||||
* SAVE_PROCESS_CTX() does not clobber these registers, they are still
|
||||
* set as the userspace have set them
|
||||
*/
|
||||
push %edx
|
||||
push %ebx
|
||||
push %eax
|
||||
push %ecx
|
||||
@@ -412,7 +411,7 @@ ipc_entry:
|
||||
call do_ipc
|
||||
|
||||
/* restore the current process pointer and save the return value */
|
||||
add $4 * 4, %esp
|
||||
add $3 * 4, %esp
|
||||
pop %esi
|
||||
mov %eax, AXREG(%esi)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user