kobj_boot.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*/
#include <sys/bootconf.h>
#include <sys/kobj_impl.h>
#include <sys/archsystm.h>
/*
* We don't use the global offset table, but
* ld may throw in an UNDEFINED reference in
* our symbol table.
*/
#pragma weak _GLOBAL_OFFSET_TABLE_
/*
* Note: doflush() must be inlined, since we call it before we
* have relocated ourselves.
*/
/*
* Boot transfers control here. At this point,
* we haven't relocated our own symbols, so the
* world (as we know it) is pretty small right now.
*/
void
void *romp,
{
int i;
for (i = 0; i < BA_NUM; i++)
/*
* Check the bootstrap vector.
*/
case EB_AUXV:
break;
case EB_DYNAMIC:
break;
}
}
return;
/*
* Now the aux vector.
*/
case AT_PHDR:
break;
case AT_PHENT:
break;
case AT_PHNUM:
break;
case AT_PAGESZ:
break;
case AT_SUN_LDELF:
break;
case AT_SUN_LDSHDR:
break;
case AT_SUN_LDNAME:
break;
case AT_SUN_LPAGESZ:
break;
case AT_SUN_IFLUSH:
break;
case AT_SUN_CPU:
break;
case AT_ENTRY:
break;
}
}
/*
* Build cache table for section addresses.
*/
for (i = 0; i < sh_num; i++) {
}
/*
* Find the end of data
* (to allocate bss)
*/
break;
}
}
return;
/*
* Find the symbol table, and then loop
* through the symbols adjusting their
* values to reflect where the sections
* were loaded.
*/
for (i = 1; i < sh_num; i++) {
continue;
continue;
/*
* Assign the addresses for COMMON
* symbols even though we haven't
* actually allocated bss yet.
*/
/*
* Squirrel it away for later.
*/
continue;
return;
/*
* Symbol's new address.
*/
}
}
/*
* Allocate bss for COMMON, if any.
*/
} else {
align = BO_NO_ALIGN;
}
int (*bsys_1275_call)(void *);
char allocstr[6];
(int (*)(void *))bootops->bsys_1275_call;
allocstr[0] = 'a';
(void) (bsys_1275_call)(args);
return;
}
/*
* Zero it.
*/
*(char *)va = 0;
/*
* Update the size of data.
*/
}
/*
* Relocate our own symbols. We'll handle the
* undefined symbols later.
*/
for (i = 1; i < sh_num; i++) {
int relocsize;
continue;
/*
* Get the section being relocated
* and the symbol table.
*/
/*
* Loop through relocations.
*/
register unsigned long stndx;
int rtype;
if (rtype == R_SPARC_NONE) {
continue;
}
/*
* if R_SPARC_RELATIVE, simply add base addr
* to reloc location
*/
if (rtype == R_SPARC_RELATIVE) {
} else {
/*
* Check for bad symbol index.
*/
return;
/*
* Just bind our own symbols at this point.
*/
continue;
}
STB_LOCAL) {
/*
* If PC-relative, subtract ref addr.
*/
if (rtype == R_SPARC_PC10 ||
rtype == R_SPARC_PC22 ||
rtype == R_SPARC_DISP8 ||
rtype == R_SPARC_DISP16 ||
rtype == R_SPARC_DISP32 ||
rtype == R_SPARC_WPLT30 ||
rtype == R_SPARC_WDISP30 ||
rtype == R_SPARC_WDISP22 ||
rtype == R_SPARC_WDISP16 ||
rtype == R_SPARC_WDISP19)
}
}
return;
/*
* insert value calculated at reference point
* 3 cases - normal byte order aligned, normal byte
* order unaligned, and byte swapped
* for the swapped and unaligned cases we insert value
* a byte at a time
*/
switch (rtype) {
case 40123:
/*
* This isn't a real relocation type.
* It just confuses the compiler
* sufficiently that it can't generate
* a jump table -- tee hee
*/
return;
case R_SPARC_GLOB_DAT: /* 32bit word aligned */
case R_SPARC_RELATIVE:
case R_SPARC_DISP32:
case R_SPARC_32:
/*
* 7/19/89 rmk adding current value of
* *offptr to value. Should not be needed,
* since this is a RELA type and *offptr
* should be in addend
*/
break;
case R_SPARC_8:
case R_SPARC_DISP8:
else
return;
break;
case R_SPARC_LO10:
case R_SPARC_PC10:
break;
case R_SPARC_13:
else
return;
break;
case R_SPARC_16:
case R_SPARC_DISP16:
else
return;
break;
case R_SPARC_22:
else
return;
break;
case R_SPARC_PC22:
else
return;
break;
case R_SPARC_WDISP22:
else
return;
break;
case R_SPARC_HI22:
break;
case R_SPARC_WDISP30:
case R_SPARC_WPLT30:
break;
case R_SPARC_UA32: {
union {
uint32_t l;
char c[4];
} symval;
break;
}
case R_SPARC_10:
else
return;
break;
case R_SPARC_11:
else
return;
break;
case R_SPARC_WDISP16:
| (value & 0x3fff));
} else
return;
break;
case R_SPARC_WDISP19:
else
return;
break;
case R_SPARC_5:
else
return;
break;
case R_SPARC_6:
else
return;
break;
case R_SPARC_7:
else
return;
break;
case R_SPARC_LM22:
break;
case R_SPARC_HH22:
break;
case R_SPARC_HM10:
break;
case R_SPARC_64:
break;
default:
return;
}
/*
* We only need to do it once.
*/
} /* while */
}
/*
* Done relocating all of our *defined*
* symbols, so we hand off.
*/
}