Author Topic: enter protected mode but lgdr instruction not accepted  (Read 3704 times)

ACP

  • Regular Member
  • *
  • Posts: 10
Re: enter protected mode but lgdr instruction not accepted
« Reply #15 on: November 10, 2015, 06:33:16 PM »
.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

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: enter protected mode but lgdr instruction not accepted
« Reply #16 on: November 10, 2015, 10:33:29 PM »
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

  • Member
  • **
  • Posts: 51
Re: enter protected mode but lgdr instruction not accepted
« Reply #17 on: November 13, 2015, 05:14:07 PM »
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

  • Member
  • ****
  • Posts: 944
Re: enter protected mode but lgdr instruction not accepted
« Reply #18 on: November 14, 2015, 09:24:12 AM »
Hi,

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

Regards,

Steve N.

sinsi

  • Member
  • ****
  • Posts: 996
Re: enter protected mode but lgdr instruction not accepted
« Reply #19 on: November 14, 2015, 01:18:32 PM »
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.
I can walk on water but stagger on beer.

ggmasm32

  • Member
  • **
  • Posts: 51
Re: enter protected mode but lgdr instruction not accepted
« Reply #20 on: November 14, 2015, 06:34:53 PM »
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

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: enter protected mode but lgdr instruction not accepted
« Reply #21 on: November 15, 2015, 11:41:33 AM »
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

  • Member
  • **
  • Posts: 51
Re: enter protected mode but lgdr instruction not accepted
« Reply #22 on: November 15, 2015, 03:36:15 PM »
ok i will thanks., i know people who know too much get cranky at times. I sometimes do it too.