void replyFromKernel_success_empty(tcb_t *thread) { setRegister(thread, badgeRegister, 0); setRegister(thread, msgInfoRegister, wordFromMessageInfo( message_info_new(0, 0, 0, 0))); }
/* ReadRegisters is a special case: replyFromKernel & setMRs are * unfolded here, in order to avoid passing the large reply message up * to the top level in a global (and double-copying). We prevent the * top-level replyFromKernel_success_empty() from running by setting the * thread state. Retype does this too. */ exception_t invokeTCB_ReadRegisters(tcb_t *tcb_src, bool_t suspendSource, unsigned int n, word_t arch, bool_t call) { unsigned int i, j; exception_t e; tcb_t *thread; thread = ksCurThread; if (suspendSource) { suspend(tcb_src); } e = Arch_performTransfer(arch, tcb_src, ksCurThread); if (e != EXCEPTION_NONE) { return e; } if (call) { word_t *ipcBuffer; ipcBuffer = lookupIPCBuffer(true, thread); setRegister(thread, badgeRegister, 0); for (i = 0; i < n && i < n_frameRegisters && i < n_msgRegisters; i++) { setRegister(thread, msgRegisters[i], getRegister(tcb_src, frameRegisters[i])); } if (ipcBuffer != NULL && i < n && i < n_frameRegisters) { for (; i < n && i < n_frameRegisters; i++) { ipcBuffer[i + 1] = getRegister(tcb_src, frameRegisters[i]); } } j = i; for (i = 0; i < n_gpRegisters && i + n_frameRegisters < n && i + n_frameRegisters < n_msgRegisters; i++) { setRegister(thread, msgRegisters[i + n_frameRegisters], getRegister(tcb_src, gpRegisters[i])); } if (ipcBuffer != NULL && i < n_gpRegisters && i + n_frameRegisters < n) { for (; i < n_gpRegisters && i + n_frameRegisters < n; i++) { ipcBuffer[i + n_frameRegisters + 1] = getRegister(tcb_src, gpRegisters[i]); } } setRegister(thread, msgInfoRegister, wordFromMessageInfo( message_info_new(0, 0, 0, i + j))); } setThreadState(thread, ThreadState_Running); return EXCEPTION_NONE; }
void replyFromKernel_error(tcb_t *thread) { unsigned int len; word_t *ipcBuffer; ipcBuffer = lookupIPCBuffer(true, thread); setRegister(thread, badgeRegister, 0); len = setMRs_syscall_error(thread, ipcBuffer); setRegister(thread, msgInfoRegister, wordFromMessageInfo( message_info_new(current_syscall_error.type, 0, 0, len))); }
void doFaultTransfer(word_t badge, tcb_t *sender, tcb_t *receiver, word_t *receiverIPCBuffer) { unsigned int sent; message_info_t msgInfo; sent = setMRs_fault(sender, receiver, receiverIPCBuffer); msgInfo = message_info_new( fault_get_faultType(sender->tcbFault), 0, 0, sent); setRegister(receiver, msgInfoRegister, wordFromMessageInfo(msgInfo)); setRegister(receiver, badgeRegister, badge); }
exception_t invokeReadVMCS(vcpu_t *vcpu, int num_fields, uint32_t *fields) { tcb_t *thread; int i; word_t *sendBuf; thread = ksCurThread; sendBuf = lookupIPCBuffer(true, thread); for (i = 0; i < n_msgRegisters && i < num_fields; i++) { setRegister(thread, msgRegisters[i], readVMCSfield(vcpu, fields[i])); } if (sendBuf) { for (; i < num_fields; i++) { sendBuf[i + 1] = readVMCSfield(vcpu, fields[i]); } } setRegister(thread, msgInfoRegister, wordFromMessageInfo( message_info_new(0, 0, 0, i))); setThreadState(thread, ThreadState_Running); return EXCEPTION_NONE; }
void doAsyncTransfer(word_t badge, word_t msgWord, tcb_t *thread) { message_info_t msgInfo; unsigned int msgTransferred; if (n_msgRegisters < 1) { word_t *ipcBuffer; ipcBuffer = lookupIPCBuffer(true, thread); if (ipcBuffer != NULL) { ipcBuffer[1] = msgWord; msgTransferred = 1; } else { msgTransferred = 0; } } else { setRegister(thread, msgRegisters[0], msgWord); msgTransferred = 1; } setRegister(thread, badgeRegister, badge); msgInfo = message_info_new(0, 0, 0, msgTransferred); setRegister(thread, msgInfoRegister, wordFromMessageInfo(msgInfo)); }