arm용 u-boot를 분석 중 변수 선언에 대한 질문

gauibauibo의 이미지

u-boot 소스를 분석중에

    register volatile gd_t *gd asm("r8")

로 구조체 변수를 선언하는 부분이 있는데

제가 알기로는 register는 변수를 cpu의 레지스테에 저장하라는 뜻이고

volatile은 컴파일 최적화하지말고 선언한 변수를 메모리에서 직접 접근해서 가지고 와라

이런 뜻으로 알고있는데...

위에서와 같이 register volatile 변수를 선언하면 어떤 뜻인지 모르겠습니다.

ohhara의 이미지


arm compiler의 확장을 정확히 몰라서 확실하지는 않지만,

아마도 gd를 register에 잡고 *gd를 volatile하게 access하라는 의미가 아닌가 추측됩니다.

Taeho Oh ( ohhara@postech.edu , ohhara@plus.or.kr ) http://ohhara.sarang.net
Postech ( Pohang University of Science and Technology ) http://www.postech.edu
Digital Media Professionals Inc. http://www.dmprof.com

Taeho Oh ( ohhara@postech.edu ) http://ohhara.sarang.net
Postech ( Pohang University of Science and Technology ) http://www.postech.edu
Alticast Corp. http://www.alticast.com