From 716f732e3a8ab779b79a546060a22a361794c132 Mon Sep 17 00:00:00 2001 From: Kenneth J Davis Date: Sat, 10 Feb 2024 17:34:00 -0500 Subject: [PATCH] rework to make handling flags simpler, from ecm --- kernel/intr.asm | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/kernel/intr.asm b/kernel/intr.asm index 013d23d..8fcbc3a 100644 --- a/kernel/intr.asm +++ b/kernel/intr.asm @@ -41,9 +41,7 @@ push es %endif push ds - pushf - ; Flags are preserved across the entire - ; function call, particularly IF. + pushf arg nr, {rp,%1} mov ax, [.nr] ; interrupt number @@ -55,38 +53,18 @@ arg nr, {rp,%1} %else mov bx, [.rp] ; regpack structure %endif + mov cx, [bx+4] mov dx, [bx+6] mov si, [bx+8] mov di, [bx+10] mov bp, [bx+12] push word [bx+14] ; ds mov es, [bx+16] - pushf - pop cx - and cx, 0F02Ah - ; Get the current reserved bits from the FL - ; register. Hardens against possible weirdness - ; around eg the NEC V20/V30 MD flag. - - mov ax, [bx + 22] ; flags - and ax, ~ 0F72Ah - ; Clear most of the top bits of the FL input. - ; Particularly, clear DF, IF, and TF. Callers - ; often do not initialise all of the iregs - ; structure passed to us. Avoid weirdness - ; when DF would be set (DN) or when TF would - ; enable tracing randomly. - - or ax, cx - ; Set reserved bits to same as current FL. - - push ax + mov ah, byte [bx+22] ; flags + sahf mov ax, [bx] - mov cx, [bx+4] mov bx, [bx+2] - popf ; set live FL pop ds - sti int 0 %%intr_1: