I n protected-, m emory larger t han 1 MB b e accessed Windows X P prote cted I n a ddion, segments b e variable size (b e low o r a bove 64 KB) So me s ystem c ontrol instructions are o nly va lid protecte d mo de I n protecte d, b ase:offset log ical memo ry addressing sche me ( w hich m od e) c hanged T he offse t p art of l ogical memory is stil l u sed H owever, w hen o perates in u sed real protecte, p rocessor w ork e her w h of fsets ( the instructio n ) o r w h 32- b lengt h s ( the 32-b structionmode) A 32-b N otice hat t real- only availabl e w hich accessing 32-b s r equires prefix 66h) H owever, b ase calculatio n is appending a 0 a t nd a llows segmen struction d ifferent ts u p 4 G b ytes 6 1 -b d ( during p rotected I nstead e segment c ontents c reate a segmen t base address ( which g ives a 20-b phy sical ad d ress), re gister conta ins a selector that selects a descriptor a descri ptor table T he desc riptor desc ribes memory segment' s l ocation,length, acce ss rights T his s imilar selecting o ne c ard a d eck c ards in o n e' Because of fset s till c reate a log ical memory instructions s ame a s f unction eal D ESCRIPTORS: s pocket addr ss, e protecte d r eal structions I n f act, m ost p rograms w rten r w ill f unction w hout c hange th e protec ted mod e T he s elector, l ocated in regist e r, selec ts s desc riptors ( stor ed describes memor y ): the glo b al o ne of 192 the location, length a ccess rights of the memory segment Each desc riptor is 8 bytes long s mat sh own belo w: T he 8192 r equires 8 * 8192 = 64K bytes memory T he m ain p arts a : 8 descriptors one two l ocal descr iptor tabl e s T he de scriptor B ase (B31 B 0 ): dicates starting locatio n (ba se ) m emory se gment This a llows segme nts b egin a t any l ocation rocessor' s p 4 G by tes m emory
L im ( L19 L 0 ): c ontains l ast f ound a S ince t his f ield 20 b s, s ize c ould b e anywh ere between 1 1 M byt e s H owever, i f ( granulary b ) s e t, F FFH) I n 4K by t es v alue l im t his c ase, segment s ize c ould b e anywh m ultiplied by 4K b t e re etween G b y es ( ie, a ppended w h b 4 K and 4 G by tes in ste ps of E xample, B ase = Start = 10000000 h Lim = 001F Fh G = 0 S o, E nd = Base + L im = 10000000h + 001FF h = 100001FFh S egment S ize = 512 byte s B ase = Start = 10000000 h Lim = 001F Fh G = 1 S o, E nd = Bas e + L im * 4 K = 10000000h + 001F FFFFh = 101FFFFFh S egment S ize = 2 M bytes A V b : u sed b y some operating sy stems n ot a vailable ( AV = 0) dicate hat t segme nt a vailable ( AV = 1 ) o r D b : I f D = 0, structions structions, c ompatible w h 8086-80286 microprocessors T his m eans structions u se es registers b y d efault T his ode m instructio n r o DOS mo de If D = 1, structions ar e 32-b s by de fault (Wdows XP w orks in th m o de) By d efault, the 32-b a ssumes a ll es a ll re gisters re instructio n m o de a 32 b s N ote d efault s ize address b e overridde n both 16-32-b instructio n s u sing th e 66h 67h prefix e s I n s upposed b e a maxi mum protected-, s s till u sed b ut s are 64K byte s A ccess r ights b yte: allow s c omplete c ontrol over segment If se gment a data, d irection of growth is specifie d I f the grow s beyond i ts l im, microprocessor's o perating sy stem prog ram ter rupted, indicatin g a g eneral p rotection faul t Y ou specif y
w hether a da ta se gment be w rten o r wre-prote cted T he code can have reading hibed p rotect oftware u navailable r ealmode s T his why I t c alled p rotected T his ind k p rotection SELECTORS: D escriptors c hosen b y segme nt T here t wo s: G lobal s : c ontains defin ions apply all s ystem descr iptors) p rograms ( also ca L ocal s : usually u nique a n appl ication ( also c alled a pplication descriprs) E ach de scriptor con tains 8192 s, s o a tal of 16,384 descripto rs are available to a n a pplication a t any t ime Thi s a llows u p o l led t 16,384 m emory s b e d escribed each application T he Figur e be low s hows protecte d mo de I t contains: 13-b selector f ield: c hooses o ne 8192 s descripto r ( 213 = 8192) T able dicator ( TI) bi t : s elects e her g lobal (TI = 0) o r the lo cal des c riptor ( TI = 1) R equested leve l ( RPL) field: r equests th e a ccess a memory se gment T he hig hest pr ivilege leve l 00 l owest is 11 I f requested privile ge leve l matche s or h igher priory t han leve l set by the a ccess rig hts b y te, access grant e d W indows u ses 00 ( ring 0 ) k ernel d river prog rams 11 ( rin g 3) a pplications W indows d oes n ot u se le vels 01 o r 10 I f s ystem normally dicates a violation s v iolated, the
E xample: R eal M ode: D S = 0008h, n data segment bytes begin s t a locatio n 00080h s le ngth is 64K Prot ected M ode: D S = 0008h = 0000 0000 0000 1000, n selector sele cts D escriptor 1 in globa l u sing a r equested 00 T he globa l descriptor table s tored m emory a s s hown below
D escriptor numbe r 1 con tains a desc riptor that d efines base address as 00100000h w h a l im 000FFh T his r efers memory l ocations 00100000h 001000FFh the data