memory.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Id$ */
  6. #define ALLOEMIT 0 /* Section contents. */
  7. #define ALLORELO (ALLOEMIT + MAXSECT) /* Relocation table. */
  8. #define ALLOLOCL (ALLORELO + 1) /* Saved local names. */
  9. #define ALLOGLOB (ALLOLOCL + 1) /* Saved global names. */
  10. #define ALLOLCHR (ALLOGLOB + 1) /* Strings of local names. */
  11. #define ALLOGCHR (ALLOLCHR + 1) /* Strings of global names. */
  12. #ifdef SYMDEBUG
  13. #define ALLODBUG (ALLOGCHR + 1) /* Symbolic debugging info. */
  14. #else /* SYMDEBUG */
  15. #define ALLODBUG ALLOGCHR
  16. #endif /* SYMDEBUG */
  17. #define ALLOSYMB (ALLODBUG + 1) /* Symbol table. */
  18. #define ALLOARCH (ALLOSYMB + 1) /* Archive positions. */
  19. #define ALLOMODL (ALLOARCH + 1) /* Modules. */
  20. #define ALLORANL (ALLOMODL + 1) /* Ranlib information. */
  21. #define NMEMS (ALLORANL + 1)
  22. #define BADOFF ((ind_t)-1)
  23. typedef long ind_t;
  24. struct memory {
  25. char *mem_base;
  26. ind_t mem_full;
  27. ind_t mem_left;
  28. };
  29. extern struct memory mems[];
  30. #define address(piece,offset) (mems[(piece)].mem_base+(offset))
  31. #define modulptr(offset) (mems[ALLOMODL].mem_base+core_position+(offset))
  32. #define int_align(sz) (((sz)+(sizeof(int)-1))&~(int)(sizeof(int)-1))
  33. extern ind_t core_position;
  34. void init_core();
  35. ind_t hard_alloc(int piece, long size);
  36. ind_t alloc(int piece, long size);
  37. void dealloc(int piece);
  38. char *core_alloc(int piece, long size);
  39. void core_free(int piece, char *p);
  40. void freeze_core();
  41. void write_bytes();
  42. void namecpy(struct outname *name, unsigned int nname, long offchar);