From: Antonio Ospite Date: Sat, 28 Jun 2014 08:53:53 +0000 (+0200) Subject: ddsect.sh: fix calculating END_ADDRESS X-Git-Url: https://git.ao2.it/ddsect.git/commitdiff_plain/dfc0a89d1af98db9e1c5b6bbef874dc545eb1a08?hp=0cf32b433cd2b1c528cf273c9d589841c25c9d90 ddsect.sh: fix calculating END_ADDRESS Calculate the actual end address of the section, this way it could be reused in other memory layout files. Adjust also the size calculation, so that the value will be the same as before. --- diff --git a/ddsect.sh b/ddsect.sh index b1c5122..1a27e5f 100755 --- a/ddsect.sh +++ b/ddsect.sh @@ -34,11 +34,11 @@ parse_map_file() do RANGE=$(echo $line | cut -d ':' -f 1) START_ADDRESS=$(( $(echo $RANGE | cut -d '-' -f 1) )) - END_ADDRESS=$(( $(echo $RANGE | cut -d '-' -f 2) )) + END_ADDRESS=$(( $(echo $RANGE | cut -d '-' -f 2) - 1)) NAME=$(echo $line | cut -d ':' -f 2 | sed -e 's/^"//' -e 's/"$//') - SIZE=$(($END_ADDRESS - $START_ADDRESS)) + SIZE=$(($END_ADDRESS - $START_ADDRESS + 1)) SIZE_KiB=$(($SIZE / 1024))