Exo 1 finis
This commit is contained in:
parent
cf00c53e65
commit
f5dfce1617
53
2020-2021/S3T_TP_00_REVISIONS/hello.s
Normal file
53
2020-2021/S3T_TP_00_REVISIONS/hello.s
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
.file "hello.c"
|
||||||
|
.text
|
||||||
|
.section .rodata
|
||||||
|
.LC0:
|
||||||
|
.string "./hello.c"
|
||||||
|
.LC1:
|
||||||
|
.string "argc == 2"
|
||||||
|
.LC2:
|
||||||
|
.string "\nhello %s\n\n"
|
||||||
|
.text
|
||||||
|
.globl main
|
||||||
|
.type main, @function
|
||||||
|
main:
|
||||||
|
.LFB6:
|
||||||
|
.cfi_startproc
|
||||||
|
pushq %rbp
|
||||||
|
.cfi_def_cfa_offset 16
|
||||||
|
.cfi_offset 6, -16
|
||||||
|
movq %rsp, %rbp
|
||||||
|
.cfi_def_cfa_register 6
|
||||||
|
subq $32, %rsp
|
||||||
|
movl %edi, -4(%rbp)
|
||||||
|
movq %rsi, -16(%rbp)
|
||||||
|
movq %rdx, -24(%rbp)
|
||||||
|
cmpl $2, -4(%rbp)
|
||||||
|
je .L2
|
||||||
|
leaq __PRETTY_FUNCTION__.2887(%rip), %rcx
|
||||||
|
movl $6, %edx
|
||||||
|
leaq .LC0(%rip), %rsi
|
||||||
|
leaq .LC1(%rip), %rdi
|
||||||
|
call __assert_fail@PLT
|
||||||
|
.L2:
|
||||||
|
movq -16(%rbp), %rax
|
||||||
|
addq $8, %rax
|
||||||
|
movq (%rax), %rax
|
||||||
|
movq %rax, %rsi
|
||||||
|
leaq .LC2(%rip), %rdi
|
||||||
|
movl $0, %eax
|
||||||
|
call printf@PLT
|
||||||
|
movl $0, %eax
|
||||||
|
leave
|
||||||
|
.cfi_def_cfa 7, 8
|
||||||
|
ret
|
||||||
|
.cfi_endproc
|
||||||
|
.LFE6:
|
||||||
|
.size main, .-main
|
||||||
|
.section .rodata
|
||||||
|
.type __PRETTY_FUNCTION__.2887, @object
|
||||||
|
.size __PRETTY_FUNCTION__.2887, 5
|
||||||
|
__PRETTY_FUNCTION__.2887:
|
||||||
|
.string "main"
|
||||||
|
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
|
||||||
|
.section .note.GNU-stack,"",@progbits
|
@ -5,11 +5,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main(int argc, char * argv[]){
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=1; i< argc; i++) {
|
for (i = 1; i < argc; i++)
|
||||||
printf("argument %d: %s\n",i,argv[i]);
|
{
|
||||||
|
printf("argument %d: %s\n", i, argv[i]);
|
||||||
}
|
}
|
||||||
printf("\nPID = %d - PPID = %d \n\n",getpid(), getppid());
|
printf("\nPID = %d - PPID = %d \n\n", getpid(), getppid());
|
||||||
|
|
||||||
|
//sleep(60);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
22
2020-2021/S3T_TP_00_REVISIONS/processus_3.c
Executable file
22
2020-2021/S3T_TP_00_REVISIONS/processus_3.c
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* @ Author: JunkJumper
|
||||||
|
* @ Link: https://github.com/JunkJumper
|
||||||
|
* @ Copyright: Creative Common 4.0 (CC BY 4.0)
|
||||||
|
* @ Create Time: 04-09-2020 10:41:01
|
||||||
|
* @ Modified by: JunkJumper
|
||||||
|
* @ Modified time: 04-09-2020 10:58:23
|
||||||
|
* @ Description:
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[], char* envp[])
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while(envp[i] != NULL) {
|
||||||
|
i++;
|
||||||
|
printf("%s\n", envp[i]);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user