1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-03 09:42:22 +02:00

API: Use stack pointer as API signature search hint in the glue layer.

De-hardcode range in RAM we search for the API signature. Instead use the stack
pointer as a hint to narrow down the range in which the signature could reside
(it is malloc'ed on the U-Boot heap, and is hoped to remain in some proximity
from stack area). Adjust PowerPC code in API demo to the new scheme.

Signed-off-by: Rafal Czubak <rcz@semihalf.com>
Signed-off-by: Rafal Jaworowski <raj@semihalf.com>
This commit is contained in:
Rafal Jaworowski
2009-01-23 13:27:15 +01:00
committed by Wolfgang Denk
parent 86b4bafdfa
commit b84d7d8f1e
3 changed files with 23 additions and 10 deletions

View File

@@ -60,13 +60,20 @@ static int valid_sig(struct api_signature *sig)
int api_search_sig(struct api_signature **sig) {
unsigned char *sp;
uint32_t search_start = 0;
uint32_t search_end = 0;
if (sig == NULL)
return 0;
sp = (unsigned char *)API_SEARCH_START;
if (search_hint == 0)
search_hint = 255 * 1024 * 1024;
while ((sp + (int)API_SIG_MAGLEN) < (unsigned char *)API_SEARCH_END) {
search_start = search_hint & ~0x000fffff;
search_end = search_start + API_SEARCH_LEN - API_SIG_MAGLEN;
sp = (unsigned char *)search_start;
while ((sp + API_SIG_MAGLEN) < (unsigned char *)search_end) {
if (!memcmp(sp, API_SIG_MAGIC, API_SIG_MAGLEN)) {
*sig = (struct api_signature *)sp;
if (valid_sig(*sig))