
Am 01.11.2011 16:28, schrieb Mike Frysinger:
On Tuesday 01 November 2011 10:07:31 Matthias Weisser wrote:
--- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c
+void *os_mmap(void *addr, size_t length, int prot, int flags, int fd,
off_t offset)
+{
- return mmap((void *)addr, length, PROT_READ | PROT_WRITE,
void cast here is unnecessary
Right.
--- a/arch/sandbox/lib/board.c +++ b/arch/sandbox/lib/board.c
+static gd_t gd_mem;
i don't think this indirection is necessary. probably can replace the static gd_mem with: gd_t gd;
AFAIK gd is a pointer. So I think we always need some sort of memory where the actual structure is stored.
+#define CONFIG_SYS_SDRAM_BASE 0x20000000 ...
- mem = malloc(size);
- mem = os_mmap((void *)CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_SDRAM_SIZE,
0, 0, -1, 0);
mmap() makes no guarantee that the requested address is what you'll get back. so there's no point in having this SDRAM_BASE define. punt it and pass in NULL instead.
But it works in most cases :-) The point of adding it was that I really like to have memory aligned on a 256MB boundary or so like it is in most SOCs. But thats a personal preference. And if it doesn't work you can still get the address of physical memory from bdinfo.
also, with Simon's other patch to md to use the remap func, the address of our memory backing store doesn't matter.
Well, you are right. But with the posted patch you don't need any remap function and md/mm/mtest/mw works out of the box.
Regards Matthias