Skip to content

pdol9/libasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libasm

Description

Rewriting the C functions listed below in x86-64 assembly using NASM to create a static library (libasm.a). Tests for these functions are provided in C (main.c), as well as in assembly (main.s).

The mandatory directory contains basic string functions (completed), while the bonus section includes linked list functions (WIP).

Since some rewritten functions use system calls and may call ___errno_location, it is possible to check the type of error (e.g., Bad file descriptor, Bad address). As a result, perror() will return or print an appropriate error message.

Functions

  • ft_strlen:
    size_t strlen(const char *s);
    man 3 strlen # Linux Programmer's Manual

  • ft_strcpy:
    char *strcpy(char *dest, const char *src);
    man 3 strcpy

  • ft_strcmp:
    int strcmp(const char *s1, const char *s2);
    man 3 strcmp

  • ft_write:
    ssize_t write(int fd, const void *buf, size_t count);
    man 2 write

  • ft_read:
    ssize_t read(int fd, void *buf, size_t count);
    man 2 read

  • ft_strdup:
    char *strdup(const char *s);
    man 3 strdup

Installation

  • to compile library, run:
cd ./mandatory/ && make
  • to compile library with tester, run:
cd ./mandatory/ && make ctest

About

42 project based on x86-64 assembly

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published