Date: Fri, 13 Oct 1995 15:30:25 +0200 (UKR) From: Sergey Shkonda <serg@bcs1.bcs.zaporizhzhe.ua> To: martin@innovus.com, hackers@freebsd.org Subject: netboot patch Message-ID: <199510131330.AA09369@bcs1.bcs.zaporizhzhe.ua>
next in thread | raw e-mail | index | archive | help
There are error in first patch. Need be another function for switching to real mode at exit. -- Sergey Shkonda, serg@bcs1.bcs.zaporizhzhe.ua *** start2.S.OO Fri Oct 13 15:16:52 1995 --- start2.S Fri Oct 13 15:29:48 1995 *************** *** 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 --- 3,10 ---- #define KERN_CODE_SEG 0x08 #define KERN_DATA_SEG 0x10 #define REAL_MODE_SEG 0x18 ! #define REAL_MODE_CODE 0x20 ! #define REAL_MODE_DATA 0x28 #define CR0_PE 1 #define opsize .byte 0x66 *************** *** 89,95 **** call _main .globl _exit _exit: ! call _prot_to_real #ifdef BOOTROM xor %eax,%eax mov %ax,%ds --- 90,96 ---- call _main .globl _exit _exit: ! call _quit_prot #ifdef BOOTROM xor %eax,%eax mov %ax,%ds *************** *** 281,288 **** 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 */ --- 282,324 ---- 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: + cli + /* clear the PE bit of CR0 */ + mov %cr0, %eax + opsize + andl $0!CR0_PE, %eax + mov %eax, %cr0 + + /* make intersegment jmp to flush the processor pipeline + * and reload CS register + */ + opsize + ljmp $(RELOC)>>4, $2f-RELOC + 2: + /* we are in real mode now + * set up the real mode segment registers : DS, SS, ES + */ + mov %cs, %ax + mov %ax, %ds + mov %ax, %es + mov %ax, %ss + sti + opsize + ret + + /************************************************************************** + QUIT_PROT - Quit from Protected Mode + **************************************************************************/ + .globl _quit_prot + _quit_prot: + pop %eax + sub $RELOC,%eax /* Adjust return address */ + push %eax sub $RELOC,%esp /* Adjust stack pointer */ ! ljmp $REAL_MODE_CODE, $1f-RELOC /* jump to a 16 bit segment */ 1: cli mov $REAL_MODE_DATA, %ax /* load selector in shadow */ *************** *** 330,335 **** --- 366,375 ---- .word 0xffff, 0 .byte 0, 0x93, 0xcf, 0 + /* 16 bit real mode */ + .word 0xffff, 0 + .byte 0, 0x9b, 0x0f, 0 + /* 16 bit real mode code segment */ .word 0xffff, RELOC&0xffff .byte (RELOC)>>16, 0x9b, 0x00, 0 *************** *** 340,344 **** .align 4 gdtarg: ! .word 0x27 /* limit */ .long gdt /* addr */ --- 380,384 ---- .align 4 gdtarg: ! .word 0x2f /* limit */ .long gdt /* addr */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510131330.AA09369>