	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mphyp_pte_insert
_mphyp_pte_insert:                      ## @mphyp_pte_insert
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movl	12(%rsi), %edi
	movq	_MA_OWNED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_PMAP_LOCK_ASSERT
	leaq	-72(%rbp), %rsi
	movq	%r15, %rdi
	callq	_moea64_pte_from_pvo
	movl	$0, -88(%rbp)
	movq	_mphyp_eviction_lock@GOTPCREL(%rip), %rdi
	leaq	-56(%rbp), %rsi
	callq	_rm_rlock
	movq	(%r15), %rdx
	andq	$-8, %rdx
	movq	%rdx, (%r15)
	movq	_H_ENTER@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	-72(%rbp), %ecx
	movq	-64(%rbp), %r8
	leaq	-80(%rbp), %rax
	leaq	-104(%rbp), %r12
	xorl	%ebx, %ebx
	leaq	-48(%rbp), %r9
	xorl	%esi, %esi
	pushq	%r12
	pushq	%rax
	callq	_phyp_pft_hcall
	addq	$16, %rsp
	movq	_H_SUCCESS@GOTPCREL(%rip), %r14
	cmpq	(%r14), %rax
	je	LBB0_1
## %bb.2:
	movq	_H_PTEG_FULL@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	sete	%dil
	movq	-64(%rbp), %rsi
	callq	_KASSERT
	movq	_PVO_HID@GOTPCREL(%rip), %r13
	movl	(%r13), %eax
	xorl	%eax, 8(%r15)
	movq	_LPTE_HID@GOTPCREL(%rip), %rax
	movl	-72(%rbp), %ecx
	xorl	(%rax), %ecx
	movl	%ecx, -72(%rbp)
	movq	_moea64_pteg_mask@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shll	$3, %eax
	movslq	%eax, %rdx
	xorq	(%r15), %rdx
	movq	%rdx, (%r15)
	movq	_H_ENTER@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	-64(%rbp), %r8
	xorl	%ebx, %ebx
	leaq	-48(%rbp), %r9
	xorl	%esi, %esi
	pushq	%r12
	leaq	-80(%rbp), %rax
	pushq	%rax
	callq	_phyp_pft_hcall
	addq	$16, %rsp
	cmpq	(%r14), %rax
	jne	LBB0_3
LBB0_1:
	movq	_mphyp_eviction_lock@GOTPCREL(%rip), %rdi
	leaq	-56(%rbp), %rsi
	callq	_rm_runlock
	movq	-48(%rbp), %rax
	movq	%rax, (%r15)
LBB0_11:
	movl	%ebx, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	xorl	%edi, %edi
	movq	_H_PTEG_FULL@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	sete	%dil
	movq	%rax, %rsi
	callq	_KASSERT
	movq	_mphyp_eviction_lock@GOTPCREL(%rip), %rbx
	leaq	-56(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_rm_runlock
	movq	%rbx, %rdi
	callq	_rm_wlock
	movq	(%r15), %rdi
	leaq	-88(%rbp), %rsi
	callq	_mphyp_pte_spillable_ident
	movq	%rax, %rdx
	movq	%rax, -48(%rbp)
	cmpq	$-1, %rax
	jne	LBB0_6
## %bb.4:
	movl	(%r13), %eax
	xorl	%eax, 8(%r15)
	movq	_LPTE_HID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%eax, -72(%rbp)
	movq	_moea64_pteg_mask@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shll	$3, %eax
	movslq	%eax, %rdi
	xorq	(%r15), %rdi
	movq	%rdi, (%r15)
	leaq	-88(%rbp), %rsi
	callq	_mphyp_pte_spillable_ident
	movq	%rax, %rdx
	movq	%rax, -48(%rbp)
	cmpq	$-1, %rax
	je	LBB0_5
LBB0_6:
	movl	-88(%rbp), %ecx
	movq	_LPTE_VALID@GOTPCREL(%rip), %rax
	testl	%ecx, (%rax)
	je	LBB0_7
## %bb.8:
	movq	_H_REMOVE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_H_AVPN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_LPTE_AVPN_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %ecx
	leaq	-96(%rbp), %rax
	xorl	%r8d, %r8d
	movq	%r12, %r14
	movq	%r12, %r9
	pushq	%r12
	pushq	%rax
	callq	_phyp_pft_hcall
	addq	$16, %rsp
	movq	%rax, %rbx
	movq	_moea64_pte_overflow@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leal	1(%rdi), %ecx
	movl	%ecx, (%rax)
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_STAT_MOEA64
	movq	_H_SUCCESS@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rbx
	sete	%al
	movq	_H_NOT_FOUND@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rbx
	sete	%cl
	orb	%al, %cl
	movzbl	%cl, %edi
	movslq	%ebx, %rsi
	callq	_KASSERT
	movq	-48(%rbp), %rdx
	leaq	-80(%rbp), %rbx
	movq	_H_ENTER@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_7:
	leaq	-80(%rbp), %rbx
	movq	%r12, %r14
	movq	_H_ENTER@GOTPCREL(%rip), %rax
	movq	_H_SUCCESS@GOTPCREL(%rip), %r12
LBB0_9:
	movl	(%rax), %edi
	movq	_H_EXACT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-72(%rbp), %ecx
	movq	-64(%rbp), %r8
	leaq	-48(%rbp), %r9
	pushq	%r14
	pushq	%rbx
	callq	_phyp_pft_hcall
	addq	$16, %rsp
	movq	%rax, %r14
	movq	_mphyp_eviction_lock@GOTPCREL(%rip), %rdi
	callq	_rm_wunlock
	movq	-48(%rbp), %rax
	movq	%rax, (%r15)
	xorl	%ebx, %ebx
	cmpq	(%r12), %r14
	je	LBB0_11
## %bb.10:
	leaq	L_.str.4(%rip), %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	_panic
	movl	%r14d, %ebx
	jmp	LBB0_11
LBB0_5:
	movq	_mphyp_eviction_lock@GOTPCREL(%rip), %rdi
	callq	_rm_wunlock
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_panic
	movl	$-1, %ebx
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_MA_OWNED,4,2                   ## @MA_OWNED
	.comm	_mphyp_eviction_lock,4,2        ## @mphyp_eviction_lock
	.comm	_H_ENTER,4,2                    ## @H_ENTER
	.comm	_H_SUCCESS,8,3                  ## @H_SUCCESS
	.comm	_H_PTEG_FULL,8,3                ## @H_PTEG_FULL
	.comm	_moea64_pteg_count,4,2          ## @moea64_pteg_count
	.comm	_PVO_HID,4,2                    ## @PVO_HID
	.comm	_LPTE_HID,4,2                   ## @LPTE_HID
	.comm	_moea64_pteg_mask,4,2           ## @moea64_pteg_mask
	.section	__TEXT,__cstring,cstring_literals
L_.str.2:                               ## @.str.2
	.asciz	"mphyp_pte_insert: overflow"

	.comm	_LPTE_VALID,4,2                 ## @LPTE_VALID
	.comm	_H_REMOVE,4,2                   ## @H_REMOVE
	.comm	_H_AVPN,4,2                     ## @H_AVPN
	.comm	_LPTE_AVPN_MASK,4,2             ## @LPTE_AVPN_MASK
	.comm	_moea64_pte_overflow,4,2        ## @moea64_pte_overflow
	.comm	_H_NOT_FOUND,8,3                ## @H_NOT_FOUND
	.comm	_H_EXACT,4,2                    ## @H_EXACT
L_.str.4:                               ## @.str.4
	.asciz	"Page replacement error: %ld"

	.no_dead_strip	_mphyp_pte_insert
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mphyp_pte_insert
_mphyp_pte_insert:                      ; @mphyp_pte_insert
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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	x19, x1
	ldr	w0, [x1, #12]
Lloh0:
	adrp	x8, _MA_OWNED@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MA_OWNED@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_PMAP_LOCK_ASSERT
	add	x1, sp, #40
	mov	x0, x19
	bl	_moea64_pte_from_pvo
	str	wzr, [sp, #56]
Lloh3:
	adrp	x0, _mphyp_eviction_lock@GOTPAGE
Lloh4:
	ldr	x0, [x0, _mphyp_eviction_lock@GOTPAGEOFF]
	add	x1, sp, #72
	bl	_rm_rlock
	ldr	x8, [x19]
	and	x2, x8, #0xfffffffffffffff8
Lloh5:
	adrp	x23, _H_ENTER@GOTPAGE
Lloh6:
	ldr	x23, [x23, _H_ENTER@GOTPAGEOFF]
	str	x2, [x19]
	ldr	w0, [x23]
	ldr	w3, [sp, #40]
	ldr	x4, [sp, #48]
	add	x8, sp, #56
	add	x20, x8, #8
	add	x5, sp, #32
	add	x7, sp, #24
	mov	w1, #0
	mov	x6, x20
	bl	_phyp_pft_hcall
Lloh7:
	adrp	x22, _H_SUCCESS@GOTPAGE
Lloh8:
	ldr	x22, [x22, _H_SUCCESS@GOTPAGEOFF]
	ldr	x8, [x22]
	cmp	x0, x8
	b.eq	LBB0_2
; %bb.1:
Lloh9:
	adrp	x21, _H_PTEG_FULL@GOTPAGE
Lloh10:
	ldr	x21, [x21, _H_PTEG_FULL@GOTPAGEOFF]
	ldr	x8, [x21]
	cmp	x0, x8
	cset	w0, eq
	ldr	x1, [sp, #48]
	bl	_KASSERT
Lloh11:
	adrp	x24, _PVO_HID@GOTPAGE
Lloh12:
	ldr	x24, [x24, _PVO_HID@GOTPAGEOFF]
	ldr	w8, [x24]
	ldr	w9, [x19, #8]
	eor	w8, w9, w8
	str	w8, [x19, #8]
Lloh13:
	adrp	x25, _LPTE_HID@GOTPAGE
Lloh14:
	ldr	x25, [x25, _LPTE_HID@GOTPAGEOFF]
	ldr	w8, [x25]
	ldr	w9, [sp, #40]
	eor	w3, w9, w8
	str	w3, [sp, #40]
Lloh15:
	adrp	x26, _moea64_pteg_mask@GOTPAGE
Lloh16:
	ldr	x26, [x26, _moea64_pteg_mask@GOTPAGEOFF]
	ldr	w8, [x26]
	lsl	w8, w8, #3
	sxtw	x8, w8
	ldr	x9, [x19]
	eor	x2, x9, x8
	str	x2, [x19]
	ldr	w0, [x23]
	ldr	x4, [sp, #48]
	add	x5, sp, #32
	add	x7, sp, #24
	mov	w1, #0
	mov	x6, x20
	bl	_phyp_pft_hcall
	ldr	x8, [x22]
	cmp	x0, x8
	b.ne	LBB0_4
LBB0_2:
Lloh17:
	adrp	x0, _mphyp_eviction_lock@GOTPAGE
Lloh18:
	ldr	x0, [x0, _mphyp_eviction_lock@GOTPAGEOFF]
	add	x1, sp, #72
	bl	_rm_runlock
	mov	w20, #0
	ldr	x8, [sp, #32]
	str	x8, [x19]
LBB0_3:
	mov	x0, x20
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_4:
	mov	x1, x0
	ldr	x8, [x21]
	cmp	x0, x8
	cset	w0, eq
	bl	_KASSERT
Lloh19:
	adrp	x21, _mphyp_eviction_lock@GOTPAGE
Lloh20:
	ldr	x21, [x21, _mphyp_eviction_lock@GOTPAGEOFF]
	add	x1, sp, #72
	mov	x0, x21
	bl	_rm_runlock
	mov	x0, x21
	bl	_rm_wlock
	ldr	x0, [x19]
	add	x1, sp, #56
	bl	_mphyp_pte_spillable_ident
	mov	x2, x0
	str	x0, [sp, #32]
	cmn	x0, #1
	b.ne	LBB0_6
; %bb.5:
	ldr	w8, [x24]
	ldr	w9, [x19, #8]
	eor	w8, w9, w8
	str	w8, [x19, #8]
	ldr	w8, [x25]
	ldr	w9, [sp, #40]
	eor	w8, w9, w8
	str	w8, [sp, #40]
	ldr	w8, [x26]
	lsl	w8, w8, #3
	sxtw	x8, w8
	ldr	x9, [x19]
	eor	x0, x9, x8
	str	x0, [x19]
	add	x1, sp, #56
	bl	_mphyp_pte_spillable_ident
	mov	x2, x0
	str	x0, [sp, #32]
	cmn	x0, #1
	b.eq	LBB0_11
LBB0_6:
	ldr	w8, [sp, #56]
Lloh21:
	adrp	x9, _LPTE_VALID@GOTPAGE
Lloh22:
	ldr	x9, [x9, _LPTE_VALID@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.7:
Lloh24:
	adrp	x9, _H_REMOVE@GOTPAGE
Lloh25:
	ldr	x9, [x9, _H_REMOVE@GOTPAGEOFF]
Lloh26:
	adrp	x10, _H_AVPN@GOTPAGE
Lloh27:
	ldr	x10, [x10, _H_AVPN@GOTPAGEOFF]
Lloh28:
	ldr	w0, [x9]
Lloh29:
	ldr	w1, [x10]
Lloh30:
	adrp	x9, _LPTE_AVPN_MASK@GOTPAGE
Lloh31:
	ldr	x9, [x9, _LPTE_AVPN_MASK@GOTPAGEOFF]
Lloh32:
	ldr	w9, [x9]
	and	w3, w9, w8
	add	x5, sp, #24
	add	x6, sp, #16
	add	x7, sp, #24
	mov	x4, #0
	bl	_phyp_pft_hcall
	mov	x21, x0
Lloh33:
	adrp	x8, _moea64_pte_overflow@GOTPAGE
Lloh34:
	ldr	x8, [x8, _moea64_pte_overflow@GOTPAGEOFF]
	ldr	w0, [x8]
	add	w9, w0, #1
	str	w9, [x8]
	bl	_STAT_MOEA64
	ldr	x8, [x22]
	cmp	x21, x8
Lloh35:
	adrp	x8, _H_NOT_FOUND@GOTPAGE
Lloh36:
	ldr	x8, [x8, _H_NOT_FOUND@GOTPAGEOFF]
Lloh37:
	ldr	x8, [x8]
	ccmp	x21, x8, #4, ne
	cset	w0, eq
	sxtw	x1, w21
	bl	_KASSERT
	ldr	x2, [sp, #32]
LBB0_8:
	ldr	w0, [x23]
Lloh38:
	adrp	x8, _H_EXACT@GOTPAGE
Lloh39:
	ldr	x8, [x8, _H_EXACT@GOTPAGEOFF]
Lloh40:
	ldr	w1, [x8]
	ldr	w3, [sp, #40]
	ldr	x4, [sp, #48]
	add	x5, sp, #32
	add	x7, sp, #24
	mov	x6, x20
	bl	_phyp_pft_hcall
	mov	x20, x0
Lloh41:
	adrp	x0, _mphyp_eviction_lock@GOTPAGE
Lloh42:
	ldr	x0, [x0, _mphyp_eviction_lock@GOTPAGEOFF]
	bl	_rm_wunlock
	ldr	x8, [sp, #32]
	str	x8, [x19]
	ldr	x8, [x22]
	cmp	x20, x8
	b.ne	LBB0_10
; %bb.9:
	mov	w20, #0
	b	LBB0_3
LBB0_10:
	str	x20, [sp]
Lloh43:
	adrp	x0, l_.str.4@PAGE
Lloh44:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_panic
	b	LBB0_3
LBB0_11:
Lloh45:
	adrp	x0, _mphyp_eviction_lock@GOTPAGE
Lloh46:
	ldr	x0, [x0, _mphyp_eviction_lock@GOTPAGEOFF]
	bl	_rm_wunlock
Lloh47:
	adrp	x0, l_.str.2@PAGE
Lloh48:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_panic
	mov	w20, #-1
	b	LBB0_3
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh28
	.loh AdrpLdrGot	Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpLdrGot	Lloh45, Lloh46
	.cfi_endproc
                                        ; -- End function
	.comm	_MA_OWNED,4,2                   ; @MA_OWNED
	.comm	_mphyp_eviction_lock,4,2        ; @mphyp_eviction_lock
	.comm	_H_ENTER,4,2                    ; @H_ENTER
	.comm	_H_SUCCESS,8,3                  ; @H_SUCCESS
	.comm	_H_PTEG_FULL,8,3                ; @H_PTEG_FULL
	.comm	_moea64_pteg_count,4,2          ; @moea64_pteg_count
	.comm	_PVO_HID,4,2                    ; @PVO_HID
	.comm	_LPTE_HID,4,2                   ; @LPTE_HID
	.comm	_moea64_pteg_mask,4,2           ; @moea64_pteg_mask
	.section	__TEXT,__cstring,cstring_literals
l_.str.2:                               ; @.str.2
	.asciz	"mphyp_pte_insert: overflow"

	.comm	_LPTE_VALID,4,2                 ; @LPTE_VALID
	.comm	_H_REMOVE,4,2                   ; @H_REMOVE
	.comm	_H_AVPN,4,2                     ; @H_AVPN
	.comm	_LPTE_AVPN_MASK,4,2             ; @LPTE_AVPN_MASK
	.comm	_moea64_pte_overflow,4,2        ; @moea64_pte_overflow
	.comm	_H_NOT_FOUND,8,3                ; @H_NOT_FOUND
	.comm	_H_EXACT,4,2                    ; @H_EXACT
l_.str.4:                               ; @.str.4
	.asciz	"Page replacement error: %ld"

	.no_dead_strip	_mphyp_pte_insert
.subsections_via_symbols
