	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pmap_protect                   ## -- Begin function pmap_protect
	.p2align	4, 0x90
_pmap_protect:                          ## @pmap_protect
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %ebx
	movl	%edx, %r15d
	movl	%esi, %r13d
	movl	%edi, %r14d
	movq	_KTR_PMAP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	movl	%r13d, %ecx
	movl	%r15d, %r8d
	movl	%ebx, %r9d
	callq	_CTR4
	movq	_VM_PROT_READ@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_28
## %bb.1:
	movq	_VM_PROT_WRITE@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_2
## %bb.27:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_28:
	movl	%r14d, %edi
	movl	%r13d, %esi
	movl	%r15d, %edx
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_pmap_remove                    ## TAILCALL
LBB0_2:
	movq	_pvh_global_lock@GOTPCREL(%rip), %rdi
	callq	_rw_wlock
	movl	%r14d, %edi
	callq	_PMAP_LOCK
	movl	%r15d, %ebx
	subl	%r13d, %ebx
	movq	_FALSE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%r14d, %edi
	movl	%r13d, %esi
	movl	%ebx, %edx
	movl	%ecx, %r8d
	callq	_pmap_dcache_wb_range
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shll	$2, %eax
	xorl	%ecx, %ecx
	cmpl	%eax, %ebx
	setl	%cl
	negl	%ecx
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movl	$0, -60(%rbp)                   ## 4-byte Folded Spill
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
                                        ##     Child Loop BB0_8 Depth 2
	movl	%r13d, %ebx
	.p2align	4, 0x90
LBB0_4:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpl	%r15d, %ebx
	jge	LBB0_21
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=2
	movl	%ebx, %r13d
	movl	%ebx, %edi
	callq	_L2_NEXT_BUCKET
	movl	%eax, %ebx
	cmpl	%r15d, %eax
	cmovgel	%r15d, %ebx
	movl	%r14d, %edi
	movl	%r13d, %esi
	callq	_pmap_get_l2_bucket
	testq	%rax, %rax
	je	LBB0_4
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	(%rax), %r12
	movl	%r13d, %edi
	callq	_l2pte_index
	cmpl	%ebx, %r13d
	jge	LBB0_3
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	leaq	(%r12,%rax,4), %rdx
	movq	_L2_S_PROT_W@GOTPCREL(%rip), %rcx
	jmp	LBB0_8
LBB0_14:                                ##   in Loop: Header=BB0_8 Depth=2
	incl	%esi
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	orl	%eax, -60(%rbp)                 ## 4-byte Folded Spill
LBB0_20:                                ##   in Loop: Header=BB0_8 Depth=2
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	addl	(%rax), %r13d
	addq	$4, %rdx
	cmpl	%ebx, %r13d
	jge	LBB0_3
LBB0_8:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%rdx), %r12d
	testl	%r12d, %r12d
	je	LBB0_20
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=2
	testl	%r12d, (%rcx)
	je	LBB0_20
## %bb.10:                              ##   in Loop: Header=BB0_8 Depth=2
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movl	%r12d, %edi
	callq	_l2pte_pa
	movl	%eax, %edi
	callq	_PHYS_TO_VM_PAGE
	movq	_L2_S_PROT_W@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	notl	%ecx
	andl	%r12d, %ecx
	movq	%rax, %r12
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%ecx, (%rdi)
	callq	_PTE_SYNC
	movq	_VPO_UNMANAGED@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	xorl	%eax, %eax
	testl	%ecx, (%r12)
	jne	LBB0_13
## %bb.11:                              ##   in Loop: Header=BB0_8 Depth=2
	movq	_PVF_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r12, %rdi
	movl	%r14d, %esi
	movl	%r13d, %edx
	xorl	%r8d, %r8d
	callq	_pmap_modify_pv
	movq	_PVF_WRITE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_8 Depth=2
	movq	%r12, %rdi
	movl	%eax, %r12d
	callq	_vm_page_dirty
	movl	%r12d, %eax
LBB0_13:                                ##   in Loop: Header=BB0_8 Depth=2
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	testl	%esi, %esi
	movq	_L2_S_PROT_W@GOTPCREL(%rip), %rcx
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	jns	LBB0_14
## %bb.15:                              ##   in Loop: Header=BB0_8 Depth=2
	movl	%eax, %r12d
	movl	%eax, %edi
	callq	_PV_BEEN_EXECD
	testq	%rax, %rax
	je	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_8 Depth=2
	movl	%r14d, %edi
	movl	%r13d, %esi
	callq	_pmap_tlb_flushID_SE
	jmp	LBB0_19
LBB0_17:                                ##   in Loop: Header=BB0_8 Depth=2
	movl	%r12d, %edi
	callq	_PV_BEEN_REFD
	testq	%rax, %rax
	je	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_8 Depth=2
	movl	%r14d, %edi
	movl	%r13d, %esi
	callq	_pmap_tlb_flushD_SE
LBB0_19:                                ##   in Loop: Header=BB0_8 Depth=2
	movq	_L2_S_PROT_W@GOTPCREL(%rip), %rcx
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	jmp	LBB0_20
LBB0_21:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_26
## %bb.22:
	movl	-60(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edi
	callq	_PV_BEEN_EXECD
	testq	%rax, %rax
	je	LBB0_24
## %bb.23:
	movl	%r14d, %edi
	callq	_pmap_tlb_flushID
	jmp	LBB0_26
LBB0_24:
	movl	%ebx, %edi
	callq	_PV_BEEN_REFD
	testq	%rax, %rax
	je	LBB0_26
## %bb.25:
	movl	%r14d, %edi
	callq	_pmap_tlb_flushD
LBB0_26:
	movq	_pvh_global_lock@GOTPCREL(%rip), %rdi
	callq	_rw_wunlock
	movl	%r14d, %edi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PMAP_UNLOCK                    ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_KTR_PMAP,4,2                   ## @KTR_PMAP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"pmap_protect: pmap %p sva 0x%08x eva 0x%08x prot %x"

	.comm	_VM_PROT_READ,4,2               ## @VM_PROT_READ
	.comm	_VM_PROT_WRITE,4,2              ## @VM_PROT_WRITE
	.comm	_pvh_global_lock,4,2            ## @pvh_global_lock
	.comm	_FALSE,4,2                      ## @FALSE
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_L2_S_PROT_W,4,2                ## @L2_S_PROT_W
	.comm	_VPO_UNMANAGED,4,2              ## @VPO_UNMANAGED
	.comm	_PVF_WRITE,4,2                  ## @PVF_WRITE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pmap_protect                   ; -- Begin function pmap_protect
	.p2align	2
_pmap_protect:                          ; @pmap_protect
	.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
	mov	x22, x3
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _KTR_PMAP@GOTPAGE
Lloh1:
	ldr	x8, [x8, _KTR_PMAP@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	mov	x3, x21
	mov	x4, x20
	mov	x5, x22
	bl	_CTR4
Lloh5:
	adrp	x8, _VM_PROT_READ@GOTPAGE
Lloh6:
	ldr	x8, [x8, _VM_PROT_READ@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	tst	w8, w22
	b.eq	LBB0_3
; %bb.1:
Lloh8:
	adrp	x8, _VM_PROT_WRITE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _VM_PROT_WRITE@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	tst	w8, w22
	b.eq	LBB0_4
; %bb.2:
	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
LBB0_3:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	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
	b	_pmap_remove
LBB0_4:
Lloh11:
	adrp	x0, _pvh_global_lock@GOTPAGE
Lloh12:
	ldr	x0, [x0, _pvh_global_lock@GOTPAGEOFF]
	bl	_rw_wlock
	mov	x0, x19
	bl	_PMAP_LOCK
	sub	w23, w20, w21
Lloh13:
	adrp	x8, _FALSE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh15:
	ldr	w3, [x8]
	mov	x0, x19
	mov	x1, x21
	mov	x2, x23
	mov	x4, x3
	bl	_pmap_dcache_wb_range
	str	wzr, [sp, #12]                  ; 4-byte Folded Spill
Lloh16:
	adrp	x26, _PAGE_SIZE@GOTPAGE
Lloh17:
	ldr	x26, [x26, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w8, [x26]
	cmp	w23, w8, lsl #2
	csetm	w27, lt
Lloh18:
	adrp	x28, _L2_S_PROT_W@GOTPAGE
Lloh19:
	ldr	x28, [x28, _L2_S_PROT_W@GOTPAGEOFF]
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_11 Depth 2
	cmp	w21, w20
	b.ge	LBB0_23
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x21
	bl	_L2_NEXT_BUCKET
	cmp	w0, w20
	csel	w22, w0, w20, lt
	mov	x0, x19
	mov	x1, x21
	bl	_pmap_get_l2_bucket
	cbz	x0, LBB0_22
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x23, [x0]
	mov	x0, x21
	bl	_l2pte_index
	cmp	w21, w22
	b.ge	LBB0_5
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x23, x23, x0, lsl #2
	b	LBB0_11
LBB0_9:                                 ;   in Loop: Header=BB0_11 Depth=2
	add	w27, w27, #1
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	orr	w8, w24, w8
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=2
	ldr	w8, [x26]
	add	x23, x23, #4
	add	w21, w8, w21
	cmp	w21, w22
	b.ge	LBB0_5
LBB0_11:                                ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w24, [x23]
	cbz	w24, LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=2
	ldr	w8, [x28]
	tst	w8, w24
	b.eq	LBB0_10
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=2
	mov	x0, x24
	bl	_l2pte_pa
	bl	_PHYS_TO_VM_PAGE
	mov	x25, x0
	ldr	w8, [x28]
	bic	w8, w24, w8
	str	w8, [x23]
	mov	x0, x23
	bl	_PTE_SYNC
	ldr	w8, [x25]
Lloh20:
	adrp	x9, _VPO_UNMANAGED@GOTPAGE
Lloh21:
	ldr	x9, [x9, _VPO_UNMANAGED@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_11 Depth=2
	mov	w24, #0
	tbz	w27, #31, LBB0_9
	b	LBB0_18
LBB0_15:                                ;   in Loop: Header=BB0_11 Depth=2
	mov	x1, x19
	str	w27, [sp, #8]                   ; 4-byte Folded Spill
Lloh23:
	adrp	x27, _PVF_WRITE@GOTPAGE
Lloh24:
	ldr	x27, [x27, _PVF_WRITE@GOTPAGEOFF]
	ldr	w3, [x27]
	mov	x0, x25
	mov	x2, x21
	mov	w4, #0
	bl	_pmap_modify_pv
	mov	x24, x0
	ldr	w8, [x27]
	tst	w8, w0
	b.eq	LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_11 Depth=2
	mov	x0, x25
	bl	_vm_page_dirty
LBB0_17:                                ;   in Loop: Header=BB0_11 Depth=2
	ldr	w27, [sp, #8]                   ; 4-byte Folded Reload
	tbz	w27, #31, LBB0_9
LBB0_18:                                ;   in Loop: Header=BB0_11 Depth=2
	mov	x0, x24
	bl	_PV_BEEN_EXECD
	cbz	x0, LBB0_20
; %bb.19:                               ;   in Loop: Header=BB0_11 Depth=2
	mov	x0, x19
	mov	x1, x21
	bl	_pmap_tlb_flushID_SE
	b	LBB0_10
LBB0_20:                                ;   in Loop: Header=BB0_11 Depth=2
	mov	x0, x24
	bl	_PV_BEEN_REFD
	cbz	x0, LBB0_10
; %bb.21:                               ;   in Loop: Header=BB0_11 Depth=2
	mov	x0, x19
	mov	x1, x21
	bl	_pmap_tlb_flushD_SE
	b	LBB0_10
LBB0_22:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x21, x22
	b	LBB0_5
LBB0_23:
	cbz	w27, LBB0_28
; %bb.24:
	ldr	w20, [sp, #12]                  ; 4-byte Folded Reload
	mov	x0, x20
	bl	_PV_BEEN_EXECD
	cbz	x0, LBB0_26
; %bb.25:
	mov	x0, x19
	bl	_pmap_tlb_flushID
	b	LBB0_28
LBB0_26:
	mov	x0, x20
	bl	_PV_BEEN_REFD
	cbz	x0, LBB0_28
; %bb.27:
	mov	x0, x19
	bl	_pmap_tlb_flushD
LBB0_28:
Lloh25:
	adrp	x0, _pvh_global_lock@GOTPAGE
Lloh26:
	ldr	x0, [x0, _pvh_global_lock@GOTPAGEOFF]
	bl	_rw_wunlock
	mov	x0, x19
	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
	b	_PMAP_UNLOCK
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_KTR_PMAP,4,2                   ; @KTR_PMAP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pmap_protect: pmap %p sva 0x%08x eva 0x%08x prot %x"

	.comm	_VM_PROT_READ,4,2               ; @VM_PROT_READ
	.comm	_VM_PROT_WRITE,4,2              ; @VM_PROT_WRITE
	.comm	_pvh_global_lock,4,2            ; @pvh_global_lock
	.comm	_FALSE,4,2                      ; @FALSE
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_L2_S_PROT_W,4,2                ; @L2_S_PROT_W
	.comm	_VPO_UNMANAGED,4,2              ; @VPO_UNMANAGED
	.comm	_PVF_WRITE,4,2                  ; @PVF_WRITE
.subsections_via_symbols
