On Thu, Nov 7, 2019 at 9:31 AM Julius Zint <zint.jul...@gmail.com> wrote:
> the following code snipped is from sys/arch/amd64/stand/libsa/gidt.S > > /* pass BIOS return values back to caller */ > movl %eax, 0xb*4(%esp) > movl %ecx, 0xa*4(%esp) > movl %edx, 0x9*4(%esp) > movb %bh , 0xe*4(%esp) > > /* clear NT flag in eflags */ > /* Martin Fredriksson <mar...@gbg.netman.se> */ > 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 > movl %edx, _C_LABEL(BIOS_regs)+BIOSR_DX > movl %ebp, _C_LABEL(BIOS_regs)+BIOSR_BP > movl %esi, _C_LABEL(BIOS_regs)+BIOSR_SI > movl %edi, _C_LABEL(BIOS_regs)+BIOSR_DI > > These instructions are being executed after a BIOS interrupt. If i read > correctly, than (BIOS_regs)+BIOSR_AX contains the contents of the eflags > processor register and not of %eax. Is this intended or should it contain > the value of %eax? > Yeah, it looks like it's in the wrong order. The trick, of course, is that nothing actually examines BIOS_regs.biosr_ax, so the fact that the wrong value is saved there hasn't mattered. Since we're unlikely to do _more_ with BIOS calls in the boot loader, my inclination would be to eliminate the structure value and the code that sets it (incorrectly). Opinions? Philip Guenther