@@ -971,6 +971,24 @@ impl EntryOptions {
971
971
pub struct InterruptStackFrame ( InterruptStackFrameValue ) ;
972
972
973
973
impl InterruptStackFrame {
974
+ /// Creates a new interrupt stack frame with the given values.
975
+ #[ inline]
976
+ pub fn new (
977
+ instruction_pointer : VirtAddr ,
978
+ code_segment : SegmentSelector ,
979
+ cpu_flags : RFlags ,
980
+ stack_pointer : VirtAddr ,
981
+ stack_segment : SegmentSelector ,
982
+ ) -> Self {
983
+ Self ( InterruptStackFrameValue :: new (
984
+ instruction_pointer,
985
+ code_segment,
986
+ cpu_flags,
987
+ stack_pointer,
988
+ stack_segment,
989
+ ) )
990
+ }
991
+
974
992
/// Gives mutable access to the contents of the interrupt stack frame.
975
993
///
976
994
/// The `Volatile` wrapper is used because LLVM optimizations remove non-volatile
@@ -1030,6 +1048,26 @@ pub struct InterruptStackFrameValue {
1030
1048
}
1031
1049
1032
1050
impl InterruptStackFrameValue {
1051
+ /// Creates a new interrupt stack frame with the given values.
1052
+ #[ inline]
1053
+ pub fn new (
1054
+ instruction_pointer : VirtAddr ,
1055
+ code_segment : SegmentSelector ,
1056
+ cpu_flags : RFlags ,
1057
+ stack_pointer : VirtAddr ,
1058
+ stack_segment : SegmentSelector ,
1059
+ ) -> Self {
1060
+ Self {
1061
+ instruction_pointer,
1062
+ code_segment,
1063
+ _reserved1 : Default :: default ( ) ,
1064
+ cpu_flags,
1065
+ stack_pointer,
1066
+ stack_segment,
1067
+ _reserved2 : Default :: default ( ) ,
1068
+ }
1069
+ }
1070
+
1033
1071
/// Call the `iretq` (interrupt return) instruction.
1034
1072
///
1035
1073
/// This function doesn't have to be called in an interrupt handler.
0 commit comments