Removal of the system task

* Userspace change to use the new kernel calls

	- _taskcall(SYSTASK...) changed to _kernel_call(...)

	- int 32 reused for the kernel calls

	- _do_kernel_call() to make the trap to kernel

	- kernel_call() to make the actuall kernel call from C using
	  _do_kernel_call()

	- unlike ipc call the kernel call always succeeds as kernel is
	  always available, however, kernel may return an error

* Kernel side implementation of kernel calls

	- the SYSTEm task does not run, only the proc table entry is
	  preserved

	- every data_copy(SYSTEM is no data_copy(KERNEL

	- "locking" is an empty operation now as everything runs in
	  kernel

	- sys_task() is replaced by kernel_call() which copies the
	  message into kernel, dispatches the call to its handler and
	  finishes by either copying the results back to userspace (if
	  need be) or by suspending the process because of VM

	- suspended processes are later made runnable once the memory
	  issue is resolved, picked up by the scheduler and only at
	  this time the call is resumed (in fact restarted) which does
	  not need to copy the message from userspace as the message
	  is already saved in the process structure.

	- no ned for the vmrestart queue, the scheduler will restart
	  the system calls

	- no special case in do_vmctl(), all requests remove the
	  RTS_VMREQUEST flag
This commit is contained in:
Tomas Hruby
2010-02-09 15:20:09 +00:00
parent 5e57818431
commit 728f0f0c49
84 changed files with 274 additions and 249 deletions

View File

@@ -407,7 +407,8 @@ PRIVATE struct gate_table_s gate_table_ioapic[] = {
};
PRIVATE struct gate_table_s gate_table_common[] = {
{ ipc_entry, SYS386_VECTOR, USER_PRIVILEGE },
{ ipc_entry, IPC_VECTOR, USER_PRIVILEGE },
{ kernel_call_entry, KERN_CALL_VECTOR, USER_PRIVILEGE },
{ level0_call, LEVEL0_VECTOR, TASK_PRIVILEGE },
{ NULL, 0, 0}
};

View File

@@ -21,12 +21,12 @@ struct reg86u reg86;
PUBLIC int do_int86(struct proc * caller, message * m_ptr)
{
data_copy(caller->p_endpoint, (vir_bytes) m_ptr->INT86_REG86,
SYSTEM, (vir_bytes) &reg86, sizeof(reg86));
KERNEL, (vir_bytes) &reg86, sizeof(reg86));
level0(int86);
/* Copy results back to the caller */
data_copy(SYSTEM, (vir_bytes) &reg86,
data_copy(KERNEL, (vir_bytes) &reg86,
caller->p_endpoint, (vir_bytes) m_ptr->INT86_REG86, sizeof(reg86));
/* The BIOS call eats interrupts. Call get_randomness to generate some

View File

@@ -243,7 +243,7 @@ PUBLIC void proc_stacktrace(struct proc *whichproc)
#define PRCOPY(pr, pv, v, n) \
(iskernel ? (memcpy((char *) v, (char *) pv, n), OK) : \
data_copy(pr->p_endpoint, pv, SYSTEM, (vir_bytes) (v), n))
data_copy(pr->p_endpoint, pv, KERNEL, (vir_bytes) (v), n))
if(PRCOPY(whichproc, v_bp, &v_hbp, sizeof(v_hbp)) != OK) {
kprintf("(v_bp 0x%lx ?)", v_bp);

View File

@@ -377,7 +377,7 @@ hwint15:
hwint_slave(15)
/*
* syscall is only from a process to kernel
* IPC is only from a process to kernel
*/
.balign 16
.globl ipc_entry
@@ -411,6 +411,36 @@ ipc_entry:
jmp restart
/*
* kernel call is only from a process to kernel
*/
.balign 16
.globl kernel_call_entry
kernel_call_entry:
SAVE_PROCESS_CTX(0)
/* save the pointer to the current process */
push %ebp
/* for stack trace */
movl $0, %ebp
/*
* pass the syscall arguments from userspace to the handler.
* SAVE_PROCESS_CTX() does not clobber these registers, they are still
* set as the userspace have set them
*/
push %eax
call kernel_call
/* restore the current process pointer and save the return value */
add $8, %esp
jmp restart
.balign 16
/*
* called by the exception interrupt vectors. If the exception does not push

View File

@@ -212,7 +212,8 @@ PUBLIC void idt_init(void)
{ alignment_check, ALIGNMENT_CHECK_VECTOR, INTR_PRIVILEGE },
{ machine_check, MACHINE_CHECK_VECTOR, INTR_PRIVILEGE },
{ simd_exception, SIMD_EXCEPTION_VECTOR, INTR_PRIVILEGE },
{ ipc_entry, SYS386_VECTOR, USER_PRIVILEGE },/* 386 system call */
{ ipc_entry, IPC_VECTOR, USER_PRIVILEGE },
{ kernel_call_entry, KERN_CALL_VECTOR, USER_PRIVILEGE },
{ level0_call, LEVEL0_VECTOR, TASK_PRIVILEGE },
{ NULL, 0, 0}
};