ack/util/led/memory.h

61 lines
1.9 KiB
C
Raw Normal View History

1987-03-09 19:15:41 +00:00
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
1994-06-24 11:31:16 +00:00
/* $Id$ */
1985-01-10 13:35:39 +00:00
#ifndef __MEMORY_H_INCLUDED__
#define __MEMORY_H_INCLUDED__
#include <stdbool.h>
#include <stddef.h>
1985-01-10 13:35:39 +00:00
#define ALLOEMIT 0 /* Section contents. */
#define ALLORELO (ALLOEMIT + MAXSECT) /* Relocation table. */
#define ALLOLOCL (ALLORELO + 1) /* Saved local names. */
#define ALLOGLOB (ALLOLOCL + 1) /* Saved global names. */
#define ALLOLCHR (ALLOGLOB + 1) /* Strings of local names. */
#define ALLOGCHR (ALLOLCHR + 1) /* Strings of global names. */
#ifdef SYMDBUG
1985-01-10 13:35:39 +00:00
#define ALLODBUG (ALLOGCHR + 1) /* Symbolic debugging info. */
#define ALLOSYMB (ALLODBUG + 1)
#else /* SYMDBUG */
#define ALLOSYMB (ALLOGCHR + 1) /* Symbol table. */
#endif /* SYMDBUG */
1985-01-10 13:35:39 +00:00
#define ALLOARCH (ALLOSYMB + 1) /* Archive positions. */
#define ALLOMODL (ALLOARCH + 1) /* Modules. */
#define ALLORANL (ALLOMODL + 1) /* Ranlib information. */
#define NMEMS (ALLORANL + 1)
#define BADOFF ((ind_t)-1)
typedef size_t ind_t;
1988-01-11 18:24:34 +00:00
1985-01-10 13:35:39 +00:00
struct memory {
char *mem_base;
ind_t mem_full;
ind_t mem_left;
};
extern struct memory mems[];
struct outname;
1985-01-10 13:35:39 +00:00
#define address(piece,offset) (mems[(piece)].mem_base+(offset))
#define modulptr(offset) (mems[ALLOMODL].mem_base+core_position+(offset))
#define int_align(sz) (((sz)+(sizeof(int)-1))&~(sizeof(int)-1))
1988-04-21 18:53:31 +00:00
extern bool incore;
1985-01-10 13:35:39 +00:00
extern ind_t core_position;
2017-08-06 13:57:49 +00:00
extern void init_core(void);
extern ind_t hard_alloc(int piece, size_t size);
extern ind_t alloc(int piece, size_t size);
2017-08-06 09:58:36 +00:00
extern void dealloc(int piece);
extern char *core_alloc(int piece, size_t size);
2017-08-06 09:58:36 +00:00
extern void core_free(int piece, char* p);
2017-08-06 13:57:49 +00:00
extern void write_bytes(void);
extern void freeze_core(void);
2017-08-06 13:57:49 +00:00
extern void namecpy(struct outname* name, unsigned nname, long offchar);
#endif /* #ifndef __MEMORY_H_INCLUDED__ */