forked from xuos/xiuos
fix sys_kill.
This commit is contained in:
@@ -24,6 +24,19 @@ enum {
|
||||
ARM_PERIPHERAL_VIRT_BASE = 0x50000000,
|
||||
};
|
||||
|
||||
enum _gicd_sgi_filter {
|
||||
//! Forward the interrupt to the CPU interfaces specified in the @a target_list parameter.
|
||||
kGicSgiFilter_UseTargetList = 0,
|
||||
|
||||
//! Forward the interrupt to all CPU interfaces except that of the processor that requested
|
||||
//! the interrupt.
|
||||
kGicSgiFilter_AllOtherCPUs = 1,
|
||||
|
||||
//! Forward the interrupt only to the CPU interface of the processor that requested the
|
||||
//! interrupt.
|
||||
kGicSgiFilter_OnlyThisCPU = 2
|
||||
};
|
||||
|
||||
struct _gicd_registers {
|
||||
uint32_t CTLR; //!< Distributor Control Register.
|
||||
uint32_t TYPER; //!< Interrupt Controller Type Register.
|
||||
@@ -76,7 +89,7 @@ int main()
|
||||
mmap(ARM_PERIPHERAL_VIRT_BASE, ARM_PERIPHERAL_BASE, 0x2000, true);
|
||||
|
||||
printf("%s: Sending soft interrupt\n", prog_name);
|
||||
gic_send_sgi(SW_INTERRUPT_3, 0, 2);
|
||||
gic_send_sgi(SW_INTERRUPT_3, 0, kGicSgiFilter_OnlyThisCPU);
|
||||
printf("%s: Soft interrupt send done\n", prog_name);
|
||||
exit();
|
||||
}
|
||||
@@ -178,24 +178,29 @@ void ipc_server_loop(struct IpcNode* ipc_node)
|
||||
a session could be delay in case one of its message(current message) needs to wait for an interrupt message's arrival
|
||||
interfaces[opcode] should explicitly call delay_session() and return to delay this session
|
||||
*/
|
||||
while (msg->header.magic == IPC_MSG_MAGIC && msg->header.valid == 1 && msg->header.done != 1) {
|
||||
while (msg->header.magic == IPC_MSG_MAGIC && msg->header.valid == 1) {
|
||||
// printf("session %d [%d, %d]\n", session_list[i].id, session_list[i].head, session_list[i].tail);
|
||||
if (session_used_size(&session_list[i]) == 0 && session_forward_tail(&session_list[i], msg->header.len) < 0) {
|
||||
break;
|
||||
}
|
||||
if (ipc_node->interfaces[msg->header.opcode]) {
|
||||
ipc_node->interfaces[msg->header.opcode](msg);
|
||||
// check if this session is delayed by op handler, all messages after the delayed message in current session is blocked.
|
||||
if (session_delayed) {
|
||||
session_delayed = false;
|
||||
break;
|
||||
|
||||
// this is a message needs to handle
|
||||
if (msg->header.done != 1) {
|
||||
if (ipc_node->interfaces[msg->header.opcode]) {
|
||||
ipc_node->interfaces[msg->header.opcode](msg);
|
||||
// check if this session is delayed by op handler, all messages after the delayed message in current session is blocked.
|
||||
if (session_delayed) {
|
||||
session_delayed = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
printf("Unsupport opcode(%d) for server: %s\n", msg->header.opcode, ipc_node->name);
|
||||
}
|
||||
} else {
|
||||
printf("Unsupport opcode(%d) for server: %s\n", msg->header.opcode, ipc_node->name);
|
||||
}
|
||||
// current msg is a message that needs to ignore
|
||||
// finish this message in server's perspective
|
||||
while (session_forward_head(&session_list[i], msg->header.len) < 0) {
|
||||
yield();
|
||||
if (session_forward_head(&session_list[i], msg->header.len) < 0) {
|
||||
break;
|
||||
}
|
||||
msg = IPCSESSION_MSG(&session_list[i]);
|
||||
}
|
||||
|
||||
@@ -61,6 +61,6 @@ bool session_free_buf(struct Session* session, int len)
|
||||
if (len > session_used_size(session)) {
|
||||
return false;
|
||||
}
|
||||
assert(session_forward_head(session, len) != 1);
|
||||
assert(session_forward_head(session, len) != -1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ __attribute__((__always_inline__)) static inline int session_remain_capacity(str
|
||||
|
||||
__attribute__((__always_inline__)) static inline int session_forward_head(struct Session* session, int len)
|
||||
{
|
||||
if (((session->head + len) % session->capacity) > session->tail) {
|
||||
if (len > session_used_size(session)) {
|
||||
printf("forward head with too much size\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user