solo5 icon indicating copy to clipboard operation
solo5 copied to clipboard

Custom block size

Open reynir opened this issue 2 years ago • 1 comments

This adds an option to specify a block size different from 512. The block size must be a power of 2 greater than or equal 512.

Marked as a draft as

  • it's not well tested,
  • I'm not sure about a few details and decisions.

Some things to investigate (CC @Julow):

  • [ ] Does the restriction on block size make sense?
  • [ ] What other components require block sizes to be >= 512 ?
  • [ ] Is here anything that might misbehave if it no longer exactly 512 ?
  • [ ] The mirage library has "preferred block size" to give a chance to the lower levels to enforce the block size. Should there be something similar here (get feedback from the lower levels instead of writing the rule in the parser) ?

reynir avatar Sep 13 '22 12:09 reynir

I had made some silly mistakes in the code that are now fixed. The following is the output from mirage-skeleton/device-usage/block:

$ solo5-hvt --block:storage=disk.img --block-size:storage=4096 -- block_test.hvt 
            |      ___|
  __|  _ \  |  _ \ __ \
\__ \ (   | | (   |  ) |
____/\___/ _|\___/____/
Solo5: Bindings version v0.7.3
Solo5: Memory map: 512 MB addressable:
Solo5:   reserved @ (0x0 - 0xfffff)
Solo5:       text @ (0x100000 - 0x1ebfff)
Solo5:     rodata @ (0x1ec000 - 0x224fff)
Solo5:       data @ (0x225000 - 0x2dbfff)
Solo5:       heap >= 0x2dc000 < stack < 0x20000000
2022-09-15 08:38:27 -00:00: INF [block] sectors = 12500
read_write=true
sector_size=4096

2022-09-15 08:38:27 -00:00: ERR [block] Expecting error output from the following operation...
2022-09-15 08:38:27 -00:00: ERR [block] Expecting error output from the following operation...
2022-09-15 08:38:27 -00:00: ERR [block] Expecting error output from the following operation...
2022-09-15 08:38:27 -00:00: ERR [block] Expecting error output from the following operation...
2022-09-15 08:38:27 -00:00: INF [block] Test sequence finished

2022-09-15 08:38:27 -00:00: INF [block] Total tests started: 10

2022-09-15 08:38:27 -00:00: INF [block] Total tests passed:  10

2022-09-15 08:38:27 -00:00: INF [block] Total tests failed:  0

reading 1 sectors at 12500
reading 12 sectors at 12489
Solo5: solo5_exit(0) called

reynir avatar Sep 15 '22 08:09 reynir

I think this is ready once we add to the usage message a warning that changing this could break atomicity.

reynir avatar Oct 27 '22 11:10 reynir

Thanks all of you for this great work. We must notice that such work is only integrated for hvt and spt. The work seems fine as far as I can say and thanks to add more tests about that 👍 .

dinosaure avatar Nov 04 '22 14:11 dinosaure