Date: Fri, 13 Oct 1995 14:31:16 +0200 (UKR) From: Sergey Shkonda <serg@bcs1.bcs.zaporizhzhe.ua> To: martin@victor.innovus.com (Martin Renters) Cc: hackers@freebsd.org Subject: netboot patch Message-ID: <199510131231.AA08999@bcs1.bcs.zaporizhzhe.ua> In-Reply-To: <199510121501.LAA10217@victor.innovus.com> from "Martin Renters" at Oct 12, 95 11:01:16 am
next in thread | previous in thread | raw e-mail | index | archive | help
> > > Troubles detected when DOS memory managers used > > after netboot.com. (I type 'N' when question "Boot from Network") > > IMHO there are incorrect switching from P-mode to R-mode at exit. > > I have heard this from other people as well, but I don't really know > what I'm doing incorrectly on the switch back. I found this bug. You need to load selector with limit 64k to ss, ds, es, fs and fs registers _before_ cleaning PE flag. Then shadow registers filled correctly. > > Martin > *** start2.S.O Fri Oct 13 14:10:34 1995 --- start2.S Fri Oct 13 14:22:27 1995 *************** *** 3,8 **** --- 3,9 ---- #define KERN_CODE_SEG 0x08 #define KERN_DATA_SEG 0x10 #define REAL_MODE_SEG 0x18 + #define REAL_MODE_DATA 0x20 #define CR0_PE 1 #define opsize .byte 0x66 *************** *** 280,288 **** pop %eax sub $RELOC,%eax /* Adjust return address */ push %eax ! sub $RELOC,%esp /* Adjust stack pointer */ ! ljmp $REAL_MODE_SEG, $1f /* jump to a 16 bit segment */ 1: /* clear the PE bit of CR0 */ mov %cr0, %eax opsize --- 281,296 ---- pop %eax sub $RELOC,%eax /* Adjust return address */ push %eax ! sub $RELOC,%esp /* Adjust stack pointer */ ! ljmp $REAL_MODE_SEG, $1f-RELOC /* jump to a 16 bit segment */ 1: + cli + mov $REAL_MODE_DATA, %ax /* load selector in shadow */ + mov %ax, %ss /* registers */ + mov %ax, %ds + mov %ax, %es + mov %ax, %fs + mov %ax, %gs /* clear the PE bit of CR0 */ mov %cr0, %eax opsize *************** *** 322,332 **** .word 0xffff, 0 .byte 0, 0x93, 0xcf, 0 ! /* 16 bit real mode */ .word 0xffff, 0 ! .byte 0, 0x9b, 0x0f, 0 .align 4 gdtarg: ! .word 0x1f /* limit */ .long gdt /* addr */ --- 330,344 ---- .word 0xffff, 0 .byte 0, 0x93, 0xcf, 0 ! /* 16 bit real mode code segment */ ! .word 0xffff, RELOC&0xffff ! .byte (RELOC)>>16, 0x9b, 0x00, 0 ! ! /* 16 bit real mode data segment, any base */ .word 0xffff, 0 ! .byte 0, 0x93, 0x00, 0 .align 4 gdtarg: ! .word 0x27 /* limit */ .long gdt /* addr */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510131231.AA08999>