Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Decrypting

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 23rd September 2008, 08:12   #10  |  Link
Oopho2ei
Guest
 
Posts: n/a
Quote:
Originally Posted by schluppo View Post
This prevents people from using a PC-trace beyond ~8,000,000 instructions. Even splitting the big file into smaller 16mb-files and trying to reload traces after every 8,000,000 instructions does not help and throws the same exception.
Try to read only 1MB from the traces into memory and store it in a ring buffer like:
Code:
uint32 ringsize = 0x40000;

unit32 ringbuffer[ringsize];
uint32 i = 0; // entry pointer in trace file

fopen(...)

// initialize the buffer
fread(ringbuffer, sizeof(uint32), ringsize, trace_file);

while (1)
{
  printf("current pc is: %08d\n", ringbuffer[i % ringsize]);

  i++; // switch to next pc entry

  // usually we could write and read at the same time (two threads)
  // i assume only one thread so i refresh/write the entire buffer at once
  if( i % ringsize == 0) // check if are back to our starting point (walked the ring all the way around). if so refresh the buffer
  {
    // read the next MB into the buffer
    fread(ringbuffer, sizeof(uint32), ringsize, trace_file);
  }
}
I wrote this in only a few minutes (so there might be a mistake) but i hope it helps.

Last edited by Oopho2ei; 23rd September 2008 at 16:31. Reason: added missing "== 0"
  Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:35.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.