(ARM) 명령어의 차이에 대한 것입니다.

suh1978의 이미지

ARM 보드에 부트로더를 만들고 있습니다.

테스트용으로 지금은 잘 동작하는데요..

좀 확실하게 아는게 아닌거 같은 부분이 하나 있어서요..

아래 소스를 보시면

_start: b RESET
b UNDEF
b SWI
b PABORT
b DABORT
b NOT_USED
b INTREQ
b FINTREQ

부트로더의 초기부분입니다. 각 익셉션/인터럽트에 대한 벡터테이블을

구성하고 있는 부분입니다. 이것을 아래와 같이 변경하면 잘되던것이

무반응이 되어버리는데요.

/*
_start:
ldr pc, RESET @ offset 0x00 : Reset
ldr pc, UNDEF @ offset 0x04 : Undefined Instruction
ldr pc, SWI @ offset 0x08 : Software Instruction
ldr pc, PABORT @ offset 0x0c : Prefetch Abort
ldr pc, DABORT @ offset 0x10 : Data Abort
ldr pc, NOT_USED @ offset 0x14 : reserved
ldr pc, INTREQ @ offset 0x18 : Interrupt Request
ldr pc, FINTREQ @ offset 0x1c : Fast Interrupt Request
*/

branch 명령어를 사용하는것과 ldr명령어로 pc를 직접 변경시키는것에

서로 차이가 있는것인가요.

ohhara의 이미지


arm assembly가 잘 기억이 안 나서 확실하게는 대답을 못하겠는데 b는 memory가 가르키는 곳으로 jump를 하는거고 ldr은 memory가 가르키고 있는 곳의 data를 register에 move시키는 것일 듯한 느낌이 듭니다.
확실한 것은 JTAG Debugger같은 거로 step을 해 가면서 보면 가장 확실할 듯 합니다. 뭔가 사소한 실수일 듯한 느낌이 듭니다. ^^;

기억이 가물가물해서 확실한 정보는 아닙니다. ^^;;

Taeho Oh ( ohhara@postech.edu, ohhara@plus.or.kr ) http://ohhara.sarang.net
Postech ( Pohang University of Science and Technology ) http://www.postech.edu
PLUS ( Postech Laboratory for Unix Security ) http://www.plus.or.kr

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

익명사용자의 이미지

branch 의 offset range 는 큽니다만, ldr 에서 pc 에 넣는 값은 range 는 작습니다. 12 bit 던가 잘 기억은 안 납니다만. 이것보다 커지게 되면 ldr 은 생성되는 바이너리의 가장 뒷쪽에 offset 를 써놓고 ldr 실행시 그 값을 참조하여 수행합니다. label 들의 위치가 멀리 있다면 가까이 놓고 한번 테스트 해보시면 뭔가 다른 결과가 나오지 않을까요.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.