diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-07-15 09:58:58 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-07-15 09:58:58 (GMT) |
commit | 52d721c47cce927345cb5e66674ca2cc48d75349 (patch) | |
tree | fbfb4e38586f96f17e282b45851c70edaa5e0536 /src/glibext/gbinportion.c | |
parent | f3184725ec750317c04f1989ac83c2bbc75865a9 (diff) |
Truncated binary portions to fit the binary content size if needed.
Diffstat (limited to 'src/glibext/gbinportion.c')
-rw-r--r-- | src/glibext/gbinportion.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c index b8e3ed7..731cd08 100644 --- a/src/glibext/gbinportion.c +++ b/src/glibext/gbinportion.c @@ -485,6 +485,40 @@ const mrange_t *g_binary_portion_get_range(const GBinPortion *portion) } +/****************************************************************************** +* * +* Paramètres : portion = description de partie à mettre à jour. * +* max = première position physique hors limite. * +* * +* Description : Assure qu'une portion ne dépasse pas une position donnée. * +* * +* Retour : true si la portion a été modifiée, false sinon. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool g_binary_portion_limit_range(GBinPortion *portion, phys_t max) +{ + bool result; /* Bilan à retourner */ + vmpa2t end; /* Limite actuelle de portion */ + const vmpa2t *start; /* Position de départ */ + + compute_mrange_end_addr(&portion->range, &end); + + result = get_phy_addr(&end) > max; + + if (result) + { + start = get_mrange_addr(&portion->range); + set_mrange_length(&portion->range, max - get_phy_addr(start)); + + } + + return result; + +} + /****************************************************************************** * * |