-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lucien Le Roux
committed
Feb 28, 2017
0 parents
commit 8b97025
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
## | ||
## Makefile for in /home/le-rou_c/docs/asm_minilibc | ||
## | ||
## Made by Lucien Le Roux | ||
## Login <[email protected]> | ||
## | ||
## Started on Tue Feb 28 09:39:50 2017 Lucien Le Roux | ||
## Last update Tue Feb 28 09:43:57 2017 Lucien Le Roux | ||
## | ||
|
||
NAME = strlen | ||
|
||
SRC = strlen.s | ||
OBJ = $(SRC:.s=.o) | ||
|
||
CC = nasm -f elf64 | ||
LD = ld | ||
|
||
RM = rm -f | ||
|
||
all: $(NAME) | ||
|
||
|
||
$(NAME): $(SRC) | ||
$(CC) $(SRC) -o $(OBJ) | ||
$(LD) $(OBJ) -o $(NAME) | ||
|
||
clean: | ||
$(RM) $(OBJ) | ||
|
||
fclean: clean | ||
$(RM) $(NAME) | ||
|
||
re: fclean all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
section .data | ||
|
||
|
||
section .text | ||
global _start | ||
|
||
_printRBX: | ||
mov rax, 1 ; sys_write | ||
mov rdi, 1 ; stdout | ||
mov rsi, [edi] ; argv[0] | ||
mov r10, 1 ; longueur de la chaine | ||
syscall | ||
ret | ||
|
||
_start: | ||
mov rbx, rsp | ||
add rbx, 32 ; argv | ||
|
||
call _printRBX | ||
|
||
mov rax, 60 | ||
mov rdi, 0 | ||
syscall | ||
ret | ||
|