Skip to content

Commit

Permalink
para compilar con geany y arm-gcc
Browse files Browse the repository at this point in the history
  • Loading branch information
pablinn committed Aug 27, 2016
1 parent 805e2b0 commit 71198a1
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 0 deletions.
26 changes: 26 additions & 0 deletions bash.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.section .text

.global main
main:

.code 32
add r6,pc,#1
bx r6

.code 16
/*write()*/
mov r2,#6
mov r1,pc
add r1,#12
mov r0,$0x1
mov r7,$0x4
svc 0

/*exit()*/
sub r0,r0,r0 /*0=1-1*/
mov r7,$0x1
svc 0



.ascii "lsusb\n"
28 changes: 28 additions & 0 deletions hello.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.syntax unified

@ --------------------------------
.global main
main:
@ Stack the return address (lr) in addition to a dummy register (ip) to
@ keep the stack 8-byte aligned.
push {ip, lr}

@ Load the argument and perform the call. This is like 'printf("...")' in C.
ldr r0, =message
bl printf

@ Exit from 'main'. This is like 'return 0' in C.
mov r0, #0 @ Return 0.

@ Pop the dummy ip to reverse our alignment fix, and pop the original lr
@ value directly into pc — the Program Counter — to return.
pop {ip, pc}

@ --------------------------------
@ Data for the printf calls. The GNU assembler's ".asciz" directive
@ automatically adds a NULL character termination.
message:
.asciz "vamos within temptation.\n"



25 changes: 25 additions & 0 deletions lsusb.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.section .text

.global main
main:

.code 32
add r6,pc,#1
bx r6

.code 16
/*write()*/
mov r2,#6
mov r1,pc
add r1,#14
mov r0,$0x1
mov r7,$0x4
svc 1

/*exit()*/
sub r4,r4,r4
mov r0,r4
mov r7,$0x1
svc 1

.ascii "lsusb\n"
9 changes: 9 additions & 0 deletions prueba1.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.global main

main:
mov r1,#5
mov r2,#7
add r0,r1,r2
bx lr


33 changes: 33 additions & 0 deletions shell.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
r0 0
r1 /bin/sh
r2 /bin/sh
r7 11
*/


.section .text

.global main
main:

.code 32
add r6,pc,#1
bx r6

.code 16

mov r0,pc /*guardomos el program counter en r0*/
add r0,#10

str r3,[sp,#4]
add r1,sp,#4
sub r2,r2,r2
mov r7,#11
svc 1



.ascii "//bin/sh\n"

0 comments on commit 71198a1

Please sign in to comment.