Possible duplicate exist 그러나이 문제를 비슷한 방법으로 적용 할 방법을 찾지 못했습니다.x86 AT & T 어셈블리의 데이터 변수 주소를 얻는 것
반환 할 함수를 만들고 있는데, 정수는 x86 AT & T 어셈블리의 문자열입니다.
변수를 선언하는 코드는 resdes
입니다.
.data
.align 4
resdes: .long 12
resdes
이제 (I을 올바르게 이해?) 내가 사용하는 무료 11 다른 바이트 다음에 메모리 위치를 가리 킵니다.
한 번에 하나의 숫자를 정수에서 바이트로 하나씩로드하려고합니다. 위의 코드에서
ifd:
movl (%esp, %ecx), %eax //This loads %eax with my int
movl resdes, %ecx //This is incorrect and causes errors later
inc %ecx
movl $10, %ebx //Division by 10 to basically do a modulo operation
cdq
divloop:
div %ebx
movb %dl, (%ecx) //This is where I move the digit into the memory
//And here I get the ERROR because (%ecx) does
//not contain the proper address
inc %ecx //And set the pointer to point to the next byte
cmp $0, %eax //If there are noe more digits left we are finished
je divfinish1
jmp divloop //I leave out alot of the code that I know
//work because it's not relevant
내 문제가 %ecx
레지스터에 resdes
의 실제 주소를 받고, 첫 번째 줄이 내 코드입니다. 내가 알고있는 한, 내용은이고 resdes
- 주소는 %ecx
입니다. 이것은 내가 원하는 것이 아닙니다.
감사가 해결되지 않기 때문에이 실제 문제가 무엇인지 더 분명하게,이를 시도 할 것이다 –