eclair: obtain MAP_KERNEL_START from kernel image
Change-Id: I946c640ddb2e2b32362760254a86c611517becf3
This commit is contained in:
@ -98,8 +98,8 @@ uintptr_t virt_to_phys(uintptr_t va)
|
||||
return (va - MAP_ST + PHYS_OFFSET);
|
||||
}
|
||||
|
||||
if (va >= MAP_KERNEL) {
|
||||
return (va - MAP_KERNEL + kernel_base);
|
||||
if (va >= MAP_KERNEL_START) {
|
||||
return (va - MAP_KERNEL_START + kernel_base);
|
||||
}
|
||||
|
||||
return NOPHYS;
|
||||
@ -107,7 +107,13 @@ uintptr_t virt_to_phys(uintptr_t va)
|
||||
|
||||
int arch_setup_constants(void)
|
||||
{
|
||||
/* Nothing here */
|
||||
MAP_KERNEL_START = lookup_symbol("_head");
|
||||
if (MAP_KERNEL_START == NOSYMBOL) {
|
||||
fprintf(stderr, "error: obtaining MAP_KERNEL_START\n");
|
||||
return 1;
|
||||
}
|
||||
printf("arm64 MAP_KERNEL_START 0x%lx\n", MAP_KERNEL_START);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -9,15 +9,11 @@
|
||||
#
|
||||
# if (CONFIG_ARM64_VA_BITS == 42)
|
||||
# /* VA_BITS=42, 64K_PAGE address */
|
||||
# define MAP_KERNEL 0xfffffc0007800000
|
||||
# define MAP_ST 0xfffffe0000000000
|
||||
# define MAP_KERNEL_TEXT "0xfffffc0007800000"
|
||||
#
|
||||
# elif (CONFIG_ARM64_VA_BITS == 48)
|
||||
# /* VA_BITS=48, 64K_PAGE address */
|
||||
# define MAP_KERNEL 0xffff000007800000
|
||||
# define MAP_ST 0xffff800000000000
|
||||
# define MAP_KERNEL_TEXT "0xffff000007800000"
|
||||
#
|
||||
# else
|
||||
#
|
||||
@ -29,15 +25,11 @@
|
||||
#
|
||||
# if (CONFIG_ARM64_VA_BITS == 39)
|
||||
# /* VA_BITS=39, 4K_PAGE address */
|
||||
# define MAP_KERNEL 0xffffff8007800000
|
||||
# define MAP_ST 0xffffffc000000000
|
||||
# define MAP_KERNEL_TEXT "0xffffff8007800000"
|
||||
#
|
||||
# elif (CONFIG_ARM64_VA_BITS == 48)
|
||||
# /* VA_BITS=48, 4K_PAGE address */
|
||||
# define MAP_KERNEL 0xffff000007800000
|
||||
# define MAP_ST 0xffff800000000000
|
||||
# define MAP_KERNEL_TEXT "0xffff000007800000"
|
||||
#
|
||||
# else
|
||||
#
|
||||
|
||||
@ -124,6 +124,16 @@ uintptr_t virt_to_phys(uintptr_t va)
|
||||
|
||||
int arch_setup_constants(void)
|
||||
{
|
||||
MAP_KERNEL_START = lookup_symbol("_head");
|
||||
if (MAP_KERNEL_START == NOSYMBOL) {
|
||||
fprintf(stderr, "error: obtaining MAP_KERNEL_START\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* One page extra head, see smp-x86.lds */
|
||||
MAP_KERNEL_START -= 0x1000;
|
||||
printf("x86 MAP_KERNEL_START 0x%lx\n", MAP_KERNEL_START);
|
||||
|
||||
if (read_symbol_64("linux_page_offset_base",
|
||||
&linux_page_offset) != 0) {
|
||||
fprintf(stderr, "error: obtaining Linux page offset\n");
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
#define MAP_ST_START 0xffff800000000000UL
|
||||
#define MAP_FIXED_START 0xffff860000000000UL
|
||||
#define MAP_KERNEL_START 0xFFFFFFFFFE800000UL
|
||||
extern unsigned long linux_page_offset;
|
||||
#define ARCH_CLV_SPAN "x86_cpu_local_variables_span"
|
||||
|
||||
|
||||
@ -60,6 +60,9 @@ struct thread_info {
|
||||
uintptr_t arch_clv;
|
||||
}; /* struct thread_info */
|
||||
|
||||
/* Virtual address where McKernel is mapped to */
|
||||
unsigned long MAP_KERNEL_START;
|
||||
|
||||
static struct options opt;
|
||||
static volatile int f_done = 0;
|
||||
static bfd *symbfd = NULL;
|
||||
@ -83,7 +86,6 @@ uintptr_t lookup_symbol(char *name)
|
||||
return (symtab[i]->section->vma + symtab[i]->value);
|
||||
}
|
||||
}
|
||||
#define NOSYMBOL ((uintptr_t)-1)
|
||||
return NOSYMBOL;
|
||||
} /* lookup_symbol() */
|
||||
|
||||
@ -794,10 +796,11 @@ static void command(const char *cmd, char *res, size_t res_size) {
|
||||
rbp += sprintf(rbp, "T0;tnotrun:0");
|
||||
}
|
||||
else if (!strncmp(p, "qXfer:memory-map:read::", 23)) {
|
||||
char *str =
|
||||
"<memory-map>"
|
||||
"<memory type=\"rom\" start=\""MAP_KERNEL_TEXT"\" length=\"0x27000\"/>"
|
||||
"</memory-map>";
|
||||
char str[1024];
|
||||
sprintf(str, "<memory-map>"
|
||||
"<memory type=\"rom\" start=\"0x%lx\" length=\"0x27000\"/>"
|
||||
"</memory-map>", MAP_KERNEL_START);
|
||||
|
||||
rbp += sprintf(rbp, "l");
|
||||
if (0)
|
||||
rbp += print_hex(rbp, res_size, str);
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
#include <inttypes.h>
|
||||
#include <arch-eclair.h>
|
||||
|
||||
extern unsigned long MAP_KERNEL_START;
|
||||
|
||||
/* common */
|
||||
int read_mem(uintptr_t va, void *buf, size_t size);
|
||||
#define NOSYMBOL ((uintptr_t)-1)
|
||||
|
||||
Reference in New Issue
Block a user