2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * Originally, this code translated kernel supplied virtual addresses into 2N/A * "memory cookies", which was a 32-bit number with ascii-M in the upper 8 2N/A * bits, a 4-bit index and a 20-bit offset. However, this caused two 2N/A * problems: 1) the 20-bit offset was too small for some devices, esp. some 2N/A * with frame-buffers; 2) if the fcode used the cookie to program the 2N/A * hardware, there was no easy way for the software to detect that a 2N/A * translation needed to be done. 2N/A * For that reason, "memory cookies" are now just the kernel-supplied 2N/A * virtual address, and we now check each memory access to see if it's 2N/A * attempting to access kernel-supplied memory. The only important thing 2N/A * now is that "is_mcookie" returns 1 (or true) if the tested mcookie 2N/A * is a kernel virtual address. 2N/A * There is a potential bug if the kernel virtual address happens to 2N/A * conflict with a user virtual address. However, the current implementation 2N/A * of Solaris avoids this conflict.