Initial revision
This commit is contained in:
parent
bffdad9cdc
commit
9947059dcc
93
util/ceg/ce_back/as_back/Makefile
Normal file
93
util/ceg/ce_back/as_back/Makefile
Normal file
|
@ -0,0 +1,93 @@
|
|||
EM=/proj/em/Work
|
||||
CEG=/usr/star/kaashoek/em/ceg.1
|
||||
SOURCE=$(CEG)/ce_back/as_back
|
||||
|
||||
IDIRS=-I.\
|
||||
-I..\
|
||||
-I$(EM)/h\
|
||||
-I$(EM)/modules/h
|
||||
|
||||
LIBS=$(EM)/modules/lib/object.a\
|
||||
$(EM)/modules/lib/libstring.a\
|
||||
$(EM)/modules/lib/libprint.a\
|
||||
$(EM)/modules/lib/libsystem.a
|
||||
|
||||
all : bottom.o con1.o con2.o con4.o end_back.o gen1.o gen2.o\
|
||||
gen4.o init_back.o reloc1.o reloc2.o reloc4.o bss.o\
|
||||
rom1.o rom2.o rom4.o set_global.o set_local.o switchseg.o symboldef.o \
|
||||
do_open.o do_close.o text1.o text2.o text4.o
|
||||
|
||||
bottom.o : ../mach.h back.h header.h $(SOURCE)/bottom.c
|
||||
cc -c $(IDIRS) $(SOURCE)/bottom.c
|
||||
|
||||
bss.o : ../mach.h back.h header.h $(SOURCE)/bss.c
|
||||
cc -c $(IDIRS) $(SOURCE)/bss.c
|
||||
|
||||
text1.o : ../mach.h back.h header.h $(SOURCE)/text1.c
|
||||
cc -c $(IDIRS) $(SOURCE)/text1.c
|
||||
|
||||
text2.o : ../mach.h back.h header.h $(SOURCE)/text2.c
|
||||
cc -c $(IDIRS) $(SOURCE)/text2.c
|
||||
|
||||
text4.o : ../mach.h back.h header.h $(SOURCE)/text4.c
|
||||
cc -c $(IDIRS) $(SOURCE)/text4.c
|
||||
|
||||
con1.o : ../mach.h back.h header.h $(SOURCE)/con1.c
|
||||
cc -c $(IDIRS) $(SOURCE)/con1.c
|
||||
|
||||
con2.o : ../mach.h back.h header.h $(SOURCE)/con2.c
|
||||
cc -c $(IDIRS) $(SOURCE)/con2.c
|
||||
|
||||
con4.o : ../mach.h back.h header.h $(SOURCE)/con4.c
|
||||
cc -c $(IDIRS) $(SOURCE)/con4.c
|
||||
|
||||
do_open.o : back.h header.h ../mach.h $(SOURCE)/do_open.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/do_open.c
|
||||
|
||||
do_close.o : back.h header.h ../mach.h $(SOURCE)/do_close.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/do_close.c
|
||||
|
||||
gen1.o : back.h header.h ../mach.h $(SOURCE)/gen1.c
|
||||
cc -c $(IDIRS) $(SOURCE)/gen1.c
|
||||
|
||||
gen2.o : back.h header.h ../mach.h $(SOURCE)/gen2.c
|
||||
cc -c $(IDIRS) $(SOURCE)/gen2.c
|
||||
|
||||
gen4.o : back.h header.h ../mach.h $(SOURCE)/gen4.c
|
||||
cc -c $(IDIRS) $(SOURCE)/gen4.c
|
||||
|
||||
init_back.o : header.h back.h ../mach.h $(SOURCE)/init_back.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/init_back.c
|
||||
|
||||
end_back.o : header.h back.h ../mach.h $(SOURCE)/end_back.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/end_back.c
|
||||
|
||||
reloc1.o : back.h header.h ../mach.h $(SOURCE)/reloc1.c
|
||||
cc -c $(IDIRS) $(SOURCE)/reloc1.c
|
||||
|
||||
reloc2.o : back.h header.h ../mach.h $(SOURCE)/reloc2.c
|
||||
cc -c $(IDIRS) $(SOURCE)/reloc2.c
|
||||
|
||||
reloc4.o : back.h header.h ../mach.h $(SOURCE)/reloc4.c
|
||||
cc -c $(IDIRS) $(SOURCE)/reloc4.c
|
||||
|
||||
rom1.o : back.h header.h ../mach.h $(SOURCE)/rom1.c
|
||||
cc -c $(IDIRS) $(SOURCE)/rom1.c
|
||||
|
||||
rom2.o : back.h header.h ../mach.h $(SOURCE)/rom2.c
|
||||
cc -c $(IDIRS) $(SOURCE)/rom2.c
|
||||
|
||||
rom4.o : back.h header.h ../mach.h $(SOURCE)/rom4.c
|
||||
cc -c $(IDIRS) $(SOURCE)/rom4.c
|
||||
|
||||
set_global.o : header.h back.h ../mach.h $(SOURCE)/set_global.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/set_global.c
|
||||
|
||||
set_local.o : header.h back.h ../mach.h $(SOURCE)/set_local.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/set_local.c
|
||||
|
||||
switchseg.o : header.h back.h ../mach.h $(SOURCE)/switchseg.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/switchseg.c
|
||||
|
||||
symboldef.o : header.h back.h ../mach.h $(SOURCE)/symboldef.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/symboldef.c
|
18
util/ceg/ce_back/as_back/back.h
Normal file
18
util/ceg/ce_back/as_back/back.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <em.h>
|
||||
#include <system.h>
|
||||
|
||||
extern File *codefile;
|
||||
|
||||
extern char *extnd_name(), *extnd_dnam(), *extnd_dlb(), *extnd_ilb(),
|
||||
*extnd_hol(), *extnd_ext(), *extnd_pro(), *extnd_start();
|
||||
|
||||
extern int holno, procno;
|
||||
|
||||
#define swtxt() switchseg( SEGTXT)
|
||||
|
||||
#define SEGTXT 0
|
||||
#define SEGROM 1
|
||||
#define SEGCON 2
|
||||
#define SEGBSS 3
|
||||
|
||||
#define ABSOLUTE 1
|
96
util/ceg/ce_back/as_back/bottom.c
Normal file
96
util/ceg/ce_back/as_back/bottom.c
Normal file
|
@ -0,0 +1,96 @@
|
|||
#include "mach.h"
|
||||
#include "const.h"
|
||||
#include "back.h"
|
||||
|
||||
|
||||
int procno = 0, holno = 0, cur_seg = -1, saved = FALSE;
|
||||
char name[256], labeltje[256];
|
||||
|
||||
File *codefile;
|
||||
|
||||
|
||||
align_word()
|
||||
|
||||
/* The EM-definition demands that segments are aligned at a word boundary
|
||||
*/
|
||||
|
||||
{
|
||||
switch ( cur_seg) {
|
||||
case SEGTXT : return;
|
||||
default : fprint( codefile, ALIGN_FMT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
save_label( l)
|
||||
char *l;
|
||||
{
|
||||
sprint( labeltje, "%s", l);
|
||||
saved = TRUE;
|
||||
}
|
||||
|
||||
|
||||
dump_label()
|
||||
{
|
||||
if ( saved) {
|
||||
align_word();
|
||||
symbol_definition( labeltje);
|
||||
}
|
||||
saved = FALSE;
|
||||
}
|
||||
|
||||
|
||||
char *extnd_pro( procno)
|
||||
int procno;
|
||||
{
|
||||
sprint( name, "pro%d", procno);
|
||||
return( name);
|
||||
}
|
||||
|
||||
|
||||
char *extnd_start( procno)
|
||||
int procno;
|
||||
{
|
||||
sprint( name, "start%d", procno);
|
||||
return( name);
|
||||
}
|
||||
|
||||
|
||||
char *extnd_name( s)
|
||||
char *s;
|
||||
{
|
||||
sprint( name, NAME_FMT, s);
|
||||
return( name);
|
||||
}
|
||||
|
||||
|
||||
char *extnd_dnam( s)
|
||||
char *s;
|
||||
{
|
||||
sprint( name, DNAM_FMT, s);
|
||||
return( name);
|
||||
}
|
||||
|
||||
|
||||
char *extnd_dlb( g)
|
||||
arith g;
|
||||
{
|
||||
sprint( name, DLB_FMT, (arith)g);
|
||||
return( name);
|
||||
}
|
||||
|
||||
|
||||
char *extnd_ilb( l)
|
||||
arith l;
|
||||
{
|
||||
sprint( name, ILB_FMT, procno, (arith) l);
|
||||
return( name);
|
||||
}
|
||||
|
||||
|
||||
char *extnd_hol( hol)
|
||||
int hol;
|
||||
{
|
||||
sprint( name, HOL_FMT, hol);
|
||||
return( name);
|
||||
}
|
7
util/ceg/ce_back/as_back/bss.c
Normal file
7
util/ceg/ce_back/as_back/bss.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
bss( n)
|
||||
arith n;
|
||||
{
|
||||
fprint( codefile, BSS_FMT, (arith) n);
|
||||
}
|
7
util/ceg/ce_back/as_back/con1.c
Normal file
7
util/ceg/ce_back/as_back/con1.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
con1( w)
|
||||
arith w;
|
||||
{
|
||||
gen1( w);
|
||||
}
|
7
util/ceg/ce_back/as_back/con2.c
Normal file
7
util/ceg/ce_back/as_back/con2.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
con2( w)
|
||||
arith w;
|
||||
{
|
||||
gen2( w);
|
||||
}
|
7
util/ceg/ce_back/as_back/con4.c
Normal file
7
util/ceg/ce_back/as_back/con4.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
con4( w)
|
||||
arith w;
|
||||
{
|
||||
gen4( w);
|
||||
}
|
2
util/ceg/ce_back/as_back/const.h
Normal file
2
util/ceg/ce_back/as_back/const.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
#define TRUE 1
|
||||
#define FALSE 0
|
6
util/ceg/ce_back/as_back/do_close.c
Normal file
6
util/ceg/ce_back/as_back/do_close.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include "header.h"
|
||||
|
||||
do_close()
|
||||
{
|
||||
sys_close( codefile);
|
||||
}
|
10
util/ceg/ce_back/as_back/do_open.c
Normal file
10
util/ceg/ce_back/as_back/do_open.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include "header.h"
|
||||
|
||||
do_open( filename)
|
||||
char *filename;
|
||||
{
|
||||
if ( filename == (char *) '\0')
|
||||
return( FALSE);
|
||||
else
|
||||
return( sys_open( filename, OP_WRITE, &codefile));
|
||||
}
|
5
util/ceg/ce_back/as_back/end_back.c
Normal file
5
util/ceg/ce_back/as_back/end_back.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "header.h"
|
||||
|
||||
end_back()
|
||||
{
|
||||
}
|
17
util/ceg/ce_back/as_back/gen1.c
Normal file
17
util/ceg/ce_back/as_back/gen1.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "header.h"
|
||||
|
||||
gen1( w)
|
||||
arith w;
|
||||
{
|
||||
switch ( cur_seg) {
|
||||
case SEGTXT : fprint( codefile, BYTE_FMT, (arith) w);
|
||||
break;
|
||||
case SEGCON : fprint( codefile, BYTE_FMT, (arith) w);
|
||||
break;
|
||||
case SEGROM : fprint( codefile, BYTE_FMT, (arith) w);
|
||||
break;
|
||||
case SEGBSS : bss( 1);
|
||||
break;
|
||||
default : fprint( STDERR, "gen1 unkown seg %d\n", cur_seg);
|
||||
}
|
||||
}
|
17
util/ceg/ce_back/as_back/gen2.c
Normal file
17
util/ceg/ce_back/as_back/gen2.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "header.h"
|
||||
|
||||
gen2( w)
|
||||
arith w;
|
||||
{
|
||||
switch ( cur_seg) {
|
||||
case SEGTXT : fprint( codefile, WORD_FMT, (arith) w);
|
||||
break;
|
||||
case SEGCON : fprint( codefile, WORD_FMT, (arith) w);
|
||||
break;
|
||||
case SEGROM : fprint( codefile, WORD_FMT, (arith) w);
|
||||
break;
|
||||
case SEGBSS : bss( 2);
|
||||
break;
|
||||
default : fprint( STDERR, "gen2 unkown seg %d\n", cur_seg);
|
||||
}
|
||||
}
|
17
util/ceg/ce_back/as_back/gen4.c
Normal file
17
util/ceg/ce_back/as_back/gen4.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "header.h"
|
||||
|
||||
gen4( w)
|
||||
arith w;
|
||||
{
|
||||
switch ( cur_seg) {
|
||||
case SEGTXT : fprint( codefile, LONG_FMT, (arith) w);
|
||||
break;
|
||||
case SEGCON : fprint( codefile, LONG_FMT, (arith) w);
|
||||
break;
|
||||
case SEGROM : fprint( codefile, LONG_FMT, (arith) w);
|
||||
break;
|
||||
case SEGBSS : bss( 4);
|
||||
break;
|
||||
default : fprint( STDERR, "gen4 unkown seg %d\n", cur_seg);
|
||||
}
|
||||
}
|
7
util/ceg/ce_back/as_back/header.h
Normal file
7
util/ceg/ce_back/as_back/header.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "mach.h"
|
||||
#include "const.h"
|
||||
#include "back.h"
|
||||
|
||||
extern int cur_seg;
|
||||
|
||||
extern holno, procno;
|
5
util/ceg/ce_back/as_back/init_back.c
Normal file
5
util/ceg/ce_back/as_back/init_back.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "header.h"
|
||||
|
||||
init_back()
|
||||
{
|
||||
}
|
9
util/ceg/ce_back/as_back/reloc1.c
Normal file
9
util/ceg/ce_back/as_back/reloc1.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "header.h"
|
||||
|
||||
reloc1( s, o, r)
|
||||
char *s;
|
||||
arith o;
|
||||
int r;
|
||||
{
|
||||
fprint( codefile, RELOC1_FMT, s, (arith) o);
|
||||
}
|
9
util/ceg/ce_back/as_back/reloc2.c
Normal file
9
util/ceg/ce_back/as_back/reloc2.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "header.h"
|
||||
|
||||
reloc2( s, o, r)
|
||||
char *s;
|
||||
arith o;
|
||||
int r;
|
||||
{
|
||||
fprint( codefile, RELOC2_FMT, s, (arith) o);
|
||||
}
|
9
util/ceg/ce_back/as_back/reloc4.c
Normal file
9
util/ceg/ce_back/as_back/reloc4.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "header.h"
|
||||
|
||||
reloc4( s, o, r)
|
||||
char *s;
|
||||
arith o;
|
||||
int r;
|
||||
{
|
||||
fprint( codefile, RELOC4_FMT, s, (arith) o);
|
||||
}
|
7
util/ceg/ce_back/as_back/rom1.c
Normal file
7
util/ceg/ce_back/as_back/rom1.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
rom1( w)
|
||||
arith w;
|
||||
{
|
||||
gen1( w);
|
||||
}
|
7
util/ceg/ce_back/as_back/rom2.c
Normal file
7
util/ceg/ce_back/as_back/rom2.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
rom2( w)
|
||||
arith w;
|
||||
{
|
||||
gen2( w);
|
||||
}
|
7
util/ceg/ce_back/as_back/rom4.c
Normal file
7
util/ceg/ce_back/as_back/rom4.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
rom4( w)
|
||||
arith w;
|
||||
{
|
||||
gen4( w);
|
||||
}
|
7
util/ceg/ce_back/as_back/set_global.c
Normal file
7
util/ceg/ce_back/as_back/set_global.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
set_global_visible( s)
|
||||
char *s;
|
||||
{
|
||||
fprint( codefile, GLOBAL_FMT, s);
|
||||
}
|
7
util/ceg/ce_back/as_back/set_local.c
Normal file
7
util/ceg/ce_back/as_back/set_local.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
set_local_visible( s)
|
||||
char *s;
|
||||
{
|
||||
fprint( codefile, LOCAL_FMT, s);
|
||||
}
|
25
util/ceg/ce_back/as_back/switchseg.c
Normal file
25
util/ceg/ce_back/as_back/switchseg.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include "header.h"
|
||||
|
||||
switchseg( seg)
|
||||
int seg;
|
||||
{
|
||||
if ( seg == cur_seg)
|
||||
return;
|
||||
|
||||
cur_seg = seg;
|
||||
|
||||
switch ( cur_seg) {
|
||||
case SEGTXT : fprint( codefile, SEGTXT_FMT);
|
||||
break;
|
||||
case SEGCON : fprint( codefile, SEGDAT_FMT);
|
||||
break;
|
||||
case SEGROM : fprint( codefile, SEGDAT_FMT);
|
||||
break;
|
||||
case SEGBSS : fprint( codefile, SEGBSS_FMT);
|
||||
break;
|
||||
}
|
||||
|
||||
if ( seg != SEGTXT)
|
||||
align_word();
|
||||
}
|
||||
|
7
util/ceg/ce_back/as_back/symboldef.c
Normal file
7
util/ceg/ce_back/as_back/symboldef.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
symbol_definition( s)
|
||||
char *s;
|
||||
{
|
||||
fprint( codefile, SYMBOL_DEF_FMT, s);
|
||||
}
|
7
util/ceg/ce_back/as_back/text1.c
Normal file
7
util/ceg/ce_back/as_back/text1.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
text1( w)
|
||||
arith w;
|
||||
{
|
||||
gen1( w);
|
||||
}
|
7
util/ceg/ce_back/as_back/text2.c
Normal file
7
util/ceg/ce_back/as_back/text2.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
text2( w)
|
||||
arith w;
|
||||
{
|
||||
gen2( w);
|
||||
}
|
7
util/ceg/ce_back/as_back/text4.c
Normal file
7
util/ceg/ce_back/as_back/text4.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "header.h"
|
||||
|
||||
text4( w)
|
||||
arith w;
|
||||
{
|
||||
gen4( w);
|
||||
}
|
107
util/ceg/ce_back/obj_back/Makefile
Normal file
107
util/ceg/ce_back/obj_back/Makefile
Normal file
|
@ -0,0 +1,107 @@
|
|||
EM=/proj/em/Work
|
||||
CEG=/usr/star/kaashoek/em/ceg.1
|
||||
SOURCE=$(CEG)/ce_back/obj_back
|
||||
|
||||
IDIRS=-I.\
|
||||
-I..\
|
||||
-I$(EM)/h\
|
||||
-I$(EM)/modules/h
|
||||
|
||||
LIBS=$(EM)/modules/lib/object.a\
|
||||
$(EM)/modules/lib/libstring.a\
|
||||
$(EM)/modules/lib/libprint.a\
|
||||
$(EM)/modules/lib/liballoc.a\
|
||||
$(EM)/modules/lib/libsystem.a
|
||||
|
||||
all : data.o con2.o con4.o relocation.o end_back.o gen1.o gen2.o\
|
||||
gen4.o init_back.o mysprint.o output.o reloc1.o reloc2.o reloc4.o\
|
||||
rom2.o rom4.o set_global.o set_local.o switchseg.o symboldef.o text2.o\
|
||||
text4.o do_open.o do_close.o memory.o label.o misc.o extnd.o symtable.o
|
||||
|
||||
data.o : data.h back.h header.h $(SOURCE)/data.c
|
||||
cc -c $(IDIRS) $(SOURCE)/data.c
|
||||
|
||||
memory.o :data.h back.h header.h $(SOURCE)/memory.c
|
||||
cc -c $(IDIRS) $(SOURCE)/memory.c
|
||||
|
||||
con2.o : data.h back.h header.h $(SOURCE)/con2.c
|
||||
cc -c $(IDIRS) $(SOURCE)/con2.c
|
||||
|
||||
con4.o : data.h back.h header.h $(SOURCE)/con4.c
|
||||
cc -c $(IDIRS) $(SOURCE)/con4.c
|
||||
|
||||
relocation.o : data.h back.h ../mach.h $(SOURCE)/relocation.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/relocation.c
|
||||
|
||||
do_open.o : data.h back.h ../mach.h $(SOURCE)/do_open.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/do_open.c
|
||||
|
||||
do_close.o : data.h back.h ../mach.h $(SOURCE)/do_close.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/do_close.c
|
||||
|
||||
gen1.o : data.h back.h header.h $(SOURCE)/gen1.c
|
||||
cc -c $(IDIRS) $(SOURCE)/gen1.c
|
||||
|
||||
gen2.o : data.h back.h header.h $(SOURCE)/gen2.c
|
||||
cc -c $(IDIRS) $(SOURCE)/gen2.c
|
||||
|
||||
gen4.o : data.h back.h header.h $(SOURCE)/gen4.c
|
||||
cc -c $(IDIRS) $(SOURCE)/gen4.c
|
||||
|
||||
init_back.o : data.h back.h ../mach.h $(SOURCE)/init_back.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/init_back.c
|
||||
|
||||
end_back.o : data.h back.h ../mach.h $(SOURCE)/end_back.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/end_back.c
|
||||
|
||||
mysprint.o : data.h back.h data.h $(SOURCE)/mysprint.c
|
||||
cc -c $(IDIRS) $(SOURCE)/mysprint.c
|
||||
|
||||
output.o : data.h back.h ../mach.h $(SOURCE)/output.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/output.c
|
||||
|
||||
reloc1.o : data.h back.h header.h $(SOURCE)/reloc1.c
|
||||
cc -c $(IDIRS) $(SOURCE)/reloc1.c
|
||||
|
||||
reloc2.o : data.h back.h header.h $(SOURCE)/reloc2.c
|
||||
cc -c $(IDIRS) $(SOURCE)/reloc2.c
|
||||
|
||||
reloc4.o : data.h back.h header.h $(SOURCE)/reloc4.c
|
||||
cc -c $(IDIRS) $(SOURCE)/reloc4.c
|
||||
|
||||
rom2.o : data.h back.h header.h $(SOURCE)/rom2.c
|
||||
cc -c $(IDIRS) $(SOURCE)/rom2.c
|
||||
|
||||
rom4.o : data.h back.h header.h $(SOURCE)/rom4.c
|
||||
cc -c $(IDIRS) $(SOURCE)/rom4.c
|
||||
|
||||
set_global.o : data.h back.h ../mach.h $(SOURCE)/set_global.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/set_global.c
|
||||
|
||||
set_local.o : data.h back.h ../mach.h $(SOURCE)/set_local.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/set_local.c
|
||||
|
||||
switchseg.o : data.h back.h ../mach.h $(SOURCE)/switchseg.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/switchseg.c
|
||||
|
||||
symboldef.o : data.h back.h ../mach.h $(SOURCE)/symboldef.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/symboldef.c
|
||||
|
||||
text2.o : data.h back.h ../mach.h $(SOURCE)/text2.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/text2.c
|
||||
|
||||
text4.o : data.h back.h ../mach.h $(SOURCE)/text4.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/text4.c
|
||||
|
||||
symtable.o : data.h back.h ../mach.h $(SOURCE)/symtable.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/symtable.c
|
||||
|
||||
extnd.o : data.h back.h ../mach.h $(SOURCE)/extnd.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/extnd.c
|
||||
|
||||
misc.o : data.h back.h ../mach.h $(SOURCE)/misc.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/misc.c
|
||||
|
||||
label.o : data.h back.h ../mach.h $(SOURCE)/label.c
|
||||
cc -c $(IDIRS) -I.. $(SOURCE)/label.c
|
||||
|
27
util/ceg/ce_back/obj_back/back.h
Normal file
27
util/ceg/ce_back/obj_back/back.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
extern char *extnd_name(), *extnd_dnam(), *extnd_dlb(), *extnd_ilb(),
|
||||
*extnd_hol(), *extnd_ext(), *extnd_pro(), *extnd_start();
|
||||
extern holno, procno;
|
||||
|
||||
#include "data.h"
|
||||
|
||||
#define text1(b) {if (text-text_area>=size_text) mem_text() ; *text++=b;}
|
||||
#define con1(b) {if (data-data_area>=size_data) mem_data(); *data++ = b;}
|
||||
#define rom1(b) {if (data-data_area>=size_data) mem_data(); *data++=b;}
|
||||
#define bss( n) ( nbss += n)
|
||||
|
||||
#define SEGTXT 0
|
||||
#define SEGROM 1
|
||||
#define SEGCON 2
|
||||
#define SEGBSS 3
|
||||
|
||||
#define swtxt() switchseg( SEGTXT)
|
||||
|
||||
#define MAXTEXT 20
|
||||
#define MAXDATA 20
|
||||
#define MAXRELO 3
|
||||
#define MAXNAME 5
|
||||
#define MAXSTRING 20
|
||||
#define MAXHASH 256
|
||||
|
||||
#define PC_REL 1
|
||||
#define ABSOLUTE !PC_REL
|
15
util/ceg/ce_back/obj_back/con2.c
Normal file
15
util/ceg/ce_back/obj_back/con2.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include "mach.h"
|
||||
#include "back.h"
|
||||
|
||||
con2( w)
|
||||
TWO_BYTES w;
|
||||
{
|
||||
#ifdef BYTES_REVERSED
|
||||
con1( (char) ( ( unsigned short)w>>8));
|
||||
con1( (char) w);
|
||||
#else
|
||||
con1( (char) w);
|
||||
con1( (char) ( ( unsigned short)w>>8));
|
||||
#endif
|
||||
}
|
||||
|
15
util/ceg/ce_back/obj_back/con4.c
Normal file
15
util/ceg/ce_back/obj_back/con4.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include "mach.h"
|
||||
|
||||
con4( l)
|
||||
FOUR_BYTES l;
|
||||
{
|
||||
#ifdef WORDS_REVERSED
|
||||
con2( (short) ((unsigned long)l>>16));
|
||||
con2( (short) l);
|
||||
#else
|
||||
con2( (short) l);
|
||||
con2( (short) ((unsigned long)l>>16));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
97
util/ceg/ce_back/obj_back/data.c
Normal file
97
util/ceg/ce_back/obj_back/data.c
Normal file
|
@ -0,0 +1,97 @@
|
|||
#include <system.h>
|
||||
#include <out.h>
|
||||
#include "mach.h"
|
||||
|
||||
|
||||
char *text_area,
|
||||
*data_area,
|
||||
*string_area,
|
||||
*text, *data, *string;
|
||||
struct outrelo *reloc_info, *relo;
|
||||
struct outname *symbol_table;
|
||||
|
||||
|
||||
int cur_seg = -1 , nname = 0;
|
||||
long nbss = 0, size_text, size_data, size_reloc, size_symbol,
|
||||
size_string;
|
||||
|
||||
|
||||
put1(sect,addr,b)
|
||||
char *sect;
|
||||
long addr;
|
||||
char b;
|
||||
{
|
||||
sect[addr] = b;
|
||||
}
|
||||
|
||||
|
||||
put2(sect,addr,w)
|
||||
char *sect;
|
||||
long addr;
|
||||
int w;
|
||||
{
|
||||
#ifdef BYTES_REVERSED
|
||||
put1(sect,addr,(char) (w>>8));
|
||||
put1(sect,addr+1,(char) w);
|
||||
#else
|
||||
put1(sect,addr,(char) w);
|
||||
put1(sect,addr+1,(char) (w>>8));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
put4(sect,addr,l)
|
||||
char *sect;
|
||||
long addr;
|
||||
long l;
|
||||
{
|
||||
#ifdef WORDS_REVERSED
|
||||
put2(sect,addr,(short) (l>>16));
|
||||
put2(sect,addr+2,(short) l);
|
||||
#else
|
||||
put2(sect,addr,(short) l);
|
||||
put2(sect,addr+2,(short) (l>>16));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
char get1( sect, addr)
|
||||
char *sect;
|
||||
long addr;
|
||||
{
|
||||
return( sect[addr]);
|
||||
}
|
||||
|
||||
|
||||
short get2(sect,addr)
|
||||
char *sect;
|
||||
long addr;
|
||||
{
|
||||
short h,l;
|
||||
|
||||
#ifdef BYTES_REVERSED
|
||||
h = sect[addr];
|
||||
l = sect[addr+1];
|
||||
#else
|
||||
l = sect[addr];
|
||||
h = sect[addr+1];
|
||||
#endif
|
||||
return( ( h << 8) | ( l & 255));
|
||||
}
|
||||
|
||||
|
||||
long get4(sect,addr)
|
||||
char *sect;
|
||||
long addr;
|
||||
{
|
||||
long l,h;
|
||||
|
||||
#ifdef WORDS_REVERSED
|
||||
h = get2(sect,addr);
|
||||
l = get2(sect,addr+2);
|
||||
#else
|
||||
l = get2(sect,addr);
|
||||
h = get2(sect,addr+2);
|
||||
#endif
|
||||
return( ( h << 16) | ( l & 65535L));
|
||||
}
|
13
util/ceg/ce_back/obj_back/data.h
Normal file
13
util/ceg/ce_back/obj_back/data.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
extern long cur_value();
|
||||
|
||||
extern int cur_seg;
|
||||
|
||||
extern char *text, *data, *string;
|
||||
extern int nname;
|
||||
extern long nbss, size_text, size_data, size_reloc, size_symbol,
|
||||
size_string;
|
||||
|
||||
extern char *text_area, *data_area, *string_area;
|
||||
extern struct outrelo *reloc_info, *relo;
|
||||
extern struct outname *symbol_table;
|
||||
|
10
util/ceg/ce_back/obj_back/do_close.c
Normal file
10
util/ceg/ce_back/obj_back/do_close.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include <out.h>
|
||||
#include <arch.h>
|
||||
#include <ranlib.h>
|
||||
|
||||
do_close()
|
||||
{
|
||||
output();
|
||||
|
||||
wr_close();
|
||||
}
|
14
util/ceg/ce_back/obj_back/do_open.c
Normal file
14
util/ceg/ce_back/obj_back/do_open.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <out.h>
|
||||
#include <arch.h>
|
||||
#include <ranlib.h>
|
||||
#include "data.h"
|
||||
#include "header.h"
|
||||
|
||||
do_open( filename)
|
||||
char *filename;
|
||||
{
|
||||
if ( filename == (char *) '\0')
|
||||
return( 0);
|
||||
else
|
||||
return( wr_open( filename));
|
||||
}
|
41
util/ceg/ce_back/obj_back/end_back.c
Normal file
41
util/ceg/ce_back/obj_back/end_back.c
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include <out.h>
|
||||
#include "mach.h"
|
||||
#include "back.h"
|
||||
#include "header.h"
|
||||
|
||||
|
||||
end_back()
|
||||
{
|
||||
sync();
|
||||
define_segments();
|
||||
do_local_relocation();
|
||||
}
|
||||
|
||||
|
||||
sync()
|
||||
{
|
||||
while ( ( text - text_area) % EM_WSIZE != 0 )
|
||||
text1( '\0');
|
||||
while ( ( data - data_area) % EM_WSIZE != 0 )
|
||||
con1( '\0');
|
||||
}
|
||||
|
||||
|
||||
static char *seg_name[] = {
|
||||
".text",
|
||||
".rom",
|
||||
".con",
|
||||
".bss"
|
||||
};
|
||||
|
||||
|
||||
define_segments()
|
||||
{
|
||||
int i, s;
|
||||
|
||||
for ( s = SEGTXT; s <= SEGBSS; s++) {
|
||||
i = find_sym( seg_name[s], SYMBOL_DEFINITION);
|
||||
symbol_table[i].on_type = ( S_MIN + s) | S_SCT;
|
||||
}
|
||||
}
|
||||
|
77
util/ceg/ce_back/obj_back/extnd.c
Normal file
77
util/ceg/ce_back/obj_back/extnd.c
Normal file
|
@ -0,0 +1,77 @@
|
|||
#include <system.h>
|
||||
#include <em.h>
|
||||
#include <out.h>
|
||||
#include "header.h"
|
||||
#include "mach.h"
|
||||
|
||||
/* The extnd_*() make a name unique. The resulting string is directly stored
|
||||
in the symbol_table (by mysprint()). Later additional fields in the
|
||||
symbol_table are filled. For these actions the values of the index in
|
||||
the symbol_table and the length of the string are stored.
|
||||
*/
|
||||
|
||||
extern int string_lengte, index_symbol_table;
|
||||
int procno = 0, holno = 0;
|
||||
|
||||
|
||||
char *extnd_pro( procno)
|
||||
int procno;
|
||||
{
|
||||
string_lengte = mysprint( "pro%d", procno);
|
||||
index_symbol_table = find_sym( string, STORE_STRING);
|
||||
return( symbol_table[ index_symbol_table].on_foff + string_area);
|
||||
}
|
||||
|
||||
|
||||
char *extnd_start( procno)
|
||||
int procno;
|
||||
{
|
||||
string_lengte = mysprint( "start%d", procno);
|
||||
index_symbol_table = find_sym( string, STORE_STRING);
|
||||
return( symbol_table[ index_symbol_table].on_foff + string_area);
|
||||
}
|
||||
|
||||
|
||||
char *extnd_name( s)
|
||||
char *s;
|
||||
{
|
||||
string_lengte = mysprint( NAME_FMT, s);
|
||||
index_symbol_table = find_sym( string, STORE_STRING);
|
||||
return( string_area + symbol_table[ index_symbol_table].on_foff);
|
||||
}
|
||||
|
||||
|
||||
char *extnd_dnam( s)
|
||||
char *s;
|
||||
{
|
||||
string_lengte = mysprint( DNAM_FMT, s);
|
||||
index_symbol_table = find_sym( string, STORE_STRING);
|
||||
return( symbol_table[ index_symbol_table].on_foff + string_area);
|
||||
}
|
||||
|
||||
|
||||
char *extnd_dlb( g)
|
||||
arith g;
|
||||
{
|
||||
string_lengte = mysprint( DLB_FMT, (arith)g);
|
||||
index_symbol_table = find_sym( string, STORE_STRING);
|
||||
return( symbol_table[ index_symbol_table].on_foff + string_area);
|
||||
}
|
||||
|
||||
|
||||
char *extnd_ilb( l)
|
||||
arith l;
|
||||
{
|
||||
string_lengte = mysprint( ILB_FMT, procno, (arith) l);
|
||||
index_symbol_table = find_sym( string, STORE_STRING);
|
||||
return( symbol_table[ index_symbol_table].on_foff + string_area);
|
||||
}
|
||||
|
||||
|
||||
char *extnd_hol( hol)
|
||||
int hol;
|
||||
{
|
||||
string_lengte = mysprint( HOL_FMT, hol);
|
||||
index_symbol_table = find_sym( string, STORE_STRING);
|
||||
return( symbol_table[ index_symbol_table].on_foff + string_area);
|
||||
}
|
21
util/ceg/ce_back/obj_back/gen1.c
Normal file
21
util/ceg/ce_back/obj_back/gen1.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include <system.h>
|
||||
#include "mach.h"
|
||||
#include "back.h"
|
||||
|
||||
gen1( c)
|
||||
ONE_BYTE c;
|
||||
{
|
||||
switch ( cur_seg) {
|
||||
case SEGTXT : text1( c);
|
||||
return;
|
||||
case SEGCON : con1( c);
|
||||
return;
|
||||
case SEGROM : rom1( c);
|
||||
return;
|
||||
case SEGBSS : bss( 1);
|
||||
return;
|
||||
default : fprint( STDERR, "gen1() : bad seg number\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
15
util/ceg/ce_back/obj_back/gen2.c
Normal file
15
util/ceg/ce_back/obj_back/gen2.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include "mach.h"
|
||||
#include "back.h"
|
||||
|
||||
gen2( w)
|
||||
TWO_BYTES w;
|
||||
{
|
||||
#ifdef BYTES_REVERSED
|
||||
gen1( (char) ( ( unsigned short)w>>8));
|
||||
gen1( (char) w);
|
||||
#else
|
||||
gen1( (char) w);
|
||||
gen1( (char) ( ( unsigned short)w>>8));
|
||||
#endif
|
||||
}
|
||||
|
14
util/ceg/ce_back/obj_back/gen4.c
Normal file
14
util/ceg/ce_back/obj_back/gen4.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "mach.h"
|
||||
|
||||
gen4( l)
|
||||
FOUR_BYTES l;
|
||||
{
|
||||
#ifdef WORDS_REVERSED
|
||||
gen2( (short) ((unsigned long)l>>16));
|
||||
gen2( (short) l);
|
||||
#else
|
||||
gen2( (short) l);
|
||||
gen2( (short) ((unsigned long)l>>16));
|
||||
#endif
|
||||
}
|
||||
|
6
util/ceg/ce_back/obj_back/hash.h
Normal file
6
util/ceg/ce_back/obj_back/hash.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
struct Hashitem {
|
||||
int hs_next;
|
||||
int hs_nami;
|
||||
};
|
||||
|
||||
extern struct Hashitem *Hashitems;
|
5
util/ceg/ce_back/obj_back/header.h
Normal file
5
util/ceg/ce_back/obj_back/header.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#define SYMBOL_DEFINITION 1
|
||||
#define REFERENCE 2
|
||||
#define STORE_STRING 3
|
||||
|
||||
#define conv_seg( s) ( ( s == SEGROM) ? SEGCON : s)
|
27
util/ceg/ce_back/obj_back/init_back.c
Normal file
27
util/ceg/ce_back/obj_back/init_back.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <out.h>
|
||||
#include "back.h"
|
||||
#include "hash.h"
|
||||
|
||||
char *calloc();
|
||||
|
||||
init_back()
|
||||
{
|
||||
text_area = calloc( MAXTEXT, sizeof( char));
|
||||
data_area = calloc( MAXDATA, sizeof( char));
|
||||
reloc_info = (struct outrelo *)calloc( MAXRELO, SZ_RELO);
|
||||
symbol_table = (struct outname *)calloc( MAXNAME, SZ_NAME);
|
||||
Hashitems = (struct Hashitem *)calloc( MAXNAME + 1,
|
||||
sizeof( struct Hashitem));
|
||||
string_area = calloc( MAXSTRING, sizeof( char));
|
||||
|
||||
text = text_area;
|
||||
data = data_area;
|
||||
string = string_area;
|
||||
relo = reloc_info;
|
||||
|
||||
size_text = MAXTEXT;
|
||||
size_data = MAXDATA;
|
||||
size_reloc = MAXRELO;
|
||||
size_symbol = MAXNAME;
|
||||
size_string = MAXSTRING;
|
||||
}
|
24
util/ceg/ce_back/obj_back/label.c
Normal file
24
util/ceg/ce_back/obj_back/label.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include <out.h>
|
||||
#include "header.h"
|
||||
#include "back.h"
|
||||
|
||||
int Label, label_waiting;
|
||||
|
||||
save_label( lab)
|
||||
char *lab;
|
||||
{
|
||||
Label = find_sym( lab, SYMBOL_DEFINITION);
|
||||
label_waiting = 1;
|
||||
}
|
||||
|
||||
|
||||
dump_label()
|
||||
{
|
||||
if ( label_waiting) {
|
||||
align_word();
|
||||
symbol_table[ Label].on_valu = cur_value();
|
||||
symbol_table[ Label].on_type |= ( S_MIN + conv_seg( cur_seg));
|
||||
label_waiting = 0;
|
||||
}
|
||||
}
|
||||
|
64
util/ceg/ce_back/obj_back/memory.c
Normal file
64
util/ceg/ce_back/obj_back/memory.c
Normal file
|
@ -0,0 +1,64 @@
|
|||
#include <out.h>
|
||||
#include <system.h>
|
||||
#include "data.h"
|
||||
#include "hash.h"
|
||||
|
||||
char *realloc();
|
||||
|
||||
mem_text()
|
||||
{
|
||||
/* print( "text_area too small %d %d \n", text_area, text); */
|
||||
|
||||
text_area = realloc( text_area, sizeof( char) * 2 * size_text);
|
||||
text = text_area + size_text;
|
||||
size_text = 2 * size_text;
|
||||
}
|
||||
|
||||
|
||||
mem_data()
|
||||
{
|
||||
/* print( "data_area too small\n"); */
|
||||
|
||||
data_area = realloc( data_area, sizeof( char) * 2 * size_data);
|
||||
data = data_area + size_data;
|
||||
size_data = 2 * size_data;
|
||||
}
|
||||
|
||||
|
||||
mem_symbol_hash()
|
||||
{
|
||||
/* print( "symbol_table out of memory\n"); */
|
||||
|
||||
size_symbol = 2 * size_symbol;
|
||||
symbol_table = (struct outname *) realloc( (char *) symbol_table,
|
||||
sizeof( struct outname) * size_symbol);
|
||||
|
||||
/* print( "hash out of memory\n"); */
|
||||
|
||||
Hashitems = (struct Hashitem *) realloc( (char *) Hashitems,
|
||||
sizeof( struct Hashitem)*(size_symbol+1));
|
||||
}
|
||||
|
||||
|
||||
mem_relo()
|
||||
{
|
||||
/* print( "reloc_table out of memory\n"); */
|
||||
|
||||
reloc_info = (struct outrelo *) realloc( (char *) reloc_info,
|
||||
sizeof( struct outrelo) * 2 * size_reloc);
|
||||
relo = reloc_info + size_reloc;
|
||||
size_reloc = 2 * size_reloc;
|
||||
}
|
||||
|
||||
|
||||
mem_string()
|
||||
{
|
||||
int i;
|
||||
|
||||
/* print( "string_area out of memory %d %d \n", string_area, string);*/
|
||||
|
||||
i = string - string_area;
|
||||
size_string = 2 * size_string;
|
||||
string_area = realloc( string_area, sizeof( char) * size_string);
|
||||
string = string_area + i;
|
||||
}
|
39
util/ceg/ce_back/obj_back/misc.c
Normal file
39
util/ceg/ce_back/obj_back/misc.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include <system.h>
|
||||
#include "mach.h"
|
||||
#include "back.h"
|
||||
|
||||
/* The following functions are called from reloc1(), reloc2(), reloc4(),
|
||||
dump_label().
|
||||
*/
|
||||
|
||||
align_word()
|
||||
{
|
||||
switch ( cur_seg) {
|
||||
case SEGTXT : return;
|
||||
case SEGCON : while ( (data - data_area) % EM_WSIZE != 0)
|
||||
con1( '\0');
|
||||
return;
|
||||
case SEGROM : while ( (data - data_area) % EM_WSIZE != 0)
|
||||
rom1( '\0');
|
||||
return;
|
||||
case SEGBSS : while ( nbss % EM_WSIZE != 0)
|
||||
nbss++;
|
||||
return;
|
||||
default : fprint( STDERR, "align_word() : unknown seg\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
long cur_value()
|
||||
{
|
||||
switch( cur_seg) {
|
||||
case SEGTXT: return text - text_area;
|
||||
case SEGCON: return data - data_area;
|
||||
case SEGROM: return data - data_area;
|
||||
case SEGBSS: return nbss;
|
||||
default : fprint( STDERR, "cur_value() : unknown seg\n");
|
||||
return -1L;
|
||||
}
|
||||
}
|
||||
|
122
util/ceg/ce_back/obj_back/mysprint.c
Normal file
122
util/ceg/ce_back/obj_back/mysprint.c
Normal file
|
@ -0,0 +1,122 @@
|
|||
#include <system.h>
|
||||
#include "data.h"
|
||||
|
||||
int mysprint( fmt, args)
|
||||
char *fmt;
|
||||
int args;
|
||||
{
|
||||
return( _myformat( fmt, &args));
|
||||
}
|
||||
|
||||
char *long2str();
|
||||
|
||||
static int integral(c)
|
||||
{
|
||||
switch (c) {
|
||||
case 'b':
|
||||
return -2;
|
||||
case 'd':
|
||||
return 10;
|
||||
case 'o':
|
||||
return -8;
|
||||
case 'u':
|
||||
return -10;
|
||||
case 'x':
|
||||
return -16;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _myformat( fmt, argp)
|
||||
char *fmt;
|
||||
char *argp;
|
||||
{
|
||||
register char *pf = fmt, *pa = argp;
|
||||
register char *pb = string;
|
||||
int n = 0;
|
||||
|
||||
while (*pf) {
|
||||
if (*pf == '%') {
|
||||
register width, base, pad, npad, s_l;
|
||||
char *arg;
|
||||
char cbuf[2];
|
||||
char *badformat = "<bad format>";
|
||||
|
||||
/* get padder */
|
||||
if (*++pf == '0') {
|
||||
pad = '0';
|
||||
++pf;
|
||||
}
|
||||
else
|
||||
pad = ' ';
|
||||
|
||||
/* get width */
|
||||
width = 0;
|
||||
while (*pf >= '0' && *pf <= '9')
|
||||
width = 10 * width + *pf++ - '0';
|
||||
|
||||
/* get text and move pa */
|
||||
if (*pf == 's') {
|
||||
arg = *(char **)pa;
|
||||
pa += sizeof(char *);
|
||||
}
|
||||
else
|
||||
if (*pf == 'c') {
|
||||
cbuf[0] = * (int *) pa;
|
||||
cbuf[1] = '\0';
|
||||
pa += sizeof(int);
|
||||
arg = &cbuf[0];
|
||||
}
|
||||
else
|
||||
if (*pf == 'l') {
|
||||
/* alignment ??? */
|
||||
if (base = integral(*++pf)) {
|
||||
arg = long2str(*(long *)pa, base);
|
||||
pa += sizeof(long);
|
||||
}
|
||||
else {
|
||||
pf--;
|
||||
arg = badformat;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (base = integral(*pf)) {
|
||||
arg = long2str((long)*(int *)pa, base);
|
||||
pa += sizeof(int);
|
||||
}
|
||||
else
|
||||
if (*pf == '%')
|
||||
arg = "%";
|
||||
else
|
||||
arg = badformat;
|
||||
|
||||
s_l = strlen( arg);
|
||||
npad = width - s_l;
|
||||
if ( npad > 0)
|
||||
s_l += npad;
|
||||
|
||||
if ( n + s_l + string - string_area >= size_string) {
|
||||
mem_string();
|
||||
pb = string + n;
|
||||
}
|
||||
|
||||
while (npad-- > 0)
|
||||
*pb++ = pad;
|
||||
|
||||
while (*pb++ = *arg++);
|
||||
n += s_l;
|
||||
|
||||
pb--;
|
||||
pf++;
|
||||
}
|
||||
else {
|
||||
if ( n + ( string - string_area) >= size_string) {
|
||||
mem_string();
|
||||
pb = string + n;
|
||||
}
|
||||
n++;
|
||||
*pb++ = *pf++;
|
||||
}
|
||||
}
|
||||
return n ;
|
||||
}
|
89
util/ceg/ce_back/obj_back/output.c
Normal file
89
util/ceg/ce_back/obj_back/output.c
Normal file
|
@ -0,0 +1,89 @@
|
|||
#include <system.h>
|
||||
#include <out.h>
|
||||
#include "data.h"
|
||||
|
||||
output()
|
||||
/* Notice : entries in the symbol_table are converted.
|
||||
*/
|
||||
|
||||
{
|
||||
struct outhead header;
|
||||
struct outsect sect;
|
||||
long ntext = text - text_area,
|
||||
ndata = data - data_area,
|
||||
nchar = string - string_area;
|
||||
int nrelo = relo - reloc_info;
|
||||
|
||||
header.oh_magic = O_MAGIC;
|
||||
header.oh_flags = HF_LINK;
|
||||
header.oh_nsect = 4;
|
||||
header.oh_nrelo = nrelo;
|
||||
header.oh_nname = nname;
|
||||
header.oh_nemit = ntext + ndata;
|
||||
header.oh_nchar = nchar;
|
||||
|
||||
wr_ohead( &header);
|
||||
|
||||
sect.os_base = 20;
|
||||
sect.os_size = ntext;
|
||||
sect.os_foff = OFF_EMIT( header);
|
||||
sect.os_flen = ntext;
|
||||
sect.os_lign = 1;
|
||||
|
||||
wr_sect( §, 1);
|
||||
|
||||
sect.os_base = 20 + ntext;
|
||||
sect.os_size = 0;
|
||||
sect.os_foff = OFF_EMIT( header) + ntext;
|
||||
sect.os_flen = 0;
|
||||
sect.os_lign = 1;
|
||||
|
||||
wr_sect( §, 1);
|
||||
|
||||
sect.os_base = 20 + ntext;
|
||||
sect.os_size = ndata;
|
||||
sect.os_foff = OFF_EMIT( header) + ntext;
|
||||
sect.os_flen = ndata;
|
||||
sect.os_lign = 1;
|
||||
|
||||
wr_sect( §, 1);
|
||||
|
||||
sect.os_base = 20 + ntext + ndata;
|
||||
sect.os_size = nbss;
|
||||
sect.os_foff = OFF_EMIT( header) + ntext + ndata;
|
||||
sect.os_flen = 0;
|
||||
sect.os_lign = 1;
|
||||
|
||||
wr_sect( §, 1);
|
||||
|
||||
wr_outsect( 0);
|
||||
wr_emit( text_area, ntext);
|
||||
wr_outsect( 2);
|
||||
wr_emit( data_area, ndata);
|
||||
|
||||
wr_relo( reloc_info, nrelo);
|
||||
|
||||
convert_outname( &header);
|
||||
wr_name( symbol_table, nname);
|
||||
|
||||
wr_string( string_area, nchar);
|
||||
}
|
||||
|
||||
wr_fatal()
|
||||
{
|
||||
fprint( STDERR, "write failed\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
convert_outname( header)
|
||||
struct outhead *header;
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i < nname; i++) {
|
||||
symbol_table[ i].on_foff += OFF_CHAR( *header);
|
||||
}
|
||||
}
|
||||
|
||||
|
29
util/ceg/ce_back/obj_back/reloc1.c
Normal file
29
util/ceg/ce_back/obj_back/reloc1.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include <out.h>
|
||||
#include <em.h>
|
||||
#include "mach.h"
|
||||
#include "back.h"
|
||||
#include "header.h"
|
||||
|
||||
reloc1( sym, off, pcrel)
|
||||
char *sym;
|
||||
arith off;
|
||||
int pcrel;
|
||||
{
|
||||
if ( relo - reloc_info >= size_reloc)
|
||||
mem_relo();
|
||||
|
||||
relo->or_type = RELO1;
|
||||
#ifdef BYTES_REVERSED /* Nog optimaliseren?? */
|
||||
relo->or_type |= RELBR;
|
||||
#endif
|
||||
#ifdef WORDS_REVERSED
|
||||
relo->or_type |= RELWR;
|
||||
#endif
|
||||
relo->or_type |= ( pcrel) ? RELPC : S_UND;
|
||||
relo->or_sect = S_MIN + conv_seg( cur_seg);
|
||||
relo->or_nami = find_sym(sym, REFERENCE);
|
||||
relo->or_addr = cur_value();
|
||||
gen1( (pcrel) ? off - ( cur_value() + 1) : off);
|
||||
|
||||
relo++;
|
||||
}
|
29
util/ceg/ce_back/obj_back/reloc2.c
Normal file
29
util/ceg/ce_back/obj_back/reloc2.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include <out.h>
|
||||
#include <em.h>
|
||||
#include "mach.h"
|
||||
#include "back.h"
|
||||
#include "header.h"
|
||||
|
||||
reloc2( sym, off, pcrel)
|
||||
char *sym;
|
||||
arith off;
|
||||
int pcrel;
|
||||
{
|
||||
if ( relo - reloc_info >= size_reloc)
|
||||
mem_relo();
|
||||
|
||||
relo->or_type = RELO2;
|
||||
#ifdef BYTES_REVERSED /* Nog optimaliseren?? */
|
||||
relo->or_type |= RELBR;
|
||||
#endif
|
||||
#ifdef WORDS_REVERSED
|
||||
relo->or_type |= RELWR;
|
||||
#endif
|
||||
relo->or_type |= ( pcrel) ? RELPC : S_UND;
|
||||
relo->or_sect = S_MIN + conv_seg( cur_seg);
|
||||
relo->or_nami = find_sym(sym, REFERENCE);
|
||||
relo->or_addr = cur_value();
|
||||
gen2( (pcrel) ? off - ( cur_value() + 2) : off);
|
||||
|
||||
relo++;
|
||||
}
|
35
util/ceg/ce_back/obj_back/reloc4.c
Normal file
35
util/ceg/ce_back/obj_back/reloc4.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include <em.h>
|
||||
#include <out.h>
|
||||
#include <system.h>
|
||||
#include "mach.h"
|
||||
#include "back.h"
|
||||
#include "header.h"
|
||||
|
||||
reloc4( sym, off, pcrel)
|
||||
char *sym;
|
||||
arith off;
|
||||
int pcrel;
|
||||
{
|
||||
if ( relo - reloc_info >= size_reloc)
|
||||
mem_relo();
|
||||
|
||||
relo->or_type = RELO4;
|
||||
#ifdef BYTES_REVERSED /* Nog optimaliseren?? */
|
||||
relo->or_type |= RELBR;
|
||||
#endif
|
||||
#ifdef WORDS_REVERSED
|
||||
relo->or_type |= RELWR;
|
||||
#endif
|
||||
relo->or_type |= ( pcrel) ? RELPC : S_UND;
|
||||
relo->or_sect = S_MIN + conv_seg( cur_seg);
|
||||
relo->or_nami = find_sym(sym, REFERENCE);
|
||||
relo->or_addr = cur_value();
|
||||
gen4( (pcrel) ? off - ( cur_value() + 4) : off);
|
||||
|
||||
/* print( "r %s r %ld s %d in %d adrr %ld off %ld\n",
|
||||
sym, pcrel, cur_seg, relo->or_nami, relo->or_addr,
|
||||
(pcrel) ? off-cur_value() : off);
|
||||
*/
|
||||
|
||||
relo++;
|
||||
}
|
91
util/ceg/ce_back/obj_back/relocation.c
Normal file
91
util/ceg/ce_back/obj_back/relocation.c
Normal file
|
@ -0,0 +1,91 @@
|
|||
#include <system.h>
|
||||
#include <out.h>
|
||||
#include "back.h"
|
||||
|
||||
#define seg_index( s) ( nname - SEGBSS - 1 + s)
|
||||
|
||||
long get4();
|
||||
long base_adres();
|
||||
extern short get2();
|
||||
extern char get1();
|
||||
|
||||
|
||||
do_local_relocation()
|
||||
{
|
||||
register struct outrelo *ptr;
|
||||
register int s;
|
||||
|
||||
for ( ptr = reloc_info; ptr < relo; ptr++) {
|
||||
s = ptr->or_nami;
|
||||
if ( symbol_table[ s].on_valu != -1)
|
||||
do_relo(&symbol_table[ s], ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
do_relo(np,rp)
|
||||
struct outname *np;
|
||||
struct outrelo *rp;
|
||||
{
|
||||
long oldval,newval;
|
||||
char *sect;
|
||||
|
||||
switch( rp->or_sect - S_MIN) {
|
||||
case SEGTXT:
|
||||
sect = text_area;
|
||||
break;
|
||||
case SEGCON:
|
||||
sect = data_area;
|
||||
break;
|
||||
default:
|
||||
fprint( STDERR,
|
||||
"do_local_relo(): bad section %d\n",
|
||||
rp->or_sect - S_MIN);
|
||||
break;
|
||||
}
|
||||
|
||||
/* nu reloceren tov het segment waar het symbool in voorkomt! */
|
||||
if ( rp->or_type & RELO4) {
|
||||
oldval = get4( sect, rp->or_addr);
|
||||
newval = oldval + np->on_valu;
|
||||
put4( sect, rp->or_addr, newval);
|
||||
|
||||
rp->or_nami = seg_index(
|
||||
( symbol_table[ rp->or_nami].on_type & S_TYP) - S_MIN);
|
||||
}
|
||||
else if ( rp->or_type & RELO2) {
|
||||
oldval = (long) get2( sect, rp->or_addr);
|
||||
newval = oldval + np->on_valu;
|
||||
put2( sect, rp->or_addr, (int) newval);
|
||||
|
||||
rp->or_nami = seg_index(
|
||||
( symbol_table[ rp->or_nami].on_type & S_TYP) - S_MIN);
|
||||
}
|
||||
else if ( rp->or_type & RELO1) {
|
||||
oldval = (long) get1( sect, rp->or_addr);
|
||||
newval = oldval + np->on_valu;
|
||||
put1( sect, rp->or_addr, (char) newval);
|
||||
|
||||
rp->or_nami = seg_index(
|
||||
( symbol_table[ rp->or_nami].on_type & S_TYP) - S_MIN);
|
||||
}
|
||||
else
|
||||
print( STDERR, "do_relo() : bad relocation size\n");
|
||||
/* print(
|
||||
"reloc %s adrr=%ld sect=%ld oldval=%ld newval=%ld def = %ld\n",
|
||||
np->on_foff+string_area, rp->or_addr, rp->or_sect-S_MIN, oldval, newval, np->on_valu);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
long base_adres( seg)
|
||||
int seg;
|
||||
{
|
||||
switch ( seg) {
|
||||
case SEGTXT : return( 0);
|
||||
case SEGCON : return( text-text_area);
|
||||
case SEGBSS : return( text-text_area + data-data_area);
|
||||
default : fprint( STDERR, "base_adres() wrong seg %d\n", seg);
|
||||
}
|
||||
}
|
16
util/ceg/ce_back/obj_back/rom2.c
Normal file
16
util/ceg/ce_back/obj_back/rom2.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include "mach.h"
|
||||
#include "back.h"
|
||||
|
||||
rom2( w)
|
||||
TWO_BYTES w;
|
||||
{
|
||||
#ifdef BYTES_REVERSED
|
||||
rom1( (char) ( ( unsigned short)w>>8));
|
||||
rom1( (char) w);
|
||||
#else
|
||||
rom1( (char) w);
|
||||
rom1( (char) ( ( unsigned short)w>>8));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
15
util/ceg/ce_back/obj_back/rom4.c
Normal file
15
util/ceg/ce_back/obj_back/rom4.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include "mach.h"
|
||||
|
||||
rom4( l)
|
||||
FOUR_BYTES l;
|
||||
{
|
||||
#ifdef WORDS_REVERSED
|
||||
rom2( (short) ((unsigned long)l>>16));
|
||||
rom2( (short) l);
|
||||
#else
|
||||
rom2( (short) l);
|
||||
rom2( (short) ((unsigned long)l>>16));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
14
util/ceg/ce_back/obj_back/set_global.c
Normal file
14
util/ceg/ce_back/obj_back/set_global.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <out.h>
|
||||
#include "data.h"
|
||||
#include "header.h"
|
||||
|
||||
set_global_visible(sym)
|
||||
char *sym;
|
||||
{
|
||||
int i;
|
||||
|
||||
i = find_sym(sym, REFERENCE);
|
||||
symbol_table[i].on_type |= S_EXT;
|
||||
}
|
||||
|
||||
|
14
util/ceg/ce_back/obj_back/set_local.c
Normal file
14
util/ceg/ce_back/obj_back/set_local.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <out.h>
|
||||
#include "data.h"
|
||||
#include "header.h"
|
||||
|
||||
set_local_visible(sym)
|
||||
char *sym;
|
||||
{
|
||||
int i;
|
||||
|
||||
i = find_sym(sym, REFERENCE);
|
||||
symbol_table[i].on_type &= (~S_EXT);
|
||||
}
|
||||
|
||||
|
14
util/ceg/ce_back/obj_back/switchseg.c
Normal file
14
util/ceg/ce_back/obj_back/switchseg.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "data.h"
|
||||
|
||||
switchseg( seg)
|
||||
int seg;
|
||||
|
||||
/* De EM definitie eist dat pseudoinstructies gealigned worden op
|
||||
* woordgrens.
|
||||
*/
|
||||
{
|
||||
if ( seg == cur_seg)
|
||||
return;
|
||||
cur_seg = seg;
|
||||
align_word();
|
||||
}
|
18
util/ceg/ce_back/obj_back/symboldef.c
Normal file
18
util/ceg/ce_back/obj_back/symboldef.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <out.h>
|
||||
#include <system.h>
|
||||
#include "data.h"
|
||||
#include "back.h"
|
||||
#include "header.h"
|
||||
|
||||
symbol_definition(sym)
|
||||
char *sym;
|
||||
{
|
||||
int i;
|
||||
|
||||
i = find_sym( sym, SYMBOL_DEFINITION);
|
||||
(symbol_table + i)->on_valu = cur_value();
|
||||
(symbol_table + i)->on_type |= (S_MIN + conv_seg( cur_seg));
|
||||
/* print( "s %s in %d seg %d addr %ld\n", sym , i, conv_seg( cur_seg),
|
||||
cur_value()); */
|
||||
}
|
||||
|
99
util/ceg/ce_back/obj_back/symtable.c
Normal file
99
util/ceg/ce_back/obj_back/symtable.c
Normal file
|
@ -0,0 +1,99 @@
|
|||
#include <out.h>
|
||||
#include <system.h>
|
||||
#include "hash.h"
|
||||
#include "header.h"
|
||||
#include "back.h"
|
||||
|
||||
|
||||
int string_lengte = 0,
|
||||
index_symbol_table = -1;
|
||||
|
||||
struct Hashitem *Hashitems ;
|
||||
int Hashtab[ MAXHASH];
|
||||
|
||||
|
||||
int find_sym( sym, isdef)
|
||||
char *sym;
|
||||
int isdef;
|
||||
{
|
||||
register char *p;
|
||||
register struct outname *s;
|
||||
register struct Hashitem *ip;
|
||||
register int h;
|
||||
|
||||
if ( index_symbol_table != -1 ) {
|
||||
s = symbol_table + index_symbol_table;
|
||||
if ( sym == s->on_foff + string_area) {
|
||||
if ( (s->on_valu == -2) && ( isdef == REFERENCE)) {
|
||||
s->on_type = S_EXT;
|
||||
s->on_valu = -1;
|
||||
}
|
||||
return( index_symbol_table);
|
||||
}
|
||||
}
|
||||
|
||||
h = Hash(sym);
|
||||
for ( ip = Hashtab[h] + Hashitems ; ip != Hashitems;
|
||||
ip = (ip->hs_next) + Hashitems) {
|
||||
s = symbol_table + ip->hs_nami;
|
||||
if (strcmp(sym, (s->on_foff) + string_area) == 0) {
|
||||
if ( (s->on_valu == -2) && (isdef == REFERENCE)) {
|
||||
s->on_type = S_EXT;
|
||||
s->on_valu = -1;
|
||||
}
|
||||
return ip->hs_nami;
|
||||
}
|
||||
}
|
||||
|
||||
if ( nname >= size_symbol)
|
||||
mem_symbol_hash();
|
||||
|
||||
s = symbol_table + nname;
|
||||
ip = Hashitems + nname + 1; /* skip the first entry */
|
||||
|
||||
if (isdef == REFERENCE) {
|
||||
s->on_type = S_EXT;
|
||||
s->on_valu = -1;
|
||||
}
|
||||
if (isdef == STORE_STRING) {
|
||||
s->on_type = S_UND;
|
||||
s->on_valu = -2;
|
||||
}
|
||||
|
||||
ip->hs_nami = nname;
|
||||
ip->hs_next = Hashtab[h];
|
||||
Hashtab[h] = ip - Hashitems;
|
||||
|
||||
if ( sym == string)
|
||||
string += string_lengte;
|
||||
else { /* zie C_fil, C_lin, C_lni */
|
||||
string_lengte = 0;
|
||||
for( p=sym; *p != '\0' ; p++) {
|
||||
if ( (string - string_area) >= size_string)
|
||||
mem_string();
|
||||
*string++ = *p;
|
||||
string_lengte++;
|
||||
}
|
||||
}
|
||||
if ( (string - string_area) >= size_string)
|
||||
mem_string();
|
||||
*string++ = '\0';
|
||||
s->on_foff = string - (string_lengte + 1) - string_area;
|
||||
|
||||
return nname++;
|
||||
}
|
||||
|
||||
|
||||
int Hash(sym)
|
||||
char *sym;
|
||||
{
|
||||
register unsigned h;
|
||||
register c;
|
||||
|
||||
h = 0;
|
||||
while (c = *sym++) {
|
||||
h <<= 2;
|
||||
h += c;
|
||||
}
|
||||
return (h % MAXHASH);
|
||||
}
|
15
util/ceg/ce_back/obj_back/text2.c
Normal file
15
util/ceg/ce_back/obj_back/text2.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include "mach.h"
|
||||
#include "back.h"
|
||||
|
||||
text2( w)
|
||||
TWO_BYTES w;
|
||||
{
|
||||
#ifdef BYTES_REVERSED
|
||||
text1( (char) ( ( unsigned short)w>>8));
|
||||
text1( (char) w);
|
||||
#else
|
||||
text1( (char) w);
|
||||
text1( (char) ( ( unsigned short)w>>8));
|
||||
#endif
|
||||
}
|
||||
|
6
util/ceg/defaults/message/C_cst.c
Normal file
6
util/ceg/defaults/message/C_cst.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <em.h>
|
||||
|
||||
C_cst( l)
|
||||
arith l;
|
||||
{
|
||||
}
|
7
util/ceg/defaults/message/C_dlb.c
Normal file
7
util/ceg/defaults/message/C_dlb.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <em.h>
|
||||
|
||||
C_dlb( l, val)
|
||||
label l;
|
||||
char *val;
|
||||
{
|
||||
}
|
7
util/ceg/defaults/message/C_dnam.c
Normal file
7
util/ceg/defaults/message/C_dnam.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <em.h>
|
||||
|
||||
C_dnam( str, val)
|
||||
char *str;
|
||||
arith val;
|
||||
{
|
||||
}
|
7
util/ceg/defaults/message/C_fcon.c
Normal file
7
util/ceg/defaults/message/C_fcon.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <em.h>
|
||||
|
||||
C_fcon( val, siz)
|
||||
char *val;
|
||||
arith siz;
|
||||
{
|
||||
}
|
7
util/ceg/defaults/message/C_icon.c
Normal file
7
util/ceg/defaults/message/C_icon.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <em.h>
|
||||
|
||||
C_icon( val, siz)
|
||||
char *val;
|
||||
arith siz;
|
||||
{
|
||||
}
|
6
util/ceg/defaults/message/C_ilb.c
Normal file
6
util/ceg/defaults/message/C_ilb.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <em.h>
|
||||
|
||||
C_ilb( l)
|
||||
label l;
|
||||
{
|
||||
}
|
6
util/ceg/defaults/message/C_mes_begin.c
Normal file
6
util/ceg/defaults/message/C_mes_begin.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <em.h>
|
||||
|
||||
C_mes_begin( ms)
|
||||
int ms;
|
||||
{
|
||||
}
|
5
util/ceg/defaults/message/C_mes_end.c
Normal file
5
util/ceg/defaults/message/C_mes_end.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include <em.h>
|
||||
|
||||
C_mes_end()
|
||||
{
|
||||
}
|
6
util/ceg/defaults/message/C_pnam.c
Normal file
6
util/ceg/defaults/message/C_pnam.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <em.h>
|
||||
|
||||
C_pnam( str)
|
||||
char *str;
|
||||
{
|
||||
}
|
7
util/ceg/defaults/message/C_scon.c
Normal file
7
util/ceg/defaults/message/C_scon.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <em.h>
|
||||
|
||||
C_scon( str, siz)
|
||||
char *str;
|
||||
arith siz;
|
||||
{
|
||||
}
|
7
util/ceg/defaults/message/C_ucon.c
Normal file
7
util/ceg/defaults/message/C_ucon.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <em.h>
|
||||
|
||||
C_ucon( val, siz)
|
||||
char *val;
|
||||
arith siz;
|
||||
{
|
||||
}
|
7
util/ceg/defaults/not_impl/not_impl.c
Normal file
7
util/ceg/defaults/not_impl/not_impl.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <system.h>
|
||||
|
||||
not_implemented( instr)
|
||||
char *instr;
|
||||
{
|
||||
fprint( STDERR, "!! %s, NOT implemented !!\n", instr);
|
||||
}
|
268
util/ceg/defaults/not_impl/not_impl_table
Normal file
268
util/ceg/defaults/not_impl/not_impl_table
Normal file
|
@ -0,0 +1,268 @@
|
|||
C_loc ::= not_implemented( "C_loc").
|
||||
C_ldc ::= not_implemented( "C_ldc").
|
||||
C_loc ::= not_implemented( "C_loc").
|
||||
C_ldc ::= not_implemented( "C_ldc").
|
||||
C_lol ::= not_implemented( "C_lol").
|
||||
C_loe ::= not_implemented( "C_loe").
|
||||
C_loe_dnam ::= not_implemented( "C_loe_dnam").
|
||||
C_loe_dlb ::= not_implemented( "C_loe_dlb").
|
||||
C_lil ::= not_implemented( "C_lil").
|
||||
C_lof ::= not_implemented( "C_lof").
|
||||
C_lal ::= not_implemented( "C_lal").
|
||||
C_lae ::= not_implemented( "C_lae").
|
||||
C_lae_dnam ::= not_implemented( "C_lae_dnam").
|
||||
C_lae_dlb ::= not_implemented( "C_lae_dlb").
|
||||
C_lxl ::= not_implemented( "C_lxl").
|
||||
C_lxa ::= not_implemented( "C_lxa").
|
||||
C_loi ::= not_implemented( "C_loi").
|
||||
C_los ::= not_implemented( "C_los").
|
||||
C_los_narg ::= not_implemented( "C_los_narg").
|
||||
C_ldl ::= not_implemented( "C_ldl").
|
||||
C_lde ::= not_implemented( "C_lde").
|
||||
C_lde_dnam ::= not_implemented( "C_lde_dnam").
|
||||
C_lde_dlb ::= not_implemented( "C_lde_dlb").
|
||||
C_ldf ::= not_implemented( "C_ldf").
|
||||
C_lpi ::= not_implemented( "C_lpi").
|
||||
C_inn ::= not_implemented( "C_inn").
|
||||
C_inn_narg ::= not_implemented( "C_inn_narg").
|
||||
C_set ::= not_implemented( "C_set").
|
||||
C_set_narg ::= not_implemented( "C_set_narg").
|
||||
C_lar ::= not_implemented( "C_lar").
|
||||
C_lar_narg ::= not_implemented( "C_lar_narg").
|
||||
C_sar ::= not_implemented( "C_sar").
|
||||
C_sar_narg ::= not_implemented( "C_sar_narg").
|
||||
C_aar ::= not_implemented( "C_aar").
|
||||
C_aar_narg ::= not_implemented( "C_aar_narg").
|
||||
C_cmi ::= not_implemented( "C_cmi").
|
||||
C_cmi_narg ::= not_implemented( "C_cmi_narg").
|
||||
C_cmf ::= not_implemented( "C_cmf").
|
||||
C_cmf_narg ::= not_implemented( "C_cmf_narg").
|
||||
C_cmu ::= not_implemented( "C_cmu").
|
||||
C_cmu_narg ::= not_implemented( "C_cmu_narg").
|
||||
C_cms ::= not_implemented( "C_cms").
|
||||
C_cms_narg ::= not_implemented( "C_cms_narg").
|
||||
C_cmp ::= not_implemented( "C_cmp").
|
||||
C_tlt ::= not_implemented( "C_tlt").
|
||||
C_tle ::= not_implemented( "C_tle").
|
||||
C_teq ::= not_implemented( "C_teq").
|
||||
C_tne ::= not_implemented( "C_tne").
|
||||
C_tge ::= not_implemented( "C_tge").
|
||||
C_tgt ::= not_implemented( "C_tgt").
|
||||
C_bra ::= not_implemented( "C_bra").
|
||||
C_blt ::= not_implemented( "C_blt").
|
||||
C_ble ::= not_implemented( "C_ble").
|
||||
C_beq ::= not_implemented( "C_beq").
|
||||
C_bne ::= not_implemented( "C_bne").
|
||||
C_bge ::= not_implemented( "C_bge").
|
||||
C_bgt ::= not_implemented( "C_bgt").
|
||||
C_zlt ::= not_implemented( "C_zlt").
|
||||
C_zle ::= not_implemented( "C_zle").
|
||||
C_zeq ::= not_implemented( "C_zeq").
|
||||
C_zne ::= not_implemented( "C_zne").
|
||||
C_zge ::= not_implemented( "C_zge").
|
||||
C_zgt ::= not_implemented( "C_zgt").
|
||||
C_cai ::= not_implemented( "C_cai").
|
||||
C_cal ::= not_implemented( "C_cal").
|
||||
C_lfr ::= not_implemented( "C_lfr").
|
||||
C_ret ::= not_implemented( "C_ret").
|
||||
C_asp ::= not_implemented( "C_asp").
|
||||
C_ass ::= not_implemented( "C_ass").
|
||||
C_ass_narg ::= not_implemented( "C_ass_narg").
|
||||
C_blm ::= not_implemented( "C_blm").
|
||||
C_bls ::= not_implemented( "C_bls").
|
||||
C_bls_narg ::= not_implemented( "C_bls_narg").
|
||||
C_csa ::= not_implemented( "C_csa").
|
||||
C_csa_narg ::= not_implemented( "C_csa_narg").
|
||||
C_csb ::= not_implemented( "C_csb").
|
||||
C_csb_narg ::= not_implemented( "C_csb_narg").
|
||||
C_dch ::= not_implemented( "C_dch").
|
||||
C_dup ::= not_implemented( "C_dup").
|
||||
C_dus ::= not_implemented( "C_dus").
|
||||
C_dus_narg ::= not_implemented( "C_dus_narg").
|
||||
C_exg ::= not_implemented( "C_exg").
|
||||
C_exg_narg ::= not_implemented( "C_exg_narg").
|
||||
C_fil ::= not_implemented( "C_fil").
|
||||
C_fil_dnam ::= not_implemented( "C_fil_dnam").
|
||||
C_fil_dlb ::= not_implemented( "C_fil_dlb").
|
||||
C_gto ::= not_implemented( "C_gto").
|
||||
C_gto_dnam ::= not_implemented( "C_gto_dnam").
|
||||
C_gto_dlb ::= not_implemented( "C_gto_dlb").
|
||||
C_lim ::= not_implemented( "C_lim").
|
||||
C_lin ::= not_implemented( "C_lin").
|
||||
C_lni ::= not_implemented( "C_lni").
|
||||
C_lor ::= not_implemented( "C_lor").
|
||||
C_lpb ::= not_implemented( "C_lpb").
|
||||
C_mon ::= not_implemented( "C_mon").
|
||||
C_nop ::= not_implemented( "C_nop").
|
||||
C_rck ::= not_implemented( "C_rck").
|
||||
C_rck_narg ::= not_implemented( "C_rck_narg").
|
||||
C_rtt ::= not_implemented( "C_rtt").
|
||||
C_sig ::= not_implemented( "C_sig").
|
||||
C_sim ::= not_implemented( "C_sim").
|
||||
C_str ::= not_implemented( "C_str").
|
||||
C_trp ::= not_implemented( "C_trp").
|
||||
C_stl ::= not_implemented( "C_stl").
|
||||
C_ste ::= not_implemented( "C_ste").
|
||||
C_ste_dnam ::= not_implemented( "C_ste_dnam").
|
||||
C_ste_dlb ::= not_implemented( "C_ste_dlb").
|
||||
C_sil ::= not_implemented( "C_sil").
|
||||
C_stf ::= not_implemented( "C_stf").
|
||||
C_sti ::= not_implemented( "C_sti").
|
||||
C_sts ::= not_implemented( "C_sts").
|
||||
C_sts_narg ::= not_implemented( "C_sts_narg").
|
||||
C_sdl ::= not_implemented( "C_sdl").
|
||||
C_sde ::= not_implemented( "C_sde").
|
||||
C_sde_dnam ::= not_implemented( "C_sde_dnam").
|
||||
C_sde_dlb ::= not_implemented( "C_sde_dlb").
|
||||
C_sdf ::= not_implemented( "C_sdf").
|
||||
C_adi ::= not_implemented( "C_adi").
|
||||
C_adi_narg ::= not_implemented( "C_adi_narg").
|
||||
C_sbi ::= not_implemented( "C_sbi").
|
||||
C_sbi_narg ::= not_implemented( "C_sbi_narg").
|
||||
C_mli ::= not_implemented( "C_mli").
|
||||
C_mli_narg ::= not_implemented( "C_mli_narg").
|
||||
C_dvi ::= not_implemented( "C_dvi").
|
||||
C_dvi_narg ::= not_implemented( "C_dvi_narg").
|
||||
C_rmi ::= not_implemented( "C_rmi").
|
||||
C_rmi_narg ::= not_implemented( "C_rmi_narg").
|
||||
C_ngi ::= not_implemented( "C_ngi").
|
||||
C_ngi_narg ::= not_implemented( "C_ngi_narg").
|
||||
C_sli ::= not_implemented( "C_sli").
|
||||
C_sli_narg ::= not_implemented( "C_sli_narg").
|
||||
C_sri ::= not_implemented( "C_sri").
|
||||
C_sri_narg ::= not_implemented( "C_sri_narg").
|
||||
C_adu ::= not_implemented( "C_adu").
|
||||
C_adu_narg ::= not_implemented( "C_adu_narg").
|
||||
C_sbu ::= not_implemented( "C_sbu").
|
||||
C_sbu_narg ::= not_implemented( "C_sbu_narg").
|
||||
C_mlu ::= not_implemented( "C_mlu").
|
||||
C_mlu_narg ::= not_implemented( "C_mlu_narg").
|
||||
C_dvu ::= not_implemented( "C_dvu").
|
||||
C_dvu_narg ::= not_implemented( "C_dvu_narg").
|
||||
C_rmu ::= not_implemented( "C_rmu").
|
||||
C_rmu_narg ::= not_implemented( "C_rmu_narg").
|
||||
C_slu ::= not_implemented( "C_slu").
|
||||
C_slu_narg ::= not_implemented( "C_slu_narg").
|
||||
C_sru ::= not_implemented( "C_sru").
|
||||
C_sru_narg ::= not_implemented( "C_sru_narg").
|
||||
C_adf ::= not_implemented( "C_adf").
|
||||
C_adf_narg ::= not_implemented( "C_adf_narg").
|
||||
C_sbf ::= not_implemented( "C_sbf").
|
||||
C_sbf_narg ::= not_implemented( "C_sbf_narg").
|
||||
C_mlf ::= not_implemented( "C_mlf").
|
||||
C_mlf_narg ::= not_implemented( "C_mlf_narg").
|
||||
C_dvf ::= not_implemented( "C_dvf").
|
||||
C_dvf_narg ::= not_implemented( "C_dvf_narg").
|
||||
C_ngf ::= not_implemented( "C_ngf").
|
||||
C_ngf_narg ::= not_implemented( "C_ngf_narg").
|
||||
C_fif ::= not_implemented( "C_fif").
|
||||
C_fif_narg ::= not_implemented( "C_fif_narg").
|
||||
C_fef ::= not_implemented( "C_fef").
|
||||
C_fef_narg ::= not_implemented( "C_fef_narg").
|
||||
C_adp ::= not_implemented( "C_adp").
|
||||
C_ads ::= not_implemented( "C_ads").
|
||||
C_ads_narg ::= not_implemented( "C_ads_narg").
|
||||
C_sbs ::= not_implemented( "C_sbs").
|
||||
C_sbs_narg ::= not_implemented( "C_sbs_narg").
|
||||
C_inc ::= not_implemented( "C_inc").
|
||||
C_inl ::= not_implemented( "C_inl").
|
||||
C_ine ::= not_implemented( "C_ine").
|
||||
C_ine_dnam ::= not_implemented( "C_ine_dnam").
|
||||
C_ine_dlb ::= not_implemented( "C_ine_dlb").
|
||||
C_dec ::= not_implemented( "C_dec").
|
||||
C_del ::= not_implemented( "C_del").
|
||||
C_dee ::= not_implemented( "C_dee").
|
||||
C_dee_dnam ::= not_implemented( "C_dee_dnam").
|
||||
C_dee_dlb ::= not_implemented( "C_dee_dlb").
|
||||
C_zrl ::= not_implemented( "C_zrl").
|
||||
C_zre ::= not_implemented( "C_zre").
|
||||
C_zre_dnam ::= not_implemented( "C_zre_dnam").
|
||||
C_zre_dlb ::= not_implemented( "C_zre_dlb").
|
||||
C_zrf ::= not_implemented( "C_zrf").
|
||||
C_zrf_narg ::= not_implemented( "C_zrf_narg").
|
||||
C_zer ::= not_implemented( "C_zer").
|
||||
C_zer_narg ::= not_implemented( "C_zer_narg").
|
||||
C_cii ::= not_implemented( "C_cii").
|
||||
C_cui ::= not_implemented( "C_cui").
|
||||
C_cfi ::= not_implemented( "C_cfi").
|
||||
C_cif ::= not_implemented( "C_cif").
|
||||
C_cuf ::= not_implemented( "C_cuf").
|
||||
C_cff ::= not_implemented( "C_cff").
|
||||
C_ciu ::= not_implemented( "C_ciu").
|
||||
C_cuu ::= not_implemented( "C_cuu").
|
||||
C_cfu ::= not_implemented( "C_cfu").
|
||||
C_and ::= not_implemented( "C_and").
|
||||
C_and_narg ::= not_implemented( "C_and_narg").
|
||||
C_ior ::= not_implemented( "C_ior").
|
||||
C_ior_narg ::= not_implemented( "C_ior_narg").
|
||||
C_xor ::= not_implemented( "C_xor").
|
||||
C_xor_narg ::= not_implemented( "C_xor_narg").
|
||||
C_com ::= not_implemented( "C_com").
|
||||
C_com_narg ::= not_implemented( "C_com_narg").
|
||||
C_rol ::= not_implemented( "C_rol").
|
||||
C_rol_narg ::= not_implemented( "C_rol_narg").
|
||||
C_ror ::= not_implemented( "C_ror").
|
||||
C_ror_narg ::= not_implemented( "C_ror_narg").
|
||||
C_init ::= not_implemented( "C_init").
|
||||
C_open ::= not_implemented( "C_open").
|
||||
C_close ::= not_implemented( "C_close").
|
||||
C_magic ::= not_implemented( "C_magic").
|
||||
C_df_dlb ::= not_implemented( "C_df_dlb").
|
||||
C_df_dnam ::= not_implemented( "C_df_dnam").
|
||||
C_df_ilb ::= not_implemented( "C_df_ilb").
|
||||
C_pro ::= not_implemented( "C_pro").
|
||||
C_pro_narg ::= not_implemented( "C_pro_narg").
|
||||
C_end ::= not_implemented( "C_end").
|
||||
C_end_narg ::= not_implemented( "C_end_narg").
|
||||
C_exa_dlb ::= not_implemented( "C_exa_dlb").
|
||||
C_exa_dnam ::= not_implemented( "C_exa_dnam").
|
||||
C_exp ::= not_implemented( "C_exp").
|
||||
C_ina_dlb ::= not_implemented( "C_ina_dlb").
|
||||
C_ina_dnam ::= not_implemented( "C_ina_dnam").
|
||||
C_inp ::= not_implemented( "C_inp").
|
||||
C_con_cst ::= not_implemented( "C_con_cst").
|
||||
C_con_icon ::= not_implemented( "C_con_icon").
|
||||
C_con_ucon ::= not_implemented( "C_con_ucon").
|
||||
C_con_fcon ::= not_implemented( "C_con_fcon").
|
||||
C_con_scon ::= not_implemented( "C_con_scon").
|
||||
C_con_dnam ::= not_implemented( "C_con_dnam").
|
||||
C_con_dlb ::= not_implemented( "C_con_dlb").
|
||||
C_con_ilb ::= not_implemented( "C_con_ilb").
|
||||
C_con_pnam ::= not_implemented( "C_con_pnam").
|
||||
C_rom_cst ::= not_implemented( "C_rom_cst").
|
||||
C_rom_icon ::= not_implemented( "C_rom_icon").
|
||||
C_rom_ucon ::= not_implemented( "C_rom_ucon").
|
||||
C_rom_fcon ::= not_implemented( "C_rom_fcon").
|
||||
C_rom_scon ::= not_implemented( "C_rom_scon").
|
||||
C_rom_dnam ::= not_implemented( "C_rom_dnam").
|
||||
C_rom_dlb ::= not_implemented( "C_rom_dlb").
|
||||
C_rom_ilb ::= not_implemented( "C_rom_ilb").
|
||||
C_rom_pnam ::= not_implemented( "C_rom_pnam").
|
||||
C_bss_cst ::= not_implemented( "C_bss_cst").
|
||||
C_bss_icon ::= not_implemented( "C_bss_icon").
|
||||
C_bss_ucon ::= not_implemented( "C_bss_ucon").
|
||||
C_bss_fcon ::= not_implemented( "C_bss_fcon").
|
||||
C_bss_dnam ::= not_implemented( "C_bss_dnam").
|
||||
C_bss_dlb ::= not_implemented( "C_bss_dlb").
|
||||
C_bss_ilb ::= not_implemented( "C_bss_ilb").
|
||||
C_bss_pnam ::= not_implemented( "C_bss_pnam").
|
||||
C_hol_cst ::= not_implemented( "C_hol_cst").
|
||||
C_hol_icon ::= not_implemented( "C_hol_icon").
|
||||
C_hol_ucon ::= not_implemented( "C_hol_ucon").
|
||||
C_hol_fcon ::= not_implemented( "C_hol_fcon").
|
||||
C_hol_dnam ::= not_implemented( "C_hol_dnam").
|
||||
C_hol_dlb ::= not_implemented( "C_hol_dlb").
|
||||
C_hol_ilb ::= not_implemented( "C_hol_ilb").
|
||||
C_hol_pnam ::= not_implemented( "C_hol_pnam").
|
||||
C_cst ::= not_implemented( "C_cst").
|
||||
C_icon ::= not_implemented( "C_icon").
|
||||
C_ucon ::= not_implemented( "C_ucon").
|
||||
C_fcon ::= not_implemented( "C_fcon").
|
||||
C_scon ::= not_implemented( "C_scon").
|
||||
C_dnam ::= not_implemented( "C_dnam").
|
||||
C_dlb ::= not_implemented( "C_dlb").
|
||||
C_ilb ::= not_implemented( "C_ilb").
|
||||
C_pnam ::= not_implemented( "C_pnam").
|
||||
C_mes_begin ::= not_implemented( "C_mes_begin").
|
||||
C_mes_end ::= not_implemented( "C_mes_end").
|
||||
C_exc ::= not_implemented( "C_exc").
|
6
util/ceg/defaults/pseudo/C_busy.c
Normal file
6
util/ceg/defaults/pseudo/C_busy.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
extern int busy;
|
||||
|
||||
int C_busy()
|
||||
{
|
||||
return( busy);
|
||||
}
|
12
util/ceg/defaults/pseudo/C_close.c
Normal file
12
util/ceg/defaults/pseudo/C_close.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include <assert.h>
|
||||
|
||||
extern int busy;
|
||||
|
||||
C_close()
|
||||
{
|
||||
assert( busy);
|
||||
|
||||
end_back();
|
||||
do_close();
|
||||
busy = 0;
|
||||
}
|
13
util/ceg/defaults/pseudo/C_df_dlb.c
Normal file
13
util/ceg/defaults/pseudo/C_df_dlb.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
C_df_dlb( l)
|
||||
label l;
|
||||
|
||||
/* Bij welk data-segment hoort dit label thuis? ROM, CON, HOL, BSS ???
|
||||
* Oplossing : Bewaar het label totdat de eerstvolgende data-instructie aange-
|
||||
* roepen wordt, op dat moment het label genereren!!
|
||||
*/
|
||||
{
|
||||
save_label( extnd_dlb( l));
|
||||
}
|
8
util/ceg/defaults/pseudo/C_df_dnam.c
Normal file
8
util/ceg/defaults/pseudo/C_df_dnam.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
C_df_dnam( s)
|
||||
char *s;
|
||||
{
|
||||
save_label( extnd_name( s));
|
||||
}
|
9
util/ceg/defaults/pseudo/C_df_ilb.c
Normal file
9
util/ceg/defaults/pseudo/C_df_ilb.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
C_df_ilb( l)
|
||||
label l;
|
||||
{
|
||||
symbol_definition( extnd_ilb( l));
|
||||
set_local_visible( extnd_ilb( l));
|
||||
}
|
21
util/ceg/defaults/pseudo/C_end.c
Normal file
21
util/ceg/defaults/pseudo/C_end.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
extern int locals_created;
|
||||
|
||||
C_end( l)
|
||||
arith l;
|
||||
{
|
||||
char *p;
|
||||
|
||||
swtxt();
|
||||
|
||||
if ( !locals_created) {
|
||||
p = extnd_pro( procno);
|
||||
|
||||
symbol_definition( p);
|
||||
set_local_visible( p);
|
||||
locals( l);
|
||||
jump( extnd_start( procno));
|
||||
}
|
||||
}
|
8
util/ceg/defaults/pseudo/C_end_narg.c
Normal file
8
util/ceg/defaults/pseudo/C_end_narg.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include <assert.h>
|
||||
|
||||
extern int locals_created;
|
||||
|
||||
C_end_narg()
|
||||
{
|
||||
assert( locals_created);
|
||||
}
|
8
util/ceg/defaults/pseudo/C_exa_dlb.c
Normal file
8
util/ceg/defaults/pseudo/C_exa_dlb.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
C_exa_dlb( l)
|
||||
label l;
|
||||
{
|
||||
set_global_visible( extnd_dlb( l));
|
||||
}
|
8
util/ceg/defaults/pseudo/C_exa_dnam.c
Normal file
8
util/ceg/defaults/pseudo/C_exa_dnam.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
C_exa_dnam( s)
|
||||
char *s;
|
||||
{
|
||||
set_global_visible( extnd_dnam( s));
|
||||
}
|
8
util/ceg/defaults/pseudo/C_exp.c
Normal file
8
util/ceg/defaults/pseudo/C_exp.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
C_exp( s)
|
||||
char *s;
|
||||
{
|
||||
set_global_visible( extnd_name( s));
|
||||
}
|
8
util/ceg/defaults/pseudo/C_ina_dlb.c
Normal file
8
util/ceg/defaults/pseudo/C_ina_dlb.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
C_ina_dlb( l)
|
||||
label l;
|
||||
{
|
||||
set_local_visible( extnd_dlb( l));
|
||||
}
|
8
util/ceg/defaults/pseudo/C_ina_dnam.c
Normal file
8
util/ceg/defaults/pseudo/C_ina_dnam.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
C_ina_dnam( s)
|
||||
char *s;
|
||||
{
|
||||
set_local_visible( extnd_name( s));
|
||||
}
|
18
util/ceg/defaults/pseudo/C_init.c
Normal file
18
util/ceg/defaults/pseudo/C_init.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <em.h>
|
||||
#include <system.h>
|
||||
#include "mach.h"
|
||||
|
||||
C_init( wsize, psize)
|
||||
arith wsize, psize;
|
||||
{
|
||||
if ( wsize != EM_WSIZE) {
|
||||
fprint( STDERR, "wrong word size\n");
|
||||
exit( -1);
|
||||
}
|
||||
if ( psize != EM_PSIZE) {
|
||||
fprint( STDERR, "wrong pointer size\n");
|
||||
exit( -1);
|
||||
}
|
||||
|
||||
init_back();
|
||||
}
|
8
util/ceg/defaults/pseudo/C_inp.c
Normal file
8
util/ceg/defaults/pseudo/C_inp.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
C_inp( s)
|
||||
char *s;
|
||||
{
|
||||
set_local_visible( extnd_name( s));
|
||||
}
|
3
util/ceg/defaults/pseudo/C_magic.c
Normal file
3
util/ceg/defaults/pseudo/C_magic.c
Normal file
|
@ -0,0 +1,3 @@
|
|||
C_magic()
|
||||
{
|
||||
}
|
17
util/ceg/defaults/pseudo/C_open.c
Normal file
17
util/ceg/defaults/pseudo/C_open.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include <assert.h>
|
||||
#include <system.h>
|
||||
|
||||
extern int busy;
|
||||
|
||||
int C_open( filename)
|
||||
char *filename;
|
||||
{
|
||||
assert( !busy);
|
||||
|
||||
if ( !do_open( filename)) {
|
||||
fprint( STDERR, "Couldn't open %s\n", filename);
|
||||
return( 0)
|
||||
}
|
||||
else
|
||||
return( 1);
|
||||
}
|
17
util/ceg/defaults/pseudo/C_pro.c
Normal file
17
util/ceg/defaults/pseudo/C_pro.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
extern int locals_created;
|
||||
|
||||
C_pro( s, l)
|
||||
char *s;
|
||||
arith l;
|
||||
{
|
||||
swtxt();
|
||||
|
||||
symbol_definition( extnd_name( s));
|
||||
procno++;
|
||||
prolog();
|
||||
locals(l);
|
||||
locals_created = 1;
|
||||
}
|
24
util/ceg/defaults/pseudo/C_pro_narg.c
Normal file
24
util/ceg/defaults/pseudo/C_pro_narg.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
extern int locals_created;
|
||||
|
||||
C_pro_narg( s)
|
||||
char*s;
|
||||
|
||||
/* Het aantal locale variabelen is nog niet bekend, maar het stack-frame moet
|
||||
* nu wel gemaakt worden! Oplossing : Pas bij bij C_end() is het aantal locale
|
||||
* variabelen bekend dus nu een "jump" genereren en bij C_end() prolog() aan-
|
||||
* roepen en daarna terug-jump-en naar het begin van de EM-procedure.
|
||||
*/
|
||||
{
|
||||
swtxt();
|
||||
|
||||
symbol_definition( extnd_name( s));
|
||||
procno++;
|
||||
prolog();
|
||||
locals_created = 0;
|
||||
jump( extnd_pro( procno));
|
||||
symbol_definition( extnd_start( procno));
|
||||
set_local_visible( extnd_start( procno));
|
||||
}
|
1
util/ceg/defaults/pseudo_vars.c
Normal file
1
util/ceg/defaults/pseudo_vars.c
Normal file
|
@ -0,0 +1 @@
|
|||
int locals_created = 0, busy = 0;
|
48
util/ceg/defaults/storage/C_bss_cst.c
Normal file
48
util/ceg/defaults/storage/C_bss_cst.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
#include <em.h>
|
||||
#include "mach.h"
|
||||
#include "back.h"
|
||||
|
||||
#if EM_WSIZE == 1
|
||||
#define conEM_WSIZE con1
|
||||
#define romEM_WSIZE rom1
|
||||
#define CAST_WSIZE ONE_BYTE
|
||||
#endif
|
||||
#if EM_WSIZE == 2
|
||||
#define conEM_WSIZE con2
|
||||
#define romEM_WSIZE rom2
|
||||
#define CAST_WSIZE TWO_BYTES
|
||||
#endif
|
||||
#if EM_WSIZE == 4
|
||||
#define conEM_WSIZE con4
|
||||
#define romEM_WSIZE rom4
|
||||
#define CAST_WSIZE FOUR_BYTES
|
||||
#endif
|
||||
|
||||
#if EM_PSIZE == 1
|
||||
#define relocEM_PSIZE reloc1
|
||||
#endif
|
||||
#if EM_PSIZE == 2
|
||||
#define relocEM_PSIZE reloc2
|
||||
#endif
|
||||
#if EM_PSIZE == 4
|
||||
#define relocEM_PSIZE reloc4
|
||||
#endif
|
||||
|
||||
C_bss_cst( n, w, i)
|
||||
arith n, w;
|
||||
int i;
|
||||
{
|
||||
if ( i == 0 || w == BSS_INIT) {
|
||||
switchseg( SEGBSS);
|
||||
dump_label();
|
||||
|
||||
bss( n);
|
||||
}
|
||||
else {
|
||||
switchseg( SEGCON);
|
||||
dump_label();
|
||||
|
||||
for ( i = 0; i < n/EM_WSIZE; i++)
|
||||
conEM_WSIZE( (CAST_WSIZE) w);
|
||||
}
|
||||
}
|
49
util/ceg/defaults/storage/C_bss_dlb.c
Normal file
49
util/ceg/defaults/storage/C_bss_dlb.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
#include <em.h>
|
||||
#include "mach.h"
|
||||
#include "back.h"
|
||||
|
||||
#if EM_WSIZE == 1
|
||||
#define conEM_WSIZE con1
|
||||
#define romEM_WSIZE rom1
|
||||
#define CAST_WSIZE ONE_BYTE
|
||||
#endif
|
||||
#if EM_WSIZE == 2
|
||||
#define conEM_WSIZE con2
|
||||
#define romEM_WSIZE rom2
|
||||
#define CAST_WSIZE TWO_BYTES
|
||||
#endif
|
||||
#if EM_WSIZE == 4
|
||||
#define conEM_WSIZE con4
|
||||
#define romEM_WSIZE rom4
|
||||
#define CAST_WSIZE FOUR_BYTES
|
||||
#endif
|
||||
|
||||
#if EM_PSIZE == 1
|
||||
#define relocEM_PSIZE reloc1
|
||||
#endif
|
||||
#if EM_PSIZE == 2
|
||||
#define relocEM_PSIZE reloc2
|
||||
#endif
|
||||
#if EM_PSIZE == 4
|
||||
#define relocEM_PSIZE reloc4
|
||||
#endif
|
||||
|
||||
C_bss_dlb( n, l, offs, i)
|
||||
arith n, offs;
|
||||
label l;
|
||||
int i;
|
||||
{
|
||||
if ( i == 0) {
|
||||
switchseg( SEGBSS);
|
||||
dump_label();
|
||||
|
||||
bss( n);
|
||||
}
|
||||
else {
|
||||
switchseg( SEGCON);
|
||||
dump_label();
|
||||
|
||||
for ( i = 0; i < n/EM_PSIZE; i++)
|
||||
relocEM_PSIZE( extnd_dlb( l), offs, ABSOLUTE);
|
||||
}
|
||||
}
|
49
util/ceg/defaults/storage/C_bss_dnam.c
Normal file
49
util/ceg/defaults/storage/C_bss_dnam.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
#include <em.h>
|
||||
#include "mach.h"
|
||||
#include "back.h"
|
||||
|
||||
#if EM_WSIZE == 1
|
||||
#define conEM_WSIZE con1
|
||||
#define romEM_WSIZE rom1
|
||||
#define CAST_WSIZE ONE_BYTE
|
||||
#endif
|
||||
#if EM_WSIZE == 2
|
||||
#define conEM_WSIZE con2
|
||||
#define romEM_WSIZE rom2
|
||||
#define CAST_WSIZE TWO_BYTES
|
||||
#endif
|
||||
#if EM_WSIZE == 4
|
||||
#define conEM_WSIZE con4
|
||||
#define romEM_WSIZE rom4
|
||||
#define CAST_WSIZE FOUR_BYTES
|
||||
#endif
|
||||
|
||||
#if EM_PSIZE == 1
|
||||
#define relocEM_PSIZE reloc1
|
||||
#endif
|
||||
#if EM_PSIZE == 2
|
||||
#define relocEM_PSIZE reloc2
|
||||
#endif
|
||||
#if EM_PSIZE == 4
|
||||
#define relocEM_PSIZE reloc4
|
||||
#endif
|
||||
|
||||
C_bss_dnam( n, s, offs, i)
|
||||
arith n, offs;
|
||||
char *s;
|
||||
int i;
|
||||
{
|
||||
if ( i == 0) {
|
||||
switchseg( SEGBSS);
|
||||
dump_label();
|
||||
|
||||
bss( n);
|
||||
}
|
||||
else {
|
||||
switchseg( SEGCON);
|
||||
dump_label();
|
||||
|
||||
for ( i = 0; i < n/EM_PSIZE; i++)
|
||||
relocEM_PSIZE( extnd_dnam( s), offs, ABSOLUTE);
|
||||
}
|
||||
}
|
49
util/ceg/defaults/storage/C_bss_ilb.c
Normal file
49
util/ceg/defaults/storage/C_bss_ilb.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
#include <em.h>
|
||||
#include "mach.h"
|
||||
#include "back.h"
|
||||
|
||||
#if EM_WSIZE == 1
|
||||
#define conEM_WSIZE con1
|
||||
#define romEM_WSIZE rom1
|
||||
#define CAST_WSIZE ONE_BYTE
|
||||
#endif
|
||||
#if EM_WSIZE == 2
|
||||
#define conEM_WSIZE con2
|
||||
#define romEM_WSIZE rom2
|
||||
#define CAST_WSIZE TWO_BYTES
|
||||
#endif
|
||||
#if EM_WSIZE == 4
|
||||
#define conEM_WSIZE con4
|
||||
#define romEM_WSIZE rom4
|
||||
#define CAST_WSIZE FOUR_BYTES
|
||||
#endif
|
||||
|
||||
#if EM_PSIZE == 1
|
||||
#define relocEM_PSIZE reloc1
|
||||
#endif
|
||||
#if EM_PSIZE == 2
|
||||
#define relocEM_PSIZE reloc2
|
||||
#endif
|
||||
#if EM_PSIZE == 4
|
||||
#define relocEM_PSIZE reloc4
|
||||
#endif
|
||||
|
||||
C_bss_ilb( n, l, i)
|
||||
arith n;
|
||||
label l;
|
||||
int i;
|
||||
{
|
||||
if ( i == 0) {
|
||||
switchseg( SEGBSS);
|
||||
dump_label();
|
||||
|
||||
bss( n);
|
||||
}
|
||||
else {
|
||||
switchseg( SEGCON);
|
||||
dump_label();
|
||||
|
||||
for ( i = 0; i < n/EM_PSIZE; i++)
|
||||
relocEM_PSIZE( extnd_ilb( l), 0, ABSOLUTE);
|
||||
}
|
||||
}
|
49
util/ceg/defaults/storage/C_bss_pnam.c
Normal file
49
util/ceg/defaults/storage/C_bss_pnam.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
#include <em.h>
|
||||
#include "mach.h"
|
||||
#include "back.h"
|
||||
|
||||
#if EM_WSIZE == 1
|
||||
#define conEM_WSIZE con1
|
||||
#define romEM_WSIZE rom1
|
||||
#define CAST_WSIZE ONE_BYTE
|
||||
#endif
|
||||
#if EM_WSIZE == 2
|
||||
#define conEM_WSIZE con2
|
||||
#define romEM_WSIZE rom2
|
||||
#define CAST_WSIZE TWO_BYTES
|
||||
#endif
|
||||
#if EM_WSIZE == 4
|
||||
#define conEM_WSIZE con4
|
||||
#define romEM_WSIZE rom4
|
||||
#define CAST_WSIZE FOUR_BYTES
|
||||
#endif
|
||||
|
||||
#if EM_PSIZE == 1
|
||||
#define relocEM_PSIZE reloc1
|
||||
#endif
|
||||
#if EM_PSIZE == 2
|
||||
#define relocEM_PSIZE reloc2
|
||||
#endif
|
||||
#if EM_PSIZE == 4
|
||||
#define relocEM_PSIZE reloc4
|
||||
#endif
|
||||
|
||||
C_bss_pnam( n, s, i)
|
||||
arith n;
|
||||
char *s;
|
||||
int i;
|
||||
{
|
||||
if ( i == 0) {
|
||||
switchseg( SEGBSS);
|
||||
dump_label();
|
||||
|
||||
bss( n);
|
||||
}
|
||||
else {
|
||||
switchseg( SEGCON);
|
||||
dump_label();
|
||||
|
||||
for ( i = 0; i < n/EM_PSIZE; i++)
|
||||
relocEM_PSIZE( extnd_name( s), 0, ABSOLUTE);
|
||||
}
|
||||
}
|
39
util/ceg/defaults/storage/C_con_cst.c
Normal file
39
util/ceg/defaults/storage/C_con_cst.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include <em.h>
|
||||
#include "mach.h"
|
||||
#include "back.h"
|
||||
|
||||
#if EM_WSIZE == 1
|
||||
#define conEM_WSIZE con1
|
||||
#define romEM_WSIZE rom1
|
||||
#define CAST_WSIZE ONE_BYTE
|
||||
#endif
|
||||
#if EM_WSIZE == 2
|
||||
#define conEM_WSIZE con2
|
||||
#define romEM_WSIZE rom2
|
||||
#define CAST_WSIZE TWO_BYTES
|
||||
#endif
|
||||
#if EM_WSIZE == 4
|
||||
#define conEM_WSIZE con4
|
||||
#define romEM_WSIZE rom4
|
||||
#define CAST_WSIZE FOUR_BYTES
|
||||
#endif
|
||||
|
||||
#if EM_PSIZE == 1
|
||||
#define relocEM_PSIZE reloc1
|
||||
#endif
|
||||
#if EM_PSIZE == 2
|
||||
#define relocEM_PSIZE reloc2
|
||||
#endif
|
||||
#if EM_PSIZE == 4
|
||||
#define relocEM_PSIZE reloc4
|
||||
#endif
|
||||
|
||||
|
||||
C_con_cst( c)
|
||||
arith c;
|
||||
{
|
||||
switchseg( SEGCON);
|
||||
dump_label();
|
||||
|
||||
conEM_WSIZE( (CAST_WSIZE) c);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue