switch from protected mode to real mode in kernel

switch from protected mode to real mode in kernel

Post by phil-news-nos.. » Mon, 28 Feb 2000 04:00:00



Does anyone have code that would show how to switch from protected mode
back to 8086 compatible real mode that x86 processors always start in?
I would be doing this at the end of a shutdown before the kernel would
otherwise do its final halt/reboot.

--
| Phil Howard - KA9WGN | for headlines that | Just say no to absurd patents |

| Dallas - Texas - USA | linuxhomepage.com  | Shop http://bn.com/ instead   |

 
 
 

switch from protected mode to real mode in kernel

Post by Nix » Tue, 07 Mar 2000 04:00:00



> Does anyone have code that would show how to switch from protected mode
> back to 8086 compatible real mode that x86 processors always start in?
> I would be doing this at the end of a shutdown before the kernel would
> otherwise do its final halt/reboot.

See linux/arch/i386/process.c:reboot_setup() and code following.

--
`> KNOWLEDGE AND SKILLS
 You must have some, but I don't see any evidence of it.'
   --- Craig Hardie flames a luser recruitment consultant
       advertising `Microsoft based solutions' on uk.comp.os.linux

 
 
 

1. linux->real mode-> boot other OS in protected mode

well, not really.

machine_real_start() from process.c switches into 16 bit mode. you can pass
arbitrary code to that function. this code has to:
reset some hardware ---
  - reset 8259 interrupt controller, that is, IRQ mapping (IRQ0->INT8)
  - reset 8253 timer to 18,2 ticks per second (I think)
and then:
  - correctly initialize EBP, ESP to 0x7c0, SS to 0.
  - also clear bits 16-31 of EAX, EBX ....
and as a last step:
  - reset harddisk via int10
  - read sector 0 to 0x7c0
  - copy sector 0 to 0x600
  - far jmp to 0:0x7c0

with this, I can boot DOS with EMM (goes into protected mode) or even
boot Windows2k-server. the latter only on my EPIA-ITX board, on another
board, it unfortunately crashes as soon as it goes into protected mode,
that is, the machine looks like its performing a cold-start (warm-start?).
seems like a double- or triple-fault. any idea on how this can be debugged?

thanks in advance,
herbert

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. XFCE into session pulldown?

3. A confusion about IA32 protected mode protecting kernel data.

4. mounting Apple HD images on Linux?

5. How to enter VGA 12H mode from protected mode?

6. newbie network problems

7. i386: Switching to protected mode

8. NFS: rpc.nfsd -> nfssvc

9. i386: Switching to protected mode?

10. Switching from an Xwin graphics mode to a terminal mode

11. Switching btw Xwin graphical mode and terminal mode

12. Problems switching between X Mode and Login Prompt Mode

13. Subject : Switching btw Xwin graphical mode and terminal mode