capDL-tool fix for empty CNode slots
If you generate capdl for a CNode with empty slots, capDL-tool incorrectly calculates CDL_CapMap::num because it uses Map.size which doesn't include empty slots. The right way to calculate "num" is by taking the max of the key values +1. diff --git a/capDL-tool/CapDL/PrintC.hs b/capDL-tool/CapDL/PrintC.hs index ec0eda9..b4a2cbb 100644 --- a/capDL-tool/CapDL/PrintC.hs +++ b/capDL-tool/CapDL/PrintC.hs @@ -224,7 +224,7 @@ memberSlots objs obj_id slots irqNode cdt ms = showSlots objs obj_id (Map.toList slots) irqNode cdt ms +++ "}," where - slot_count = Map.size slots + slot_count = if Map.null slots then 0 else (fst $ Map.findMax slots) + 1 printInit :: [Word] -> String printInit argv = -Sam
Sam,
If you generate capdl for a CNode with empty slots, capDL-tool incorrectly calculates CDL_CapMap::num because it uses Map.size which doesn't include empty slots. The right way to calculate "num" is by taking the max of the key values +1.
Thanks for the patch. Could you make a pull request at https://github.com/seL4/capdl for this? Axel
Actually, I sent this prematurely. It appears to mess up something in the
VSpace construction. Please ignore for now.
On Wed, Apr 6, 2022 at 10:36 AM Axel Heider
Sam,
If you generate capdl for a CNode with empty slots, capDL-tool incorrectly calculates CDL_CapMap::num because it uses Map.size which doesn't include empty slots. The right way to calculate "num" is by taking the max of the key values +1.
Thanks for the patch. Could you make a pull request at https://github.com/seL4/capdl for this?
Axel
My change is just wrong; discard.
On Wed, Apr 6, 2022 at 11:07 AM Sam Leffler
Actually, I sent this prematurely. It appears to mess up something in the VSpace construction. Please ignore for now.
On Wed, Apr 6, 2022 at 10:36 AM Axel Heider
wrote: Sam,
If you generate capdl for a CNode with empty slots, capDL-tool incorrectly calculates CDL_CapMap::num because it uses Map.size which doesn't include empty slots. The right way to calculate "num" is by taking the max of the key values +1.
Thanks for the patch. Could you make a pull request at https://github.com/seL4/capdl for this?
Axel
participants (2)
-
Axel Heider
-
Sam Leffler