Skip to main content

luaur_code_gen/methods/
unwind_builder_win_start_function.rs

1use crate::records::unwind_builder_win::UnwindBuilderWin;
2
3impl UnwindBuilderWin {
4    pub fn start_function(&mut self) {
5        // End offset is filled in later and everything gets adjusted at the end
6        let mut func = crate::records::unwind_function_win::UnwindFunctionWin::default();
7        func.begin_offset = 0;
8        func.end_offset = 0;
9        func.unwind_info_offset =
10            unsafe { self.raw_data_pos.offset_from(self.raw_data.as_ptr()) as u32 };
11        self.unwind_functions.push(func);
12
13        self.unwind_codes.clear();
14        self.unwind_codes.reserve(16);
15
16        self.prolog_size = 0;
17
18        // rax has register index 0, which in Windows unwind info means that frame register is not used
19        self.frame_reg = crate::records::register_x_64::RegisterX64::rax;
20        self.frame_reg_offset = 0;
21    }
22}