
{"id":1955,"date":"2010-07-09T21:42:37","date_gmt":"2010-07-09T16:12:37","guid":{"rendered":"http:\/\/www.jeffrin.in\/?p=1955"},"modified":"2010-07-09T21:42:37","modified_gmt":"2010-07-09T16:12:37","slug":"the-intel-ia32-processors-have-a-base-pointer","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2010\/07\/09\/the-intel-ia32-processors-have-a-base-pointer\/","title":{"rendered":"The Intel IA32 processors have a base pointer.."},"content":{"rendered":"<pre>\n<h3> software | Windows | <\/h3>\n<\/pre>\n<pre>\n<a href=\"http:\/\/www.trueangle.org\/wp-content\/uploads\/2010\/07\/2eb76-ebp-2.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.trueangle.org\/wp-content\/uploads\/2010\/07\/2eb76-ebp-2.png\" alt=\"\" title=\"ebp\" width=\"294\" height=\"150\" class=\"aligncenter size-full wp-image-1956\" \/><\/a>\n<\/pre>\n<pre>\nThe Intel IA32 processors have a base pointer register called EBP . The\nEBP register is typically set to the value of the ESP register at the\n beginning of a procedure, and used to address the procedure arguments\n and locally allocated variables throughout the procedure. Thus, the\n arguments are located at positive offsets from the EBP register, while the\n variables are located at negative offsets from the EBP register.\n\nsource :\nhttp:\/\/d3s.mff.cuni.cz\/~ceres\/sch\/osy\/text\/ch03s02s02.php\n<\/pre>\n<pre>\n<h3> software | GNU\/Linux | <\/h3>\n<\/pre>\n<pre>\n(gdb) info registers\nrax            0xfffffffffffffdfc\t-516\nrbx            0x5dc\t1500\nrcx            0xffffffffffffffff\t-1\nrdx            0x5dc\t1500\nrsi            0x1\t1\nrdi            0x7ffffb2814d0\t140737407096016\nrbp            0x1f70160\t0x1f70160\nrsp            0x7ffffb281480\t0x7ffffb281480\nr8             0x0\t0\nr9             0xffffffff\t4294967295\nr10            0x8\t8\nr11            0x246\t582\nr12            0x7ffffb2814d0\t140737407096016\nr13            0x7ffffb2814e0\t140737407096032\nr14            0x0\t0\nr15            0x1\t1\nrip            0x7f668b3710c8\t0x7f668b3710c8 \neflags         0x246\t[ PF ZF IF ]\ncs             0x33\t51\nss             0x2b\t43\nds             0x0\t0\nes             0x0\t0\nfs             0x0\t0\ngs             0x0\t0\n(gdb)\n\n<h4>  rbp            0x1f70160\t0x1f70160 <\/h4>\n<\/pre>\n<pre>\nIn computer architecture, a processor register (or general purpose\n register) is a small amount of storage available on the CPU whose\n contents can be accessed more quickly than storage available\n elsewhere.\nsource :\nhttp:\/\/en.wikipedia.org\/wiki\/Processor_register\n\nThe AMD64 architecture has sixteen 64-bit general purpose registers\n (GPRs): RAX, RBX, RCX, RDX, <b>RBP<\/b>, RSI, RDI, RSP, R8, R9, R10, R11, R12,\n R13, R14, and R15. Compared to the x86 architecture, the AMD64\n architecture has eight new GPRs.\n\nsource :\nhttp:\/\/developers.sun.com\/solaris\/articles\/x64_dbx.html\n<\/pre>\n<pre>\n<h3> | Related Discussion | <\/h3>\n<\/pre>\n<pre>\n Hi, Could somebody please explain what GCC is doing for this piece of code? What is it initializing? The original code is:\n\n#include \nint main()\n{\n\n}\nAnd it was translated to:\n\n    .file       \"test1.c\"\n    .def        ___main;        .scl    2;      .type   32;     .endef\n    .text\n.globl _main\n    .def        _main;  .scl    2;      .type   32;     .endef\n_main:\n    pushl       %ebp\n    movl        %esp, %ebp\n    subl        $8, %esp\n    andl        $-16, %esp\n    movl        $0, %eax\n    addl        $15, %eax\n    addl        $15, %eax\n    shrl        $4, %eax\n    sall        $4, %eax\n    movl        %eax, -4(%ebp)\n    movl        -4(%ebp), %eax\n    call        __alloca\n    call        ___main\n    leave\n    ret\n<\/pre>\n<pre>\n<h3> | Variation | <\/h3>\n<\/pre>\n<pre>\nRegisters E(SP), E(IP) and E(BP) are promoted to 64-bits and are re-named RSP, RIP, and RBP respectively.\n\nsource and link(s) :\nhttp:\/\/x86asm.net\/articles\/x86-64-tour-of-intel-manuals\/\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>software | Windows | The Intel IA32 processors have a base pointer register called EBP . The EBP register is typically set to the value of the ESP register at the beginning of a procedure, and used to address the procedure arguments and locally allocated variables throughout the procedure. Thus, the arguments are located at &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2010\/07\/09\/the-intel-ia32-processors-have-a-base-pointer\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;The Intel IA32 processors have a base pointer..&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[695,731,1035,1359,1680],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/1955"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=1955"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/1955\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=1955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=1955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=1955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}