File:  [XINU] / xinu / sys / sizmem.s
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:40:10 2018 UTC (8 years, 2 months ago) by root
Branches: xinu, MAIN
CVS tags: xinu-19910600, HEAD
Xinu for 68000/68010

|* sizmem.s - sizmem */

DISABLE	=	0x2700
EXCPPC	=	0x0008

|*------------------------------------------------------------------------
|*  sizmem  --  size memory, placing highest valid address in _maxaddr
|*------------------------------------------------------------------------
	.text
	.globl	_sizmem, _end
.data
savsp:  .long 0
.text

_sizmem:
	movw	sr, sp@-
	movw	#DISABLE, sr
	movl	a0, sp@-
	movl	EXCPPC, sp@-
	movl	#siztrap, EXCPPC
	movl	sp,savsp       | remember sp for trap
	movl	#_end, a0      | start from end of program
sizloop:
	movl	a0@,a0@+      | ref mem where a0 points
	movl	a0, _maxaddr
	bra 	sizloop

siztrap:
	movl 	_maxaddr, a0
	subl	#4,a0
	movl 	a0,_maxaddr     | adjust to last actual word addr
	movl	savsp,sp        | drop stack frame from trap
	movl	sp@+, EXCPPC | restore vector
	movl	sp@+, a0     | and a0
	movw	sp@+, sr   | | and sr
	rts


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.