944,171 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 3875
  • Assembly RSS
Jan 18th, 2007
0

Help needed for a project concerning protected mode

Expand Post »
I have a project for which I have to implement parameter passing through stack between different protection levels. The information about the number of variables needed to be passed at the function must be given through DWORD Count of Call gate

For this project I have to:

A) Create 4 code segments
1) Real mode
2) Protected mode 16bit - privilege level 0
3) Protected mode 32bit - privilege level 0
4) Protected mode 32bit - privilege level 3

B) Enter protected mode - PL0

C) Adjust GDT, IDT, TSS, Stscks for the 3 privilege levels

D) Create the appropriate Call gate

E) Enter PL3

F) Execute a algorithm that uses a function at PL0 through Call Gate

G) Return to Real mode


My first question is how do I create the 4 code segments needed? can anyone help me?

Thanks you very much in advance
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
aserfiotis is offline Offline
2 posts
since Jan 2007
Jan 18th, 2007
0

Re: Help needed for a project concerning protected mode

Just declare them like any other segment. What their attributes are will be diddled by protected mode code somewhere, not the assembler.
Reputation Points: 31
Solved Threads: 0
Light Poster
Purple Avenger is offline Offline
49 posts
since Jan 2007
Feb 1st, 2007
0

Re: Help needed for a project concerning protected mode

Click to Expand / Collapse  Quote originally posted by aserfiotis ...
I have a project for which I have to implement parameter passing through stack between different protection levels. The information about the number of variables needed to be passed at the function must be given through DWORD Count of Call gate

For this project I have to:

A) Create 4 code segments
1) Real mode
2) Protected mode 16bit - privilege level 0
3) Protected mode 32bit - privilege level 0
4) Protected mode 32bit - privilege level 3

B) Enter protected mode - PL0

C) Adjust GDT, IDT, TSS, Stscks for the 3 privilege levels

D) Create the appropriate Call gate

E) Enter PL3

F) Execute a algorithm that uses a function at PL0 through Call Gate

G) Return to Real mode


My first question is how do I create the 4 code segments needed? can anyone help me?

Thanks you very much in advance
------------------------------------------------
Hi,

This is garni,

well your ? is good, ok lets 1st make your question clear.

So now you owns the entire responsibility of the entire system(i.e you want to boot the system with your own machine code)?

then establish proper segments in memory .

then create descriptor in memory and then move the base address of corresponding segments in memory to that particular descriptor.

then you want to do a call to the procedure via call gate is that?

1 st confirm me that all of the things that i have typed above are right? then i will be able to answer you properly.

there is nothing like switching to previlege level 3, it is just a matter of "call" macro instruction.

the only thing that determines the previlege level is the 2 bit CPL (Current Previlege Level) that is part of the 16- bit Code Segment Value when the processor is in protected mode.

so when you do a call to a procedure that is in a segment which is of previlege level 3 (the descriptor for particular segment in memory holds a 2 bit descriptor value of 3 )then thats it you are done with processor will load that selector in CS, so Obviously your CPL will get changed by this time so now your are in PL3,

so finally the only difficulty you will face is switching to protected mode, and switching back to real mode.

that is also simple but you need t have prior idea about the structure of the descriptor, and how we can mix both 16 bit and 32 bit code in a same segment using operand size prefix and address size prefix.

will help u more if you bit elaborate your question.

thx,
Garni.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Garni is offline Offline
8 posts
since Feb 2007
Feb 2nd, 2007
0

Re: Help needed for a project concerning protected mode

If you can find a copy, the Intel 386 "Operating System Writer's Guide" explains a lot of this stuff in detail.
Reputation Points: 31
Solved Threads: 0
Light Poster
Purple Avenger is offline Offline
49 posts
since Jan 2007
Jun 3rd, 2007
0

Re: Help needed for a project concerning protected mode

Click to Expand / Collapse  Quote originally posted by Garni ...
------------------------------------------------
Hi,

This is garni,

well your ? is good, ok lets 1st make your question clear.

So now you owns the entire responsibility of the entire system(i.e you want to boot the system with your own machine code)?

then establish proper segments in memory .

then create descriptor in memory and then move the base address of corresponding segments in memory to that particular descriptor.

then you want to do a call to the procedure via call gate is that?

1 st confirm me that all of the things that i have typed above are right? then i will be able to answer you properly.

there is nothing like switching to previlege level 3, it is just a matter of "call" macro instruction.

the only thing that determines the previlege level is the 2 bit CPL (Current Previlege Level) that is part of the 16- bit Code Segment Value when the processor is in protected mode.

so when you do a call to a procedure that is in a segment which is of previlege level 3 (the descriptor for particular segment in memory holds a 2 bit descriptor value of 3 )then thats it you are done with processor will load that selector in CS, so Obviously your CPL will get changed by this time so now your are in PL3,

so finally the only difficulty you will face is switching to protected mode, and switching back to real mode.

that is also simple but you need t have prior idea about the structure of the descriptor, and how we can mix both 16 bit and 32 bit code in a same segment using operand size prefix and address size prefix.

will help u more if you bit elaborate your question.

thx,
Garni.
First of all I would like to apologise for not thanking you months ago for your answer. I live in Greece and during the last few months we had enormous problems with university education and as a result the project was postponed, so totally forgot it.


If you 're still willing to help me (if not it would be totally logical after my behaviour) I would like to give you some more information.

What you said I want to do is true. Switching to protected mode and back isn' t a problem. I have already written thw code for that transition.

What I don 't know how to do is how to create the appropriate call gate, how to enter PL3 and how to execute an algorithm that uses a function at PL0 through Call Gate.

Thank you for your time and I' m very sorry again for the negligence.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
aserfiotis is offline Offline
2 posts
since Jan 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: MIPS Assembly Help
Next Thread in Assembly Forum Timeline: newbie





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC