dtb_object.cc (9538:182d67b5b57a) | dtb_object.cc (10508:aa46a8ae3487) |
---|---|
1/* 2 * Copyright (c) 2013 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 21 unchanged lines hidden (view full) --- 30 31#include <sys/mman.h> 32#include <err.h> 33#include <unistd.h> 34 35#include <cassert> 36 37#include "base/loader/dtb_object.hh" | 1/* 2 * Copyright (c) 2013 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 21 unchanged lines hidden (view full) --- 30 31#include <sys/mman.h> 32#include <err.h> 33#include <unistd.h> 34 35#include <cassert> 36 37#include "base/loader/dtb_object.hh" |
38#include "sim/byteswap.hh" |
|
38#include "fdt.h" 39#include "libfdt.h" 40 41ObjectFile * 42DtbObject::tryFile(const std::string &fname, int fd, size_t len, uint8_t *data) 43{ 44 // Check if this is a FDT file by looking for magic number 45 if (fdt_magic((void*)data) == FDT_MAGIC) { --- 103 unchanged lines hidden (view full) --- 149 munmap(fileData, this->len); 150 fileData = fdt_buf_w_space; 151 fileDataMmapped = false; 152 this->len = newLen; 153 154 return true; 155} 156 | 39#include "fdt.h" 40#include "libfdt.h" 41 42ObjectFile * 43DtbObject::tryFile(const std::string &fname, int fd, size_t len, uint8_t *data) 44{ 45 // Check if this is a FDT file by looking for magic number 46 if (fdt_magic((void*)data) == FDT_MAGIC) { --- 103 unchanged lines hidden (view full) --- 150 munmap(fileData, this->len); 151 fileData = fdt_buf_w_space; 152 fileDataMmapped = false; 153 this->len = newLen; 154 155 return true; 156} 157 |
158Addr 159DtbObject::findReleaseAddr() 160{ 161 void *fd = (void*)fileData; 162 163 int offset = fdt_path_offset(fd, "/cpus/cpu@0"); 164 int len; 165 166 const void* temp = fdt_getprop(fd, offset, "cpu-release-addr", &len); 167 Addr rel_addr = 0; 168 169 if (len > 3) 170 rel_addr = betoh(*static_cast<const uint32_t*>(temp)); 171 if (len == 8) 172 rel_addr = (rel_addr << 32) | betoh(*(static_cast<const uint32_t*>(temp)+1)); 173 174 return rel_addr; 175} 176 177 |
|
157bool 158DtbObject::loadGlobalSymbols(SymbolTable *symtab, Addr addrMask) 159{ 160 // nothing to do here 161 return false; 162} 163 164bool 165DtbObject::loadLocalSymbols(SymbolTable *symtab, Addr addrMask) 166{ 167 // nothing to do here 168 return false; 169} | 178bool 179DtbObject::loadGlobalSymbols(SymbolTable *symtab, Addr addrMask) 180{ 181 // nothing to do here 182 return false; 183} 184 185bool 186DtbObject::loadLocalSymbols(SymbolTable *symtab, Addr addrMask) 187{ 188 // nothing to do here 189 return false; 190} |