[PATCH] reboot=bios is invalidating cache incorrectly

Robert Hentosh (robert@dell.com)
Fri, 19 Apr 2002 17:00:11 -0500 (CDT)


Sorry for the trashed email and patch. Apparently Outlook knows better
than I where to do word wrapping on patches.

Here it is again from pine.

When specifying the kernel parameter reboot=bios the assembly code that is
executed to switch to real mode and call the bios vector contains an
error. This causes rebooting via bios to hang in certain conditions.

The hand assembled routine contained in the array "real_mode_switch"
contains INVD which invalidates the CPU caches, unfortunately the routine
was just previously copied via memcpy and is contained in the cache. This
leads to unexpected results. The following patch replaces INVD with
WBINVD which will insure that the routine is written to RAM before
invalidating the cache, providing more reliable reboots.

This patch applies cleanly to 2.4.18 and 2.5.8. It probably also works
with all 2.2.x, 2.4.x and 2.5.x kernels.

This fixes a long standing bug that prevented reliable reboots on some
platforms.

Regards,
Robert Hentosh

--
Robert Hentosh
Sr. Software Engineer
Dell Linux Solutions www.dell.com/linux

--- linux-2.4.18.orig/arch/i386/kernel/process.c Fri Apr 19 14:37:21 2002 +++ linux-2.4.18/arch/i386/kernel/process.c Fri Apr 19 14:41:11 2002 @@ -253,7 +253,7 @@ 0x66, 0x0f, 0x20, 0xc3, /* movl %cr0,%ebx */ 0x66, 0x81, 0xe3, 0x00, 0x00, 0x00, 0x60, /* andl $0x60000000,%ebx */ 0x74, 0x02, /* jz f */ - 0x0f, 0x08, /* invd */ + 0x0f, 0x09, /* wbinvd */ 0x24, 0x10, /* f: andb $0x10,al */ 0x66, 0x0f, 0x22, 0xc0 /* movl %eax,%cr0 */ };

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/