	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function add_bo_to_vm
_add_bo_to_vm:                          ## @add_bo_to_vm
	.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	8(%rsi), %r15
	testq	%r15, %r15
	je	LBB0_1
## %bb.2:
	movq	%rsi, %r13
	movq	%r8, -48(%rbp)                  ## 8-byte Spill
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	movq	16(%rsi), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	(%rax), %r12
	xorl	%ebx, %ebx
	testl	%ecx, %ecx
	movl	$0, %r14d
	cmovneq	%r12, %r14
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$32, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	addq	%r15, %r14
	addq	%r14, %r12
	leaq	L_.str.1(%rip), %rdi
	movq	%r14, %rsi
	movq	%r12, %rdx
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rcx
	movq	%rax, %r15
	callq	_pr_debug
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	callq	_amdgpu_vm_bo_add
	movl	%eax, 4(%r15)
	testl	%eax, %eax
	je	LBB0_5
## %bb.6:
	movq	%r14, 24(%r15)
	movl	(%r13), %esi
	addq	$4, %r13
	movq	%r12, %rdi
	callq	_amdgpu_gmc_get_pte_flags
	movl	%eax, 16(%r15)
	movq	%r12, 8(%r15)
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_list_add
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	movq	%r15, (%rax)
LBB0_8:
	movq	%rbx, %rdi
	callq	_vm_validate_pt_pd_bos
	testl	%eax, %eax
	je	LBB0_9
## %bb.10:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_pr_err
	movl	4(%r15), %esi
	movq	%r12, %rdi
	callq	_amdgpu_vm_bo_rmv
	movq	%r15, %rdi
	callq	_list_del
	jmp	LBB0_11
LBB0_1:
	leaq	L_.str(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_pr_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_12
LBB0_3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_12
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	leaq	L_.str.2(%rip), %rdi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_pr_err
LBB0_11:
	movq	%r15, %rdi
	callq	_kfree
	jmp	LBB0_12
LBB0_9:
	xorl	%ebx, %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid VA when adding BO to VM\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.1:                               ## @.str.1
	.asciz	"\t add VA 0x%llx - 0x%llx to vm %p\n"

L_.str.2:                               ## @.str.2
	.asciz	"Failed to add BO object to VM. ret == %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"validate_pt_pd_bos() failed\n"

	.no_dead_strip	_add_bo_to_vm
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function add_bo_to_vm
_add_bo_to_vm:                          ; @add_bo_to_vm
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	ldr	x25, [x1, #8]
	cbz	x25, LBB0_7
; %bb.1:
	mov	x22, x4
	mov	x21, x2
	mov	x23, x1
	mov	x20, x0
	ldr	x24, [x1, #16]
	ldr	x26, [x24]
	cmp	w3, #0
	csel	x27, xzr, x26, eq
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #32
	bl	_kzalloc
	cbz	x0, LBB0_8
; %bb.2:
	mov	x19, x0
	add	x25, x27, x25
	add	x2, x25, x26
Lloh3:
	adrp	x0, l_.str.1@PAGE
Lloh4:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x25
	mov	x3, x21
	bl	_pr_debug
	mov	x0, x20
	mov	x1, x21
	mov	x2, x24
	bl	_amdgpu_vm_bo_add
	str	w0, [x19, #4]
	cbz	w0, LBB0_10
; %bb.3:
	add	x24, x23, #4
	str	x25, [x19, #24]
	ldr	w1, [x23]
	mov	x0, x20
	bl	_amdgpu_gmc_get_pte_flags
	str	w0, [x19, #16]
	str	x20, [x19, #8]
	mov	x0, x19
	mov	x1, x24
	bl	_list_add
	cbz	x22, LBB0_5
; %bb.4:
	str	x19, [x22]
LBB0_5:
	mov	x0, x21
	bl	_vm_validate_pt_pd_bos
	mov	x21, x0
	cbz	w0, LBB0_12
; %bb.6:
Lloh5:
	adrp	x0, l_.str.3@PAGE
Lloh6:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_pr_err
	ldr	w1, [x19, #4]
	mov	x0, x20
	bl	_amdgpu_vm_bo_rmv
	mov	x0, x19
	bl	_list_del
	b	LBB0_11
LBB0_7:
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_9
LBB0_8:
Lloh11:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_12
LBB0_10:
Lloh13:
	adrp	x8, _EINVAL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w21, w8
	str	x21, [sp]
Lloh16:
	adrp	x0, l_.str.2@PAGE
Lloh17:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_err
LBB0_11:
	mov	x0, x19
	bl	_kfree
LBB0_12:
	mov	x0, x21
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid VA when adding BO to VM\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.1:                               ; @.str.1
	.asciz	"\t add VA 0x%llx - 0x%llx to vm %p\n"

l_.str.2:                               ; @.str.2
	.asciz	"Failed to add BO object to VM. ret == %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"validate_pt_pd_bos() failed\n"

	.no_dead_strip	_add_bo_to_vm
.subsections_via_symbols
