	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %ebx
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r12
	movq	_KTR_PMAP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	(%r12), %rax
	movq	_curcpu@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %edx
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rcx
	movq	%r14, %r8
	movl	%ebx, %r9d
	callq	_CTR4
	movq	_VM_PROT_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%ebx, %eax
	movq	_VM_PROT_NONE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_1
## %bb.11:
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_pmap_remove                    ## TAILCALL
LBB0_1:
	movq	_VM_PROT_WRITE@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_2
## %bb.10:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	%r12, %rdi
	callq	_PMAP_LOCK
	movq	%r14, %rax
	subq	%r15, %rax
	movq	_PMAP_TSB_THRESH@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jle	LBB0_3
## %bb.12:
	movq	_pmap_protect_tte@GOTPCREL(%rip), %r8
	movq	%r12, %rdi
	xorl	%esi, %esi
	movq	%r15, %rdx
	movq	%r14, %rcx
	callq	_tsb_foreach
	movq	%r12, %rdi
	callq	_tlb_context_demap
	jmp	LBB0_9
LBB0_3:
	cmpq	%r15, %r14
	jle	LBB0_8
## %bb.4:
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r13
	movq	%r15, %rbx
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=1
	addq	(%r13), %rbx
	cmpq	%r14, %rbx
	jge	LBB0_8
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_tsb_tte_lookup
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	%r12, %rdi
	xorl	%esi, %esi
	movq	%rax, %rdx
	movq	%rbx, %rcx
	callq	_pmap_protect_tte
	jmp	LBB0_7
LBB0_8:
	decq	%r14
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_tlb_range_demap
LBB0_9:
	movq	%r12, %rdi
	addq	$8, %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: ctx=%#lx sva=%#lx eva=%#lx prot=%#lx"

	.comm	_curcpu,8,3                     ## @curcpu
	.comm	_VM_PROT_READ,4,2               ## @VM_PROT_READ
	.comm	_VM_PROT_NONE,4,2               ## @VM_PROT_NONE
	.comm	_VM_PROT_WRITE,4,2              ## @VM_PROT_WRITE
	.comm	_PMAP_TSB_THRESH,8,3            ## @PMAP_TSB_THRESH
	.comm	_PAGE_SIZE,8,3                  ## @PAGE_SIZE
.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:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x22, x3
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _KTR_PMAP@GOTPAGE
Lloh1:
	ldr	x8, [x8, _KTR_PMAP@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	ldr	x8, [x19]
Lloh3:
	adrp	x9, _curcpu@GOTPAGE
Lloh4:
	ldr	x9, [x9, _curcpu@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	ldr	w2, [x8, x9, lsl #2]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x3, x20
	mov	x4, x21
	mov	x5, x22
	bl	_CTR4
Lloh8:
	adrp	x8, _VM_PROT_READ@GOTPAGE
Lloh9:
	ldr	x8, [x8, _VM_PROT_READ@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	and	w8, w8, w22
Lloh11:
	adrp	x9, _VM_PROT_NONE@GOTPAGE
Lloh12:
	ldr	x9, [x9, _VM_PROT_NONE@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_2
; %bb.1:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_pmap_remove
LBB0_2:
Lloh14:
	adrp	x8, _VM_PROT_WRITE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _VM_PROT_WRITE@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	tst	w8, w22
	b.eq	LBB0_4
; %bb.3:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_4:
	mov	x0, x19
	bl	_PMAP_LOCK
Lloh17:
	adrp	x8, _PMAP_TSB_THRESH@GOTPAGE
Lloh18:
	ldr	x8, [x8, _PMAP_TSB_THRESH@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
	sub	x9, x21, x20
	cmp	x9, x8
	b.le	LBB0_6
; %bb.5:
Lloh20:
	adrp	x4, _pmap_protect_tte@GOTPAGE
Lloh21:
	ldr	x4, [x4, _pmap_protect_tte@GOTPAGEOFF]
	mov	x0, x19
	mov	x1, #0
	mov	x2, x20
	mov	x3, x21
	bl	_tsb_foreach
	mov	x0, x19
	bl	_tlb_context_demap
	b	LBB0_12
LBB0_6:
	cmp	x21, x20
	b.le	LBB0_11
; %bb.7:
Lloh22:
	adrp	x23, _PAGE_SIZE@GOTPAGE
Lloh23:
	ldr	x23, [x23, _PAGE_SIZE@GOTPAGEOFF]
	mov	x22, x20
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	ldr	x8, [x23]
	add	x22, x8, x22
	cmp	x22, x21
	b.ge	LBB0_11
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x22
	bl	_tsb_tte_lookup
	cbz	x0, LBB0_8
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	mov	x2, x0
	mov	x0, x19
	mov	x1, #0
	mov	x3, x22
	bl	_pmap_protect_tte
	b	LBB0_8
LBB0_11:
	sub	x2, x21, #1
	mov	x0, x19
	mov	x1, x20
	bl	_tlb_range_demap
LBB0_12:
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_PMAP_UNLOCK
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_KTR_PMAP,4,2                   ; @KTR_PMAP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pmap_protect: ctx=%#lx sva=%#lx eva=%#lx prot=%#lx"

	.comm	_curcpu,8,3                     ; @curcpu
	.comm	_VM_PROT_READ,4,2               ; @VM_PROT_READ
	.comm	_VM_PROT_NONE,4,2               ; @VM_PROT_NONE
	.comm	_VM_PROT_WRITE,4,2              ; @VM_PROT_WRITE
	.comm	_PMAP_TSB_THRESH,8,3            ; @PMAP_TSB_THRESH
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
.subsections_via_symbols
