/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/kobj_impl.h>
#include <sys/promimpl.h>
#include <sys/bootconf.h>
#ifdef DEBUG
#else
static int forthdebug = 0;
#endif /* DEBUG */
static int forthdebug_dbp = 0;
/*
* basic_sym[] holds all essential symbols the symbol lookup
* service requires. Forthdebug stub names appears in forthdebug
* as place holders. They are replaced with the value of corresponding
* kernel variables. For example, "modules-val-here" in forthdebug
* is replaced with the address of "modules" variable.
*
* To improve performance, we mandate the records be in the same
* sequence they appear in forthdebug, i.e "modules-val-here" is
* ahead of "primaries-v-here" in misc/forthdebug.
*
* The last record must be all 0 to indicate end of the array.
*/
static char *basic_sym[] = {
/* kernel variable */ /* forthdebug stub name - must be 16 chars */
"modules", "modules-val-here",
"primaries", "primaries-v-here",
"modreloc_flag", "modreloc-flagval",
0, 0
};
/*ARGSUSED*/
{
fdbp_hook();
}
fdbp_snoop, KOBJ_NOTIFY_MODLOADED, 0, 0
};
};
void
forthdebug_init(void)
{
int i, sz;
if (!forthdebug_supported) {
return;
}
return;
}
if (i || !fsz) {
FDEBUGFILE, i, (long long)fsz);
goto err_stat;
}
if (sz < 0) {
goto done;
}
/* resolve all essential symbols in basic_sym[] */
for (i = 0; basic_sym[i]; i += 2) {
buf_p += 16;
} else {
"forthdebug_init: No %s symbol(%p,%p), aborted\n",
goto done;
}
}
if (!forthdebug) { /* symbol lookup services only */
goto done;
}
*buf_p = '\0';
#ifdef DEBUG
#endif /* DEBUG */
prom_interpret(fth_buf, 0, 0, 0, 0, 0);
goto done;
}
prom_interpret(fth_buf, 0, 0, 0, 0, 0);
if (forthdebug_dbp) {
#ifdef NO_KOBJ_NOTIFY
#else
(void) kobj_notify_add(&knl_load);
(void) kobj_notify_add(&knl_unload);
#endif /* NO_KOBJ_NOTIFY */
prom_interpret(INSTALL_DBP, 0, 0, 0, 0, 0);
debug_enter("Defer breakpoint enabled. Add breakpoints, then");
}
done:
debug_enter("forthdebug: halt flag (-h) is set.\n");
}