달력

7

« 2025/7 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
2012. 11. 5. 14:18

thread_info 이해 카테고리 없음2012. 11. 5. 14:18


static inline struct thread_info *current_thread_info(void)
{
    return (struct thread_info *)(current_stack_pointer & ~(THREAD_SIZE - 1));
}

/* how to get the current stack pointer from C */
register unsigned long current_stack_pointer asm("esp") __attribute_used__;

현재 스택 포인터에서 비트연산을 통해 thread_info 구조체를 찾는다.

스택은 높은주소에서 낮은주소로 자라므로, 위 그림같은 구조가 된다.

:
Posted by НooпeУ


Code Start Code End