home bbs files messages ]

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,333 of 4,255   
   Joe Monk to All   
   Re: segmentation   
   22 Oct 22 13:15:50   
   
   From: joemonk64@gmail.com   
      
   > > https://en.wikipedia.org/wiki/Far_pointer   
   > It is possible if you manipulate the segment.    
      
   "For example, in an Intel 8086, as well as in later processors running 16-bit   
   code, a far pointer has two parts: a 16-bit segment value, and a 16-bit offset   
   value. A linear address is obtained by shifting the binary segment value four   
   times to the left,    
   and then adding the offset value. Hence the effective address is 20 bits   
   (actually 21-bit, which led to the address wraparound and the Gate A20). There   
   can be up to 4096 different segment-offset address pairs pointing to one   
   physical address. To compare    
   two far pointers, they must first be converted (normalized) to their 20-bit   
   linear representation."   
      
   char far *p =(char far *)0x55550005;   
   char far *q =(char far *)0x53332225;   
      
   "Physical Address = (value of segment register) * 0x10 + (value of offset).   
   Location pointed to by pointer 'p' is : 0x5555 * 0x10 + 0x0005 = 0x55555   
   Location pointed to by pointer 'q' is : 0x5333 * 0x10 + 0x2225 = 0x55555   
   So, p and q both point to the same location 0x55555."   
      
   The same is true regardless of the offset.   
      
   Joe   
      
   --- 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