	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function goya_mmu_add_mappings_for_device_cpu
_goya_mmu_add_mappings_for_device_cpu:  ## @goya_mmu_add_mappings_for_device_cpu
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	16(%rdi), %rcx
	movq	_HW_CAP_MMU@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%r14d, %r14d
	testl	%eax, (%rcx)
	je	LBB0_26
## %bb.1:
	movq	%rdi, %r12
	movq	_CPU_FW_IMAGE_SIZE@GOTPCREL(%rip), %r14
	cmpq	$0, (%r14)
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	jle	LBB0_2
## %bb.3:
	movq	_PAGE_SIZE_2MB@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movl	8(%r12), %edi
	movq	24(%r12), %rdx
	addq	%r13, %rdx
	movslq	%eax, %rcx
	movq	%rdx, %rsi
	callq	_hl_mmu_map
	testl	%eax, %eax
	jne	LBB0_5
## %bb.11:                              ##   in Loop: Header=BB0_4 Depth=1
	movslq	(%r15), %rax
	addq	%rax, %r13
	cmpq	(%r14), %r13
	jl	LBB0_4
	jmp	LBB0_12
LBB0_2:
	movq	_PAGE_SIZE_2MB@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%r13d, %r13d
LBB0_12:
	movslq	(%r12), %rdx
	leal	-1(%rax), %ecx
	testl	%edx, %ecx
	je	LBB0_21
## %bb.13:
	movq	_SZ_2M@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	jle	LBB0_25
## %bb.14:
	movq	_PAGE_SIZE_4KB@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rcx
	movl	8(%r12), %edi
	movq	_VA_CPU_ACCESSIBLE_MEM_ADDR@GOTPCREL(%rip), %r14
	movq	(%r14), %rsi
	callq	_hl_mmu_map
	xorl	%r15d, %r15d
	testl	%eax, %eax
	jne	LBB0_16
	.p2align	4, 0x90
LBB0_23:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rcx
	addq	%rcx, %r15
	movq	_SZ_2M@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r15
	jge	LBB0_25
## %bb.24:                              ##   in Loop: Header=BB0_23 Depth=1
	movslq	(%r12), %rdx
	movl	8(%r12), %edi
	movq	(%r14), %rsi
	addq	%r15, %rsi
	addq	%r15, %rdx
	callq	_hl_mmu_map
	testl	%eax, %eax
	je	LBB0_23
LBB0_16:
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	4(%r12), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rdx
	subq	%rdx, %r15
	js	LBB0_20
## %bb.18:                              ##   in Loop: Header=BB0_17 Depth=1
	movl	8(%r12), %edi
	movq	(%r14), %rsi
	addq	%r15, %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_hl_mmu_unmap
	testq	%rax, %rax
	je	LBB0_17
## %bb.19:                              ##   in Loop: Header=BB0_17 Depth=1
	movl	4(%r12), %edi
	movq	(%r14), %rdx
	addq	%r15, %rdx
	leaq	L_.str.2(%rip), %rsi
	callq	_dev_warn_ratelimited
	jmp	LBB0_17
LBB0_5:
	movl	%eax, %ebx
	movl	4(%r12), %edi
	movq	24(%r12), %rdx
	addq	%r13, %rdx
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	movl	%ebx, %r14d
	jmp	LBB0_6
LBB0_21:
	movl	8(%r12), %edi
	movq	_VA_CPU_ACCESSIBLE_MEM_ADDR@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	movslq	%eax, %rcx
	callq	_hl_mmu_map
	testl	%eax, %eax
	je	LBB0_25
## %bb.22:
	movl	%eax, %r14d
	movl	4(%r12), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	movq	_PAGE_SIZE_2MB@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	subq	%rax, %r13
	jmp	LBB0_6
LBB0_25:
	movq	_mmCPU_IF_ARUSER_OVR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_HL_KERNEL_ASID_ID@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	movq	%r12, %rdi
	callq	_goya_mmu_prepare_reg
	movq	_mmCPU_IF_AWUSER_OVR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%rbx), %edx
	movq	%r12, %rdi
	callq	_goya_mmu_prepare_reg
	movq	_mmCPU_IF_ARUSER_OVR_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	$2047, %esi                     ## imm = 0x7FF
	callq	_WREG32
	movq	_mmCPU_IF_AWUSER_OVR_EN@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	movl	$2047, %esi                     ## imm = 0x7FF
	callq	_WREG32
	movl	(%rbx), %edi
	callq	_RREG32
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	$1, 4(%rax)
	xorl	%r14d, %r14d
	jmp	LBB0_26
LBB0_20:
	movl	-48(%rbp), %r14d                ## 4-byte Reload
LBB0_6:
	testq	%r13, %r13
	js	LBB0_26
## %bb.7:
	movq	_PAGE_SIZE_2MB@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	leaq	L_.str.2(%rip), %r15
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_8 Depth=1
	movslq	(%rbx), %rdx
	subq	%rdx, %r13
	js	LBB0_26
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	8(%r12), %edi
	movq	24(%r12), %rsi
	addq	%r13, %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_hl_mmu_unmap
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movl	4(%r12), %edi
	movq	24(%r12), %rdx
	addq	%r13, %rdx
	movq	%r15, %rsi
	callq	_dev_warn_ratelimited
	jmp	LBB0_10
LBB0_26:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HW_CAP_MMU,4,2                 ## @HW_CAP_MMU
	.comm	_CPU_FW_IMAGE_SIZE,8,3          ## @CPU_FW_IMAGE_SIZE
	.comm	_PAGE_SIZE_2MB,4,2              ## @PAGE_SIZE_2MB
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Map failed for address 0x%llx\n"

	.comm	_VA_CPU_ACCESSIBLE_MEM_ADDR,8,3 ## @VA_CPU_ACCESSIBLE_MEM_ADDR
L_.str.1:                               ## @.str.1
	.asciz	"Map failed for CPU accessible memory\n"

	.comm	_SZ_2M,8,3                      ## @SZ_2M
	.comm	_PAGE_SIZE_4KB,8,3              ## @PAGE_SIZE_4KB
	.comm	_mmCPU_IF_ARUSER_OVR,4,2        ## @mmCPU_IF_ARUSER_OVR
	.comm	_HL_KERNEL_ASID_ID,4,2          ## @HL_KERNEL_ASID_ID
	.comm	_mmCPU_IF_AWUSER_OVR,4,2        ## @mmCPU_IF_AWUSER_OVR
	.comm	_mmCPU_IF_ARUSER_OVR_EN,4,2     ## @mmCPU_IF_ARUSER_OVR_EN
	.comm	_mmCPU_IF_AWUSER_OVR_EN,4,2     ## @mmCPU_IF_AWUSER_OVR_EN
L_.str.2:                               ## @.str.2
	.asciz	"failed to unmap address 0x%llx\n"

	.no_dead_strip	_goya_mmu_add_mappings_for_device_cpu
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function goya_mmu_add_mappings_for_device_cpu
_goya_mmu_add_mappings_for_device_cpu:  ; @goya_mmu_add_mappings_for_device_cpu
	.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
	ldr	x21, [x0, #16]
	ldr	w8, [x21]
Lloh0:
	adrp	x9, _HW_CAP_MMU@GOTPAGE
Lloh1:
	ldr	x9, [x9, _HW_CAP_MMU@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.1:
	mov	x19, x0
Lloh3:
	adrp	x23, _CPU_FW_IMAGE_SIZE@GOTPAGE
Lloh4:
	ldr	x23, [x23, _CPU_FW_IMAGE_SIZE@GOTPAGEOFF]
	ldr	x8, [x23]
	cmp	x8, #0
	b.le	LBB0_6
; %bb.2:
	mov	x22, #0
Lloh5:
	adrp	x24, _PAGE_SIZE_2MB@GOTPAGE
Lloh6:
	ldr	x24, [x24, _PAGE_SIZE_2MB@GOTPAGEOFF]
	ldr	w9, [x24]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19, #8]
	ldr	x8, [x19, #24]
	add	x1, x8, x22
	sxtw	x3, w9
	mov	x2, x1
	bl	_hl_mmu_map
	cbnz	w0, LBB0_11
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldrsw	x8, [x24]
	ldr	x9, [x23]
	add	x22, x22, x8
	cmp	x22, x9
	mov	x9, x8
	b.lt	LBB0_3
	b	LBB0_7
LBB0_5:
	mov	w20, #0
	b	LBB0_29
LBB0_6:
	mov	x22, #0
Lloh7:
	adrp	x8, _PAGE_SIZE_2MB@GOTPAGE
Lloh8:
	ldr	x8, [x8, _PAGE_SIZE_2MB@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
LBB0_7:
	ldrsw	x2, [x19]
	sub	w9, w8, #1
	tst	w9, w2
	b.eq	LBB0_12
; %bb.8:
Lloh10:
	adrp	x25, _SZ_2M@GOTPAGE
Lloh11:
	ldr	x25, [x25, _SZ_2M@GOTPAGEOFF]
	ldr	x8, [x25]
	cmp	x8, #1
	b.lt	LBB0_28
; %bb.9:
Lloh12:
	adrp	x23, _PAGE_SIZE_4KB@GOTPAGE
Lloh13:
	ldr	x23, [x23, _PAGE_SIZE_4KB@GOTPAGEOFF]
	ldr	x3, [x23]
	ldr	w0, [x19, #8]
Lloh14:
	adrp	x24, _VA_CPU_ACCESSIBLE_MEM_ADDR@GOTPAGE
Lloh15:
	ldr	x24, [x24, _VA_CPU_ACCESSIBLE_MEM_ADDR@GOTPAGEOFF]
	ldr	x1, [x24]
	bl	_hl_mmu_map
	cbz	w0, LBB0_14
; %bb.10:
	mov	x20, x0
	mov	x26, #0
	b	LBB0_18
LBB0_11:
	mov	x20, x0
	ldr	w0, [x19, #4]
	ldr	x8, [x19, #24]
	add	x8, x8, x22
	str	x8, [sp]
Lloh16:
	adrp	x1, l_.str@PAGE
Lloh17:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_23
LBB0_12:
	ldr	w0, [x19, #8]
Lloh18:
	adrp	x9, _VA_CPU_ACCESSIBLE_MEM_ADDR@GOTPAGE
Lloh19:
	ldr	x9, [x9, _VA_CPU_ACCESSIBLE_MEM_ADDR@GOTPAGEOFF]
Lloh20:
	ldr	x1, [x9]
                                        ; kill: def $w8 killed $w8 killed $x8 def $x8
	sxtw	x3, w8
	bl	_hl_mmu_map
	cbz	w0, LBB0_28
; %bb.13:
	mov	x20, x0
	ldr	w0, [x19, #4]
Lloh21:
	adrp	x1, l_.str.1@PAGE
Lloh22:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
Lloh23:
	adrp	x8, _PAGE_SIZE_2MB@GOTPAGE
Lloh24:
	ldr	x8, [x8, _PAGE_SIZE_2MB@GOTPAGEOFF]
Lloh25:
	ldrsw	x8, [x8]
	sub	x22, x22, x8
	b	LBB0_23
LBB0_14:
	mov	x26, #0
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	ldr	x3, [x23]
	ldr	x8, [x25]
	add	x26, x3, x26
	cmp	x26, x8
	b.ge	LBB0_28
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	ldrsw	x8, [x19]
	ldr	w0, [x19, #8]
	ldr	x9, [x24]
	add	x1, x9, x26
	add	x2, x26, x8
	bl	_hl_mmu_map
	cbz	w0, LBB0_15
; %bb.17:
	mov	x20, x0
LBB0_18:
	ldr	w0, [x19, #4]
Lloh26:
	adrp	x1, l_.str.1@PAGE
Lloh27:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	ldr	x2, [x23]
	subs	x25, x26, x2
	b.mi	LBB0_23
; %bb.19:
Lloh28:
	adrp	x21, l_.str.2@PAGE
Lloh29:
	add	x21, x21, l_.str.2@PAGEOFF
	b	LBB0_21
LBB0_20:                                ;   in Loop: Header=BB0_21 Depth=1
	ldr	x2, [x23]
	subs	x25, x25, x2
	b.mi	LBB0_23
LBB0_21:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19, #8]
	ldr	x8, [x24]
	add	x1, x8, x25
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_hl_mmu_unmap
	cbz	x0, LBB0_20
; %bb.22:                               ;   in Loop: Header=BB0_21 Depth=1
	ldr	w0, [x19, #4]
	ldr	x8, [x24]
	add	x2, x8, x25
	mov	x1, x21
	bl	_dev_warn_ratelimited
	b	LBB0_20
LBB0_23:
	tbnz	x22, #63, LBB0_29
; %bb.24:
Lloh30:
	adrp	x23, _PAGE_SIZE_2MB@GOTPAGE
Lloh31:
	ldr	x23, [x23, _PAGE_SIZE_2MB@GOTPAGEOFF]
	ldr	w2, [x23]
Lloh32:
	adrp	x21, l_.str.2@PAGE
Lloh33:
	add	x21, x21, l_.str.2@PAGEOFF
	b	LBB0_26
LBB0_25:                                ;   in Loop: Header=BB0_26 Depth=1
	ldrsw	x2, [x23]
	subs	x22, x22, x2
	b.mi	LBB0_29
LBB0_26:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19, #8]
	ldr	x8, [x19, #24]
	add	x1, x8, x22
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_hl_mmu_unmap
	cbz	x0, LBB0_25
; %bb.27:                               ;   in Loop: Header=BB0_26 Depth=1
	ldr	w0, [x19, #4]
	ldr	x8, [x19, #24]
	add	x2, x8, x22
	mov	x1, x21
	bl	_dev_warn_ratelimited
	b	LBB0_25
LBB0_28:
Lloh34:
	adrp	x8, _mmCPU_IF_ARUSER_OVR@GOTPAGE
Lloh35:
	ldr	x8, [x8, _mmCPU_IF_ARUSER_OVR@GOTPAGEOFF]
Lloh36:
	ldr	w1, [x8]
Lloh37:
	adrp	x20, _HL_KERNEL_ASID_ID@GOTPAGE
Lloh38:
	ldr	x20, [x20, _HL_KERNEL_ASID_ID@GOTPAGEOFF]
	ldr	w2, [x20]
	mov	x0, x19
	bl	_goya_mmu_prepare_reg
Lloh39:
	adrp	x8, _mmCPU_IF_AWUSER_OVR@GOTPAGE
Lloh40:
	ldr	x8, [x8, _mmCPU_IF_AWUSER_OVR@GOTPAGEOFF]
Lloh41:
	ldr	w1, [x8]
	ldr	w2, [x20]
	mov	x0, x19
	bl	_goya_mmu_prepare_reg
Lloh42:
	adrp	x8, _mmCPU_IF_ARUSER_OVR_EN@GOTPAGE
Lloh43:
	ldr	x8, [x8, _mmCPU_IF_ARUSER_OVR_EN@GOTPAGEOFF]
Lloh44:
	ldr	w0, [x8]
	mov	w1, #2047
	bl	_WREG32
Lloh45:
	adrp	x19, _mmCPU_IF_AWUSER_OVR_EN@GOTPAGE
Lloh46:
	ldr	x19, [x19, _mmCPU_IF_AWUSER_OVR_EN@GOTPAGEOFF]
	ldr	w0, [x19]
	mov	w1, #2047
	bl	_WREG32
	ldr	w0, [x19]
	bl	_RREG32
	mov	w20, #0
	mov	w8, #1
	str	w8, [x21, #4]
LBB0_29:
	mov	x0, x20
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGot	Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_HW_CAP_MMU,4,2                 ; @HW_CAP_MMU
	.comm	_CPU_FW_IMAGE_SIZE,8,3          ; @CPU_FW_IMAGE_SIZE
	.comm	_PAGE_SIZE_2MB,4,2              ; @PAGE_SIZE_2MB
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Map failed for address 0x%llx\n"

	.comm	_VA_CPU_ACCESSIBLE_MEM_ADDR,8,3 ; @VA_CPU_ACCESSIBLE_MEM_ADDR
l_.str.1:                               ; @.str.1
	.asciz	"Map failed for CPU accessible memory\n"

	.comm	_SZ_2M,8,3                      ; @SZ_2M
	.comm	_PAGE_SIZE_4KB,8,3              ; @PAGE_SIZE_4KB
	.comm	_mmCPU_IF_ARUSER_OVR,4,2        ; @mmCPU_IF_ARUSER_OVR
	.comm	_HL_KERNEL_ASID_ID,4,2          ; @HL_KERNEL_ASID_ID
	.comm	_mmCPU_IF_AWUSER_OVR,4,2        ; @mmCPU_IF_AWUSER_OVR
	.comm	_mmCPU_IF_ARUSER_OVR_EN,4,2     ; @mmCPU_IF_ARUSER_OVR_EN
	.comm	_mmCPU_IF_AWUSER_OVR_EN,4,2     ; @mmCPU_IF_AWUSER_OVR_EN
l_.str.2:                               ; @.str.2
	.asciz	"failed to unmap address 0x%llx\n"

	.no_dead_strip	_goya_mmu_add_mappings_for_device_cpu
.subsections_via_symbols
