Fix: Update Config structures to accurately reflect TCBs#314
Conversation
81ffbc1 to
d6c7866
Compare
f4afa2f to
ab943c0
Compare
|
@tylerfanelli Returned it to original api functionality, let me know how it looks |
ab943c0 to
ad66ab1
Compare
When we updated the TCB structure, we overlooked modifying the commit-related structures to account for differences in TCB layout across CPU generations. This commit ensures that raw TCB bytes are correctly constructed for the FFI layer, and that conversions from the user-level structure to the FFI format use the appropriate TCB structure based on the processor generation. The API snp_set_config function remains the same, it will tell the CPU generation using a CPUID call. Signed-off-by: DGonzalezVillal <Diego.GonzalezVillalobos@amd.com>
ad66ab1 to
2d1b3fc
Compare
|
|
||
| #[cfg(feature = "snp")] | ||
| /// TryFrom to FFI Config when manually passing in the CPU generation | ||
| impl TryFrom<(Config, Generation)> for FFI::types::SnpSetConfig { |
There was a problem hiding this comment.
I created both implementations in the previous version of the commit: one where we don’t retrieve the CPU generation automatically, and the user provides it manually. I kept this implementation in case we ever want to change the API or if a user wants to create configurations for hosts that are not their current machine.
I'm not sure if these are reasonable use cases. This implementation is currently unused in the library—if you think it’s unnecessary, I’m happy to remove it.
There was a problem hiding this comment.
Ok, I guess it doesn't hurt to include.
|
|
||
| #[cfg(feature = "snp")] | ||
| /// TryFrom from FFI Config type when CPU Generation is manually passed in | ||
| impl TryFrom<(FFI::types::SnpSetConfig, Generation)> for Config { |
There was a problem hiding this comment.
This as well. In what context is this used?
When we updated the TCB structure, we overlooked modifying the config-related structures to account for differences in TCB layout across CPU generations.
This commit ensures that raw TCB bytes are correctly constructed for the FFI layer, and that conversions from the user-level structure to the FFI format use the appropriate TCB structure based on the processor generation.