Switching over to real mode from protected mode.......

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
East
Posts: 21
Joined: Mon Jan 21, 2008 12:56 am
Location: India

Switching over to real mode from protected mode.......

Post by East »

Hi all
I am using Linux OS and i want switch over from protected mode to real mode. I have searched some documents from google, but nothing made me clear. http://www.sudleyplace.com/pmtorm.html
can anyone elaborate the mode switching process, where it be done...

Thanks in advance.
:cry:
User avatar
einsteinjunior
Member
Member
Posts: 90
Joined: Tue Sep 11, 2007 6:42 am

Post by einsteinjunior »

You will find info in the topic in the Intel Manual ,more specifically the systems programming reference volume 3A.
Its quite somehow complicated as far as i remeber.Something about page alignment and some weird stuff i don't want to remeber,or else i will have some headache.
Jut check...........
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Hi,

Try this tutorial.

Cheers,
Adam
East
Posts: 21
Joined: Mon Jan 21, 2008 12:56 am
Location: India

Post by East »

Thanks for the responses.
AJ wrote: Try this tutorial.

The above documents explains about entering into protected mode and my previous post has the url for enter into real mode which is not clear for me. my one more doubt is entering into real mode and entering into protected mode ...all these things where should i do.....For me now i want to enter into real mode. I am in Linux (protected mode) , so where execute the code... I am new to this...
Thanks in advance.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Oh - sorry. I didn't realise you were in Linux - I'll read the question next time! :oops:

What is it you're trying to achieve at a higher level? I would be surprised if Linux let a user application switch to real mode. Perhaps you could do it from a driver module, although the system won't be too stable afterwards.

If you just want to run 16 bit code, you can try running it in v86 mode instead.

Cheers,
Adam
User avatar
t6q4
Member
Member
Posts: 25
Joined: Thu Feb 14, 2008 3:56 pm

Post by t6q4 »

Well, you could always try injecting the realmode code in the bootloader of your os before it goes to PMode, and (as AJ said) V86 mode is good because you are in Pmode, but can access the IVT.
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

Well, you could always try injecting the realmode code in the bootloader of your os before it goes to PMode
He is using Linux...

You can't switch Linux to real mode, neither MS-DOS to protected mode. In Linux, it's impossible by its architecture and security - direct access to register CR0 is prohibited.
In MS-DOS case you can freely fiddle with registers and stuff, but before leaving your application you must restore real mode, plus all segment/stack registers! (Or else a unpredictable result would happen, triple fault or some sort.)

Regards
inflater
East
Posts: 21
Joined: Mon Jan 21, 2008 12:56 am
Location: India

Post by East »

So is it not at all possible?
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

East wrote:So is it not at all possible?
It has already been explained to you several times on this forum, in fact, you created another topic asking the same question and received the same response! :roll:

http://www.osdev.org/phpBB2/viewtopic.php?t=16651

Write a bootloader, or GRUB, just stop asking the same questions.. :lol:
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
East
Posts: 21
Joined: Mon Jan 21, 2008 12:56 am
Location: India

Post by East »

Actually what i want to do is, from user application using the int 19h, it should boot the my HDD second partition (HDD-which is currently running from first partition). Previously i restarted the system and selected the boot option in BIOS. Now i am trying to boot the system with int 19h. if no other way to go, then i have to startup with writing the OS...from OS scratch can i access the BIOS interrupts? Can anyone help me
East
Posts: 21
Joined: Mon Jan 21, 2008 12:56 am
Location: India

Post by East »

i apologize for against the forum rule.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

East wrote:if no other way to go, then i have to startup with writing the OS...from OS scratch can i access the BIOS interrupts? Can anyone help me
Yes - if you write an OS from scratch, you definitely can use the BIOS interrupts because you can choose to remain in (un)real mode. You can probably even do this from earlier DOS versions (someone correct me, please!) because that is real mode too (after all, DPMI switches to and from PMode).

If all you are trying to do is restart the computer, there are other ways. You can restart a Windows box using either the WinAPI or .NET framework and Linux must have its equivalents.

Can I ask you to do one of two things:
1) Do more background reading yourself, AND/OR
2) Give us a succinct overview of your project at the top level so that we can suggest something that does work.

Cheers,
Adam
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

East wrote:from user application using the int 19h, it should boot the my HDD second partition
...okay, take it easy Myself........ yeah, it'll be hunky-dory... .... yes indeed...... .... so....



FOR THE LAST TIME: YOU -CAN'T- USE ANY INTERRUPTS, ANY, AND I REPEAT: -ANY- INTERRUPTS IN LINUX !!!!!!!! DO YOU ARE A COMPLETE MORON ??!!
User avatar
Pitchu
Member
Member
Posts: 56
Joined: Tue Feb 12, 2008 3:16 am
Location: Kashmir - Paradise On Earth

Post by Pitchu »

Hi
Access to cr0 is a previldged instruction and can be executed by kernel only (i dont think any kernel would do it), user programs cant access cr0.
If your motive is to restart, as told find some equivalent API.
If you are confused with DOS DPMI for pmode, take it as converse of NTVDM for V86.
User avatar
Pitchu
Member
Member
Posts: 56
Joined: Tue Feb 12, 2008 3:16 am
Location: Kashmir - Paradise On Earth

Post by Pitchu »

Hi
Access to cr0 is a previldged instruction and can be executed by kernel only (i dont think any kernel would do it), user programs cant access cr0.
If your motive is to restart, as told find some equivalent API.
If you are confused with DOS DPMI for pmode, take it as converse of NTVDM for V86.
Locked