宏调用问题

太虚野老 2018-09-13 02:58:26
asld10: ACQUIRE_SPINLOCK ecx,<short asld20>
fstRET KefAcquireSpinLockAtDpcLevel
align 4
asld20: SPIN_ON_SPINLOCK ecx,<short asld10>

上面代码的错误信息是:error A2166: structure field expected

ACQUIRE_SPINLOCK 宏定义:
ACQUIRE_SPINLOCK macro LockAddress, SpinLabel, NoChecking

SPIN_ON_SPINLOCK宏定义:
SPIN_ON_SPINLOCK macro LockAddress, AcquireLabel, NoChecking, PollDebugger, NoTimeout

什么原因导致的错误,代码中的尖括号又是啥意思。

宏定义的具体代码我没有写,挺复杂的。如果需要,我再贴上来。
...全文
772 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
太虚野老 2018-09-19
  • 打赏
  • 举报
回复
ACQUIRE_SPINLOCK ecx,<short asld20> 中,ecx是ACQUIRE_SPINLOCK 宏的第一个参数吗?
  • 打赏
  • 举报
回复
估计你用的汇编器版本比较低,ml 12.0汇编这两个宏没有问题。<short asld20>尖括号里是一个文本替换,意思是原样替换到使用宏参数的位置,对你的例子:
ACQUIRE_SPINLOCK ecx,<short asld20>
展开之后
jc SpinLabel
会变成
jc short asld20


太虚野老 2018-09-16
  • 打赏
  • 举报
回复
我把这两个宏的定义贴出来, 没明白你说的什么意思。
太虚野老 2018-09-16
  • 打赏
  • 举报
回复
ACQUIRE_SPINLOCK macro LockAddress, SpinLabel, NoChecking .errb <LockAddress> .errb <SpinLabel> ifndef NT_UP ; ; Attempt to assert the lock ; lock bts dword ptr [LockAddress], 0 ; test and set the spinlock jc SpinLabel ; spinlock owned, go SpinLabe if DBG ifb <NoChecking> push edi ; save edi mov edi,fs:PcPrcb mov edi, [edi].PbCurrentThread or edi, 1 ; spinlock owned mov [LockAddress], edi ; remember current thread pop edi ; restore edi endif ; NoChecking endif ; DBG endif ; NT_UP endm SPIN_ON_SPINLOCK macro LockAddress, AcquireLabel, NoChecking, PollDebugger, NoTimeout local a,b,flag ; define a local label .errb <LockAddress> .errb <AcquireLabel> ifndef NT_UP if DBG EXTRNP Kii386SpinOnSpinLock,2 flag = 0 ifb <NoChecking> flag = flag + 1 endif ifnb <Polldebugger> flag = flag + 2 endif ifb <NoTimeout> flag = flag + 4 endif stdCall Kii386SpinOnSpinLock,<LockAddress,flag> jmp AcquireLabel else ; DBG ; ; Non-Debug version ; a: test dword ptr [LockAddress], 1 ; Was spinlock cleared? jz AcquireLabel ; Yes, go get it YIELD jmp short a endif ; DBG endif ; NT_UP endm
  • 打赏
  • 举报
回复
<short asld20>应该是一个文本替换,在宏内部某个符号被替换为short asld20

21,458

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧