Description: This is Part 10 of the "Assembly Language Primer for Hackers" video series. Please start here by watching Part 1 of this series, if you have not already done so. In this video we will look at how to write functions in Assembly Language. <br><br>The most important step in writing functions in assembly is to understand how to pass arguments to them and then read their return values. We will look at 2 techniques - using registers and using global memory locations to understand how this can be done. In this demo we will use our familiar "Hello World" program to demonstrate how to code a simple function using the "write()" syscall. We will useĀ the Function.s program to demonstrate argument passing using the CPU registers and Function2.s to demo argument passing using global memory location in the .BSS segment. <br><br><br><style type="text/css"> body { background: </style> </div>
Tags: programming ,
Disclaimer: We are a infosec video aggregator and this video is linked from an external website. The original author may be different from the user re-posting/linking it here. Please do not assume the authors to be same without verifying.
I really really enjoy these series, I have been using it as a refreshment, I have not looked at asm in a long time.
Thank you for all your work
I too enjoy the series. Recently retired, interested in hacking and computer security. This is a great start. Thanks for all your work.
If only these videos were available when i was doing my Undergrad.....My exams would have been a lot easier!
Many thanks again, great video. Only 1 left in this series.
This is great! Loved the series. Learning ASM after years of hoping. Thanks a lot.
Thank you vivek sir..I am new to this field of information security and I am learning assembly after so long time and that to from basics...getting everything very clear..!!
I would also like to thank my guide AP4CH3 who asked me to watch this all videos so i can clear my basics easily.
As always! Another great movie! Thank you Vivek!
awesome video vivek.
Hi Vivek.
Thanks for this awesome videos.
i have a question about the example used in the code.
The second example on Myfunction you use the movl instruction to copy addresses of pointer and lenght.
movl StringPointer, %ecx
movl StringLenght, %edx
i tryed to use leal instead of movl,even the address is copied in the register it doesen't work.
what mistake i'm making?
Thanks
@ireip
leal HelloWorldStr, %ecx
movl $HelloWorldStr, %ecx
these 2 are equivalent, i think leal tries to get the address of the .data label HelloWorldStr, but in this example (2nd one) we already have the value of the string address in the .lcomm label, and using lea StringPointer will try to get the address where the address is right now
hi, great series I am using it as a refresher and it does MagiC:) Just a question about string len. You are setting it to 14 for HelloWorld string and 17 for HelloFunction string. when I run it my output is:
Hello World!
HHello Function!
first letter of the second string is doubled, and because this strings are in memory one after another i think(and gdb knows:P) first of them is printed: Hello World!\nH
but i can see that you compile/link/run it with out a problem, so is this OS or GCC compability thing???
hi MR Vivek.
thanks a lot for this priceless videos.
i just want to ask if , is it possible to upload your presentation files so that it used as cheat sheet?
thanks again
Thanks for your hard work Vivek.
After this is completed, what other sources of training would you suggest for a programming n00b?
Thanks a bunch Vivek, your videos are serving as a great primer prior to getting Bill Blunden's root kit book in a couple of weeks.
Thanks a lot! Your work is always superb :)
Much thanks for the video from Moscow )
it is awesome .
Dear viviek,
I have no words to praise you for the simplistic way with which you are able to express such things.It too good...!!!
Wonderful video, Now I understand a little more about functions
Another excellent video. I was getting an error when wrote the command "print x / $eip" As seen at 13:31. The error was "$2= Value can't be converted to integer." When I changed it to "print x / $rip" it worked correctly. It must have something to do with the fact that I am using a 64 bit CPU.