[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: (no subject)

Pallav Nawani wrote:
> On Tue, 6 Jun 2000, Rajeev Jha wrote:
> >
> > hi
> > that brings us to the next question, what is a binary file ? like i have
> > some a.out which can be displayed  with 'od' ; now this dump is what is
> > a.out or is it something more. specifically how the info contained in
> > this file is relayed to the OS ?
> >
> A binary file is a sequence of instructions to the microprocessor
> (Hereafter abbreviated mpu). A program has two components:
> 1. data to be acted upon
> 2. Sequence of instructions.
> Data can be interpreted in the manner of ascii etc.  Now since the
> binary files are also stored in the same way in the disk, only way
> for the OS to know whether they are executables or not is the
> presence of 'x' permission (or the suffix 'com' or 'exe' in case of
> windows/Dos). That being the case, The OS also needs
> to know from where the instructions etc start in the file, where the
> data is, etc.
> Thus executables have a header which provides such information.
> Using which, the OS executes the instructions. In Dos (Well, when I
> studied this, I read a book on how x86 cpu does this on dos so I
> don't have a idea how this is on linux) 'EXE' files have such
> headers, while 'com' (which stands for command) do not, instructions
> start from the first line.

The difference between .EXE and .COM is that .EXE files are relocatable,
i.e. u can load them in any area of memory. The loader takes care of
converting the address references to absolute ones. Hence .EXE may be
larger than 1 DOS segment, i.e. 64 KB. But a .COM is *not* relocatable!
The Code, Data and Stack *all* have to be within 1 segment!

Peter Abel: x86 Assebly Programming, PHI.