aboutsummaryrefslogtreecommitdiff
path: root/sys/memio/mgtfwa.x
blob: 9b39f6eb07c2ec5e2e2b5c0b7849980c05eaa553 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<syserr.h>
include	<config.h>
include	<mach.h>

# MGTFWA -- Given a user buffer pointer, retrieve physical address of buffer.
# If physical address of buffer does not seem reasonable, memory has probably
# been overwritten, a fatal error.

int procedure mgtfwa (ptr, dtype)

pointer	ptr, bufptr
int	dtype
int	locbuf, fwa
int	coerce()

begin
	bufptr = coerce (ptr, dtype, TY_INT)
	fwa = Memi[bufptr-1]
	call zlocva (Memi[bufptr-1], locbuf)

	if (abs (locbuf - fwa) > SZ_VMEMALIGN)
	    call sys_panic (SYS_MCORRUPTED, "Memory has been corrupted")

	return (fwa)
end