(&mut self, vmctx: Reg)
| 125 | } |
| 126 | |
| 127 | fn check_stack(&mut self, vmctx: Reg) -> Result<()> { |
| 128 | let ptr_size: u8 = self.ptr_size.bytes().try_into().unwrap(); |
| 129 | |
| 130 | self.with_scratch::<IntScratch, _>(|masm, scratch| { |
| 131 | masm.load_ptr( |
| 132 | masm.address_at_reg(vmctx, ptr_size.vmcontext_store_context().into())?, |
| 133 | scratch.writable(), |
| 134 | )?; |
| 135 | |
| 136 | masm.load_ptr( |
| 137 | Address::offset( |
| 138 | scratch.inner(), |
| 139 | ptr_size.vmstore_context_stack_limit().into(), |
| 140 | ), |
| 141 | scratch.writable(), |
| 142 | )?; |
| 143 | |
| 144 | masm.add_stack_max(scratch.inner()); |
| 145 | |
| 146 | masm.asm.cmp_rr(scratch.inner(), regs::rsp(), masm.ptr_size); |
| 147 | masm.asm.trapif(IntCmpKind::GtU, TrapCode::STACK_OVERFLOW); |
| 148 | wasmtime_environ::error::Ok(()) |
| 149 | })?; |
| 150 | |
| 151 | // Emit unwind info. |
| 152 | if self.shared_flags.unwind_info() { |
| 153 | self.asm.unwind_inst(UnwindInst::DefineNewFrame { |
| 154 | offset_upward_to_caller_sp: Self::ABI::arg_base_offset().into(), |
| 155 | |
| 156 | // The Winch calling convention has no callee-save registers, so nothing will be |
| 157 | // clobbered. |
| 158 | offset_downward_to_clobbers: 0, |
| 159 | }) |
| 160 | } |
| 161 | Ok(()) |
| 162 | } |
| 163 | |
| 164 | fn push(&mut self, reg: Reg, size: OperandSize) -> Result<StackSlot> { |
| 165 | let bytes = match (reg.class(), size) { |
no test coverage detected