Here's a testing program called dumpmem.c that you can include in your first boot image, so that you can look at physical memory locations:
#include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <inttypes.h> #include <string.h> #include <sys/neutrino.h> int main( int argc, char **argv ) { char *ptr; size_t len; uint64_t addr; long int ltmp; char c; int i; if ( argc < 3 ) { fprintf(stderr,"enter addr and size\n"); exit(1); } addr = strtoull( argv[1], NULL, 0 ); ltmp = strtol( argv[2], NULL, 0 ); len = ltmp; fprintf(stderr,"Dumping %d (0x%x) bytes at addr 0x%llx\n", len, len, addr ); ThreadCtl( _NTO_TCTL_IO, 0); ptr = mmap_device_memory( 0, len, PROT_READ|PROT_WRITE|PROT_NOCACHE, 0, addr ); if ( ptr == MAP_FAILED ) { perror( "mmap_device_memory for physical address failed" ); exit( EXIT_FAILURE ); } for ( i=0; i < len; i++ ) { c =(*(ptr+i) & 0xff); if ( isprint(c) ) fprintf(stderr, "%c", c ); fprintf(stderr, "[%x] ", c ); if ( ( i % 20 ) == 0 ) fprintf(stderr,"\n"); } }
For example, to print the first 100 bytes at address 0x600000 (to look for the "imagefs" signature), type:
dumpmem 0x600000 100