home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / arch / 8390 < prev    next >
Encoding:
Text File  |  1992-07-28  |  2.9 KB  |  71 lines

  1. Newsgroups: comp.arch
  2. Path: sparky!uunet!world!cmr
  3. From: cmr@world.std.com (Charles M Richmond)
  4. Subject: Re: MIPS assembler/linker/memory allocation
  5. Message-ID: <Brxxn0.3uL@world.std.com>
  6. Organization: Integrated International Systems Corp. One Longfellow Place, Suite 3309, Boston, Ma.
  7. References: <14163@borg.cs.unc.edu>
  8. Date: Sat, 25 Jul 1992 10:40:11 GMT
  9. Lines: 60
  10.  
  11. yuki@watanabe.cs.unc.edu (Yuki Watanabe) writes:
  12.  
  13. >Is there any detailed documentation on MIPS/Ultrix memory allocation 
  14. >for C language (and assembly language).   I have MIPS RISC Architecture
  15. >book by Kane and Heinrich.   We are interested (eventually) in loading 
  16. >a.out file produced by C compiler in a low-level simulator. 
  17.  
  18.  
  19. There is a lot of info online in the man pages. For example:
  20.  
  21. From "ld"
  22.      The text and data segments must not overlap and all addresses must be
  23.      less than 0x80000000.  The stack starts below 0x80000000 and grows
  24.      through lower addresses, so leave space for it.
  25.  
  26.      For ZMAGIC and NMAGIC files, the default text segment address is
  27.      0x00400000 and the default data segment address is 0x10000000.  For
  28.      OMAGIC files, the default text segment address is 0x10000000 with the
  29.      data segment following the text segment.  The default for all types of
  30.      files is that the bss segment follows the data segment.
  31.  
  32. From "scnhdr"
  33.      struct scnhdr
  34.      {
  35.      char            s_name[8];    /* section name */
  36.      long            s_paddr;      /* physical address, aliased s_nlib */
  37.      long            s_vaddr;      /* virtual address */
  38.      long            s_size;       /* section size */
  39.      long            s_scnptr;     /* file ptr to raw data for section */
  40.      long            s_relptr;     /* file ptr to relocation */
  41.      long            s_lnnoptr;    /* file ptr to gp table */
  42.      unsigned short  s_nreloc;     /* number of relocation entries */
  43.      unsigned short  s_nlnno;      /* number of gp table entries */
  44.      long            s_flags;      /* flags */
  45.      };
  46.  
  47. From "reloc"
  48.      struct   reloc
  49.      {
  50.         long      r_vaddr ;          /* (virtual) address of reference */
  51.         long      r_symndx ;         /* index into symbol table */
  52.         ushort    r_type ;           /* relocation type */
  53.         unsigned  r_symndx:24,       /* index into symbol table */
  54.                   r_reserved:3,
  55.                   r_type:4,          /* relocation type */
  56.                   r_extern:1;        /* if 1 symndx is an index into the
  57.                                         external symbol table, else symndx
  58.                                         is a section # */
  59.      } ;
  60.  
  61.  
  62. I hope that some of this is helpful.
  63.  
  64. Charlie
  65.  
  66. -- 
  67. *****************************************************************************
  68. *  Charles Richmond     Integrated International Systems Corporation        *
  69. *  cmr@world.std.com    (Temporary) crichmond@mr4dec.enet.dec.com           *
  70. *  Specializing in UNIX, X, Image Processing, and Communications.           *
  71.