kernel_memory_dump

SPPURV1 13-ta vezba vezba 13 SPPURV

May 20th, 2015
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. SecondPass* doSecondPass(FirstPass** firstPass)
  2. {
  3. SecondPass* secondPass;
  4. int bapp;
  5.  
  6. //init second pass data
  7.  
  8. secondPass = (SecondPass*)malloc(sizeof(SecondPass));
  9.  
  10. secondPass->textSection.size = 0;
  11.  
  12. for(int i = 0; i < __NFILE__; i++)
  13. {
  14.         secondPass->textSection.size += firstPass[i]->textSection.size;
  15. }
  16.  
  17. secondPass->textSection.buffer = (char*)malloc(sizeof(char) * secondPass->textSection.size);
  18. memset(secondPass->textSection.buffer, 0x0, secondPass->textSection.size * sizeof(char));
  19.  
  20. secondPass->dataSection.size = 0;
  21. secondPass->dataSection.buffer = NULL;
  22.  
  23. // your code should go here
  24.  
  25. list<RelTableEntry*>::iterator it;
  26. for(int i = 0; i < __NFILE__; i++)
  27. {
  28. for(it = firstPass[i]->relTable->begin();; it != firstPass[i]->relTable->end(); ++it)
  29. {
  30.         SymbolTableEntry ste = *findSymbol((*it)->symbolName);
  31.         relMips26((Elf32_Word*)(firstPass[0]->textSection.buffer + (*it)->offset), ste.pap + ste.value);
  32. }      
  33. int offset = 0;
  34. memcpy(secondPass->textSection.buffer + offset, firstPass[i]->textSection.buffer, firstPass[i]>textSection.size); offset += firstPass[i]->textSection.size;
  35. }
  36.  
  37. return secondPass;
  38. }
Add Comment
Please, Sign In to add comment