Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.os.development    |    Operating system development chatter    |    4,255 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 3,145 of 4,255    |
|    wolfgang kern to James Harris    |
|    Re: The EA jump immediately after enabli    |
|    26 Mar 22 19:31:14    |
      From: nowhere@nevernet.at              On 26/03/2022 07:52, James Harris wrote:       > On 25/03/2022 19:46, wolfgang kern wrote:       >> On 25/03/2022 10:50, James Harris wrote:       >>> On 25/03/2022 07:33, wolfgang kern wrote:       >>>> On 23/03/2022 18:50, James Harris wrote:       >>>> [agreed..]       >>>>> For Intel and probably AMD it looks as though one can get the CPU       >>>>> to report the Limit with an LSL instruction and the Attributes with       >>>>> LAR but I don't know a way to get the base.       >>>>       >>>> get_base: ;selector in eax assume DS=flat       >>>> MOV esi,anybuffer       >>>> SGDT [ds:esi] ;now you know where the GDT resides       >>>> AND eax,FFF8 ;just in case       >>>> ; SHL eax,3 ;mul by 8       >>>> ; ADD esi,eax       >>>> LEA esi,[eax*8+esi] ;same as the two lines above but       >>>> faster/shorter       >>>> MOV ecx,[esi+2] ;low 24 bits of base       >>>> AND ecx,00FFFFFF       >>>> MOV bl,[esi+7]       >>>> SHL ebx,24 ;decimal yet!       >>>> OR ecx,ebx ;ecx hold 32 bit base of selector       eax yet       >>>>       >>>> it works on both code and data descriptors.              >>> What if the segreg (and, hence, its Base) had been loaded before       >>> switching to Pmode?              >> As long a GDT is already installed this works with 66 and 67 overrides       >> also in RM.              > That's not what I mean. Rather, let's say selector and base had been       > loaded in Real Mode, then you switched to Protected Mode, your SGDT       > wouldn't tell you anything useful for such a case because the base       > wouldn't have been loaded from the GDT.              true after power up or hard RESET. If the BIOS may have played with it       then there must be valid GDT-entries at least for SS and DS.              But you can't switch to PM without valid entries in the GDT :)       I wont recommend to try this test between set PE and load CS.              > In short, LSL will report the limit but nothing (AFAIK) will report the       > base. It's not a problem, BTW, just an observation that there's no       > equivalent of LSL for the base.              But right, while in RM you can't be sure if a GDT exists or not.       Only after RESET you can rely on the default setting.              Finally I never needed that test because I decided what's where and how       all by myself :)       __       wolfgang              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca