Comments (4)
When I searched, there is no way to define immutable field in struct.
I think that adding private realm_id
and ipa_bits
field in Rec and making only init()
and getter function is the best like the following comment in this reference
The best, as Lily Ballard noted, is that you can declare your Shape field as private and make a getter method using impl A {...}.
let me make a PR for it :)
from islet.
Please let me know if you are already implementing it :)
Nothing done yet. Appreciate it if you bring up this issue and make a draft PR! I'll happily get involved with that PR after that draft.
from islet.
Rec and making only init() and getter function
--> I agree this is good enough.
My initial thought on how to implement this is as follows.
// define accessor
impl<'a, E> EntryGuard<'a, E> {
// new function for child-parent access
// NOTE: ==> add a comment here about the two rules for child-parent access
pub fn parent_content<T: Content>(&self) -> &T {
// E: the type of child (e.g., Rec), T: the type of parent (e.g., Rd)
// <TODO> do type checking--> it looks like, either (1) or (2). ==> this is for Rule-1.
// (1) if E::type == Rec && T::type == Rd, error otherwise
// (2) if E::type::get_parent_type() == T::type, error otherwise
unsafe { &*(self.addr as *const T) }
}
// do not make parent_content_mut() as it violates Rule-2. ==> this is for Rule-2.
// pub fn parent_content_mut<T: Content>(&mut self) -> &mut T {
}
// how to use it
let mut rec_granule = get_granule_if!(arg[0], GranuleState::Rec)?;
let mut rec = rec_granule.content_mut::<Rec>();
let rd = rec_granule.parent_content::<Rd>();
// accessing Rd (parent) still requires the lock of Rec (child) but not require the lock of Rd (parent).
// in this way, it's guaranteed Rd (parent) is alive as it's guaranteed Rd never gets destroyed because of rec-granule-lock.
...
rd.id();
rd.ipa_bits();
from islet.
I see. thank you for the code. if we have to read other fields of parent a lot besides realm_id
, ipa_bits
, then that's a good approach.
Please let me know if you are already implementing it :)
from islet.
Related Issues (20)
- rust-rsi issue & SDK problem HOT 6
- Running islet with --normal-world=linux-net breaks network configuration on the host HOT 4
- Network is not configured on the realm HOT 5
- Compilation fails due to the latest switch from rsa to openssl HOT 1
- The list of code patterns where verification does not work well HOT 1
- Transfer projects from samsung/islet* to islet-projects/islet* HOT 1
- Rule checker workflow is failing on the main branch HOT 1
- Islet-cli segfaults, when launched from /shared folder with rmm=islet HOT 11
- Insert autopadding HOT 1
- Reproduce veraison demo HOT 8
- How to get a CCA machine or simulate CCA chip on X86_64? HOT 1
- RTT_INIT_RIPAS error due to some garbage in the delegated granule for RTT. HOT 1
- Failed to reproduce confidential-ml example HOT 1
- RMM v1.0-eac5 support HOT 1
- autopadding: Cannot cover struct type with a field in the struct
- Failure of unsafe-analyzer analysis
- Mentorship Opportunity for CCC Projects
- realm measurement using veraison HOT 9
- Issues with safety traits and interrupting attestation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from islet.