forked from xuos/xiuos
Close interrupt during trapframe construction.
This commit is contained in:
parent
e5df6012af
commit
695dd91201
|
@ -51,6 +51,8 @@ Modification:
|
|||
|
||||
void dump_tf(struct trapframe* tf)
|
||||
{
|
||||
KPrintf("sp_usr: 0x%x\n", tf->sp_usr);
|
||||
KPrintf("lr_usr: 0x%x\n", tf->lr_usr);
|
||||
KPrintf("lr_svc: 0x%x\n", tf->lr_svc);
|
||||
KPrintf(" spsr: 0x%x\n", tf->spsr);
|
||||
KPrintf(" r0: 0x%x\n", tf->r0);
|
||||
|
|
|
@ -47,10 +47,13 @@ trap_return:
|
|||
ldmfd r13!, {r14}
|
||||
ldmfd r13!, {r2}
|
||||
msr spsr_cxsf, r2
|
||||
ldmfd r13!, {r0-r12, pc}^ // restore context and return
|
||||
ldmfd r13!, {r0-r12} // restore context and return
|
||||
cpsie i
|
||||
ldmfd r13!, {pc}^ // restore context and return
|
||||
|
||||
user_trap_swi_enter:
|
||||
# save trapframe to swi stack
|
||||
cpsid i
|
||||
stmfd sp!, {r0-r12, r14} // save context
|
||||
mrs r2, spsr // copy spsr to r2
|
||||
stmfd r13!, {r2} // save r2(spsr) to the stack
|
||||
|
@ -66,6 +69,7 @@ user_trap_swi_enter:
|
|||
|
||||
trap_irq_enter:
|
||||
# save it on the stack as r14 is banked
|
||||
cpsid i
|
||||
sub r14, r14, #4 // r14 (lr) contains the interrupted PC
|
||||
stmfd r13!, {r0-r2, r14} //
|
||||
mrs r1, spsr // save spsr_irq
|
||||
|
@ -95,6 +99,7 @@ trap_irq_enter:
|
|||
b trap_return
|
||||
|
||||
trap_reset_enter:
|
||||
cpsid i
|
||||
mov r14, #0 // lr: not defined on reset
|
||||
stmfd r13!, {r0-r12, r14}
|
||||
mrs r2, spsr // copy spsr to r2
|
||||
|
@ -108,6 +113,7 @@ trap_reset_enter:
|
|||
bl _vector_jumper
|
||||
|
||||
trap_dabort:
|
||||
cpsid i
|
||||
sub r14, r14, #8 // lr: instruction causing the abort
|
||||
stmfd r13!, {r0-r12, r14}
|
||||
mrs r2, spsr // copy spsr to r2
|
||||
|
@ -121,6 +127,7 @@ trap_dabort:
|
|||
bl dabort_handler
|
||||
|
||||
trap_iabort:
|
||||
cpsid i
|
||||
sub r14, r14, #4 // lr: instruction causing the abort
|
||||
stmfd r13!, {r0-r12, r14}
|
||||
mrs r2, spsr // copy spsr to r2
|
||||
|
@ -134,6 +141,7 @@ trap_iabort:
|
|||
bl iabort_handler
|
||||
|
||||
trap_undefined_instruction:
|
||||
cpsid i
|
||||
stmfd r13!, {r0-r12, r14}
|
||||
mrs r2, spsr // copy spsr to r2
|
||||
stmfd r13!, {r2} // save r2(spsr) to the stack
|
||||
|
|
|
@ -34,7 +34,7 @@ Modification:
|
|||
#define STACK_DEPTH 32
|
||||
|
||||
struct spinlock { // Mutex.
|
||||
uint32_t owner_cpu; // 1 for locked, 0 for unlocked
|
||||
volatile uint32_t owner_cpu; // 1 for locked, 0 for unlocked
|
||||
char name[28]; // The call stack (an array of program counters)
|
||||
} __attribute__((aligned(32)));
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ Modification:
|
|||
#define MAX_NR_FREE_PAGES ((PHY_MEM_STOP - PHY_MEM_BASE) >> LEVEL4_PTE_SHIFT)
|
||||
|
||||
/* User memory layout */
|
||||
#define USER_STACK_SIZE PAGE_SIZE
|
||||
#define USER_STACK_SIZE MODE_STACK_SIZE
|
||||
#define USER_MEM_BASE (0x00000000)
|
||||
#define USER_MEM_TOP DEV_VRTMEM_BASE
|
||||
#define USER_IPC_SPACE_BASE (0x70000000)
|
||||
|
|
|
@ -56,7 +56,7 @@ Modification:
|
|||
#define MAX_NR_FREE_PAGES ((PHY_USER_FREEMEM_BASE - PHY_MEM_BASE) >> LEVEL4_PTE_SHIFT)
|
||||
|
||||
/* User memory layout */
|
||||
#define USER_STACK_SIZE PAGE_SIZE
|
||||
#define USER_STACK_SIZE MODE_STACK_SIZE
|
||||
#define USER_MEM_BASE (0x00000000)
|
||||
#define USER_MEM_TOP DEV_VRTMEM_BASE
|
||||
#define USER_IPC_SPACE_BASE (0x70000000)
|
||||
|
|
|
@ -89,7 +89,9 @@ 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, 0xF, kGicSgiFilter_UseTargetList);
|
||||
while (1) {
|
||||
gic_send_sgi(SW_INTERRUPT_3, 0xF, kGicSgiFilter_UseTargetList);
|
||||
}
|
||||
printf("%s: Soft interrupt send done\n", prog_name);
|
||||
exit();
|
||||
}
|
|
@ -159,6 +159,7 @@ void delay_session(void)
|
|||
void ipc_server_loop(struct IpcNode* ipc_node)
|
||||
{
|
||||
struct Session session_list[NR_MAX_SESSION];
|
||||
memset(session_list, 0, sizeof(session_list));
|
||||
for (;;) {
|
||||
/* if connect sessions are greater than NR_MAX_SESSION,
|
||||
a full round will require multiple polls.
|
||||
|
|
|
@ -37,7 +37,7 @@ Modification:
|
|||
#include "ipcargs.h"
|
||||
#include "session.h"
|
||||
|
||||
#define NR_MAX_SESSION 16
|
||||
#define NR_MAX_SESSION 32
|
||||
#define IPC_MSG_MAGIC 0xABCDDCBA
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -53,6 +53,7 @@ void dabort_handler(struct trapframe* r)
|
|||
{
|
||||
if (r->pc >= DEV_VRTMEM_BASE && is_spinlock_hold_by_current_cpu(&whole_kernel_lock)) {
|
||||
assert(is_spinlock_hold_by_current_cpu(&whole_kernel_lock));
|
||||
ERROR("dabort in kernel, current task: %s\n", cur_cpu()->task == NULL ? "NULL" : cur_cpu()->task->name);
|
||||
dabort_reason(r);
|
||||
panic("data abort exception\n");
|
||||
}
|
||||
|
@ -72,6 +73,7 @@ void iabort_handler(struct trapframe* r)
|
|||
{
|
||||
if (r->pc >= DEV_VRTMEM_BASE && is_spinlock_hold_by_current_cpu(&whole_kernel_lock)) {
|
||||
assert(is_spinlock_hold_by_current_cpu(&whole_kernel_lock));
|
||||
ERROR("iabort in kernel, current task: %s\n", cur_cpu()->task == NULL ? "NULL" : cur_cpu()->task->name);
|
||||
iabort_reason(r);
|
||||
panic("kernel prefetch abort exception\n");
|
||||
}
|
||||
|
|
|
@ -114,5 +114,4 @@ bool xizi_try_enter_kernel()
|
|||
void xizi_leave_kernel()
|
||||
{
|
||||
spinlock_unlock(&whole_kernel_lock);
|
||||
p_intr_driver->cpu_irq_enable();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue