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



Ranjit wrote:
Thanks Anton,

I read some of your article from which i understood that Windows
does'nt use call gates to implement intersegment calls. I will
continue
reading it to understand how intersegment far calls are made across
different privilege levels. Should be interesting.

But how is a cross-segment call within the *same* privilege levels
pulled off - eg, a call from my main method into CoInitialize, which
is
a user-level library call and the code segment of which would have the
privilege level as the code segment of my "main" program. Is the code
segment selector for ole32.dll's code section embedded within the
address of the CoInitialize function? Also, why do i not see the value
of the CS register change when that CALL to CoInitialize happened even
though this was a far call (am assuming)

It's simply a near call - CS isn't changed - EVER - unless you transition
into the kernel via one of the mechanisms Anton has already explained.

If you're reading something about how Windows works that's implying that
each module has it's own segments, then you're reading about 16-bit windows.
32- and 64-bit windows have always used the "flat model" that basically (or
completely, in the case of IA-64) ignores segmentation.

-cd


.



Relevant Pages

  • Re: Role of the code segment register during "far" CALLs
    ... I read some of your article from which i understood that Windows ... does'nt use call gates to implement intersegment calls. ... privilege level as the code segment of my "main" program. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Role of the code segment register during "far" CALLs
    ... If Windows did not utilize segmentation, ... 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: Role of the code segment register during "far" CALLs
    ... Windows uses a flat address space and does not utilize segmentation (other ... 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: File Transfer Wizard Problem
    ... Started reading your post and thought it was mine, ... Windows SE computer right here next to the new big one. ... Tried direct cable connection and could see the ... > Thanks, Ron ...
    (microsoft.public.windowsxp.general)
  • Re: Does Linux hog fs and gs registers?
    ... > disappointing that Windows reserves fs and gs for itself. ... There really isn't much reason to use the other segment registers. ... segmentation to allow Windows code to use FS as the TEB pointer without ...
    (comp.lang.asm.x86)