⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intrlock.src

📁 不错的东西 请查看 WINCE OS
💻 SRC
字号:
;
; Copyright (c) Microsoft Corporation.  All rights reserved.
;
;
; This source code is licensed under Microsoft Shared Source License
; Version 1.0 for Windows CE.
; For a copy of the license visit http://go.microsoft.com/fwlink/?LinkId=3223.
;
	.HEADING "Interlock memory operations"
	.FORM LINES=55
;++
;
;
; Module Name:
;
;    intrlock.src
;
; Abstract:
;
;    This module implements the InterlockedIncrement, I...Decrement,
; I...Exchange and I...TestExchange APIs.
;
;    WARNING: This module jumps to well known code in the kernel data page to
; perform the interlocked operations.  The kernel exception handlers know the
; locations of those routines so that it can perform any necessary restarts in
; case of an interrupt or an exception.
;
; Environment:
;
;    Kernel mode or User mode.
;
; Revision History:
;
;--


	.include "ksshx.h"

	LEAF_ENTRY InterlockAPIs
	ALTERNATE_ENTRY _InterlockedExchange
	mov	#USER_KPAGE+h'3c0, r0
	jmp	@r0
	nop

	ALTERNATE_ENTRY _InterlockedTestExchange
	mov	r5, r0		;\ 
	mov	r6, r5		; > swap 2nd & 3rd arguments
	mov	r0, r6		;/
	ALTERNATE_ENTRY _InterlockedCompareExchange
	mov	#USER_KPAGE+h'3d0, r0
	jmp	@r0
	nop

	ALTERNATE_ENTRY _InterlockedIncrement
	mov	#USER_KPAGE+h'3e0, r0
	jmp	@r0
	nop

	ALTERNATE_ENTRY _InterlockedExchangeAdd
	mov	#USER_KPAGE+h'3f0, r0
	jmp	@r0
	nop
	.endf

	NESTED_ENTRY _InterlockedDecrement
	sts	PR, @-r15	; save return address
	PROLOG_END
	mov	#USER_KPAGE+h'3f0, r0
	jsr	@r0		; InterlockedExchangeAdd(addend, -1)
	mov	#-1, r5

	lds	@r15+, PR
	rts			; return to original caller
	add	#-1, r0		; adjust for correct return value
	.endf

	LEAF_ENTRY _DebugBreak
	trapa	#1
	rts
	nop
	.endf

	.end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -