Skip to content
Snippets Groups Projects
Commit 03d28ffd authored by PEDRO MARTINS E SA's avatar PEDRO MARTINS E SA
Browse files

versao definitiva

parent 20c255e3
No related branches found
No related tags found
No related merge requests found
File deleted
#ifndef __MEU_MALLOC__
#define __MEU_MALLOC__
//inicia o alocador chamando a brk e atribuindo um valor pre determinado
void iniciaAlocador();
//finaliza o alocador voltando a heap para o seu inicio
void finalizaAlocador();
//Pede mais espaco na heap ao sistema operacional quando necessario
void aloca_espaco(int tam_alloc);
//Aloca o ponteiro na heap
void* alocaMem(int tam_alloc);
//rearranja os elementos dentro da heap liberando espacos desnecessarios
void arruma_heap();
//libera o ponteiro da heap
void liberaMem(void* bloco);
//escreve o estado atual da heap
void print_mapa();
#endif
\ No newline at end of file
File deleted
###########COMPILADORES##############
############COMPILADORES###############
GCC = gcc
AR = ar
AS = as
#########DIRETORIOS CRIADOS###########
##########DIRETORIOS CRIADOS###########
INC=./includes
SRC=./src
BIN=./bin
LIB=./lib
#################FLAGS#################
LIBFLAGS=-lmeu_malloc -L$(LIB)
INCFLAGS=-I$(INC)
CFLAGS=-Wall -g -no-pie -fno-pie
ARFLAGS=rcs
#LIGACOES
##############LIGACOES#################
build: diretorios libmeu_malloc.a
$(GCC) $(CFLAGS) $(INCFLAGS) $(SRC)/teste.c -o teste $(LIBFLAGS)
......@@ -25,6 +26,8 @@ libmeu_malloc.a: meu_malloc.o
meu_malloc.o:
$(AS) $(SRC)/meu_malloc.s -o $(BIN)/meu_malloc.o -g
########CRICACAO DE DIRETORIOS#########
diretorios:
@echo "Criando Diretorios \n"
......@@ -36,6 +39,7 @@ diretorios:
mkdir $(LIB); \
fi
####LIMPA OS DIRETORIOS E ARQUIVOS#####
clean:
@echo "Limpando Diretorios\n"
......
......@@ -7,9 +7,7 @@
str4: .string "*"
str5: .string "INICIANDO O ALOCADOR!\n"
str6: .string "ENTRADA INVALIDA!\n"
pula_Linha: .string "\n"
flag: .string "%d"
pula_Linha: .string "\n"#
.section .bss
.equ ALOCADOR, 1040
......@@ -139,7 +137,6 @@ alocaMem:
jmp fim_if_aloca_mem2
fim_if_aloca_mem2:
jmp fim_while_aloca_mem
fim_if_while_aloca_mem:
addq $16, 8(%rbx)
movq 8(%rbx), %r10
......@@ -241,10 +238,6 @@ print_mapa:
jmp for_cabecalho
fim_for_cabecalho:
movq $flag,%rdi
movq 8(%rbx),%rsi
call printf
cmpq $LIVRE, (%rbx)
jne else_if_while
movq $0, -8(%rbp) #i = 0
......
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment