Advertisement
Guest User

Untitled

a guest
May 23rd, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #pragma once
  2. #include "firm.h"
  3.  
  4. int get_section_by_address (void *address) {
  5. int i;
  6. struct firm_section_header volatile *sh;
  7.  
  8. for (i=0; i < FIRM_MAX_SECTION_COUNT; i++) {
  9. sh = &firm->section_headers[i];
  10. if ((sh->address <= address) && (address < (sh->address + sh->size))) {
  11. return i;
  12. }
  13. }
  14. return -1;
  15. }
  16.  
  17. /* this could/should be added a few more checks */
  18. int is_valid_firm (void) {
  19. return (firm->magic == FIRM_MAGIC);
  20. }
  21.  
  22. void dump_section_header (int index) {
  23. struct firm_section_header volatile *sh;
  24.  
  25. sh = &firm->section_headers[index];
  26. Debug("Section %02d/%02d (ARM%s):", index, FIRM_MAX_SECTION_COUNT, sh->type ? "11" : "9");
  27. Debug("%08X - %08X", sh->address, sh->address + sh->size);
  28. Debug("");
  29. return;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement