Re: Role of the code segment register during "far" CALLs

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




I see..So that's why every page has permissions such as READ,WRITE,
EXECUTE, etc and the protection checks happen directly on the page
which is about to be touched. So for example a CALL <CoInitialize
address> would first check if the page which contains the CoInititalize
code has EXECUTE permissions and proceed only thereafter. Something
along those lines?

I would advise you to read Intel Developer's Manual (Volume3) - you
don't seem to see the difference between segmentation and page-level
protection

Anton Bassov

Ranjit wrote:
I see..So that's why every page has permissions such as READ,WRITE,
EXECUTE, etc and the protection checks happen directly on the page
which is about to be touched. So for example a CALL <CoInitialize
address> would first check if the page which contains the CoInititalize
code has EXECUTE permissions and proceed only thereafter. Something
along those lines?

Thanks.
Ranjit

Skywing [MVP] wrote:
Windows uses a flat address space and does not utilize segmentation (other
than to allow for a convenient way to access the TEB through fs on x86 or gs
on x64).

--
Ken Johnson (Skywing)
Windows SDK MVP

"Ranjit" <ranjitiyer@xxxxxxxxx> wrote in message
news:1155937472.309032.37300@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

My question is in view of the memory management unit's role in address
translation, whereby for example, to access code (CALL <address>), the
CS register is first used as a selector to retrieve a Segment
Descriptor that specifies the base of the code segment, to which an
offset gets added to form a linear address which is then forwarded to
the paging unit to generate a physical address. Fine?

The question is, at what step, in the course of executing a far CALL
does the CS register change, and who changes it and where are segment
information for each module stored (PE file?). Since a far call crosses
code segment boundaries i presume that the code segment register also
should change to point to the code segment of the module in which the
called function resides. Just not sure when it happens and who makes it
happen after the far CALL instruction is issued.

I might also be doing something wrong in my experiments, but i don't
see the CS register value (register window) change when i call
CoInitialize (which resides in ole32.dll) from my application's main
method.

Thanks for any guidance on this one.
Ranjit


.



Relevant Pages

  • Re: Role of the code segment register during "far" CALLs
    ... I see..So that's why every page has permissions such as READ,WRITE, ... EXECUTE, etc and the protection checks happen directly on the page ... CS register is first used as a selector to retrieve a Segment ... code segment boundaries i presume that the code segment register also ...
    (microsoft.public.win32.programmer.kernel)
  • Re: C and Low-level Storage
    ... stored in addressable memory. ... variables in its own code segment, but the claim was that it could ... otherwise it cannot execute it. ... EXECUTE CPU ...
    (comp.lang.cobol)
  • Re: C and Low-level Storage
    ... level storage' and is not the _complete_ thread, started with "drives ... z/OS programmers crazy because they cannot store variable in the code ... variables in its own code segment, but the claim was that it could ... otherwise it cannot execute it. ...
    (comp.lang.cobol)
  • Re: CoInitialize nicht aufgerufen
    ... Ich hab hier einen Thread, ... Wenn schon, bekomm ich die Exception CoInitialize nicht aufgerufen, ... deiner TThread.Execute aufgerufen und das ThreadingModel ist ... finally CoUninitialize (auch in Execute). ...
    (de.comp.lang.delphi.misc)
  • Re: CoInitialize nicht aufgerufen
    ... Arno Garrels wrote: ... Ich hab hier einen Thread, ... Wenn schon, bekomm ich die Exception CoInitialize nicht aufgerufen, ... CoInitialize in der Execute aufrufen und auch eine ADO-Connection ...
    (de.comp.lang.delphi.misc)