Lecture 5: x86 Instruction Set, GCC Calling Conventions

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ม.ค. 2025

ความคิดเห็น • 5

  • @dheerajakula7
    @dheerajakula7 6 ปีที่แล้ว +12

    Thank u sir!

  • @reenamola2162
    @reenamola2162 2 ปีที่แล้ว

    incorrect. the first argument is only esp+4 until it enters the call. as soon as the call is entered and push ebp takes place instantly the first argument is now esp+8 not esp+4. esp+0(or esp since its +0) = return address esp+4 = function base address(from the push ebp) esp+8 = first argument in a 32bit architecture

    • @hrs7305
      @hrs7305 2 ปีที่แล้ว

      He does exactly the same at @34:51, watch the complete video before blurting out in comment section

    • @prabhavpatil3761
      @prabhavpatil3761 4 หลายเดือนก่อน

      before executing anything, we have esp pointing towards the return address. once we push ebp, esp now decrements by 4, i.e. esp = esp - 4, and after that, ebp = esp. so, the current scenario is such that:
      1. esp is pointing towards the address in the stack where the original value of ebp is stored,
      2. esp+4 is where the return address is stored
      3. esp+8 is where the first argument of the function is.
      (The stack grows downwards, hence as you insert elements in the stack, the pointer is decremented by 4 at each step)