News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

enter protected mode but lgdr instruction not accepted

Started by ggmasm32, November 01, 2015, 09:01:17 PM

Previous topic - Next topic

ACP

Quote from: dedndave on November 10, 2015, 11:42:56 AM
.686p is enough - you can delete the .486
each time you name a new processor, the old setting is tossed out, with the exception of .87, .287, etc

That was my assumption but I wasn't sure. As for 286 protected mode related instruction there is one reason to still use them on 386+: SMSW is not privilege instruction hence it can be used to detect if DOS is running in real or protected/v86 mode without causing an exception. I guess there are very few people who remember protected mode programming on 286. It was so brain damaged. Probably finding a code example for 286 PM would be a challenge by itself today. 
ASM beyond Repair https://corexor.wordpress.com blog about assembly related stuff

dedndave

it wasn't that long ago - lol
you would set up the boot vector, then cause a triple-fault (something like that) to get back to real mode
very slow

ggmasm32

meant to put it here:

my next step would be going to pmode with interrupts enabled. That translates to creating IDT from scratch. I presume this is going to be monumental task to translate every vector into IDT (at least that I think will be needed).

I have attempted few times in the past and given up with lack of resource, material. I looked into linux kernel source code that seemed to do this briefly.
Once I get over this, this would be a tremendous boost to my main pet project: minix kernel design.

I am so unsure about whether I can successfully create IDT and go in and out of pmode without hanging the system, I am even considering if someone can implement this for me for some moderate amount of bounty :).

FORTRANS

Hi,

   You could look in the source code for LILO and GRUB
and see if there is anything that helps.

Regards,

Steve N.

sinsi

The usual way for a simple IDT is
- int 00 through 1F are for CPU exceptions etc
- int 20 through 2F (really, any two blocks of 8 ) are re-mapped IRQs
- unused ints all point to the same gate which is just an iret
You can then use an int for your own code, just replace the default gate with a custom one (like linux's int 80)

The FASM board OS Construction has lots and lots of examples.

ggmasm32

thanks i do remember long time ago, if i repeated print out the vector through 0x00-3xff address, some of the mere constantly changing.  I could not explain it at that time. Then the logical question arises: if particular IVT is changing a value to different then how do i know which one to use when translating. How do I know whether it is correct one. etc.,

dedndave

i suggest you read info that is posted on osdev.org

http://forum.osdev.org/

beware - they are not very friendly over there
they assume you are an expert
before asking any questions, read everything in the world (i guess they have)

but - a good place to browse and get code snippets

ggmasm32

ok i will thanks., i know people who know too much get cranky at times. I sometimes do it too.