Changed to get led working under amoeba.

Author: K.S. Mullender.
This commit is contained in:
keie 1985-06-10 10:48:49 +00:00
parent 1c9723afd7
commit 44ccf469d9
10 changed files with 67 additions and 10 deletions

View file

@ -2,7 +2,7 @@
#ifdef NDEBUG
#define debug(s, a1, a2, a3, a4)
#define debug(s, a1, a2, a3, a4) dummy()
#else

View file

@ -8,8 +8,8 @@ static char rcsid[] = "$Header$";
#include "const.h"
static short nerrors = 0;
static diag();
static
stop()
{
extern char *outputname;
@ -61,6 +61,8 @@ diag(tail, format, a1, a2, a3, a4)
{
extern char *progname, *archname, *modulname;
extern int errno;
fprintf(stderr, "errno = %d\n", errno);
fprintf(stderr, "%s: ", progname);
if (archname)
fprintf(stderr, "%s: ", archname);

View file

@ -10,6 +10,12 @@ static char rcsid[] = "$Header$";
#include "orig.h"
#include "scan.h"
static get_name();
static process();
static getexternal();
static redefine();
static transfer();
/*
* Get section sizes and symboltable information from present module.
*/

View file

@ -12,6 +12,11 @@ static char rcsid[] = "$Header$";
extern bool incore;
extern int flagword;
static adjust_names();
static handle_relos();
static put_locals();
static compute_origins();
/*
* We know all there is to know about the current module.
* Now we relocate the values in the emitted bytes and write

View file

@ -16,6 +16,21 @@ static char rcsid[] = "$Header$";
extern bool incore;
static initializations();
static first_pass();
static long number();
static setlign();
static setbase();
static struct outname *makename();
static pass1();
static evaluate();
static norm_commons();
static complete_sections();
static change_names();
static bool tstbit();
static second_pass();
static pass2();
main(argc, argv)
int argc;
char **argv;
@ -27,7 +42,7 @@ main(argc, argv)
beginoutput();
second_pass(argv);
endoutput();
exit(0);
stop();
}
char *progname; /* Name this program was invoked with. */
@ -75,11 +90,9 @@ first_pass(argv)
int sectno;
int h;
extern int atoi();
extern long number();
extern char *index();
extern int hash();
extern struct outname *searchname();
extern struct outname *makename();
while (*++argv) {
argp = *argv;
@ -382,7 +395,6 @@ complete_sections()
register long base = 0;
register long foff;
register int sectindex;
extern bool tstbit();
foff = SZ_HEAD + outhead.oh_nsect * SZ_SECT;
for (sectindex = 0; sectindex < outhead.oh_nsect; sectindex++) {
@ -552,3 +564,9 @@ pass2(file)
}
closefile(file);
}
#ifdef NDEBUG
dummy() { ; }
#endif

View file

@ -15,6 +15,14 @@ static char rcsid[] = "$Header$";
#include "debug.h"
#include "memory.h"
static copy_down();
static copy_up();
static free_saved_moduls();
static writelong();
static sectswap();
static reloswap();
static namecpy();
struct memory mems[NMEMS];
bool incore = TRUE; /* TRUE while everything can be kept in core. */
@ -32,11 +40,13 @@ init_core()
register ind_t total_size;
register struct memory *mem;
extern char *sbrk();
extern char *brk();
char *BASE;
#include "mach.c"
total_size = (ind_t)0; /* Will accumulate the sizes. */
base = sbrk(0); /* First free. */
BASE = base = sbrk(0); /* First free. */
for (mem = mems; mem < &mems[NMEMS]; mem++) {
mem->mem_base = base;
mem->mem_full = (ind_t)0;
@ -59,7 +69,7 @@ init_core()
mems[ALLOLCHR].mem_full = 1;
mems[ALLOGCHR].mem_full = 1;
if (total_size != (int)total_size || (int)sbrk((int)total_size) == -1) {
if (brk(BASE + total_size) == (char *) -1) {
incore = FALSE; /* In core strategy failed. */
if ((int)sbrk(AT_LEAST) == -1)
fatal("no core at all");
@ -80,7 +90,7 @@ move_up(piece, incr)
extern char *sbrk();
debug("move_up(%d, %d)\n", piece, (int)incr, 0, 0);
if (incr != (int)incr || (int)sbrk((int)incr) == -1)
if (incr != (int)incr || sbrk((int)incr) == (char *) -1)
return FALSE;
for (mem = &mems[NMEMS - 1]; mem > &mems[piece]; mem--)

View file

@ -19,7 +19,7 @@
#define INCRSIZE 1024
typedef unsigned int ind_t;
typedef long ind_t;
#define BADOFF ((ind_t)-1)
struct memory {

View file

@ -6,6 +6,8 @@ static char rcsid[] = "$Header$";
#include "const.h"
#include "memory.h"
static generate_section_names();
extern struct outhead outhead;
extern bool incore;
extern int flagword;

View file

@ -37,6 +37,17 @@ long objectsize;
static long align();
static char *modulbase;
static long modulsize();
static scan_modul();
static bool all_alloc();
static bool direct_alloc();
static bool indirect_alloc();
static bool putemitindex();
static bool putreloindex();
#ifdef SYMDBUG
static bool putdbugindex();
#endif SYMDBUG
static get_indirect();
static read_modul();
/*
* Open the file with name `filename' (if necessary) and examine the first

View file

@ -17,6 +17,9 @@ static char rcsid[] = "$Header$";
#include "memory.h"
#include "orig.h"
static openoutput();
static wrt_head();
static wrt_sect();
extern long lseek();
#define WRITE 1 /* Argument to open(). */