From d927fb68776dc553f0acab6003b5e596a97c9bae Mon Sep 17 00:00:00 2001 From: Ivan Poddubny Date: Fri, 28 Oct 2005 16:16:47 +0000 Subject: [PATCH] * A bug with floppy IRQ has been finally fixed (EOI added) * optimised i40 handler git-svn-id: svn://kolibrios.org@15 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/sys32.inc | 11 +++--- kernel/trunk/core/syscall.inc | 67 ++++++++--------------------------- kernel/trunk/kernel.asm | 4 +-- 3 files changed, 21 insertions(+), 61 deletions(-) diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index fdb706230f..479acef5cf 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -280,15 +280,12 @@ show_error_parameters: call writehex mov eax,[0x3000] - shl eax,8 - cmp [0x80000+eax+0xB0],byte 0 + imul eax,tss_step + cmp [eax+tss_data+l.cs-tss_sceleton], os_code jz @f mov esi,system_error call sys_msg_board_str @@: - - mov eax,[0x3000] - imul eax,tss_step mov eax,[eax+tss_data+l.eip-tss_sceleton] mov [write_error_to],process_eip+43 @@ -338,6 +335,10 @@ p_irq6: mov ds, ax mov es, ax call fdc_irq + + mov al,0x20 ; ready for next irq + out 0x20,al + pop es ds popad iret diff --git a/kernel/trunk/core/syscall.inc b/kernel/trunk/core/syscall.inc index 85ee6631eb..6ef5a695a0 100644 --- a/kernel/trunk/core/syscall.inc +++ b/kernel/trunk/core/syscall.inc @@ -3,83 +3,44 @@ ;; SYSTEM CALL ENTRY ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -uglobal - pushed_regs rd 1 -endg align 32 i40: + push ds es pushad - push ds mov ax,word os_data mov ds,ax mov es,ax - mov [pushed_regs],esp - add dword [pushed_regs],4 - cli - - mov eax, [0x3000] - mov edi, eax - shl edi, 8 - mov [edi+0x80000+0xB0],eax ; used i40 handler ; for syscall trace function call save_registers - mov esi,[pushed_regs] - - ; load first 3 registers - mov eax,[esi+28] - mov ebx,[esi+16] - mov ecx,[esi+24] - - ; save current registers - ; stack may be modified by a system function to return some value to caller! - pushad - - ; load all registers from TSS of the application, in crossed order (why?) - mov edi,[esi+28] - mov eax,[esi+16] - mov ebx,[esi+24] - mov ecx,[esi+20] - mov edx,[esi+4] - mov esi,[esi+0] + ; load all registers in crossed order + mov edi,[esp+28] ; eax + mov eax,[esp+16] ; ebx + mov ebx,[esp+24] ; ecx + mov ecx,[esp+20] ; edx + mov edx,[esp+4] ; esi + mov esi,[esp+0] ; edi ; enable interupts - a task switch or an IRQ _CAN_ interrupt i40 handler sti - ; eax doesn't need to be saved, but... - push eax - and edi,0xff - call dword [servetable+edi*4] - pop eax + push eax + and edi,0xff + call dword [servetable+edi*4] + pop eax cli - - ; return saved and probably even changed regs - popad - - ; modify 3 program's registers (in its TSS) - mov [esi+28],eax - mov [esi+16],ebx - mov [esi+24],ecx - - xor eax, eax - mov edi, [0x3000] ; no syscall interrupt in use anymore - shl edi, 8 - mov [edi+0x80000+0xB0],eax - - pop eax - mov ds,ax - mov es,ax popad + pop es ds iretd align 4 save_registers: mov esi, [0x3010] mov eax, [esi+0x4] ; load PID - mov esi, [pushed_regs] + lea esi, [esp+4] inc [save_syscall_count] mov edi,[save_syscall_count] and edi,0xF diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 7b71f83f60..593b794bc5 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -832,9 +832,7 @@ osloop: call checkidle call check_fdd_motor_status jmp osloop -;temp_pointers: -; rd 32 -; seed dd 0x12345678 + checkidle: