diff --git a/src/kernel/cpu/cpu_error.c b/src/kernel/cpu/cpu_error.c index e12143bb..116c806a 100755 --- a/src/kernel/cpu/cpu_error.c +++ b/src/kernel/cpu/cpu_error.c @@ -1,9 +1,9 @@ #include -inthandler_f error_inthandler; -inthandler_f ERROR7; -inthandler_f ERROR13; -inthandler_f irq13; +static inthandler_f error_inthandler; +static inthandler_f ERROR7; +static inthandler_f ERROR13; +static inthandler_f irq13; void fpu_disable() { asm_set_ts, asm_set_em; @@ -69,7 +69,7 @@ static const struct { [31] = {"--", "Reserved" }, }; -void error_inthandler(i32 id, regs32 *regs) { +__attr(fastcall) void error_inthandler(i32 id, regs32 *regs) { kassert(id >= 0); kassert(id < 32); kassert(regs != null); @@ -78,11 +78,11 @@ void error_inthandler(i32 id, regs32 *regs) { abort(); } -void ERROR7(i32 id, regs32 *reg) { +__attr(fastcall) void ERROR7(i32 id, regs32 *reg) { fpu_enable(current_task); } -void irq13(i32 id, regs32 *reg) { +__attr(fastcall) void irq13(i32 id, regs32 *reg) { kloge("IRQ 13 should not be triggered"); fpu_enable(current_task); } @@ -105,7 +105,7 @@ extern byte *IVT; extern task_t v86_using_task; -void ERROR13(i32 id, regs32 *regs) { +__attr(fastcall) void ERROR13(i32 id, regs32 *regs) { const var frame = regs; const var task = current_task; if (current_task->v86_mode != 1) { diff --git a/src/kernel/drivers/general/timer.c b/src/kernel/drivers/general/timer.c index fba7ea61..1191192e 100755 --- a/src/kernel/drivers/general/timer.c +++ b/src/kernel/drivers/general/timer.c @@ -37,7 +37,7 @@ void sleep(uint64_t time_s) { // } while (now_time.sec < end_time.sec || now_time.nsec < end_time.nsec); } -static void inthandler20(i32 id, regs32 *regs) { +__attr(fastcall) void inthandler20(i32 id, regs32 *regs) { // gettime_ns(NULL); // 更新时间 system_tick++; diff --git a/src/kernel/drivers/input/keyboard.c b/src/kernel/drivers/input/keyboard.c index 922b1932..05e1af1f 100755 --- a/src/kernel/drivers/input/keyboard.c +++ b/src/kernel/drivers/input/keyboard.c @@ -112,7 +112,7 @@ static int sc2a(int sc) { int disable_flag = 0; task_t keyboard_use_task = NULL; -static void inthandler21(i32 id, regs32 *regs) { +__attr(fastcall) void inthandler21(i32 id, regs32 *regs) { // 键盘中断处理函数 u8 data, s[4]; asm_out8(PIC0_OCW2, 0x61); diff --git a/src/kernel/drivers/input/mouse.c b/src/kernel/drivers/input/mouse.c index 57b4af1a..12daf9fb 100755 --- a/src/kernel/drivers/input/mouse.c +++ b/src/kernel/drivers/input/mouse.c @@ -112,7 +112,7 @@ u32 m_cr3 = 0; u32 m_eip = 0; u32 times = 0; -static void inthandler2c(i32 id, regs32 *regs) { +__attr(fastcall) void inthandler2c(i32 id, regs32 *regs) { byte data = asm_in8(PORT_KEYDAT); klogd("mouse data=%02x\n", data); diff --git a/src/kernel/drivers/sound/hda.c b/src/kernel/drivers/sound/hda.c index 2ddf30c1..26633788 100755 --- a/src/kernel/drivers/sound/hda.c +++ b/src/kernel/drivers/sound/hda.c @@ -630,7 +630,7 @@ static int hda_open(vsound_t vsound) { return 0; } -static void hda_interrupt_handler(i32 id, regs32 *regs) { +__attr(fastcall) void hda_interrupt_handler(i32 id, regs32 *regs) { // printf("hda interrupt has been called"); if (hda_stopping) { hda_stop(); diff --git a/src/kernel/drivers/sound/sb16.c b/src/kernel/drivers/sound/sb16.c index accb736f..3ac70a45 100755 --- a/src/kernel/drivers/sound/sb16.c +++ b/src/kernel/drivers/sound/sb16.c @@ -138,7 +138,7 @@ static vsound_t snd; static inthandler_f sb16_handler; -static void sb16_handler(i32 id, regs32 *regs) { +__attr(fastcall) void sb16_handler(i32 id, regs32 *regs) { asm_in8(sb.depth == 16 ? SB_INTR16 : SB_STATE); #if VSOUND_RWAPI diff --git a/src/kernel/drivers/storage/fdc.c b/src/kernel/drivers/storage/fdc.c index 0a33481e..6a9c47a2 100755 --- a/src/kernel/drivers/storage/fdc.c +++ b/src/kernel/drivers/storage/fdc.c @@ -87,7 +87,7 @@ static void Write(int drive, byte *buffer, uint number, uint lba) { static inthandler_f flint; -static void flint(i32 id, regs32 *regs) { +__attr(fastcall) void flint(i32 id, regs32 *regs) { floppy_int_count = 1; // 设置中断计数器为1,代表中断已经发生(或者是系统已经收到了中断) asm_out8(0x20, 0x20); // 发送EOI信号,告诉PIC,我们已经处理完了这个中断 // task_run(waiter); diff --git a/src/kernel/drivers/storage/ide.c b/src/kernel/drivers/storage/ide.c index 9aa1aa4b..4e1bb58e 100755 --- a/src/kernel/drivers/storage/ide.c +++ b/src/kernel/drivers/storage/ide.c @@ -549,7 +549,7 @@ void ide_wait_irq() { ide_irq_invoked = 0; } -static void ide_irq(i32 id, regs32 *regs) { +__attr(fastcall) void ide_irq(i32 id, regs32 *regs) { klog("ide irq."); ide_irq_invoked = 1; } diff --git a/src/kernel/mm/vpage.c b/src/kernel/mm/vpage.c index d3a57333..04023b90 100755 --- a/src/kernel/mm/vpage.c +++ b/src/kernel/mm/vpage.c @@ -657,7 +657,7 @@ void page_set_physics_attr_pde(u32 vaddr, void *paddr, u32 attr, u32 pde_backup) extern TSS32 tss; -static void page_fault(i32 id, regs32 *regs) { +__attr(fastcall) void page_fault(i32 id, regs32 *regs) { asm_cli; u32 pde = current_task->pde; asm_set_cr3(PDE_ADDRESS); // 设置一个安全的页表