我正在閱讀copy_from_user
函數,在copy_from_user
函數中,使用了宏__get_user_asm
。'xorb%b1,%b1`中的%b1(b一個,而不是b L)?
在linux中有一個mmap syscall,mmap syscall會調用函數copy_from_user
。如果大小不變,此功能將使用宏__get_user_asm
。的__get_user_asm
內容
#define __get_user_asm(x, addr, err, itype, rtype, ltype, errret) \
asm volatile("1: mov"itype" %2,%"rtype"1\n" \
"2:\n" \
".section .fixup,\"ax\"\n" \
"3: mov %3,%0\n" \
" xor"itype" %"rtype"1,%"rtype"1\n" \
" jmp 2b\n" \
".previous\n" \
_ASM_EXTABLE(1b, 3b) \
: "=r" (err), ltype(x) \
: "m" (__m(addr)), "i" (errret), "0" (err))
當我嘗試 __get_user_asm(*(u8 *)dst, (u8 __user *)src, ret, "b", "b", "=q", 1);
轉化爲真正的源頭,
1: movb %2,%b1\n
2:\n
.section .fixup, "ax" \n
3: mov %3, %0 \n
**xorb %b1, %b1\n**
jmp 2b\n
.previous\n
: "=r" (ret), =q(dst)
:"m"(dst), "i"(1), "0"(ret)
.quad "1b", "2b"\n
.previous\n```
, 有什麼地方我無法理解。
1,在xorb %b1, %b1
,什麼是%b1
(b一個,而不是b L)?
2,jmp 2b
,是2b
標籤或memroy地址?如果2b
是標籤,我怎麼找到這個標籤?
3,.quad "1b", "2b"
的功能是什麼?
在哪裏可以獲得讓我在語義層理解linux內核源碼的知識?
[''xorb%b1,%b1'只是將'%b1'設置爲0](http://stackoverflow.com/questions/33666617/what-is-the-best-way-to-set-a -register-to-zero-in-x86-assembly-xor-mov-or-and) – Cornstalks
是的,我知道那句話所做的事情。但我不知道%b1是什麼? – peasantspring