Make sure that kernel is interrupt disabled.

This commit is contained in:
TXuian
2024-04-29 10:46:07 +08:00
parent 695dd91201
commit 8d2d7e3e09
7 changed files with 106 additions and 63 deletions
@@ -88,9 +88,11 @@ int main()
printf("%s: Mapping GIC\n", prog_name);
mmap(ARM_PERIPHERAL_VIRT_BASE, ARM_PERIPHERAL_BASE, 0x2000, true);
printf("%s: Sending soft interrupt\n", prog_name);
while (1) {
int send_time = 1000;
printf("%s: Sending soft interrupt for %d times\n", prog_name, send_time);
for (int i = 0; i < send_time; i++) {
gic_send_sgi(SW_INTERRUPT_3, 0xF, kGicSgiFilter_UseTargetList);
printf("%s: Soft interrupt send 1 time\n", prog_name);
}
printf("%s: Soft interrupt send done\n", prog_name);
exit();
+9 -11
View File
@@ -179,24 +179,22 @@ 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) {
while (msg->header.magic == IPC_MSG_MAGIC && msg->header.valid == 1 && msg->header.done == 0) {
// 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;
}
// 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);
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);
}
// current msg is a message that needs to ignore
// finish this message in server's perspective
@@ -56,7 +56,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 (len > session_used_size(session)) {
printf("forward head with too much size\n");
printf("forward head with too much size, session used size: %d\n", session_used_size(session));
return -1;
}
session->head = (session->head + len) % session->capacity;