메모리맵

dreamer의 이미지

리눅스에서 메모리 맵의 구성이 어떻게 되는지 알고 싶습니다.
앞부분에 코드가 맵핑되고 뒤쪽에 힙과 스택이 설정되는 걸로 알고 있는데
좀 자세하게 알고 싶습니다. 설명이나 혹은 자료가 없나요?

codebank의 이미지

/usr/include/asm/a.out.h라는 파일에 그 구조가 있습니다.
간단하게 옮기면

struct exec
{
  unsigned long a_info;         /* Use macros N_MAGIC, etc for access */
  unsigned a_text;              /* length of text, in bytes */
  unsigned a_data;              /* length of data, in bytes */
  unsigned a_bss;               /* length of uninitialized data area for file, in bytes */
  unsigned a_syms;              /* length of symbol table data in file, in bytes */
  unsigned a_entry;             /* start address */
  unsigned a_trsize;            /* length of relocation info for text, in bytes */
  unsigned a_drsize;            /* length of relocation info for data, in bytes */
};

정도가 되겠네요.

------------------------------
좋은 하루 되세요.

mushim의 이미지

아래 주소가 간략하게 설명이 잘돼어 있구요.
http://www.linux-mag.com/2002-05/compile_01.html

자세한 부분은 Understanding the Linux kernel (1st edition) 의
19장 프로그램 실행부분을 참고하시면 될것입니다.

댓글 달기

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 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.