Ejemplo n.º 1
0
/*
 * Copy the new kernel to its correct location in physical memory,
 * flush caches, ignore TLBs (we're in KSEG0 space), and jump to
 * the start of the kernel.
 */
void
main(ulong aentry, ulong acode, ulong asize, ulong argc)
{
	void *kernel;
	static ulong entry, code, size;

	putc('B'); putc('o'); putc('o'); putc('t');
	/* copy args to heap before moving stack to before a.out header */
	entry = aentry;
	code = acode;
	size = asize;
	_argc = argc;		/* argc passed to kernel */
	_env = (ulong)&((char**)CONFARGV)[argc];
	setsp(entry-0x20-4);

	memmove((void *)entry, (void *)code, size);

	cleancache();
	coherence();

	/*
	 * jump to kernel entry point.
	 */
	putc(' ');
	kernel = (void*)entry;
	go(kernel);			/* off we go - never to return */

	putc('?');
	putc('!');
	for(;;)
		;
}
Ejemplo n.º 2
0
PRIVATE OSErr renamehelper(ioParam *pb, BOOLEAN async, LONGINT dirid, filekind kind)
{
    OSErr err, err1;
    btparam btparamrec, btparamrec2;
    ioParam npb;
    
    if (!pb->ioNamePtr || indexn((char *)pb->ioNamePtr+1, ':', pb->ioNamePtr[0])
				   == (char *) pb->ioNamePtr + pb->ioNamePtr[0])
	err = pbvolrename(pb, (StringPtr) pb->ioMisc);
    else {
	err = findvcbandfile(pb, dirid, &btparamrec, &kind, FALSE);
	if (err == noErr) {
	    npb = *pb;
	    npb.ioNamePtr = (StringPtr) pb->ioMisc;
	    err = findvcbandfile(&npb, dirid, &btparamrec2, &kind, FALSE);
	    if (err != fnfErr)
		err = dupFNErr;
	    else {
		err = writevcbp(btparamrec.vcbp);
		if (err == noErr)
		    err = btrename(&btparamrec, (StringPtr) pb->ioMisc);
		err1 = cleancache(btparamrec.vcbp);
		if (err == noErr)
		    err = err1;
	    }
	}
    }
    PBRETURN(pb, err);
}
Ejemplo n.º 3
0
PUBLIC OSErr myPBOpenWD(WDPBPtr pb, BOOLEAN async)
{
    LONGINT dirid, procid;
    wdentry *wdp, *ewdp, *firstfreep;
    OSErr retval;
    filekind kind;
    btparam btparamrec;
    HVCB *vcbp;
    
    retval = findvcbandfile((ioParam *)pb, pb->ioWDDirID, &btparamrec, &kind,
    																	 FALSE);
    if (retval != noErr)
	PBRETURN(pb, retval);
    vcbp = btparamrec.vcbp;
    retval = cleancache(vcbp);
    if (retval != noErr)
	PBRETURN(pb, retval);
    if (kind == directory)
	dirid = ((directoryrec *) DATAPFROMKEY(btparamrec.foundp))->dirDirID;
    else
	dirid = pb->ioWDDirID;
    procid = pb->ioWDProcID;
    
    firstfreep = 0;
    for (wdp = (wdentry *) (WDCBsPtr + sizeof(INTEGER)),
		    ewdp = (wdentry *) (WDCBsPtr + *(INTEGER *)WDCBsPtr);
							   wdp != ewdp; wdp++) {
	if (!firstfreep && !wdp->vcbp)
	    firstfreep = wdp;
	if (wdp->vcbp == vcbp && wdp->dirid == dirid && wdp->procid == procid) {
	    pb->ioVRefNum = WDPTOWDNUM(wdp);
	    PBRETURN(pb, noErr);
	}
    }
    if (!firstfreep)
	retval = tmwdoErr;
    else {
	firstfreep->vcbp = vcbp;
	firstfreep->dirid = dirid;
	firstfreep->procid = procid;
	pb->ioVRefNum = WDPTOWDNUM(firstfreep);
	retval = noErr;
    }
    PBRETURN(pb, retval);
}
Ejemplo n.º 4
0
PRIVATE OSErr PBFInfoHelper(changeop op, fileParam *pb, long dirid,
								  BOOLEAN async)
{
    OSErr err, err1;
    HVCB *vcbp;
    filerec *frp;
    catkey *catkeyp;
    btparam btparamrec;
    filekind kind;
    
    if (op == Get && pb->ioFDirIndex > 0)
	err = btpbindex((ioParam *) pb, dirid, &vcbp, &frp, &catkeyp, TRUE);
    else {
	kind = regular;
	err = findvcbandfile((ioParam *) pb, dirid, &btparamrec, &kind, FALSE);
	if (err == noErr) {
	    if (btparamrec.success) {
		vcbp = btparamrec.vcbp;
		frp  = (filerec *) DATAPFROMKEY(btparamrec.foundp);
		catkeyp = (catkey *) btparamrec.foundp;
	    } else
		err = fnfErr;
	}
    }
    if (err == noErr) {
	switch (op) {
	case Get:
	    if (pb->ioNamePtr)
		str255assign(pb->ioNamePtr, catkeyp->ckrCName);
	    pb->ioFRefNum = flnumtorefnum(frp->filFlNum);
	    pb->ioFlAttrib = frp->filFlags;
	    pb->ioFlVersNum = 0;
	    memcpy(&pb->ioFlFndrInfo, &frp->filUsrWds,
						 (size_t) sizeof(pb->ioFlFndrInfo));
	    pb->ioFlNum = frp->filFlNum;
	    pb->ioFlStBlk = frp->filStBlk;
	    pb->ioFlLgLen = frp->filLgLen;
	    pb->ioFlPyLen = frp->filPyLen;
	    pb->ioFlRStBlk = frp->filRStBlk;
	    pb->ioFlRLgLen = frp->filRLgLen;
	    pb->ioFlRPyLen = frp->filRPyLen;
	    pb->ioFlCrDat = frp->filCrDat;
	    pb->ioFlMdDat = frp->filMdDat;
	    break;
	case Set:
	    memcpy(&frp->filUsrWds, &pb->ioFlFndrInfo,
						   (size_t) sizeof(frp->filUsrWds));
	    frp->filCrDat = pb->ioFlCrDat;
	    frp->filMdDat = pb->ioFlMdDat;
	    dirtyleaf(frp, vcbp);
	    break;
	case Lock:
	    frp->filFlags |= FSOFTLOCKBIT;
	    dirtyleaf(frp, vcbp);
	    break;
	case Unlock:
	    frp->filFlags &= ~FSOFTLOCKBIT;
	    dirtyleaf(frp, vcbp);
	    break;
	}
    }
    err1 = cleancache(vcbp);
    if (err == noErr)
	err = err1;
    PBRETURN(pb, err);
}