[질문] __asm__("andl %%esp,%0; ":"=r" (current) : "" (~8191UL)); 이거 어떻게 해석하나요 ? 상형문자인가 ? 참나~

calebrhee의 이미지


__asm__("andl %%esp,%0; ":"=r" (current) : "" (~8191UL));

좀 알려 주세요.

modestcode의 이미지

inline assembler로 검색해 보시면 문법을 아실 수 있고요,
stack size 가 8K인 architecture에서 현재 thread 정보를 current 변수로 가져오는 것으로 보이네요.
아래 C 코드와 같은 역할이죠.

http://lxr.linux.no/source/include/asm-i386/thread_info.h

90 /* how to get the thread information struct from C */
91 static inline struct thread_info *current_thread_info(void)
92 {
93         return (struct thread_info *)(current_stack_pointer & ~(THREAD_SIZE - 1));
94 }