home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.arch
- Path: sparky!uunet!world!cmr
- From: cmr@world.std.com (Charles M Richmond)
- Subject: Re: MIPS assembler/linker/memory allocation
- Message-ID: <Brxxn0.3uL@world.std.com>
- Organization: Integrated International Systems Corp. One Longfellow Place, Suite 3309, Boston, Ma.
- References: <14163@borg.cs.unc.edu>
- Date: Sat, 25 Jul 1992 10:40:11 GMT
- Lines: 60
-
- yuki@watanabe.cs.unc.edu (Yuki Watanabe) writes:
-
- >Is there any detailed documentation on MIPS/Ultrix memory allocation
- >for C language (and assembly language). I have MIPS RISC Architecture
- >book by Kane and Heinrich. We are interested (eventually) in loading
- >a.out file produced by C compiler in a low-level simulator.
-
-
- There is a lot of info online in the man pages. For example:
-
- From "ld"
- The text and data segments must not overlap and all addresses must be
- less than 0x80000000. The stack starts below 0x80000000 and grows
- through lower addresses, so leave space for it.
-
- For ZMAGIC and NMAGIC files, the default text segment address is
- 0x00400000 and the default data segment address is 0x10000000. For
- OMAGIC files, the default text segment address is 0x10000000 with the
- data segment following the text segment. The default for all types of
- files is that the bss segment follows the data segment.
-
- From "scnhdr"
- struct scnhdr
- {
- char s_name[8]; /* section name */
- long s_paddr; /* physical address, aliased s_nlib */
- long s_vaddr; /* virtual address */
- long s_size; /* section size */
- long s_scnptr; /* file ptr to raw data for section */
- long s_relptr; /* file ptr to relocation */
- long s_lnnoptr; /* file ptr to gp table */
- unsigned short s_nreloc; /* number of relocation entries */
- unsigned short s_nlnno; /* number of gp table entries */
- long s_flags; /* flags */
- };
-
- From "reloc"
- struct reloc
- {
- long r_vaddr ; /* (virtual) address of reference */
- long r_symndx ; /* index into symbol table */
- ushort r_type ; /* relocation type */
- unsigned r_symndx:24, /* index into symbol table */
- r_reserved:3,
- r_type:4, /* relocation type */
- r_extern:1; /* if 1 symndx is an index into the
- external symbol table, else symndx
- is a section # */
- } ;
-
-
- I hope that some of this is helpful.
-
- Charlie
-
- --
- *****************************************************************************
- * Charles Richmond Integrated International Systems Corporation *
- * cmr@world.std.com (Temporary) crichmond@mr4dec.enet.dec.com *
- * Specializing in UNIX, X, Image Processing, and Communications. *
-