ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Yes it is totally correct for MASM.
I have not tried much to code it up in nasm because I am not much familiar with equivalent syntax for Nasm. I know its kinda basic but I didn't find much straight forward thing.
I am suppose to write up assembly code for Linux that will switch between protection mode and real mode to trigger some SMI interrupts.
OK, first of all I don't understand MASM directives, but what I think those "DESCRIPTOR" lines mean are - they're setting aside space in memory for the Global Descriptor Table, which is needed for Protected Mode operation. Please do a Google to find out exactly what it is, or search on the alt.lang.asm and alt.os.assembly newsgroups.
You can't ENTER Protected Mode when you're within Linux, as Linux already does that as part of its bootup - it's a Protected Mode OS, and you DEFINITELY can't enter Real Mode when you're within Linux.
What are SMI Interrupts, btw?
You can't ENTER Protected Mode when you're within Linux, as Linux already does that as part of its bootup - it's a Protected Mode OS,
I would be calling an assembly function from C and would be passing a physical address to it. I know the memory region where I can do some stuff in so I do not think that it would be a problem to jump back and forth from protected to real mode.
Quote:
Originally Posted by resetreset
What are SMI Interrupts, btw?
SMM is entered via the SMI (system management interrupt), which is caused by:
* Motherboard hardware or chipset signaling via a designated pin of the processor chip. This signal can be an independent event.
* Software SMI triggered by the system software via an I/O access to a location considered special by the motherboard logic (port 0B2h is common).
* An IO write to a location which the firmware has requested that the processor chip act on.
System Management Mode (SMM) is an operating mode in which all normal execution (including the operating system) is suspended, and special separate software (usually firmware or a hardware-assisted debugger) is executed in high-privilege mode.
I would be calling an assembly function from C and would be passing a physical address to it. I know the memory region where I can do some stuff in so I do not think that it would be a problem to jump back and forth from protected to real mode.
Regardless of what "memory region to do some stuff in" you have, you CANNOT go to Real Mode from within Linux. What you're talking about is probably V86 Mode.
hmm .. i can look into it .. in the mean while .. i have another question .. I have an .obj file which was compiled on windows using masm. Can I link my c file with that .obj file and use it linux???
Last edited by yousafsajjad; 07-07-2010 at 02:31 PM.
hmm .. i can look into it .. in the mean while .. i have another question .. I have an .obj file which was compiled on windows using masm. Can I link my c file with that .obj file and use it linux???
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.