Assembly Primer For Hackers (Part 10) Functions

Posted By: SecurityTube_Bot
Posted On: Mon 21 Feb 2011
Views: 16905
Share this video:
Share it on Facebook Share it on Twitter Share it on Reddit Share it on Digg Share it on Stumbleupon
Support SecurityTube:


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.

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.


Tags: programming ,

This video is part of the following groups:

1. Assembly Language Megaprimer for Linux ( 11 videos)


Comments (12)

slingshot on Sat 26 Mar 2011

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

ElDanzante on Fri 01 Apr 2011

I too enjoy the series. Recently retired, interested in hacking and computer security. This is a great start. Thanks for all your work.

Col_Loki on Sat 30 Apr 2011

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.

b1ackzer0 on Thu 23 Jun 2011

This is great! Loved the series. Learning ASM after years of hoping. Thanks a lot.

DevilPheonam on Tue 05 Jul 2011

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.

xplt on Fri 08 Jul 2011

As always! Another great movie! Thank you Vivek!

neo on Sat 16 Jul 2011

awesome video vivek.

ireip on Wed 21 Sep 2011

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

orrala on Mon 03 Oct 2011

@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

kocur4d on Fri 04 Nov 2011

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???

Erix on Tue 17 Jan 2012

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

tecuani on Mon 23 Jan 2012

Thanks for your hard work Vivek.

After this is completed, what other sources of training would you suggest for a programming n00b?

Login to post a comment