x86 - RPL of CS while transferring control to a conforming code segment in intel microprocessor -


rpl of cs doesn't match dpl of conforming code segment. shouldn't match dpl of calling code segment (the code control has been transferred) ? , happen rpl bits when return conforming code segment? rpl bits equal dpl of conforming code segment then?

first bit of terminology fix:

the rpl (requested privilege level) bits 0 , 1 of every segment selector.
cpl (current privilege level) bits 0 , 1 of segment register cs.
dpl (descriptor privilege level) 2 bits in segment descriptor controlling protection.

there can bit of confusion since segment registers hold segment selectors , have rpl.
however, must exclude cs because cannot move directly - can change through specific instructions.

the idea use rpl lower cpl when accessing data segments: while rpl freely editable application, cpu use restrictive between rpl , cpl (effectively max between twos).
when accessing code segment rpl has little effect (with call gates used same data segment, non-conforming segments must rpl <= cpl , conforming code segment ignored) , rule set cpl depend on instruction , type of segment used.

rpl of cs doesn't match dpl of conforming code segment.

thus cs doesn't have rpl, has cpl, rest true confirmed intel sdm:

5.8.1.2
when program control transferred conforming code segment, cpl not change, if dpl of destination code segment less cpl. situation 1 cpl may different dpl of current code segment. also, since cpl not change, no stack switch occurs.

this quote answer first question

but shouldn't match dpl of calling code segment (the code control has been transferred)?

no, if code segments b , c conforming dpl 1 , 0 respectively , code in segment dpl 3 flown b , subsequently in c cpl 3, dpl of a, if caller code segment (b) has dpl 1.

basically conforming code segment calling conforming code segment.

and happen rpl bits when return conforming code segment? rpl bits equal dpl of conforming code segment then?

i assume mean cpl bits rpl bits never touched cpu.
when accessing other code segments far call or jump used (there other mechanisms ignore here equivalent 2 named) caller's cs saved on stack (with or without stack switch first) , restored upon return if access still granted.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -