CS:IP entry point calculation seems to be incorrect
EmergReanimator opened this issue · 2 comments
According to: https://en.wikibooks.org/wiki/X86_Assembly/16,_32,_and_64_Bits
... to create a 20 bit address, it would be done by taking the 16-bit value of a segment register and put it on the address bus,
but shifted 4 times to the left (thus effectively multiplying the register by 16), and then by adding the offset from another
register untouched to the value on the bus, thus creating a full a 20-bit address.
If CS = 258C and IP = 001216, then CS:IP will point to a 20 bit address equivalent to "CS × 16 + IP" which will be
258C × 1016 + 001216 = 258C0 + 001216 = 258D2 (Remember: 16 decimal = 1016).
However the implementation is: https://github.com/python-intelhex/intelhex/blob/master/intelhex/scripts/hexinfo.py
if keys == ['CS','IP']:
entry = ih.start_addr['CS'] * 65536 + ih.start_addr['IP']
Is it not an implementation mistake?
Yes, this is error.
fixed, thanks.