コード例 #1
0
/*
 * Set the PROM vector handler (for g0, g4, etc.)
 * and set boothowto from the PROM arg strings.
 *
 * Note, args are always:
 * argv[0] = boot_device	(i.e. "sd(0,0,0)")
 * argv[1] = options	(i.e. "-ds" or NULL)
 * argv[2] = NULL
 */
void
sunmon_init(void)
{
	struct sunromvec *rvec;
	struct bootparam *bp;
	char **argp;
	char *p;

	rvec = romVectorPtr;
	bp = *rvec->bootParam;

	/* Save the PROM monitor Vector Base Register (VBR). */
	sunmon_vbr = getvbr();

	/* Arrange for "trap #14" to cause a PROM abort. */
	sunmon_vbr[32+14] = romVectorPtr->abortEntry;

	/* Save and replace the "v command" handler. */
	sunmon_vcmd = *rvec->vector_cmd;
	if (rvec->romvecVersion >= 2)
		*rvec->vector_cmd = v_handler;

	/* Set boothowto flags from PROM args. */
	argp = bp->argPtr;

	/* Skip argp[0] (the device string) */
	argp++;

	/* Have options? */
	if (*argp == NULL)
		return;
	p = *argp;
	if (*p == '-') {
		/* yes, parse options */
#ifdef	DEBUG
		mon_printf("boot option: %s\n", p);
#endif
		for (++p; *p; p++)
			BOOT_FLAG(*p, boothowto);
		argp++;
	}

#ifdef	DEBUG
	/* Have init name? */
	if (*argp == NULL)
		return;
	p = *argp;
	mon_printf("boot initpath: %s\n", p);
#endif
}
コード例 #2
0
ファイル: SRT1.c プロジェクト: lacombar/netbsd-alc
/*
 * This is called by SRT0.S
 * to do final prep for main
 */
void 
_start(void)
{
	void **vbr;
	int x;

	/*
	 * Determine sun2 vs sun3 vs sun3x by looking where the
	 * vector base register points.  The PROM always
	 * points that somewhere into [MONSTART..MONEND]
	 * which is a different range on each.
	 */

	vbr = getvbr();
	x = (int)vbr & 0xFFF00000;
	if (x == SUN3X_MONSTART)
		_is3x = 1;
	else if (x == 0)
		_is2 = 1;

	/* Find the PROM vector. */
	if (_is3x)
		x = SUN3X_PROM_BASE;
	else if (_is2)
		x = SUN2_PROM_BASE;
	else
		x = SUN3_PROM_BASE;
	_romvec = ((struct sunromvec *) x);

	/* Setup trap 14 for use as a breakpoint. */
	vbr[32+14] = _romvec->abortEntry;

	/* Initialize sun3 vs sun3x function pointers. */
	if (_is3x)
		sun3x_init();
	else if (_is2)
		sun2_init();
	else
		sun3_init();

	main(0);
	exit(0);
}