	.file	"extr_intel_ctx.c_dmar_free_ctx_locked.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	dmar_free_ctx_locked
	.type	dmar_free_ctx_locked, @function
dmar_free_ctx_locked:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	mov	r12, rdi
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rsi
	sub	rsp, 16
	.cfi_def_cfa_offset 48
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	call	DMAR_ASSERT_LOCKED@PLT
	movsx	rsi, DWORD PTR 0[rbp]
	xor	edi, edi
	test	esi, esi
	setg	dil
	call	KASSERT@PLT
	mov	eax, DWORD PTR 0[rbp]
	cmp	eax, 1
	jg	.L14
	mov	eax, DWORD PTR 4[rbp]
	xor	edi, edi
	test	DWORD PTR DMAR_CTX_DISABLED[rip], eax
	mov	rsi, rbp
	sete	dil
	call	KASSERT@PLT
	mov	rdi, r12
	call	DMAR_UNLOCK@PLT
	mov	rsi, rsp
	mov	rdi, rbp
	call	dmar_map_ctx_entry@PLT
	mov	rdi, r12
	mov	r13, rax
	call	DMAR_LOCK@PLT
	movsx	rsi, DWORD PTR 0[rbp]
	xor	edi, edi
	test	esi, esi
	setg	dil
	call	KASSERT@PLT
	mov	eax, DWORD PTR 0[rbp]
	cmp	eax, 1
	jg	.L15
	mov	eax, DWORD PTR 4[rbp]
	xor	edi, edi
	test	DWORD PTR DMAR_CTX_DISABLED[rip], eax
	mov	rsi, rbp
	sete	dil
	call	KASSERT@PLT
	lea	rdi, 8[r13]
	call	dmar_pte_clear@PLT
	mov	QWORD PTR 0[r13], 0
	mov	rsi, r13
	mov	rdi, r12
	call	dmar_flush_ctx_to_ram@PLT
	mov	rdi, r12
	call	dmar_inv_ctx_glob@PLT
	mov	eax, DWORD PTR [r12]
	test	DWORD PTR DMAR_ECAP_DI[rip], eax
	je	.L5
	cmp	QWORD PTR 8[r12], 0
	mov	rdi, r12
	je	.L6
	call	dmar_qi_invalidate_iotlb_glob_locked@PLT
.L5:
	mov	rdi, QWORD PTR [rsp]
	call	dmar_unmap_pgtbl@PLT
	mov	rdi, rbp
	mov	r13, QWORD PTR 8[rbp]
	call	dmar_ctx_unlink@PLT
	mov	esi, DWORD PTR M_DMAR_CTX[rip]
	mov	rdi, rbp
	call	free@PLT
	mov	rsi, r13
	mov	rdi, r12
	call	dmar_unref_domain_locked@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L15:
	sub	eax, 1
	mov	rdi, r12
	mov	DWORD PTR 0[rbp], eax
	call	DMAR_UNLOCK@PLT
	mov	rdi, QWORD PTR [rsp]
	call	dmar_unmap_pgtbl@PLT
.L1:
	mov	rax, QWORD PTR 8[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L16
	add	rsp, 16
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	sub	eax, 1
	mov	rdi, r12
	mov	DWORD PTR 0[rbp], eax
	call	DMAR_UNLOCK@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L6:
	call	dmar_inv_iotlb_glob@PLT
	jmp	.L5
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	dmar_free_ctx_locked, .-dmar_free_ctx_locked
	.comm	TD_PREP_PINNED_ASSERT,4,4
	.comm	TD_PINNED_ASSERT,4,4
	.comm	M_DMAR_CTX,4,4
	.comm	DMAR_ECAP_DI,4,4
	.comm	DMAR_CTX_DISABLED,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_intel_ctx.c_dmar_free_ctx_locked.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	dmar_free_ctx_locked
	.syntax unified
	.arm
	.fpu softvfp
	.type	dmar_free_ctx_locked, %function
dmar_free_ctx_locked:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, lr}
	mov	r4, r1
	ldr	r3, .L17
	sub	sp, sp, #12
	ldr	r3, [r3]
	str	r3, [sp, #4]
	mov	r3,#0
	mov	r6, r0
	bl	DMAR_ASSERT_LOCKED
	ldr	r1, [r4]
	cmp	r1, #0
	movle	r0, #0
	movgt	r0, #1
	bl	KASSERT
	ldr	r3, [r4]
	cmp	r3, #1
	bgt	.L14
	ldr	r7, .L17+4
	ldr	r2, [r4, #4]
	ldr	r3, [r7]
	mov	r1, r4
	tst	r2, r3
	moveq	r0, #1
	movne	r0, #0
	bl	KASSERT
	mov	r0, r6
	bl	DMAR_UNLOCK
	mov	r1, sp
	mov	r0, r4
	bl	dmar_map_ctx_entry
	mov	r5, r0
	mov	r0, r6
	bl	DMAR_LOCK
	ldr	r1, [r4]
	cmp	r1, #0
	movle	r0, #0
	movgt	r0, #1
	bl	KASSERT
	ldr	r3, [r4]
	cmp	r3, #1
	bgt	.L15
	ldr	r2, [r4, #4]
	ldr	r3, [r7]
	mov	r1, r4
	tst	r2, r3
	moveq	r0, #1
	movne	r0, #0
	bl	KASSERT
	add	r0, r5, #4
	bl	dmar_pte_clear
	mov	r3, #0
	mov	r1, r5
	str	r3, [r5]
	mov	r0, r6
	bl	dmar_flush_ctx_to_ram
	mov	r0, r6
	bl	dmar_inv_ctx_glob
	ldr	r3, .L17+8
	ldr	r2, [r6]
	ldr	r3, [r3]
	tst	r2, r3
	beq	.L5
	ldr	r3, [r6, #4]
	mov	r0, r6
	cmp	r3, #0
	beq	.L6
	bl	dmar_qi_invalidate_iotlb_glob_locked
.L5:
	ldr	r0, [sp]
	bl	dmar_unmap_pgtbl
	mov	r0, r4
	ldr	r5, [r4, #8]
	bl	dmar_ctx_unlink
	ldr	r3, .L17+12
	mov	r0, r4
	ldr	r1, [r3]
	bl	free
	mov	r1, r5
	mov	r0, r6
	bl	dmar_unref_domain_locked
	b	.L1
.L15:
	sub	r3, r3, #1
	mov	r0, r6
	str	r3, [r4]
	bl	DMAR_UNLOCK
	ldr	r0, [sp]
	bl	dmar_unmap_pgtbl
.L1:
	ldr	r3, .L17
	ldr	r2, [r3]
	ldr	r3, [sp, #4]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L16
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, pc}
.L14:
	sub	r3, r3, #1
	mov	r0, r6
	str	r3, [r4]
	bl	DMAR_UNLOCK
	b	.L1
.L6:
	bl	dmar_inv_iotlb_glob
	b	.L5
.L16:
	bl	__stack_chk_fail
.L18:
	.align	2
.L17:
	.word	.LC0
	.word	DMAR_CTX_DISABLED
	.word	DMAR_ECAP_DI
	.word	M_DMAR_CTX
	.size	dmar_free_ctx_locked, .-dmar_free_ctx_locked
	.comm	TD_PREP_PINNED_ASSERT,4,4
	.comm	TD_PINNED_ASSERT,4,4
	.comm	M_DMAR_CTX,4,4
	.comm	DMAR_ECAP_DI,4,4
	.comm	DMAR_CTX_DISABLED,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
