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,028 of 4,255   
   James Harris to Rod Pemberton   
   Re: Format for the OS image   
   08 Jan 22 13:37:34   
   
   From: james.harris.1@gmail.com   
      
   On 06/01/2022 12:09, Rod Pemberton wrote:   
   > On Wed, 5 Jan 2022 15:40:27 +0000   
   > James Harris  wrote:   
      
   ...   
      
   >>      What formats of image file are best for the OS itself?   
      
   ...   
      
   >> 1. Flat binary   
      
   It turns out I cannot use a flat binary as my compiler does not (yet)   
   emit fully position-independent code so I've dropped flat binary as an   
   option.   
      
      
   >> 2b. Include the whole executable file, including the headers, and   
   >> write some asm code to parse the headers and jump to the executable   
   >> part of it.   
      
   This seems to be the best option for now, i.e.:   
      
   1. Load a file in its entirety and jump to its first byte.   
      
   2. Have some code there which understands the format of the executable   
   which follows and applies fixups to it.   
      
   ...   
      
   >> So, any thoughts on what format an OS image should have?   
   >>   
   >   
   > As long as your 16-bit OS loader code or GRUB etc can properly transfer   
   > execution to your 32-bit OS image, does the format really matter? ...   
      
   The problem is that the main executable needs to have fixups applied   
   before it can be run. For instance, if it includes an instruction such as   
      
      mov ebx, gdt   
      
   then that becomes an absolute load:   
      
      b8    
      
   where b8 is the opcode in hex.   
      
   Because of what is, admittedly, a policy decision, i.e. that I don't   
   want to require the code to be in a fixed location, I need to correct   
   the 'location of label gdt' field in the above instruction.   
      
   AFAICS that ought to be easy enough but ATM I cannot seem to get the   
   linker to tell me which locations need fixing up. If I don't know where   
   they are then I cannot fix em! :-(   
      
      
   --   
   James Harris   
      
   --- 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