Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SECTION .data ; /* contains initialized data */
- SECTION .bss ; /* contains uninitialized data */
- rslt RESD 1 ; int rslt;
- SECTION .text ; /* contains code
- GLOBAL _start ;
- _start: ; void main(void){
- nop ; /* do not remove the "nop" */
- push DWORD 1337 ; /* 5. Parameter */
- mov ax, 1 ;
- shl ax, 10 ; (1 << 10)
- add ax, 256 ; + 256
- push ax ; /* 4. Parameter */
- push WORD 36 ; /* 3. Parameter */
- mov eax, 1 ;
- shl eax, 14 ; 1 << 14
- push eax ; /* 2. Parameter */
- push WORD 126 ;
- call addFive ; int rslt = addive(...);
- mov ebx, 127 ;
- div ebx ; rslt % 127;
- mov [rslt], edx ; /* Rest der Divison edx */
- ; return 0;
- end:mov eax, 1 ; /* the exit system call
- mov ebx, edx ; no errorcode
- int 80h ; execute system call */
- ; }
- addFive: ; int addFive(short a, /* [ebp+8] */
- ; int b, /* [ebp+10] */
- ; short c, /* [ebp+14] */
- ; short d, /* [ebp+16] */
- ; int e /* [ebp+18] */ ) {
- push ebp ; /* Retten und Neueinstellen ebp */
- mov ebp, esp ;
- sub eax, eax ;
- mov ax, [ebp+8] ; return a +
- add eax, [ebp+10] ; b +
- add ax, [ebp+14] ; c +
- add ax, [ebp+16] ; d +
- add eax, [ebp+18] ; e;
- pop ebp ;
- ret 14 ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement