Merge pull request #70 from davidgiven/dtrg-pdp11
Make the PDP/11 code generator work.
This commit is contained in:
		
						commit
						1984f062f1
					
				
					 135 changed files with 522 additions and 494 deletions
				
			
		
							
								
								
									
										3
									
								
								README
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								README
									
										
									
									
									
								
							|  | @ -2,7 +2,7 @@ | |||
|                      =================================== | ||||
| 
 | ||||
|                   © 1987-2005 Vrije Universiteit, Amsterdam | ||||
|                                 2017-01-07 | ||||
|                                 2018-02-23 | ||||
| 
 | ||||
| 
 | ||||
| INTRODUCTION | ||||
|  | @ -35,6 +35,7 @@ linux68k      produces ELF executables for m68020 Linux systems | |||
| linuxppc      produces ELF executables for PowerPC Linux systems | ||||
| cpm           produces i80 CP/M .COM files | ||||
| rpi           produces Raspberry Pi GPU binaries | ||||
| pdpv7         produces PDP/11 V7 Unix binaries | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -14,6 +14,7 @@ vars.plats = { | |||
| 	--"qemuppc", | ||||
| 	"pc86", | ||||
| 	"rpi", | ||||
| 	"pdpv7", | ||||
| } | ||||
| vars.plats_with_tests = { | ||||
| 	"linux386", | ||||
|  |  | |||
|  | @ -1,71 +0,0 @@ | |||
| # $Revision$ | ||||
| var w=2 | ||||
| var p=2 | ||||
| var s=2 | ||||
| var l=4 | ||||
| var f=4 | ||||
| var d=8 | ||||
| var M=pdp | ||||
| var NAME=pdp | ||||
| var LIB=lib/{M}/tail_ | ||||
| var RT=lib/{M}/head_ | ||||
| var CPP_F=-D__unix | ||||
| var C_LIB={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g | ||||
| var OLD_C_LIB={C_LIB} | ||||
| var ALIGN=-a0:1 -a1:1 -a2:1 -a3:1 | ||||
| name be | ||||
| 	from .m.g | ||||
| 	to .s | ||||
| 	program {EM}/lib.bin/{M}/cg | ||||
| 	args < | ||||
| 	stdout | ||||
| 	need .e | ||||
| end | ||||
| name asopt | ||||
| 	from .s | ||||
| 	to .so | ||||
| 	program {EM}/lib.bin/{M}/top | ||||
| 	args | ||||
| 	optimizer | ||||
| 	stdin | ||||
| 	stdout | ||||
| end | ||||
| name as | ||||
| 	from .s.so | ||||
| 	to .o | ||||
| 	program {EM}/lib.bin/{M}/as | ||||
| 	args - -o > < | ||||
| 	prep cond | ||||
| end | ||||
| name led | ||||
| 	from .o.a | ||||
| 	to .out | ||||
| 	program {EM}/lib.bin/em_led | ||||
| 	mapflag -l* LNAME={EM}/{LIB}* | ||||
| 	mapflag -i SEPID=-b1:0 | ||||
| 	mapflag -n ALIGN=-a0:1 -a1:0x2000 -a2:1 -a3:1 | ||||
| 	mapflag -nr ALIGN=-a0:1 -a1:1 -a2:0x2000 -a3:1 | ||||
| 	mapflag -ansi C_LIB={EM}/{LIB}ac | ||||
| 	args {ALIGN} {SEPID?} (.e:{HEAD}={EM}/{RT}em) \ | ||||
| 		({RTS}:.ocm.bas={EM}/{RT}cc) \ | ||||
| 		({RTS}{ANSI?}:.c={EM}/{RT}cc) \ | ||||
| 		({RTS}{ANSI?}:.cansi={EM}/{RT}ac) \ | ||||
| 		({RTS}:.mod={EM}/{RT}m2) \ | ||||
| 		({RTS}:.p={EM}/{RT}pc) \ | ||||
| 		-o > < \ | ||||
| 		(.p:{TAIL}={EM}/{LIB}pc) \ | ||||
| 		(.bas:{TAIL}={EM}/{LIB}bc) \ | ||||
| 		(.ocm:{TAIL}={EM}/{LIB}ocm) \ | ||||
| 		(.mod:{TAIL}={EM}/{LIB}m2) \ | ||||
| 		(.ocm.bas:{TAIL}={OLD_C_LIB}) \ | ||||
| 		(.c:{TAIL}={C_LIB}) \ | ||||
| 		(.e:{TAIL}={EM}/{LIB}em {EM}/{LIB}mon {EM}/lib/{M}/end_em) | ||||
| 	linker | ||||
| end | ||||
| name cv | ||||
| 	from .out | ||||
| 	to .cv | ||||
| 	program {EM}/lib.bin/{M}/cv | ||||
| 	args < > | ||||
| 	outfile a.out | ||||
| end | ||||
|  | @ -1,25 +0,0 @@ | |||
| name "PDP 11 assembler" | ||||
| dir as | ||||
| end | ||||
| name "PDP 11 backend" | ||||
| dir cg | ||||
| end | ||||
| name "PDP 11 target optimizer" | ||||
| dir top | ||||
| end | ||||
| name "PDP 11 conversion program" | ||||
| dir cv | ||||
| end | ||||
| name "PDP 11 interpreter" | ||||
| system pdp* | ||||
| dir int | ||||
| end | ||||
| name "PDP 11 EM library" | ||||
| dir libem | ||||
| end | ||||
| name "PDP 11 etext,edata,end library" | ||||
| dir libend | ||||
| end | ||||
| name "PDP 11 systemcall library" | ||||
| dir libsys | ||||
| end | ||||
|  | @ -25,23 +25,23 @@ | |||
| #ifdef ACK_ASS | ||||
| #define newlbss(l,x)	fprintf(codefile,".comm %s,%u\n",l,x); | ||||
| #else | ||||
| #define newlbss(l,x)	fprintf(codefile,"%s:.=.+0%o\n",l,x); | ||||
| #define newlbss(l,x)	fprintf(codefile,"%s:.=.+%d\n",l,x); | ||||
| #endif | ||||
| 
 | ||||
| #define cst_fmt		"$0%o" | ||||
| #define off_fmt		"0%o" | ||||
| #define cst_fmt		"$%d" | ||||
| #define off_fmt		"%d" | ||||
| #define ilb_fmt		"I%x_%x" | ||||
| #define dlb_fmt		"_%d" | ||||
| #define	hol_fmt		"hol%d" | ||||
| 
 | ||||
| #define hol_off		"0%lo+hol%d" | ||||
| #define hol_off		"%d+hol%d" | ||||
| 
 | ||||
| #ifdef ACK_ASS | ||||
| #define con_cst(x)	fprintf(codefile,".data2 0%lo\n",x) | ||||
| #define con_cst(x)	fprintf(codefile,".data2 %d\n",x) | ||||
| #define con_ilb(x)	fprintf(codefile,".data2 %s\n",x) | ||||
| #define con_dlb(x)	fprintf(codefile,".data2 %s\n",x) | ||||
| #else | ||||
| #define con_cst(x)	fprintf(codefile,"0%lo\n",x) | ||||
| #define con_cst(x)	fprintf(codefile,"%d\n",x) | ||||
| #define con_ilb(x)	fprintf(codefile,"%s\n",x) | ||||
| #define con_dlb(x)	fprintf(codefile,"%s\n",x) | ||||
| #endif | ||||
|  |  | |||
							
								
								
									
										8
									
								
								mach/pdp/cv/build.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								mach/pdp/cv/build.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| cprogram { | ||||
|     name = "cv", | ||||
|     srcs = { "./*.c" }, | ||||
|     deps = { | ||||
|         "h+emheaders", | ||||
|         "modules/src/object+lib", | ||||
|     } | ||||
| } | ||||
|  | @ -25,7 +25,8 @@ clean: | |||
| 	rm -f *.$(SUF) Out cv | ||||
| 
 | ||||
| lint: | ||||
| 	$(LINT) $(LINTOPTIONS) -I$(TARGET_HOME)/h $(SRC_DIR)/cv.c $(UTIL_HOME)/modules/lib/$(LINTPREF)object.$(LINTSUF) | ||||
| 	$(LINT) $(LINTOPTIONS) -I$(TARGET_HOME)/h $(SRC_DIR)/cv.c | ||||
| $(UTIL_HOME)/modules/lib/$(LINTPREF)object.$(LINTSUF) | ||||
| 
 | ||||
| pr: | ||||
| 	@pr $(SRC_DIR)/proto.make $(SRC_DIR)/cv.c | ||||
|  |  | |||
|  | @ -1,72 +0,0 @@ | |||
| libem_s.a | ||||
| RT.s | ||||
| adf.s | ||||
| adi.s | ||||
| and.s | ||||
| cff.s | ||||
| cfi.s | ||||
| cif.s | ||||
| cii.s | ||||
| ciu.s | ||||
| cmf.s | ||||
| cmi.s | ||||
| cmi4.s | ||||
| cms.s | ||||
| cmu.s | ||||
| cmu4.s | ||||
| csa.s | ||||
| csb.s | ||||
| dup.s | ||||
| dvf.s | ||||
| dvi.s | ||||
| dvi4.s | ||||
| dvu.s | ||||
| dvu2.s | ||||
| dvu4.s | ||||
| eret.s | ||||
| exg.s | ||||
| fef.s | ||||
| fif.s | ||||
| gto.s | ||||
| iaar.s | ||||
| aar.s | ||||
| ilar.s | ||||
| inn.s | ||||
| isar.s | ||||
| lar.s | ||||
| los2.s | ||||
| mlf.s | ||||
| mli.s | ||||
| mli4.s | ||||
| mlu.s | ||||
| mlu4.s | ||||
| mon.s | ||||
| ngf.s | ||||
| ngi.s | ||||
| nop.s | ||||
| prf.s | ||||
| printf.s | ||||
| rck.s | ||||
| ret.s | ||||
| rmi.s | ||||
| rmi4.s | ||||
| rmu.s | ||||
| rmu2.s | ||||
| rmu4.s | ||||
| rol.s | ||||
| ror.s | ||||
| sar.s | ||||
| sbf.s | ||||
| sbi.s | ||||
| set.s | ||||
| setfl.s | ||||
| sim.s | ||||
| sli.s | ||||
| sri.s | ||||
| sru.s | ||||
| sto2.s | ||||
| strhp.s | ||||
| unknown.s | ||||
| trp.s | ||||
| xor.s | ||||
| save.s | ||||
							
								
								
									
										8
									
								
								mach/pdp/libem/build.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								mach/pdp/libem/build.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| for _, plat in ipairs(vars.plats) do | ||||
| 	acklibrary { | ||||
| 		name = "lib_"..plat, | ||||
| 		srcs = { "./*.s" }, | ||||
| 		vars = { plat = plat }, | ||||
| 	} | ||||
| end | ||||
| 
 | ||||
|  | @ -1,5 +0,0 @@ | |||
| end_s.a | ||||
| edata.s | ||||
| em_end.s | ||||
| end.s | ||||
| etext.s | ||||
							
								
								
									
										8
									
								
								mach/pdp/libend/build.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								mach/pdp/libend/build.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| for _, plat in ipairs(vars.plats) do | ||||
| 	acklibrary { | ||||
| 		name = "lib_"..plat, | ||||
| 		srcs = { "./*.s" }, | ||||
| 		vars = { plat = plat }, | ||||
| 	} | ||||
| end | ||||
| 
 | ||||
|  | @ -1,103 +0,0 @@ | |||
| libmon_s.a | ||||
| exit.c | ||||
| cleanup.c | ||||
| stty.c | ||||
| gtty.c | ||||
| access.s | ||||
| acct.s | ||||
| alarm.s | ||||
| chdir.s | ||||
| chmod.s | ||||
| chown.s | ||||
| chroot.s | ||||
| close.s | ||||
| creat.s | ||||
| dup.s | ||||
| execl.s | ||||
| execle.s | ||||
| execv.s | ||||
| execve.s | ||||
| fetchi.s | ||||
| fork.s | ||||
| fperr.s | ||||
| fstat.s | ||||
| ftime.s | ||||
| getgid.s | ||||
| getgrp.s | ||||
| getpid.s | ||||
| getppid.s | ||||
| getuid.s | ||||
| gldav.s | ||||
| ioctl.s | ||||
| kill.s | ||||
| killbkg.s | ||||
| killpg.s | ||||
| link.s | ||||
| lock.s | ||||
| login.s | ||||
| lseek.s | ||||
| lstat.s | ||||
| mknod.s | ||||
| mount.s | ||||
| mpxcall.s | ||||
| nice.s | ||||
| nostk.s | ||||
| open.s | ||||
| pause.s | ||||
| phys.s | ||||
| pipe.s | ||||
| profil.s | ||||
| ptrace.s | ||||
| qfstat.s | ||||
| qstat.s | ||||
| quota.s | ||||
| read.s | ||||
| readlink.s | ||||
| reboot.s | ||||
| renice.s | ||||
| rtp.s | ||||
| sbrk.s | ||||
| setgid.s | ||||
| setgrp.s | ||||
| setuid.s | ||||
| signal.s | ||||
| stat.s | ||||
| stime.s | ||||
| submit.s | ||||
| symlink.s | ||||
| sync.s | ||||
| time.s | ||||
| times.s | ||||
| ucall.s | ||||
| umask.s | ||||
| umount.s | ||||
| unlink.s | ||||
| utime.s | ||||
| vfork.s | ||||
| vhangup.s | ||||
| wait.s | ||||
| write.s | ||||
| errno.s | ||||
| _alarm.s | ||||
| _close.s | ||||
| _creat.s | ||||
| _dup.s | ||||
| _execl.s | ||||
| _exit.s | ||||
| _fork.s | ||||
| _fstat.s | ||||
| _ftime.s | ||||
| _getpid.s | ||||
| _gtty.c | ||||
| _ioctl.s | ||||
| _kill.s | ||||
| _link.s | ||||
| _lseek.s | ||||
| _open.s | ||||
| _pause.s | ||||
| _pipe.s | ||||
| _read.s | ||||
| _sbrk.s | ||||
| _unlink.s | ||||
| _wait.s | ||||
| _write.s | ||||
|  | @ -1,5 +0,0 @@ | |||
| MACH=pdp | ||||
| SUF=o | ||||
| ASAR=aal | ||||
| RANLIB=: | ||||
| MACHFL=-O -DUFS | ||||
|  | @ -40,9 +40,9 @@ con_mult(sz) word sz; { | |||
| 		fatal("bad icon/ucon size"); | ||||
| 	l = atol(str); | ||||
| #ifdef ACK_ASS | ||||
| 	fprintf(codefile,".data2 0%o, 0%o !%s\n",(int)(l>>16),(int)l, str); | ||||
| 	fprintf(codefile,".data2 %d, %d !%s\n",(int)(l>>16),(int)l, str); | ||||
| #else | ||||
| 	fprintf(codefile,"\t%o;%o\n",(int)(l>>16),(int)l); | ||||
| 	fprintf(codefile,"\t%d;%d\n",(int)(l>>16),(int)l); | ||||
| #endif | ||||
| } | ||||
| 
 | ||||
|  | @ -96,12 +96,12 @@ f_regsave() { | |||
| 		if (lbytes == 2) | ||||
| 			fprintf(codefile,"tst -(sp)\n"); | ||||
| 		else if (lbytes!=0) | ||||
| 			fprintf(codefile,"sub $0%o,sp\n",lbytes); | ||||
| 			fprintf(codefile,"sub $%d,sp\n",lbytes); | ||||
| 		for (i=0;i<n_regvars;i++) | ||||
| 			fprintf(codefile,"mov %s,-(sp)\n",regadm[i].ra_str); | ||||
| 	} else { | ||||
| 		if (lbytes>6) { | ||||
| 			fprintf(codefile,"mov $0%o,r0\n",lbytes); | ||||
| 			fprintf(codefile,"mov $%d,r0\n",lbytes); | ||||
| 			fprintf(codefile,"jsr r5,PR%s\n",Rstring); | ||||
| 		} else { | ||||
| 			fprintf(codefile,"jsr r5,PR%d%s\n",lbytes,Rstring); | ||||
|  | @ -109,7 +109,7 @@ f_regsave() { | |||
| 	} | ||||
| 	for (i=0;i<n_regvars;i++) | ||||
| 		if (regadm[i].ra_off>=0) | ||||
| 			fprintf(codefile,"mov 0%lo(r5),%s\n",regadm[i].ra_off, | ||||
| 			fprintf(codefile,"mov %d(r5),%s\n",regadm[i].ra_off, | ||||
| 						regadm[i].ra_str); | ||||
| } | ||||
| 
 | ||||
|  | @ -122,7 +122,7 @@ regsave(regstr,off,size) char *regstr; long off; { | |||
| #endif | ||||
| 	strcat(Rstring,regstr); | ||||
| 	if (off>=0) | ||||
| 		fprintf(codefile,"mov 0%lo(r5),%s\n",off,regstr); | ||||
| 		fprintf(codefile,"mov %d(r5),%s\n",off,regstr); | ||||
| end of commented away */ | ||||
| 
 | ||||
| 	strcat(Rstring,regstr); | ||||
|  | @ -154,7 +154,7 @@ prolog(nlocals) full nlocals; { | |||
| 	if (nlocals == 2) | ||||
| 		fprintf(codefile,"tst -(sp)\n"); | ||||
| 	else | ||||
| 		fprintf(codefile,"sub $0%o,sp\n",nlocals); | ||||
| 		fprintf(codefile,"sub $%d,sp\n",nlocals); | ||||
| #else | ||||
| 	lbytes = nlocals; | ||||
| #endif | ||||
|  |  | |||
|  | @ -25,23 +25,23 @@ | |||
| #ifdef ACK_ASS | ||||
| #define newlbss(l,x)	fprintf(codefile,".comm %s,%u\n",l,x); | ||||
| #else | ||||
| #define newlbss(l,x)	fprintf(codefile,"%s:.=.+0%o\n",l,x); | ||||
| #define newlbss(l,x)	fprintf(codefile,"%s:.=.+%d\n",l,x); | ||||
| #endif | ||||
| 
 | ||||
| #define cst_fmt		"$0%o" | ||||
| #define off_fmt		"0%o" | ||||
| #define cst_fmt		"$%d" | ||||
| #define off_fmt		"%d" | ||||
| #define ilb_fmt		"I%x_%x" | ||||
| #define dlb_fmt		"_%d" | ||||
| #define	hol_fmt		"hol%d" | ||||
| 
 | ||||
| #define hol_off		"0%lo+hol%d" | ||||
| #define hol_off		"%d+hol%d" | ||||
| 
 | ||||
| #ifdef ACK_ASS | ||||
| #define con_cst(x)	fprintf(codefile,".data2 0%lo\n",x) | ||||
| #define con_cst(x)	fprintf(codefile,".data2 %d\n",x) | ||||
| #define con_ilb(x)	fprintf(codefile,".data2 %s\n",x) | ||||
| #define con_dlb(x)	fprintf(codefile,".data2 %s\n",x) | ||||
| #else | ||||
| #define con_cst(x)	fprintf(codefile,"0%lo\n",x) | ||||
| #define con_cst(x)	fprintf(codefile,"%d\n",x) | ||||
| #define con_ilb(x)	fprintf(codefile,"%s\n",x) | ||||
| #define con_dlb(x)	fprintf(codefile,"%s\n",x) | ||||
| #endif | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ EM_BSIZE=4 | |||
| 
 | ||||
| SL=4 | ||||
| 
 | ||||
| FORMAT = "0%lo" | ||||
| FORMAT = "%d" | ||||
| TIMEFACTOR = 1/300 | ||||
| 
 | ||||
| illins = "Illegal" | ||||
|  |  | |||
							
								
								
									
										42
									
								
								mach/proto/cg/build.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								mach/proto/cg/build.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,42 @@ | |||
| include("util/cgg/build.lua") | ||||
| 
 | ||||
| definerule("build_cg", | ||||
| 	{ | ||||
| 		arch = { type="string" } | ||||
| 	}, | ||||
| 	function(e) | ||||
| 		-- Remember this is executed from the caller's directory; local | ||||
| 		-- target names will resolve there | ||||
| 		local headers = clibrary { | ||||
| 			name = e.name.."/headers", | ||||
| 			srcs = {}, | ||||
| 			hdrs = { | ||||
| 				"mach/proto/cg/*.h", | ||||
| 				"mach/"..e.arch.."/cg/mach.c", | ||||
| 				"mach/"..e.arch.."/cg/*.h", | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		local tables = cgg { | ||||
| 			name = e.name.."/tables", | ||||
| 			srcs = { "mach/"..e.arch.."/cg/table" } | ||||
| 		} | ||||
| 
 | ||||
| 		return cprogram { | ||||
| 			name = e.name, | ||||
| 			srcs = { | ||||
| 				"mach/proto/cg/*.c", | ||||
| 				matching(filenamesof(tables), "%.c$") | ||||
| 			}, | ||||
| 			deps = { | ||||
| 				"h+emheaders", | ||||
| 				"modules+headers", | ||||
| 				"modules/src/em_data+lib", | ||||
| 				"modules/src/flt_arith+lib", | ||||
| 				headers, | ||||
| 				tables, -- for .h file | ||||
| 			} | ||||
| 		} | ||||
| 	end | ||||
| ) | ||||
| 
 | ||||
|  | @ -1,190 +0,0 @@ | |||
| # $Id$ | ||||
| 
 | ||||
| #PARAMS         do not remove this line! | ||||
| 
 | ||||
| #MACH_DEFINE	do not remove this or the next line! | ||||
| MACH =  | ||||
| 
 | ||||
| SRC_DIR = $(SRC_HOME)/mach/$(MACH)/cg | ||||
| CDIR=$(SRC_HOME)/mach/proto/cg | ||||
| LIBEM = $(TARGET_HOME)/lib.bin/em_data.$(LIBSUF) | ||||
| LIBFLT = $(TARGET_HOME)/modules/lib/libflt.$(LIBSUF) | ||||
| CPP = $(UTIL_HOME)/lib.bin/cpp | ||||
| CGG = $(UTIL_HOME)/lib.bin/cgg | ||||
| 
 | ||||
| PREFLAGS=-I$(TARGET_HOME)/h -I$(SRC_HOME)/mach -I$(TARGET_HOME)/modules/h -I$(SRC_DIR) -I. -I$(CDIR) -DNDEBUG | ||||
| PFLAGS= | ||||
| CFLAGS=$(PREFLAGS) $(PFLAGS) $(COPTIONS) | ||||
| LDFLAGS=$(PFLAGS) $(LDOPTIONS) | ||||
| LINTFLAGS=$(PREFLAGS) $(LINTOPTIONS) | ||||
| LIBS=$(LIBEM) $(LIBFLT) | ||||
| CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \ | ||||
|        $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/main.c $(CDIR)/move.c \ | ||||
|        $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c $(CDIR)/salloc.c \ | ||||
|        $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c | ||||
| OFILES=	codegen.$(SUF) compute.$(SUF) equiv.$(SUF) fillem.$(SUF) \ | ||||
| 	gencode.$(SUF) glosym.$(SUF) main.$(SUF) move.$(SUF) nextem.$(SUF) \ | ||||
| 	reg.$(SUF) regvar.$(SUF) salloc.$(SUF) state.$(SUF) subr.$(SUF) \ | ||||
| 	var.$(SUF) | ||||
| 
 | ||||
| all:	tables.c | ||||
| 	make cg | ||||
| 
 | ||||
| cg: tables.o $(OFILES) | ||||
| 	$(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg | ||||
| 
 | ||||
| tables.$(SUF): tables.c | ||||
| 	$(CC) -c $(PREFLAGS) tables.c | ||||
| 
 | ||||
| codegen.$(SUF): $(CDIR)/codegen.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/codegen.c | ||||
| compute.$(SUF): $(CDIR)/compute.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/compute.c | ||||
| equiv.$(SUF): $(CDIR)/equiv.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/equiv.c | ||||
| fillem.$(SUF): $(CDIR)/fillem.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/fillem.c | ||||
| gencode.$(SUF): $(CDIR)/gencode.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/gencode.c | ||||
| glosym.$(SUF): $(CDIR)/glosym.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/glosym.c | ||||
| main.$(SUF): $(CDIR)/main.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/main.c | ||||
| move.$(SUF): $(CDIR)/move.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/move.c | ||||
| nextem.$(SUF): $(CDIR)/nextem.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/nextem.c | ||||
| reg.$(SUF): $(CDIR)/reg.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/reg.c | ||||
| regvar.$(SUF): $(CDIR)/regvar.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/regvar.c | ||||
| salloc.$(SUF): $(CDIR)/salloc.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/salloc.c | ||||
| state.$(SUF): $(CDIR)/state.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/state.c | ||||
| subr.$(SUF): $(CDIR)/subr.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/subr.c | ||||
| var.$(SUF): $(CDIR)/var.c | ||||
| 	$(CC) -c $(CFLAGS) $(CDIR)/var.c | ||||
| 
 | ||||
| install: all | ||||
| 	-mkdir $(TARGET_HOME)/lib.bin/$(MACH) | ||||
| 	cp cg $(TARGET_HOME)/lib.bin/$(MACH)/cg | ||||
| 
 | ||||
| cmp:	 all | ||||
| 	-cmp cg $(TARGET_HOME)/lib.bin/$(MACH)/cg | ||||
| 
 | ||||
| tables.c: $(SRC_DIR)/table $(CGG) | ||||
| 	-mv tables.h tables.h.save | ||||
| 	$(CPP) -P -I$(SRC_DIR) $(SRC_DIR)/table | $(CGG) > debug.out | ||||
| 	-if cmp -s tables.h.save tables.h; then mv tables.h.save tables.h; else exit 0; fi | ||||
| 	-if cmp -s /dev/null tables.h; then mv tables.h.save tables.h; else exit 0; fi | ||||
| 
 | ||||
| lint:	tables.c | ||||
| 	$(LINT) $(LINTFLAGS) $(CFILES) tables.c | ||||
| clean: | ||||
| 	rm -f *.$(SUF) tables.c tables.h debug.out cg tables.h.save | ||||
| 
 | ||||
| codegen.$(SUF):	$(CDIR)/assert.h | ||||
| codegen.$(SUF):	$(CDIR)/data.h | ||||
| codegen.$(SUF):	$(CDIR)/equiv.h | ||||
| codegen.$(SUF):	$(CDIR)/extern.h | ||||
| codegen.$(SUF):	$(CDIR)/param.h | ||||
| codegen.$(SUF):	$(CDIR)/result.h | ||||
| codegen.$(SUF):	$(CDIR)/state.h | ||||
| codegen.$(SUF):	tables.h | ||||
| codegen.$(SUF):	$(CDIR)/types.h | ||||
| compute.$(SUF):	$(CDIR)/assert.h | ||||
| compute.$(SUF):	$(CDIR)/data.h | ||||
| compute.$(SUF):	$(CDIR)/extern.h | ||||
| compute.$(SUF):	$(CDIR)/glosym.h | ||||
| compute.$(SUF):	$(CDIR)/param.h | ||||
| compute.$(SUF):	$(CDIR)/result.h | ||||
| compute.$(SUF):	tables.h | ||||
| compute.$(SUF):	$(CDIR)/types.h | ||||
| equiv.$(SUF):	$(CDIR)/assert.h | ||||
| equiv.$(SUF):	$(CDIR)/data.h | ||||
| equiv.$(SUF):	$(CDIR)/equiv.h | ||||
| equiv.$(SUF):	$(CDIR)/extern.h | ||||
| equiv.$(SUF):	$(CDIR)/param.h | ||||
| equiv.$(SUF):	$(CDIR)/result.h | ||||
| equiv.$(SUF):	tables.h | ||||
| equiv.$(SUF):	$(CDIR)/types.h | ||||
| fillem.$(SUF):	$(CDIR)/assert.h | ||||
| fillem.$(SUF):	$(CDIR)/data.h | ||||
| fillem.$(SUF):	$(CDIR)/extern.h | ||||
| fillem.$(SUF):	$(SRC_DIR)/mach.c | ||||
| fillem.$(SUF):	$(SRC_DIR)/mach.h | ||||
| fillem.$(SUF):	$(CDIR)/param.h | ||||
| fillem.$(SUF):	$(CDIR)/regvar.h | ||||
| fillem.$(SUF):	$(CDIR)/result.h | ||||
| fillem.$(SUF):	tables.h | ||||
| fillem.$(SUF):	$(CDIR)/types.h | ||||
| gencode.$(SUF):	$(CDIR)/assert.h | ||||
| gencode.$(SUF):	$(CDIR)/data.h | ||||
| gencode.$(SUF):	$(CDIR)/extern.h | ||||
| gencode.$(SUF):	$(CDIR)/param.h | ||||
| gencode.$(SUF):	$(CDIR)/result.h | ||||
| gencode.$(SUF):	tables.h | ||||
| gencode.$(SUF):	$(CDIR)/types.h | ||||
| glosym.$(SUF):	$(CDIR)/glosym.h | ||||
| glosym.$(SUF):	$(CDIR)/param.h | ||||
| glosym.$(SUF):	tables.h | ||||
| glosym.$(SUF):	$(CDIR)/types.h | ||||
| main.$(SUF):		$(CDIR)/param.h | ||||
| move.$(SUF):		$(CDIR)/assert.h | ||||
| move.$(SUF):		$(CDIR)/data.h | ||||
| move.$(SUF):		$(CDIR)/extern.h | ||||
| move.$(SUF):		$(CDIR)/param.h | ||||
| move.$(SUF):		$(CDIR)/result.h | ||||
| move.$(SUF):		tables.h | ||||
| move.$(SUF):		$(CDIR)/types.h | ||||
| nextem.$(SUF):	$(CDIR)/assert.h | ||||
| nextem.$(SUF):	$(CDIR)/data.h | ||||
| nextem.$(SUF):	$(CDIR)/extern.h | ||||
| nextem.$(SUF):	$(CDIR)/param.h | ||||
| nextem.$(SUF):	$(CDIR)/result.h | ||||
| nextem.$(SUF):	tables.h | ||||
| nextem.$(SUF):	$(CDIR)/types.h | ||||
| reg.$(SUF):		$(CDIR)/assert.h | ||||
| reg.$(SUF):		$(CDIR)/data.h | ||||
| reg.$(SUF):		$(CDIR)/extern.h | ||||
| reg.$(SUF):		$(CDIR)/param.h | ||||
| reg.$(SUF):		$(CDIR)/result.h | ||||
| reg.$(SUF):		tables.h | ||||
| reg.$(SUF):		$(CDIR)/types.h | ||||
| regvar.$(SUF):	$(CDIR)/assert.h | ||||
| regvar.$(SUF):	$(CDIR)/data.h | ||||
| regvar.$(SUF):	$(CDIR)/extern.h | ||||
| regvar.$(SUF):	$(CDIR)/param.h | ||||
| regvar.$(SUF):	$(CDIR)/regvar.h | ||||
| regvar.$(SUF):	$(CDIR)/result.h | ||||
| regvar.$(SUF):	tables.h | ||||
| regvar.$(SUF):	$(CDIR)/types.h | ||||
| salloc.$(SUF):	$(CDIR)/assert.h | ||||
| salloc.$(SUF):	$(CDIR)/data.h | ||||
| salloc.$(SUF):	$(CDIR)/extern.h | ||||
| salloc.$(SUF):	$(CDIR)/param.h | ||||
| salloc.$(SUF):	$(CDIR)/result.h | ||||
| salloc.$(SUF):	tables.h | ||||
| salloc.$(SUF):	$(CDIR)/types.h | ||||
| state.$(SUF):	$(CDIR)/assert.h | ||||
| state.$(SUF):	$(CDIR)/data.h | ||||
| state.$(SUF):	$(CDIR)/extern.h | ||||
| state.$(SUF):	$(CDIR)/param.h | ||||
| state.$(SUF):	$(CDIR)/result.h | ||||
| state.$(SUF):	$(CDIR)/state.h | ||||
| state.$(SUF):	tables.h | ||||
| state.$(SUF):	$(CDIR)/types.h | ||||
| subr.$(SUF):		$(CDIR)/assert.h | ||||
| subr.$(SUF):		$(CDIR)/data.h | ||||
| subr.$(SUF):		$(CDIR)/extern.h | ||||
| subr.$(SUF):		$(CDIR)/param.h | ||||
| subr.$(SUF):		$(CDIR)/result.h | ||||
| subr.$(SUF):		tables.h | ||||
| subr.$(SUF):		$(CDIR)/types.h | ||||
| var.$(SUF):		$(CDIR)/data.h | ||||
| var.$(SUF):		$(CDIR)/param.h | ||||
| var.$(SUF):		$(CDIR)/result.h | ||||
| var.$(SUF):		tables.h | ||||
| var.$(SUF):		$(CDIR)/types.h | ||||
|  | @ -1,4 +1,5 @@ | |||
| include("mach/proto/as/build.lua") | ||||
| include("mach/proto/cg/build.lua") | ||||
| include("mach/proto/ncg/build.lua") | ||||
| include("mach/proto/mcg/build.lua") | ||||
| include("mach/proto/top/build.lua") | ||||
|  |  | |||
							
								
								
									
										25
									
								
								plat/pdpv7/build-pkg.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								plat/pdpv7/build-pkg.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | |||
| include("plat/build.lua") | ||||
| 
 | ||||
| ackfile { | ||||
| 	name = "boot", | ||||
| 	srcs = { "./boot.s" }, | ||||
| 	vars = { plat = "pdpv7" } | ||||
| } | ||||
| 
 | ||||
| build_plat_libs { | ||||
| 	name = "libs", | ||||
| 	arch = "pdp", | ||||
| 	plat = "pdpv7", | ||||
| } | ||||
| 
 | ||||
| installable { | ||||
| 	name = "pkg", | ||||
| 	map = { | ||||
| 		"+tools", | ||||
| 		"+libs", | ||||
|         "./include+pkg", | ||||
| 		["$(PLATIND)/pdpv7/boot.o"] = "+boot", | ||||
|         ["$(PLATIND)/pdpv7/libsys.a"] = "./libsys+lib", | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
							
								
								
									
										28
									
								
								plat/pdpv7/build-tools.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								plat/pdpv7/build-tools.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | |||
| include("plat/build.lua") | ||||
| 
 | ||||
| build_as { | ||||
| 	name = "as", | ||||
| 	arch = "pdp", | ||||
| } | ||||
| 
 | ||||
| build_cg { | ||||
| 	name = "cg", | ||||
| 	arch = "pdp", | ||||
| } | ||||
| 
 | ||||
| build_top { | ||||
| 	name = "top", | ||||
| 	arch = "pdp" | ||||
| } | ||||
| 
 | ||||
| return installable { | ||||
| 	name = "tools", | ||||
| 	map = { | ||||
| 		["$(PLATDEP)/pdpv7/as"] = "+as", | ||||
| 		["$(PLATDEP)/pdpv7/cg"] = "+cg", | ||||
| 		["$(PLATDEP)/pdpv7/cv"] = "mach/pdp/cv+cv", | ||||
| 		["$(PLATDEP)/pdpv7/top"] = "+top", | ||||
| 		["$(PLATIND)/descr/pdpv7"] = "./descr", | ||||
| 		"util/opt+pkg", | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										83
									
								
								plat/pdpv7/descr
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								plat/pdpv7/descr
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,83 @@ | |||
| # $Revision$ | ||||
| var w=2 | ||||
| var wa=1 | ||||
| var p=2 | ||||
| var pa=1 | ||||
| var s=2 | ||||
| var sa=1 | ||||
| var l=4 | ||||
| var la=1 | ||||
| var f=4 | ||||
| var fa=1 | ||||
| var d=8 | ||||
| var da=1 | ||||
| var x=8 | ||||
| var xa=1 | ||||
| 
 | ||||
| var ARCH=pdp | ||||
| var PLATFORM=pdpv7 | ||||
| var PLATFORMDIR={EM}/share/ack/{PLATFORM} | ||||
| var CPP_F=-D__unix | ||||
| var ALIGN=-a0:1 -a1:1 -a2:1 -a3:1 | ||||
| 
 | ||||
| var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/share/ack/include/ansi | ||||
| 
 | ||||
| name be | ||||
| 	from .m.g | ||||
| 	to .s | ||||
| 	program {EM}/lib/ack/{PLATFORM}/cg | ||||
| 	args < | ||||
| 	stdout | ||||
| 	need .e | ||||
| end | ||||
| name asopt | ||||
| 	from .s | ||||
| 	to .so | ||||
| 	program {EM}/lib/ack/{PLATFORM}/top | ||||
| 	args | ||||
| 	optimizer | ||||
| 	stdin | ||||
| 	stdout | ||||
| 	prep cond | ||||
| end | ||||
| name as | ||||
| 	from .s.so | ||||
| 	to .o | ||||
| 	program {EM}/lib/ack/{PLATFORM}/as | ||||
| 	args - -o > < | ||||
| 	prep cond | ||||
| end | ||||
| name led | ||||
| 	from .o.a | ||||
| 	to .out | ||||
| 	program {EM}/lib/ack/em_led | ||||
| 	mapflag -l* LNAME={PLATFORMDIR}/lib* | ||||
| 	mapflag -i SEPID=-b1:0 | ||||
| 	mapflag -n ALIGN=-a0:1 -a1:0x2000 -a2:1 -a3:1 | ||||
| 	mapflag -nr ALIGN=-a0:1 -a1:1 -a2:0x2000 -a3:1 | ||||
| 	args {ALIGN} {SEPID?} \ | ||||
| 		({RTS}:.b=-u _i_main) \ | ||||
| 		(.e:{HEAD}={PLATFORMDIR}/boot.o) \ | ||||
| 		({RTS}:.ocm.bas.b={PLATFORMDIR}/c-ansi.o) \ | ||||
| 		({RTS}:.c={PLATFORMDIR}/c-ansi.o) \ | ||||
| 		({RTS}:.mod={PLATFORMDIR}/modula2.o) \ | ||||
| 		({RTS}:.p={PLATFORMDIR}/pascal.o) \ | ||||
| 		-o > < \ | ||||
| 		(.p:{TAIL}={PLATFORMDIR}/libpascal.a) \ | ||||
| 		(.b:{TAIL}={PLATFORMDIR}/libb.a) \ | ||||
| 		(.bas:{TAIL}={PLATFORMDIR}/libbasic.a) \ | ||||
| 		(.mod:{TAIL}={PLATFORMDIR}/libmodula2.a) \ | ||||
| 		(.ocm:{TAIL}={PLATFORMDIR}/liboccam.a) \ | ||||
| 		(.ocm.bas.mod.b.c.p:{TAIL}={PLATFORMDIR}/libc.a) \ | ||||
| 		(.e:{TAIL}={PLATFORMDIR}/libem.a \ | ||||
| 			{PLATFORMDIR}/libsys.a \ | ||||
| 			{PLATFORMDIR}/libend.a) | ||||
| 	linker | ||||
| end | ||||
| name cv | ||||
| 	from .out | ||||
| 	to .cv | ||||
| 	program {EM}/lib/ack/{PLATFORM}/cv | ||||
| 	args < > | ||||
| 	outfile a.out | ||||
| end | ||||
							
								
								
									
										16
									
								
								plat/pdpv7/include/ack/config.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								plat/pdpv7/include/ack/config.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| /*
 | ||||
|  * Raspberry Pi support library for the PDP/11 | ||||
|  * © 2013 David Given | ||||
|  * This file is redistributable under the terms of the 3-clause BSD license. | ||||
|  * See the file 'Copying' in the root of the distribution for the full text. | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _ACK_CONFIG_H | ||||
| #define _ACK_CONFIG_H | ||||
| 
 | ||||
| /* We're providing a time() system call rather than wanting a wrapper around
 | ||||
|  * gettimeofday() in the libc. */ | ||||
|   | ||||
| #define ACKCONF_TIME_IS_A_SYSCALL | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										26
									
								
								plat/pdpv7/include/build.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								plat/pdpv7/include/build.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,26 @@ | |||
| include("plat/build.lua") | ||||
| 
 | ||||
| headermap = {} | ||||
| packagemap = {} | ||||
| 
 | ||||
| local function addheader(h) | ||||
| 	headermap[h] = "./"..h | ||||
| 	packagemap["$(PLATIND)/pdpv7/include/"..h] = "./"..h | ||||
| end | ||||
| 
 | ||||
| addheader("ack/config.h") | ||||
| addheader("sys/select.h") | ||||
| addheader("termios.h") | ||||
| addheader("unistd.h") | ||||
| 
 | ||||
| acklibrary { | ||||
| 	name = "headers", | ||||
| 	hdrs = headermap | ||||
| } | ||||
| 
 | ||||
| installable { | ||||
| 	name = "pkg", | ||||
| 	map = packagemap | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
							
								
								
									
										13
									
								
								plat/pdpv7/include/sys/select.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								plat/pdpv7/include/sys/select.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| /*
 | ||||
|  * Raspberry Pi support library for the PDP/11 | ||||
|  * © 2013 David Given | ||||
|  * This file is redistributable under the terms of the 3-clause BSD license. | ||||
|  * See the file 'Copying' in the root of the distribution for the full text. | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _SYS_SELECT_H | ||||
| #define _SYS_SELECT_H | ||||
| 
 | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										47
									
								
								plat/pdpv7/include/termios.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								plat/pdpv7/include/termios.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,47 @@ | |||
| /*
 | ||||
|  * Raspberry Pi support library for the PDP/11 | ||||
|  * © 2013 David Given | ||||
|  * This file is redistributable under the terms of the 3-clause BSD license. | ||||
|  * See the file 'Copying' in the root of the distribution for the full text. | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _TERMIOS_H | ||||
| #define _TERMIOS_H | ||||
| 
 | ||||
| typedef unsigned char tcflag_t; | ||||
| 
 | ||||
| struct termios | ||||
| { | ||||
|     tcflag_t c_iflag; | ||||
|     tcflag_t c_oflag; | ||||
|     tcflag_t c_lflag; | ||||
|     tcflag_t c_cflag; | ||||
| }; | ||||
| 
 | ||||
| #define ONLCR 1 | ||||
| #define ECHO 2 | ||||
| #define INLCR 4 | ||||
| 
 | ||||
| /* Dummied parameters for compatibility --- only the ones above are
 | ||||
|  * honoured. */ | ||||
| 
 | ||||
| #define BRKINT 0 | ||||
| #define ICRNL 0 | ||||
| #define INPCK 0 | ||||
| #define ISTRIP 0 | ||||
| #define IXON 0 | ||||
| #define CS8 0 | ||||
| #define ICANON 0 | ||||
| #define IEXTEN 0 | ||||
| #define ISIG 0 | ||||
| 
 | ||||
| #define OPOST ONLCR | ||||
| 
 | ||||
| #define TCSANOW 0 | ||||
| #define TCSADRAIN 1 | ||||
| #define TCSAFLUSH 2 | ||||
| 
 | ||||
| extern int tcgetattr(int fd, struct termios* t); | ||||
| extern int tcsetattr(int fd, int actions, struct termios* t); | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										105
									
								
								plat/pdpv7/include/unistd.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										105
									
								
								plat/pdpv7/include/unistd.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,105 @@ | |||
| /*
 | ||||
|  * Raspberry Pi support library for the PDP/11 | ||||
|  * © 2013 David Given | ||||
|  * This file is redistributable under the terms of the 3-clause BSD license. | ||||
|  * See the file 'Copying' in the root of the distribution for the full text. | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _UNISTD_H | ||||
| #define _UNISTD_H | ||||
| 
 | ||||
| #include <stddef.h> | ||||
| #include <time.h> | ||||
| 
 | ||||
| /* Types */ | ||||
| 
 | ||||
| typedef int pid_t; | ||||
| typedef int mode_t; | ||||
| 
 | ||||
| typedef long suseconds_t; | ||||
| 
 | ||||
| /* Time handling. */ | ||||
| 
 | ||||
| struct timeval | ||||
| { | ||||
| 	time_t tv_sec; | ||||
| 	suseconds_t tv_usec; | ||||
| }; | ||||
| 
 | ||||
| struct timezone | ||||
| { | ||||
| 	int tz_minuteswest; | ||||
| 	int tz_dsttime; | ||||
| }; /* obsolete, unused */ | ||||
| 
 | ||||
| extern int gettimeofday(struct timeval* tv, struct timezone* tz); | ||||
| extern int settimeofday(const struct timeval* tv, const struct timezone* tz); | ||||
| 
 | ||||
| /* Constants for file access (open and friends) */ | ||||
| 
 | ||||
| enum | ||||
| { | ||||
| 	O_ACCMODE = 0x3, | ||||
| 	 | ||||
| 	O_RDONLY = 0, | ||||
| 	O_WRONLY = 1, | ||||
| 	O_RDWR = 2, | ||||
| 	 | ||||
| 	O_CREAT = 0100, | ||||
| 	O_TRUNC = 01000, | ||||
| 	O_APPEND = 02000, | ||||
| 	O_NONBLOCK = 04000 | ||||
| }; | ||||
| 
 | ||||
| /* Special variables */ | ||||
| 
 | ||||
| extern char** environ; | ||||
| 
 | ||||
| /* Implemented system calls */ | ||||
| 
 | ||||
| extern void _exit(int); | ||||
| extern pid_t getpid(void); | ||||
| extern void* sbrk(int increment); | ||||
| extern int isatty(int d); | ||||
| extern off_t lseek(int fildes, off_t offset, int whence); | ||||
| extern int close(int d); | ||||
| extern int open(const char* path, int access, ...); | ||||
| extern int creat(const char* path, mode_t mode); | ||||
| extern int read(int fd, void* buffer, size_t count); | ||||
| extern int write(int fd, void* buffer, size_t count); | ||||
| 
 | ||||
| /* Unimplemented system calls (these are just prototypes to let the library
 | ||||
|  * compile). */ | ||||
| 
 | ||||
| extern int fcntl(int fd, int op, ...); | ||||
| 
 | ||||
| /* Signal handling */ | ||||
| 
 | ||||
| typedef int sig_atomic_t; | ||||
| 
 | ||||
| #define SIG_ERR ((sighandler_t) -1)           /* Error return.  */ | ||||
| #define SIG_DFL ((sighandler_t) 0)            /* Default action.  */ | ||||
| #define SIG_IGN ((sighandler_t) 1)            /* Ignore signal.  */ | ||||
| 
 | ||||
| #define SIGABRT         6       /* Abort (ANSI) */ | ||||
| #define SIGILL          11      /* Illegal instruction */ | ||||
| 
 | ||||
| #define _NSIG           32      /* Biggest signal number + 1 | ||||
|                                    (not including real-time signals).  */ | ||||
| typedef void (*sighandler_t)(int); | ||||
| extern sighandler_t signal(int signum, sighandler_t handler); | ||||
| extern int raise(int signum); | ||||
| 
 | ||||
| /* Select */ | ||||
| 
 | ||||
| typedef uint32_t fd_set; | ||||
| 
 | ||||
| extern int select(int nfds, fd_set *readfds, fd_set *writefds, | ||||
|                   fd_set *exceptfds, struct timeval *timeout); | ||||
| 
 | ||||
| #define FD_ZERO(set) do { *set = 0; } while (0) | ||||
| #define FD_SET(fd, set) do { *set |= (1<<fd); } while (0); | ||||
| #define FD_CLR(fd, set) do { *set &= ~(1<<fd); } while (0); | ||||
| #define FD_ISSET(fd, set) (*set | (1<<fd)) | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										16
									
								
								plat/pdpv7/libsys/build.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								plat/pdpv7/libsys/build.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| acklibrary { | ||||
|     name = "lib", | ||||
|     srcs = { | ||||
|         "./*.c", | ||||
|         "./*.s", | ||||
|     }, | ||||
| 	deps = { | ||||
| 		"lang/cem/libcc.ansi/headers+headers", | ||||
| 		"plat/pdpv7/include+headers", | ||||
| 	}, | ||||
|     vars = { | ||||
|         plat = "pdpv7" | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| -- /tmp/ack-build/staging/lib/ack/cpp.ansi -D__unix -I/tmp/ack-build/obj/lang/cem/libcc.ansi/headers/headers -I/tmp/ack-build/obj/plat/rpi/include/headers -D__vc4 -D__rpi -D__ACK -I/tmp/ack-build/staging/share/ack/rpi/include -I/tmp/ack-build/staging/share/ack/include/ansi -Dvc4 -DEM_WSIZE=4 -DEM_PSIZE=4 -DEM_SSIZE=2 -DEM_LSIZE=4 -DEM_FSIZE=4 -DEM_DSIZE=4 -D_EM_WSIZE=4 -D_EM_PSIZE=4 -D_EM_SSIZE=2 -D_EM_LSIZE=4 -D_EM_FSIZE=4 -D_EM_DSIZE=4 plat/rpi/libsys/pi_user_to_phys.s | ||||
							
								
								
									
										8
									
								
								plat/pdpv7/libsys/isatty.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								plat/pdpv7/libsys/isatty.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| int isatty(int fd) | ||||
| { | ||||
|     char* p; | ||||
| 
 | ||||
|     if (gtty(fd, &p) < 0) | ||||
|         return 0; | ||||
|     return 1; | ||||
| } | ||||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		
		Reference in a new issue