	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kfd_mmio_mmap
_kfd_mmio_mmap:                         ## @kfd_mmio_mmap
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdx), %rax
	subq	8(%rdx), %rax
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rax
	jne	LBB0_1
## %bb.2:
	movq	%rdx, %rbx
	movq	%rsi, %r14
	movl	(%rdi), %edi
	callq	_amdgpu_amdkfd_get_mmio_remap_phys_addr
	movq	_VM_IO@GOTPCREL(%rip), %rcx
	movq	_VM_DONTCOPY@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movq	_VM_DONTEXPAND@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edx
	movq	_VM_NORESERVE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edx
	movq	_VM_DONTDUMP@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edx
	movl	%eax, %r15d
	movq	_VM_PFNMAP@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	orl	%edx, 16(%rbx)
	movl	20(%rbx), %edi
	callq	_pgprot_noncached
	movl	%eax, 20(%rbx)
	movl	(%r14), %esi
	movq	8(%rbx), %rdx
	movl	16(%rbx), %r8d
	movq	(%r12), %r9
	leaq	L_.str(%rip), %rdi
	movl	%r15d, %ecx
	callq	_pr_debug
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %r15d
	movq	8(%rbx), %rsi
	movq	(%r12), %rcx
	movl	20(%rbx), %r8d
	movq	%rbx, %rdi
	movl	%r15d, %edx
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_io_remap_pfn_range             ## TAILCALL
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,8,3                  ## @PAGE_SIZE
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_VM_IO,4,2                      ## @VM_IO
	.comm	_VM_DONTCOPY,4,2                ## @VM_DONTCOPY
	.comm	_VM_DONTEXPAND,4,2              ## @VM_DONTEXPAND
	.comm	_VM_NORESERVE,4,2               ## @VM_NORESERVE
	.comm	_VM_DONTDUMP,4,2                ## @VM_DONTDUMP
	.comm	_VM_PFNMAP,4,2                  ## @VM_PFNMAP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Process %d mapping mmio page\n     target user address == 0x%08llX\n     physical address    == 0x%08llX\n     vm_flags            == 0x%04lX\n     size                == 0x%04lX\n"

	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.no_dead_strip	_kfd_mmio_mmap
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kfd_mmio_mmap
_kfd_mmio_mmap:                         ; @kfd_mmio_mmap
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	ldp	x8, x9, [x2]
Lloh0:
	adrp	x22, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x22, [x22, _PAGE_SIZE@GOTPAGEOFF]
	ldr	x10, [x22]
	sub	x8, x8, x9
	cmp	x8, x10
	b.ne	LBB0_2
; %bb.1:
	mov	x19, x2
	mov	x20, x1
	ldr	w0, [x0]
	bl	_amdgpu_amdkfd_get_mmio_remap_phys_addr
	mov	x21, x0
Lloh2:
	adrp	x8, _VM_IO@GOTPAGE
Lloh3:
	ldr	x8, [x8, _VM_IO@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, _VM_DONTCOPY@GOTPAGE
Lloh6:
	ldr	x9, [x9, _VM_DONTCOPY@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh8:
	adrp	x9, _VM_DONTEXPAND@GOTPAGE
Lloh9:
	ldr	x9, [x9, _VM_DONTEXPAND@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh11:
	adrp	x9, _VM_NORESERVE@GOTPAGE
Lloh12:
	ldr	x9, [x9, _VM_NORESERVE@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh14:
	adrp	x9, _VM_DONTDUMP@GOTPAGE
Lloh15:
	ldr	x9, [x9, _VM_DONTDUMP@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh17:
	adrp	x9, _VM_PFNMAP@GOTPAGE
Lloh18:
	ldr	x9, [x9, _VM_PFNMAP@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w8, w8, w9
	ldp	w9, w0, [x19, #16]
	orr	w8, w8, w9
	str	w8, [x19, #16]
	bl	_pgprot_noncached
	str	w0, [x19, #20]
	ldr	w1, [x20]
	ldr	x2, [x19, #8]
	ldr	w4, [x19, #16]
	ldr	x5, [x22]
Lloh20:
	adrp	x0, l_.str@PAGE
Lloh21:
	add	x0, x0, l_.str@PAGEOFF
	mov	x3, x21
	bl	_pr_debug
	ldr	x1, [x19, #8]
Lloh22:
	adrp	x8, _PAGE_SHIFT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _PAGE_SHIFT@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	asr	w2, w21, w8
	ldr	x3, [x22]
	ldr	w4, [x19, #20]
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_io_remap_pfn_range
LBB0_2:
Lloh25:
	adrp	x8, _EINVAL@GOTPAGE
Lloh26:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	neg	w0, w8
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_VM_IO,4,2                      ; @VM_IO
	.comm	_VM_DONTCOPY,4,2                ; @VM_DONTCOPY
	.comm	_VM_DONTEXPAND,4,2              ; @VM_DONTEXPAND
	.comm	_VM_NORESERVE,4,2               ; @VM_NORESERVE
	.comm	_VM_DONTDUMP,4,2                ; @VM_DONTDUMP
	.comm	_VM_PFNMAP,4,2                  ; @VM_PFNMAP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Process %d mapping mmio page\n     target user address == 0x%08llX\n     physical address    == 0x%08llX\n     vm_flags            == 0x%04lX\n     size                == 0x%04lX\n"

	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.no_dead_strip	_kfd_mmio_mmap
.subsections_via_symbols
