浏览代码

Initial revision

ceriel 36 年之前
父节点
当前提交
0fee5d5f16

+ 6 - 0
mach/minix/.distr

@@ -0,0 +1,6 @@
+Action
+libm2
+liboc
+libcc
+libpc
+libsys

+ 15 - 0
mach/minix/Action

@@ -0,0 +1,15 @@
+name "Minix PC C libraries"
+dir libcc
+end
+name "Minix PC Pascal library"
+dir libpc
+end
+name "Minix PC systemcall library"
+dir libsys
+end
+name "Minix PC Occam library"
+dir liboc
+end
+name "Minix PC Modula-2 library"
+dir libm2
+end

+ 7 - 0
mach/minix/libsys/.distr

@@ -0,0 +1,7 @@
+LIST
+Makefile
+compmodule
+head_em.s
+end.s
+lib.h
+libsys_s.a

+ 56 - 0
mach/minix/libsys/LIST

@@ -0,0 +1,56 @@
+libsys_s.a
+stty.c
+gtty.c
+access.c
+alarm.c
+brk.c
+call.c
+chdir.c
+chmod.c
+chown.c
+chroot.c
+close.c
+creat.c
+dup.c
+dup2.c
+exec.c
+exit.c
+cleanup.c
+fork.c
+fstat.c
+getegid.c
+geteuid.c
+getgid.c
+getpid.c
+getuid.c
+ioctl.c
+kill.c
+link.c
+lseek.c
+message.c
+mknod.c
+mktemp.c
+mount.c
+open.c
+pause.c
+pipe.c
+read.c
+setgid.c
+setuid.c
+signal.c
+stat.c
+stderr.c
+stime.c
+sync.c
+syslib.c
+time.c
+times.c
+umask.c
+umount.c
+unlink.c
+utime.c
+wait.c
+write.c
+brksize.s
+sendrec.s
+catchsig.s

+ 40 - 0
mach/minix/libsys/Makefile

@@ -0,0 +1,40 @@
+# $Header$
+MACH=minix
+
+all:            libsys_o.a end.o head_em.o
+
+install: 	all
+		../../install libsys_o.a tail_mon
+		../../install head_em.o head_em
+		../../install end.o end_em
+
+cmp:		all
+		-../../compare libsys_o.a tail_mon
+		-../../compare head_em.o head_em
+		-../../compare end.o end_em
+
+
+end.o:		end.s
+		$(MACH) -I../../../h -O -c end.s
+
+head_em.o:	head_em.s
+		$(MACH) -I../../../h -O -c head_em.s
+
+libsys.a:	libsys_s.a
+		ASAR=aal ; export ASAR ;\
+		march . libsys.a
+
+libsys_o.a:	libsys.a ../../../lib/i86/tail_em
+		mkdir X; cd X; aal x ../libsys.a; aal x ../../../../lib/i86/tail_em; aal rv ../libsys_o.a *.o
+		rm -rf X
+
+clean:
+		rm -f *.o libsys_o.a libsys.a
+
+opr :
+		make pr | opr
+
+pr:
+		@pr `pwd`/head_em.s
+		@arch pv libsys.a | pr -h `pwd`/libsys.a
+		@pr `pwd`/end.s

+ 4 - 0
mach/minix/libsys/brksize.s

@@ -0,0 +1,4 @@
+.define _brksize
+.globl endbss, _brksize
+.data
+_brksize: .word endbss

+ 40 - 0
mach/minix/libsys/catchsig.s

@@ -0,0 +1,40 @@
+.define _begsig
+.globl _begsig
+.globl _vectab, _M
+mtype = 2			| M+mtype = &M.m_type
+_begsig:
+	push ax			| after interrupt, save all regs
+	push bx
+	push cx
+	push dx
+	push si
+	push di
+	push bp
+	push ds
+	push es
+	mov bx,sp
+	mov bx,18(bx)		| bx = signal number
+	mov ax,bx		| ax = signal number
+	dec bx			| vectab[0] is for sig 1
+	add bx,bx		| pointers are two bytes on 8088
+	mov bx,_vectab(bx)	| bx = address of routine to call
+	push _M+mtype		| push status of last system call
+	push ax			| func called with signal number as arg
+	call (bx)
+back:
+	pop ax			| get signal number off stack
+	pop _M+mtype		| restore status of previous system call
+	pop es			| signal handling finished
+	pop ds
+	pop bp
+	pop di
+	pop si
+	pop dx
+	pop cx
+	pop bx
+	pop ax
+	pop dummy		| remove signal number from stack
+	iret
+
+.data 
+dummy: .word 0

+ 4 - 0
mach/minix/libsys/compmodule

@@ -0,0 +1,4 @@
+if minix -c -L -LIB $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi

+ 10 - 0
mach/minix/libsys/end.s

@@ -0,0 +1,10 @@
+.define endtext, enddata, endbss, _end, _edata
+.globl endtext, enddata, endbss, _end, _edata
+.text
+endtext:
+.data
+enddata:
+_edata:
+.bss
+endbss:
+_end:

+ 52 - 0
mach/minix/libsys/head_em.s

@@ -0,0 +1,52 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+
+.define begtext,begdata,begbss
+.define hol0,.reghp,.limhp,.trppc,.ignmask
+.define ERANGE,ESET,EHEAP,ECASE,EILLINS,EIDIVZ,EODDZ
+.extern _end
+
+ERANGE          = 1
+ESET            = 2
+EIDIVZ          = 6
+EHEAP           = 17
+EILLINS         = 18
+EODDZ           = 19
+ECASE           = 20
+
+.sect .text
+begtext:
+	mov bx,sp
+	mov cx,(bx)
+	add bx,2
+	mov ax,cx
+	inc ax
+	shl ax,1
+	add ax,bx
+	push ax
+	push bx
+	push cx
+	xor bp,bp
+	call    _m_a_i_n
+	call	_exit
+.sect	.data
+begdata:
+hol0:
+	.data2   0,0
+	.data2   0,0
+argv:
+	.data2   3f
+envp:
+	.data2	0
+3:
+	.asciz "PROGRAM"
+.reghp:
+	.data2   endbss
+.limhp:
+	.data2   endbss
+.ignmask:
+	.data2   0
+.trppc:
+	.data2   0
+
+	.sect .bss
+begbss:

+ 32 - 0
mach/minix/libsys/sendrec.s

@@ -0,0 +1,32 @@
+.define _send, _receive, _sendrec
+.globl _send, _receive, _sendrec
+| See ../h/com.h for C definitions
+SEND = 1
+RECEIVE = 2
+BOTH = 3
+SYSVEC = 32
+
+|*========================================================================*
+|                           send and receive                              *
+|*========================================================================*
+| send(), receive(), sendrec() all save bp, but destroy ax, bx, and cx.
+
+_send:	mov cx,*SEND		| send(dest, ptr)
+	jmp L0
+
+_receive:
+	mov cx,*RECEIVE		| receive(src, ptr)
+	jmp L0
+
+_sendrec:
+	mov cx,*BOTH		| sendrec(srcdest, ptr)
+	jmp L0
+
+  L0:	push bp			| save bp
+	mov bp,sp		| can't index off sp
+	mov ax,4(bp)		| ax = dest-src
+	mov bx,6(bp)		| bx = message pointer
+	int SYSVEC		| trap to the kernel
+	pop bp			| restore bp
+	ret			| return
+