	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function perform_bb_shadow
_perform_bb_shadow:                     ## @perform_bb_shadow
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r13
	movq	(%rdi), %rax
	movq	_GTT_BUFFER@GOTPCREL(%rip), %r14
	cmpq	(%r14), %rax
	jne	LBB0_2
## %bb.1:
	movq	56(%r13), %rax
	jmp	LBB0_3
LBB0_2:
	movq	48(%r13), %rax
LBB0_3:
	addq	$8, %rax
	movq	(%rax), %r12
	movq	%r13, %rdi
	movl	$1, %esi
	callq	_get_gma_bb_from_cmd
	movq	%rax, %r15
	movq	_INTEL_GVT_INVALID_ADDR@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r15
	jne	LBB0_6
## %bb.4:
	movq	_EFAULT@GOTPCREL(%rip), %rax
LBB0_5:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_26
LBB0_6:
	leaq	-48(%rbp), %rsi
	leaq	-72(%rbp), %rdx
	movq	%r13, %rdi
	callq	_find_bb_size
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_26
## %bb.7:
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$56, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_10
## %bb.8:
	movq	%rax, %r12
	movq	(%r13), %rax
	movq	(%r14), %rcx
	xorl	%edx, %edx
	cmpq	%rcx, %rax
	setne	%dl
	movl	%edx, (%r12)
	movq	_I915_GTT_PAGE_MASK@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	notq	%rdx
	andq	%r15, %rdx
	xorl	%r14d, %r14d
	cmpq	%rcx, %rax
	cmovneq	%rdx, %r14
	movq	56(%r13), %rax
	movq	(%rax), %rax
	movl	(%rax), %ebx
	movq	-48(%rbp), %rdi
	addq	%r14, %rdi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_round_up
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_i915_gem_object_create_shmem
	movq	%rax, 16(%r12)
	movq	%rax, %rdi
	callq	_IS_ERR
	movq	16(%r12), %rdi
	testq	%rax, %rax
	je	LBB0_11
## %bb.9:
	callq	_PTR_ERR
	movl	%eax, %ebx
	jmp	LBB0_25
LBB0_10:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_11:
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	leaq	4(%r12), %r14
	movq	%r14, %rsi
	callq	_i915_gem_object_prepare_write
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_24
## %bb.12:
	movq	16(%r12), %rdi
	movq	_I915_MAP_WB@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_i915_gem_object_pin_map
	movq	%rax, 24(%r12)
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_14
## %bb.13:
	movq	24(%r12), %rdi
	callq	_PTR_ERR
	movl	%eax, %ebx
	jmp	LBB0_23
LBB0_14:
	movq	_CLFLUSH_BEFORE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %eax
	testl	%eax, (%r14)
	je	LBB0_16
## %bb.15:
	movq	16(%r12), %rax
	movq	24(%r12), %rdi
	movl	(%rax), %esi
	callq	_drm_clflush_virt_range
	movl	(%rbx), %eax
	notl	%eax
	andl	%eax, 4(%r12)
LBB0_16:
	movq	56(%r13), %rdi
	movq	-48(%rbp), %rcx
	addq	%r15, %rcx
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	shlq	$2, %r14
	movq	24(%r12), %r8
	addq	%r14, %r8
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	%r15, %rdx
	callq	_copy_gma_to_hva
	testl	%eax, %eax
	js	LBB0_21
## %bb.17:
	movq	24(%r12), %rax
	addq	%r14, %rax
	movq	-72(%rbp), %rcx
	leaq	(%rax,%rcx,4), %rsi
	movq	%r13, %rdi
	callq	_audit_bb_end
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_22
## %bb.18:
	movq	%r12, %rbx
	addq	$48, %rbx
	movq	%rbx, %rdi
	callq	_INIT_LIST_HEAD
	movq	48(%r13), %rsi
	movq	%rbx, %rdi
	callq	_list_add
	movl	$1, 8(%r12)
	movq	24(%r13), %rax
	movq	%rax, 40(%r12)
	movq	8(%r13), %rcx
	movq	_BATCH_BUFFER_INSTRUCTION@GOTPCREL(%rip), %rdx
	xorl	%ebx, %ebx
	cmpq	(%rdx), %rcx
	jne	LBB0_27
## %bb.19:
	cmpl	$0, 40(%r13)
	je	LBB0_28
LBB0_27:
	xorl	%eax, %eax
	jmp	LBB0_29
LBB0_21:
	leaq	L_.str(%rip), %rdi
	callq	_gvt_vgpu_err
	movq	_EFAULT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_22:
	movq	16(%r12), %rdi
	callq	_i915_gem_object_unpin_map
LBB0_23:
	movq	16(%r12), %rdi
	callq	_i915_gem_object_finish_access
LBB0_24:
	movq	16(%r12), %rdi
	callq	_i915_gem_object_put
LBB0_25:
	movq	%r12, %rdi
	callq	_kfree
LBB0_26:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_28:
	subq	32(%r13), %rax
	sarq	$2, %rax
LBB0_29:
	movq	%rax, 32(%r12)
	addq	24(%r12), %r14
	movq	%r14, 24(%r13)
	movq	%r15, 16(%r13)
	jmp	LBB0_26
	.cfi_endproc
                                        ## -- End function
	.comm	_GTT_BUFFER,8,3                 ## @GTT_BUFFER
	.comm	_INTEL_GVT_INVALID_ADDR,8,3     ## @INTEL_GVT_INVALID_ADDR
	.comm	_EFAULT,4,2                     ## @EFAULT
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_I915_GTT_PAGE_MASK,8,3         ## @I915_GTT_PAGE_MASK
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_I915_MAP_WB,4,2                ## @I915_MAP_WB
	.comm	_CLFLUSH_BEFORE,4,2             ## @CLFLUSH_BEFORE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"fail to copy guest ring buffer\n"

	.comm	_BATCH_BUFFER_INSTRUCTION,8,3   ## @BATCH_BUFFER_INSTRUCTION
	.no_dead_strip	_perform_bb_shadow
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function perform_bb_shadow
_perform_bb_shadow:                     ; @perform_bb_shadow
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x0
	ldr	x8, [x0]
Lloh0:
	adrp	x24, _GTT_BUFFER@GOTPAGE
Lloh1:
	ldr	x24, [x24, _GTT_BUFFER@GOTPAGEOFF]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
	ldr	x8, [x20, #56]
	b	LBB0_3
LBB0_2:
	ldr	x8, [x20, #48]
LBB0_3:
	ldr	x22, [x8, #8]!
	mov	x0, x20
	mov	w1, #1
	bl	_get_gma_bb_from_cmd
Lloh2:
	adrp	x8, _INTEL_GVT_INVALID_ADDR@GOTPAGE
Lloh3:
	ldr	x8, [x8, _INTEL_GVT_INVALID_ADDR@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_6
; %bb.4:
Lloh5:
	adrp	x8, _EFAULT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_26
LBB0_6:
	mov	x21, x0
	add	x1, sp, #8
	mov	x2, sp
	mov	x0, x20
	bl	_find_bb_size
	mov	x23, x0
	cbnz	w0, LBB0_26
; %bb.7:
Lloh7:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	w0, #56
	bl	_kzalloc
	cbz	x0, LBB0_10
; %bb.8:
	mov	x19, x0
	ldr	x8, [x20]
	ldr	x9, [x24]
	cmp	x8, x9
	cset	w8, ne
Lloh10:
	adrp	x9, _I915_GTT_PAGE_MASK@GOTPAGE
Lloh11:
	ldr	x9, [x9, _I915_GTT_PAGE_MASK@GOTPAGEOFF]
	str	w8, [x0]
Lloh12:
	ldr	x8, [x9]
	bic	x8, x21, x8
	csel	x25, x8, xzr, ne
	ldr	x8, [x20, #56]
	ldr	x8, [x8]
	ldr	w23, [x8]
	ldr	x8, [sp, #8]
	add	x0, x8, x25
Lloh13:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	bl	_round_up
	mov	x1, x0
	mov	x0, x23
	bl	_i915_gem_object_create_shmem
	str	x0, [x19, #16]
	bl	_IS_ERR
	mov	x8, x0
	ldr	x0, [x19, #16]
	cbz	x8, LBB0_11
; %bb.9:
	bl	_PTR_ERR
	mov	x23, x0
	b	LBB0_25
LBB0_10:
Lloh16:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_5
LBB0_11:
	add	x24, x19, #4
	mov	x1, x24
	bl	_i915_gem_object_prepare_write
	mov	x23, x0
	cbnz	w0, LBB0_24
; %bb.12:
	ldr	x0, [x19, #16]
Lloh18:
	adrp	x8, _I915_MAP_WB@GOTPAGE
Lloh19:
	ldr	x8, [x8, _I915_MAP_WB@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	bl	_i915_gem_object_pin_map
	str	x0, [x19, #24]
	bl	_IS_ERR
	cbz	x0, LBB0_14
; %bb.13:
	ldr	x0, [x19, #24]
	bl	_PTR_ERR
	mov	x23, x0
	b	LBB0_23
LBB0_14:
	ldr	w8, [x24]
Lloh21:
	adrp	x23, _CLFLUSH_BEFORE@GOTPAGE
Lloh22:
	ldr	x23, [x23, _CLFLUSH_BEFORE@GOTPAGEOFF]
	ldr	w9, [x23]
	tst	w9, w8
	b.eq	LBB0_16
; %bb.15:
	ldp	x8, x0, [x19, #16]
	ldr	w1, [x8]
	bl	_drm_clflush_virt_range
	ldr	w8, [x23]
	ldr	w9, [x19, #4]
	bic	w8, w9, w8
	str	w8, [x19, #4]
LBB0_16:
	ldr	x0, [x20, #56]
	ldr	x8, [sp, #8]
	add	x3, x8, x21
	ldr	x8, [x19, #24]
	add	x4, x8, x25, lsl #2
	mov	x1, x22
	mov	x2, x21
	bl	_copy_gma_to_hva
	tbnz	w0, #31, LBB0_21
; %bb.17:
	ldr	x8, [x19, #24]
	add	x8, x8, x25, lsl #2
	ldr	x9, [sp]
	add	x1, x8, x9, lsl #2
	mov	x0, x20
	bl	_audit_bb_end
	mov	x23, x0
	cbnz	w0, LBB0_22
; %bb.18:
	add	x22, x19, #48
	mov	x0, x22
	bl	_INIT_LIST_HEAD
	ldr	x1, [x20, #48]
	mov	x0, x22
	bl	_list_add
	mov	w8, #1
	str	w8, [x19, #8]
	ldr	x8, [x20, #24]
	str	x8, [x19, #40]
	ldr	x9, [x20, #8]
Lloh23:
	adrp	x10, _BATCH_BUFFER_INSTRUCTION@GOTPAGE
Lloh24:
	ldr	x10, [x10, _BATCH_BUFFER_INSTRUCTION@GOTPAGEOFF]
Lloh25:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_20
; %bb.19:
	ldr	w9, [x20, #40]
	cbz	w9, LBB0_27
LBB0_20:
	mov	x8, #0
	b	LBB0_28
LBB0_21:
Lloh26:
	adrp	x0, l_.str@PAGE
Lloh27:
	add	x0, x0, l_.str@PAGEOFF
	bl	_gvt_vgpu_err
Lloh28:
	adrp	x8, _EFAULT@GOTPAGE
Lloh29:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_22:
	ldr	x0, [x19, #16]
	bl	_i915_gem_object_unpin_map
LBB0_23:
	ldr	x0, [x19, #16]
	bl	_i915_gem_object_finish_access
LBB0_24:
	ldr	x0, [x19, #16]
	bl	_i915_gem_object_put
LBB0_25:
	mov	x0, x19
	bl	_kfree
LBB0_26:
	mov	x0, x23
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_27:
	ldr	x9, [x20, #32]
	sub	x8, x8, x9
	asr	x8, x8, #2
LBB0_28:
	mov	w23, #0
	str	x8, [x19, #32]
	ldr	x8, [x19, #24]
	add	x8, x8, x25, lsl #2
	stp	x21, x8, [x20, #16]
	b	LBB0_26
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_GTT_BUFFER,8,3                 ; @GTT_BUFFER
	.comm	_INTEL_GVT_INVALID_ADDR,8,3     ; @INTEL_GVT_INVALID_ADDR
	.comm	_EFAULT,4,2                     ; @EFAULT
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_I915_GTT_PAGE_MASK,8,3         ; @I915_GTT_PAGE_MASK
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_I915_MAP_WB,4,2                ; @I915_MAP_WB
	.comm	_CLFLUSH_BEFORE,4,2             ; @CLFLUSH_BEFORE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"fail to copy guest ring buffer\n"

	.comm	_BATCH_BUFFER_INSTRUCTION,8,3   ; @BATCH_BUFFER_INSTRUCTION
	.no_dead_strip	_perform_bb_shadow
.subsections_via_symbols
