Philip Guenther <[email protected]> wrote:
> No, it should be the other way, moving the “clear NT flag” block down after
> the “save registers into save area” block
Ah.
Index: arch/amd64/stand/libsa/gidt.S
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/gidt.S,v
retrieving revision 1.11
diff -u -p -u -r1.11 gidt.S
--- arch/amd64/stand/libsa/gidt.S 27 Oct 2012 15:43:42 -0000 1.11
+++ arch/amd64/stand/libsa/gidt.S 9 Nov 2019 06:50:57 -0000
@@ -423,14 +423,6 @@ intno = . - 1
movl %edx, 0x9*4(%esp)
movb %bh , 0xe*4(%esp)
- /* clear NT flag in eflags */
- /* Martin Fredriksson <[email protected]> */
- pushf
- pop %eax
- and $0xffffbfff, %eax
- push %eax
- popf
-
/* save registers into save area */
movl %eax, _C_LABEL(BIOS_regs)+BIOSR_AX
movl %ecx, _C_LABEL(BIOS_regs)+BIOSR_CX
@@ -438,6 +430,13 @@ intno = . - 1
movl %ebp, _C_LABEL(BIOS_regs)+BIOSR_BP
movl %esi, _C_LABEL(BIOS_regs)+BIOSR_SI
movl %edi, _C_LABEL(BIOS_regs)+BIOSR_DI
+
+ /* clear NT flag in eflags */
+ pushf
+ pop %eax
+ and $0xffffbfff, %eax
+ push %eax
+ popf
pop %gs
pop %fs
Index: arch/i386/stand/libsa/gidt.S
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/libsa/gidt.S,v
retrieving revision 1.36
diff -u -p -u -r1.36 gidt.S
--- arch/i386/stand/libsa/gidt.S 31 Oct 2012 13:55:58 -0000 1.36
+++ arch/i386/stand/libsa/gidt.S 9 Nov 2019 06:51:29 -0000
@@ -426,14 +426,6 @@ intno = . - 1
movl %edx, 0x9*4(%esp)
movb %bh , 0xe*4(%esp)
- /* clear NT flag in eflags */
- /* Martin Fredriksson <[email protected]> */
- pushf
- pop %eax
- and $0xffffbfff, %eax
- push %eax
- popf
-
/* save registers into save area */
movl %eax, _C_LABEL(BIOS_regs)+BIOSR_AX
movl %ecx, _C_LABEL(BIOS_regs)+BIOSR_CX
@@ -441,6 +433,13 @@ intno = . - 1
movl %ebp, _C_LABEL(BIOS_regs)+BIOSR_BP
movl %esi, _C_LABEL(BIOS_regs)+BIOSR_SI
movl %edi, _C_LABEL(BIOS_regs)+BIOSR_DI
+
+ /* clear NT flag in eflags */
+ pushf
+ pop %eax
+ and $0xffffbfff, %eax
+ push %eax
+ popf
pop %gs
pop %fs