mirror of
https://gitee.com/Vancouver2017/luban-lite-t3e-pro.git
synced 2025-12-13 18:08:54 +00:00
v1.0.2: optimize schedule
This commit is contained in:
@@ -57,7 +57,7 @@ Default_IRQHandler:
|
||||
la sp, g_top_irqstack
|
||||
|
||||
/* ipush */
|
||||
addi sp, sp, -(18 * FREGBYTES)
|
||||
addi sp, sp, -(18 * REGBYTES)
|
||||
STORE x1, 1 * REGBYTES(sp) // ra
|
||||
csrr x1, mepc
|
||||
STORE x1, 0 * REGBYTES(sp) // mepc
|
||||
@@ -213,7 +213,7 @@ Default_IRQHandler:
|
||||
LOAD x30, 16 * REGBYTES(sp) // t5
|
||||
LOAD x31, 17 * REGBYTES(sp) // t6
|
||||
|
||||
addi sp, sp, (18 * FREGBYTES)
|
||||
addi sp, sp, (18 * REGBYTES)
|
||||
|
||||
/* Restore sp to normal stack */
|
||||
csrr sp, mscratch
|
||||
|
||||
@@ -63,6 +63,12 @@ rt_hw_context_switch_to:
|
||||
li t1, 1
|
||||
sw t1, (t0)
|
||||
|
||||
/* make sure wite instruction is complete */
|
||||
fence
|
||||
lw t1, (t0)
|
||||
fence
|
||||
sync.is
|
||||
|
||||
/* enable global interrup */
|
||||
csrsi mstatus, 8
|
||||
|
||||
@@ -83,6 +89,11 @@ rt_hw_context_switch_to:
|
||||
rt_hw_context_switch:
|
||||
.globl rt_hw_context_switch_interrupt
|
||||
rt_hw_context_switch_interrupt:
|
||||
addi sp, sp, -(3 * REGBYTES)
|
||||
STORE t0, 0 * REGBYTES(sp)
|
||||
STORE t1, 1 * REGBYTES(sp)
|
||||
STORE t2, 2 * REGBYTES(sp)
|
||||
|
||||
/* check rt_thread_switch_interrupt_flag */
|
||||
la t0, rt_thread_switch_interrupt_flag
|
||||
lw t1, (t0)
|
||||
@@ -99,11 +110,23 @@ rt_hw_context_switch_interrupt:
|
||||
/* update to_thread */
|
||||
la t0, rt_interrupt_to_thread
|
||||
STORE a1, (t0)
|
||||
|
||||
/* set software interrupt */
|
||||
li t0, TSPEND_INTIP
|
||||
li t1, 1
|
||||
sw t1, (t0)
|
||||
|
||||
/* make sure wite instruction is complete */
|
||||
fence
|
||||
lw t1, (t0)
|
||||
fence
|
||||
sync.is
|
||||
|
||||
LOAD t0, 0 * REGBYTES(sp)
|
||||
LOAD t1, 1 * REGBYTES(sp)
|
||||
LOAD t2, 2 * REGBYTES(sp)
|
||||
addi sp, sp, (3 * REGBYTES)
|
||||
|
||||
ret
|
||||
|
||||
/*
|
||||
|
||||
@@ -71,6 +71,12 @@ rt_hw_context_switch_to:
|
||||
or t1, t1, t2
|
||||
sb t1, (t0)
|
||||
|
||||
/* make sure wite instruction is complete */
|
||||
fence
|
||||
lb t1, (t0)
|
||||
fence
|
||||
sync.i
|
||||
|
||||
/* enable global interrup */
|
||||
csrsi mstatus, 8
|
||||
|
||||
@@ -91,6 +97,11 @@ rt_hw_context_switch_to:
|
||||
rt_hw_context_switch:
|
||||
.globl rt_hw_context_switch_interrupt
|
||||
rt_hw_context_switch_interrupt:
|
||||
addi sp, sp, -(3 * REGBYTES)
|
||||
STORE t0, 0 * REGBYTES(sp)
|
||||
STORE t1, 1 * REGBYTES(sp)
|
||||
STORE t2, 2 * REGBYTES(sp)
|
||||
|
||||
/* check rt_thread_switch_interrupt_flag */
|
||||
la t0, rt_thread_switch_interrupt_flag
|
||||
lw t1, (t0)
|
||||
@@ -107,6 +118,7 @@ rt_hw_context_switch_interrupt:
|
||||
/* update to_thread */
|
||||
la t0, rt_interrupt_to_thread
|
||||
STORE a1, (t0)
|
||||
|
||||
/* set software interrupt */
|
||||
li t0, TSPEND_INTIP
|
||||
lb t1, (t0)
|
||||
@@ -114,6 +126,17 @@ rt_hw_context_switch_interrupt:
|
||||
or t1, t1, t2
|
||||
sb t1, (t0)
|
||||
|
||||
/* make sure wite instruction is complete */
|
||||
fence
|
||||
lb t1, (t0)
|
||||
fence
|
||||
sync.i
|
||||
|
||||
LOAD t0, 0 * REGBYTES(sp)
|
||||
LOAD t1, 1 * REGBYTES(sp)
|
||||
LOAD t2, 2 * REGBYTES(sp)
|
||||
addi sp, sp, (3 * REGBYTES)
|
||||
|
||||
ret
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user