Prev: D2007 does not do "multiplication illimination" optimization...
Next: Was NOP deprecated for AA64? NASM not disassembling...
From: peter on 17 Feb 2010 23:58 Hi I am adding a "page up" and "page down" button to the instruction panel (http://peter-bochs.googlecode.com/files/screendump20100203.png) For the page up button, I don't know how to calculate the address to start to disassemble. For example, if I am disassembling 0x1000 address, how can I know what address I should disassemble after pressing the "page up" button, it could be 0xff0, 0xff1, 0xff2. Currently I use this method, but it has bug, arround 50% will disassemble the correct result: save the first 10 instructions into an array, keep trying to disassemble the previous address (decrease the address one by one to try), if those 10 instructions appears again, that mean I have disassemble the correct address. thanks from Peter (cmk128(a)hotmail.com)
From: Alexei A. Frounze on 18 Feb 2010 01:43 On Feb 17, 8:58 pm, peter <cmk...(a)gmail.com> wrote: > Hi > I am adding a "page up" and "page down" button to the instruction > panel (http://peter-bochs.googlecode.com/files/screendump20100203.png) > > For the page up button, I don't know how to calculate the address to > start to disassemble. For example, if I am disassembling 0x1000 > address, how can I know what address I should disassemble after > pressing the "page up" button, it could be 0xff0, 0xff1, 0xff2. > > Currently I use this method, but it has bug, arround 50% will > disassemble the correct result: save the first 10 instructions into > an array, keep trying to disassemble the previous address (decrease > the address one by one to try), if those 10 instructions appears > again, that mean I have disassemble the correct address. > > thanks > from Peter (cmk...(a)hotmail.com) You can't implement this correctly in general when your instructions have variable length and even may overlap with data. You may only try or let the user do this by allowing him to adjust the address on the first line by +/-1 in an easy manner. Alex
From: peter on 18 Feb 2010 03:22 On 2æ18æ¥, ä¸å2æ43å, "Alexei A. Frounze" <alexfrun...(a)gmail.com> wrote: > On Feb 17, 8:58 pm, peter <cmk...(a)gmail.com> wrote: > > > > > > > Hi > >   I am adding a "page up" and "page down" button to the instruction > > panel (http://peter-bochs.googlecode.com/files/screendump20100203.png) > > > For the page up button, I don't know how to calculate the address to > > start to disassemble. For example, if I am disassembling 0x1000 > > address, how can I know what address I should disassemble after > > pressing the "page up" button, it could be 0xff0, 0xff1, 0xff2. > > > Currently I use this method, but it has bug, arround 50% will > > disassemble the correct result:  save the first 10 instructions into > > an array, keep trying to disassemble the previous address (decrease > > the address one by one to try), if those 10 instructions appears > > again, that mean I have disassemble the correct address. > > > thanks > > from Peter (cmk...(a)hotmail.com) > > You can't implement this correctly in general when your instructions > have variable length and even may overlap with data. You may only try > or let the user do this by allowing him to adjust the address on the > first line by +/-1 in an easy manner. > Alex thanks, I agree
From: wolfgang kern on 18 Feb 2010 06:00 peter asked: > Hi Hello, > I am adding a "page up" and "page down" button to the instruction > panel (http://peter-bochs.googlecode.com/files/screendump20100203.png) > For the page up button, I don't know how to calculate the address to > start to disassemble. For example, if I am disassembling 0x1000 > address, how can I know what address I should disassemble after > pressing the "page up" button, it could be 0xff0, 0xff1, 0xff2. > Currently I use this method, but it has bug, arround 50% will > disassemble the correct result: save the first 10 instructions into > an array, keep trying to disassemble the previous address (decrease > the address one by one to try), if those 10 instructions appears > again, that mean I have disassemble the correct address. > thanks > from Peter (cmk128(a)hotmail.com) I once tried this too and also used backwards byte stepping, but it will only be correct if it starts with the max. possible instruction-length (14/15 bytes depending on mode) and it heavy fails if code is mixed with data. It only remembered the last known start address of the first visible line for matching. So finally I just remember the address of the previous page start (even page size may vary with selected display layout) and use the cursor keys for moving back one byte at a time. This way allow to see otherwise hidden entry-points in addition. __ wolfgang
From: peter on 18 Feb 2010 11:46
On 2æ18æ¥, ä¸å7æ00å, "wolfgang kern" <nowh...(a)never.at> wrote: > peter asked:> Hi > > Hello, > > >   I am adding a "page up" and "page down" button to the instruction > > panel (http://peter-bochs.googlecode.com/files/screendump20100203.png) > > For the page up button, I don't know how to calculate the address to > > start to disassemble. For example, if I am disassembling 0x1000 > > address, how can I know what address I should disassemble after > > pressing the "page up" button, it could be 0xff0, 0xff1, 0xff2. > > Currently I use this method, but it has bug, arround 50% will > > disassemble the correct result:  save the first 10 instructions into > > an array, keep trying to disassemble the previous address (decrease > > the address one by one to try), if those 10 instructions appears > > again, that mean I have disassemble the correct address. > > thanks > > from Peter (cmk...(a)hotmail.com) > > I once tried this too and also used backwards byte stepping, > but it will only be correct if it starts with the max. possible > instruction-length (14/15 bytes depending on mode) and it heavy > fails if code is mixed with data. It only remembered the last > known start address of the first visible line for matching. > > So finally I just remember the address of the previous page start > (even page size may vary with selected display layout) and use > the cursor keys for moving back one byte at a time. > This way allow to see otherwise hidden entry-points in addition. > > __ > wolfgang thanks too |