From 5d29745034c854886fb5988fca65cc3757f69a3e Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Sun, 2 Aug 2020 08:27:25 +1000 Subject: Modified assembly routines to use x86's advanced addressing modes. --- kernel/traps.s | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'kernel/traps.s') diff --git a/kernel/traps.s b/kernel/traps.s index ca083dd..475495b 100644 --- a/kernel/traps.s +++ b/kernel/traps.s @@ -117,10 +117,7 @@ traps_init: mov ecx, 0 mov edx, idt .loop: - mov eax, ecx - shl eax, 2 - add eax, traps - mov eax, [eax] + mov eax, [ecx*4+traps] mov [edx], ax shr eax, 16 mov [edx+6], ax @@ -279,9 +276,7 @@ syscall_handler: push ecx push ebx and eax, 0xFF - shl eax, 2 - add eax, call_table - call [eax] + call [eax*4+call_table] add esp, 12 ; preserve the syscall's return value mov [esp+30], eax @@ -326,9 +321,7 @@ check_signals: inc ecx mov ebx, ecx ; calculate offset to the handler function - shl ecx, 2 - add ecx, eax - add ecx, ts_sig_handlers + lea ecx, [ecx*4+eax+ts_sig_handlers] cmp dword [ecx], 0 jne .custom_handler ; call the default handler -- cgit v1.3