⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usrloadsym.c

📁 ppc 8245 可编译bsp 包括 uart
💻 C
字号:
/* usrLoadSym.c - development symbol table loader *//* Copyright 1992 Wind River Systems, Inc. *//*modification history--------------------01i,18mar99,sn   prevent netSymTbl from ever firing linked C++ ctors01h,17mar99,sn   netSymTbl now records the fact that the linked C++                 ctors have already been fired.01g,19nov97,hdn  added support for TFFS.01f,18nov96,dbt  ANSIfied function headers (SPR #7427.)01e,01nov96,hdn  added support for PCMCIA.01d,23jul96,hdn  added support for ATA driver.01c,25oct94,hdn  swapped 1st and 2nd parameter of usrFdConfig().01b,13nov93,hdn  added support for floppy and IDE drive.01a,18sep92,jcf  written.*//*DESCRIPTIONThis file is used to load the development symbol table from either the networkor a SCSI disk. This file is included by usrConfig.c.SEE ALSO: usrExtra.cNOMANUAL*/#ifndef  __INCusrLoadSymc#define  __INCusrLoadSymc #ifdef	INCLUDE_NET_SYM_TBL/********************************************************************************* netLoadSymTbl - load system symbol table from network (or from SCSI)** This routine creates a system symbol table and loads it across the network.* The name of the symbol table file is constructed as:*      <host>:<bootFile>.sym** RETURNS: OK, or ERROR if symbol table was not loaded.** NOMANUAL*/STATUS netLoadSymTbl ()    {    char symTblFile [PATH_MAX + 1];   /* name of symbol table file */    if (strncmp (sysBootParams.bootDev, "scsi", 4) == 0)	sprintf (symTblFile, "%s.sym", sysBootParams.bootFile);#ifdef INCLUDE_IDE    else if (strncmp (sysBootParams.bootDev, "ide", 3) == 0)	{        int drive = 0;        int type = 0;	if (strlen (sysBootParams.bootDev) == 3)	    return (ERROR);	else	    sscanf (sysBootParams.bootDev, "%*3s%*c%d%*c%d", &drive, &type);	if (usrIdeConfig (drive, sysBootParams.bootFile) != OK)	    return (ERROR);	sprintf (symTblFile, "%s.sym", sysBootParams.bootFile);	}#endif /* INCLUDE_IDE */#ifdef INCLUDE_ATA    else if (strncmp (sysBootParams.bootDev, "ata", 3) == 0)	{	int ctrl  = 0;        int drive = 0;	if (strlen (sysBootParams.bootDev) == 3)	    return (ERROR);	else	    sscanf (sysBootParams.bootDev, "%*3s%*c%d%*c%d", &ctrl, &drive);	if (usrAtaConfig (ctrl, drive, sysBootParams.bootFile) != OK)	    return (ERROR);	sprintf (symTblFile, "%s.sym", sysBootParams.bootFile);	}#endif /* INCLUDE_ATA */#ifdef INCLUDE_FD    else if (strncmp (sysBootParams.bootDev, "fd", 2) == 0)	{        int drive = 0;        int type = 0;	if (strlen (sysBootParams.bootDev) == 2)	    return (ERROR);	else	    sscanf (sysBootParams.bootDev, "%*2s%*c%d%*c%d", &drive, &type);	if (usrFdConfig (drive, type, sysBootParams.bootFile) != OK)	    return (ERROR);	sprintf (symTblFile, "%s.sym", sysBootParams.bootFile);	}#endif /* INCLUDE_FD */#ifdef INCLUDE_PCMCIA    else if (strncmp (sysBootParams.bootDev, "pcmcia", 6) == 0)	{	int sock = NONE;	if (strlen (sysBootParams.bootDev) == 6)	    return (ERROR);	else	    sscanf (sysBootParams.bootDev, "%*6s%*c%d", &sock);	/* we try a block device first then an ethernet device */	if (usrPcmciaConfig (sock, sysBootParams.bootFile) != OK)            sprintf (symTblFile, "%s:%s.sym", sysBootParams.hostName,		     sysBootParams.bootFile);	sprintf (symTblFile, "%s.sym", sysBootParams.bootFile);	}#endif /* INCLUDE_PCMCIA */#ifdef INCLUDE_TFFS    else if (strncmp (sysBootParams.bootDev, "tffs", 4) == 0)	{        int drive = 0;        int removable = 0;	if (strlen (sysBootParams.bootDev) == 4)	    return (ERROR);	else	    sscanf (sysBootParams.bootDev, "%*4s%*c%d%*c%d", &drive, &removable);	if (usrTffsConfig (drive, removable, sysBootParams.bootFile) != OK)	    return (ERROR);	sprintf (symTblFile, "%s.sym", sysBootParams.bootFile);	}#endif /* INCLUDE_TFFS */    else        sprintf (symTblFile, "%s:%s.sym", sysBootParams.hostName,	         sysBootParams.bootFile);    printf ("Loading symbol table from %s ...", symTblFile);    if (loadSymTbl (symTblFile) == ERROR)	{	taskDelay (sysClkRateGet () * 3);	/* wait 3 seconds */	return (ERROR);	}    printf ("done\n");    return (OK);    }/********************************************************************************* loadSymTbl - load system symbol table** This routine loads the system symbol table.** RETURNS: OK or ERROR** NOMANUAL*/STATUS loadSymTbl     (    char *symTblName    )    {    char *loadAddr;    int savedCplusXtorStrategy;    int symfd = open (symTblName, O_RDONLY, 0);    if (symfd == ERROR)	{	printf ("Error opening %s: status = 0x%x\n", symTblName, errno);	return (ERROR);	}    /* load system symbol table */    loadAddr = 0;		/* to prevent symbols from being relocated */    /* SPR 22644 - loadModuleAt will fire any C++ ctors it finds     * unless the ctors strategy is set to MANUAL. We must prevent     * this since loadSymTbl should just "load the symbol table"! */    /* save ctors strategy and temporarily set to MANUAL*/    savedCplusXtorStrategy = cplusXtorStrategy;    cplusXtorStrategy = MANUAL;    if (loadModuleAt (symfd, HIDDEN_MODULE | ((sysFlags & SYSFLG_DEBUG)					      ? LOAD_ALL_SYMBOLS					      : LOAD_GLOBAL_SYMBOLS),		      &loadAddr, &loadAddr, &loadAddr) == NULL)	{  	printf ("Error loading symbol table: status = 0x%x\n", errno);	close (symfd);	/* restore ctors strategy */  	cplusXtorStrategy = savedCplusXtorStrategy;	return (ERROR);	}    close (symfd);    /* restore ctors strategy */      cplusXtorStrategy = savedCplusXtorStrategy;      return (OK);    }#endif	/* INCLUDE_NET_SYM_TBL */#endif	/* __INCusrLoadSymc */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -