de ce să știi limbaj de asamblare

Post on 12-Apr-2017

524 Views

Category:

Education

11 Downloads

Preview:

Click to see full reader

TRANSCRIPT

De ce sa s, tii limbaj de asamblare?

Razvan Deaconescurazvan.deaconescu@cs.pub.ro

Informatica la Castel 2016 (Macea, Arad)

24 august 2016

1 / 22

Exemple din securitatea ofensiva

I offensive security

I serviciu de tip hello configurat pe mas, ina virtuala

I Smashing the Stack for Fun and Profit (aleph1)

I https://www.exploit-db.com/local/

I https://www.exploit-db.com/shellcode/

I https://www.exploit-db.com/docs/39665.pdf

2 / 22

Nevoia de optimizare

Make it work. Make it right. Make it fast.

Kent Beck

http://osxr.org:8080/glibc/source/sysdeps/x86/bits/string.h

3 / 22

Nevoia de debugging

printf debuggingvalori variabile

funct, ii apelate (fluxul programului)valori din memorie

valorile registrelor procesoruluicodul rulat de procesor

4 / 22

Dezvoltare low-level

I sisteme ıncoporate (embedded systems)I Board Support Package: bootloader, kernel, drivere

I software de sistem (system software)

I dezvoltare de kernel (kernel development)

5 / 22

Inainte de a ıncepe

mai mult citim decat scriemca sa scrii poves, ti bune trebuie sa cites, ti poves, ti bune

ca sa scrii cod bun trebuie sa cites, ti cod bunmai mult ca orice, limbajul de asamblare mai mult se cites, te

Invat, am limbaj de asamblare ca sa ınt, elegem, mult mai rarsa scriem.

R. Deaconescu, 2016, Macea, Arad

6 / 22

De ce e mai us,or?

I mas, ini virtuale

I emulatoare

I documentat, ie

7 / 22

Funct, ionarea sistemului de calcul

8 / 22

Concepte

I memorie

I adresa de memorie

I cod mas, ina (instruct, iuni)

I procesor

I registre

I operat, ii / mnemonici

I operanzi: registre, adrese de memorie, valori

9 / 22

Bazele limbajului de asamblare

I datele rezida ın memorie

I datele sunt aduse din memorie ın registrele procesorului

I procesorul face operat, ii cu datele din registre

I rezultatele operat, iilor sunt scrise ınapoi ın memorie

I unele informat, ii pot fi preluate s, i transmise catre dispozitivede intrare/ies, ire

10 / 22

Operat, ii de asamblare

11 / 22

Exemple ın limbaj de asamblare

I asm/hello.asm

I asm/print_n.asm

I asm/print_n_xor.asm

12 / 22

Compiler Explorer

I https://gcc.godbolt.org/

13 / 22

Int,elegerea sistemului de calcul

De ce ınvat, a oamenii obis,nuit, i sa cante la instrumente muzicale?De ce fac oamenii obis,nuit, i sport ın mod activ?

De ce le place oamenilor (ın special copiilor) sa demonteze lucruri?

Mastery, Autonomy and Purpose (Dan Pink: Drive)

curiozitate s, i expertiza

14 / 22

Joel Spolsky: Law of Leaky Abstractions

I http:

//www.joelonsoftware.com/articles/LeakyAbstractions.html

16 / 22

Parcurgerea unei matrice

Demo: walk matrix row major.c, walk matrix column major.c

17 / 22

Shlemiel the Painter’s Algorithm

I Joel Spolsky: Back to BasicsI http:

//www.joelonsoftware.com/articles/fog0000000319.html

18 / 22

Poves, ti, povestiri, amintiri

I Minunata calatorie a lui Razvan ,,Senpai” Deaconescu ınlumea calculatoarelor

19 / 22

Cum ınvat,/cum aprofundez

I Nu ınvat,a ceva ca sa ınvet, i ceva / ca e bine / ca se cauta / cavrei sa s, tii.

I Pune-t, i obiective s, i ınvat, a ca o consecint, a. Means to an end.

I competit, ii de tip CTF (Capture the Flag)

I site-uri de tip wargames

I profiling la aplicat, ii

I programeaza pe platforme ARM (sau MIPS): Raspberry Pi

I Randal E. Bryant, David R. O’Hallaron: Computer Systems:A Programmer’s Perspective

20 / 22

La final

I Invat, a ın profunzime.

I Strica lucrurile.

I Detaliile fac diferent,a.

I Rabdarea este o virtute.

When solving problems, dig at the roots instead of just hacking atthe leaves.

Anthony J. D’Angelo

Laborator de introducere ın limbaj de asamblare: joi, 25 august2016, ora 21:00

21 / 22

Mult,umesc!

I http://www.slideshare.net/razvandeaconescu/de-ce-s-tii-limbaj-de-asamblare

I https://github.com/razvand/slides/tree/master/de-ce-asamblare

22 / 22

top related