bergvelt memory model presentation
TRANSCRIPT
![Page 1: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/1.jpg)
Background Existing Memory Model New Memory Model Closing
A Memory Model for Expanded LLVM Semanticsin Isabelle
Presented by: David Bergvelt
University of Illinois
Friday 6 November 2015
![Page 2: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/2.jpg)
Background Existing Memory Model New Memory Model Closing
Background
![Page 3: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/3.jpg)
Background Existing Memory Model New Memory Model Closing
From last time
Expand LLVM semantics in Isabelle to allow complex datastructures
getelementptr is used to index through structures
![Page 4: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/4.jpg)
Background Existing Memory Model New Memory Model Closing
From last time
Expand LLVM semantics in Isabelle to allow complex datastructures
getelementptr is used to index through structures
![Page 5: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/5.jpg)
Background Existing Memory Model New Memory Model Closing
getelementptr
getelementptr
Allows us to index through structures by performing addresscalculation
Pass in pointer and list of indices
Inbounds checking
Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”
Problem: how do we perform inbounds checks?
![Page 6: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/6.jpg)
Background Existing Memory Model New Memory Model Closing
getelementptr
getelementptr
Allows us to index through structures by performing addresscalculation
Pass in pointer and list of indices
Inbounds checking
Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”
Problem: how do we perform inbounds checks?
![Page 7: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/7.jpg)
Background Existing Memory Model New Memory Model Closing
getelementptr
getelementptr
Allows us to index through structures by performing addresscalculation
Pass in pointer and list of indices
Inbounds checking
Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”
Problem: how do we perform inbounds checks?
![Page 8: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/8.jpg)
Background Existing Memory Model New Memory Model Closing
getelementptr
getelementptr
Allows us to index through structures by performing addresscalculation
Pass in pointer and list of indices
Inbounds checking
Works as general memory traversal tool when inboundschecking is disabled
Int to pointer, pointer to int bitcasting ”flavor”
Problem: how do we perform inbounds checks?
![Page 9: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/9.jpg)
Background Existing Memory Model New Memory Model Closing
getelementptr
getelementptr
Allows us to index through structures by performing addresscalculation
Pass in pointer and list of indices
Inbounds checking
Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”
Problem: how do we perform inbounds checks?
![Page 10: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/10.jpg)
Background Existing Memory Model New Memory Model Closing
getelementptr
getelementptr
Allows us to index through structures by performing addresscalculation
Pass in pointer and list of indices
Inbounds checking
Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”
Problem: how do we perform inbounds checks?
![Page 11: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/11.jpg)
Background Existing Memory Model New Memory Model Closing
Existing Memory Model
![Page 12: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/12.jpg)
Background Existing Memory Model New Memory Model Closing
Memory access datatype
![Page 13: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/13.jpg)
Background Existing Memory Model New Memory Model Closing
Base memory model
![Page 14: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/14.jpg)
Background Existing Memory Model New Memory Model Closing
New Memory Model
![Page 15: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/15.jpg)
Background Existing Memory Model New Memory Model Closing
What do we need to change?
Sized memory access datatype
Raw addresses represented as ’a words
to allow for non-inbounds traversal with getelementptr
![Page 16: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/16.jpg)
Background Existing Memory Model New Memory Model Closing
What do we need to change?
Sized memory access datatype
Raw addresses represented as ’a words
to allow for non-inbounds traversal with getelementptr
![Page 17: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/17.jpg)
Background Existing Memory Model New Memory Model Closing
What do we need to change?
Sized memory access datatype
Raw addresses represented as ’a words
to allow for non-inbounds traversal with getelementptr
![Page 18: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/18.jpg)
Background Existing Memory Model New Memory Model Closing
Implementation (Structures)
allocation::(raw_block set)
raw_block = {start::raw_address, length::(’a uword),memory::((’a word) -> value)}
raw_address::(’a word)
![Page 19: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/19.jpg)
Background Existing Memory Model New Memory Model Closing
Implementation (Assumptions)
good_allocation::(allocation->bool)
good_allocation RBS = (for all rb in RBS and all rb2 in RBS,good_rb_pair rb1 rb2)
good_rb_pair::(raw_block -> raw_block->bool)
good_rb_pair rb1 rb2 = (good_block rb1) &((rb1.start = rb2.start) -> (rb1 = rb2)) &((rb1.start < rb2.start) -> (rb1.start+rb1.length <= rb2.start))
good_block::(raw_block -> bool)
good_block rb = ((rb.start + rb.length) < (max uword)) &(rb.length>=1)
![Page 20: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/20.jpg)
Background Existing Memory Model New Memory Model Closing
Closing
![Page 21: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/21.jpg)
Background Existing Memory Model New Memory Model Closing
Thank you!
Sources:
Concrete Semanticshttp://www.concrete-semantics.org/concrete-semantics.pdf
LLVM Language Reference Manualhttp://llvm.org/docs/LangRef.html
![Page 22: Bergvelt memory model presentation](https://reader038.vdocuments.net/reader038/viewer/2022110110/58a606d91a28abf6198b6a7f/html5/thumbnails/22.jpg)
Background Existing Memory Model New Memory Model Closing
Thank you!
Sources:
Concrete Semanticshttp://www.concrete-semantics.org/concrete-semantics.pdf
LLVM Language Reference Manualhttp://llvm.org/docs/LangRef.html