Support O2 optimization

This commit is contained in:
TXuian
2024-04-29 18:27:28 +08:00
parent 88ded7ca16
commit 077dcd66ac
18 changed files with 77 additions and 97 deletions

View File

@@ -49,7 +49,7 @@ Modification:
#include "task.h"
extern void context_switch(struct context**, struct context*);
void dabort_handler(struct trapframe* r)
__attribute__((optimize("O0"))) 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));
@@ -69,7 +69,7 @@ void dabort_handler(struct trapframe* r)
panic("dabort end should never be reashed.\n");
}
void iabort_handler(struct trapframe* r)
__attribute__((optimize("O0"))) 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));

View File

@@ -54,7 +54,7 @@ void default_interrupt_routine(void)
}
extern void context_switch(struct context**, struct context*);
void intr_irq_dispatch(struct trapframe* tf)
__attribute__((optimize("O0"))) void intr_irq_dispatch(struct trapframe* tf)
{
xizi_enter_kernel();
@@ -101,7 +101,7 @@ void xizi_enter_kernel()
spinlock_lock(&whole_kernel_lock);
}
bool xizi_try_enter_kernel()
inline bool xizi_try_enter_kernel()
{
/// @warning trampoline is responsible for closing interrupt
if (spinlock_try_lock(&whole_kernel_lock)) {
@@ -111,7 +111,7 @@ bool xizi_try_enter_kernel()
return false;
}
void xizi_leave_kernel()
inline void xizi_leave_kernel()
{
/// @warning trampoline is responsible for eabling interrupt by using user's state register
spinlock_unlock(&whole_kernel_lock);

View File

@@ -46,7 +46,7 @@ bool swi_distributer_init(struct SwiDispatcherRightGroup* _right_group)
}
extern void context_switch(struct context**, struct context*);
void software_irq_dispatch(struct trapframe* tf)
__attribute__((optimize("O0"))) void software_irq_dispatch(struct trapframe* tf)
{
xizi_enter_kernel();
assert(p_intr_driver != NULL);