[Libasm] 1. 과제해석

이호용·2021년 3월 22일
1

42_Libasm

목록 보기
1/5

이 자료는 42서울 서브젝트 과제입니다.

Libasm

  • Assembly yourself!
  • 이 프로젝트의 목적은 어셈블리 언어에 익숙해지는 것입니다.
  • (정말정말 매우매우 설렘니다.)

목차

  1. Introduction 2
  2. Common Instructions 3
  3. Mandatory part 4
  4. Bonus part

챕터 I

소개
An assembly (or assembler) language, often abbreviated asm, is a low-level programming

  • 종종 asm으로 축약되는 어셈블리는 로우레벨의 프로그래밍 언어,입니다!
    language for a computer, or other programmable device, in which there is a very strong

  • 컴퓨터 또는 기타 장비에서 프로그래밍이 가능한 언어 입니다.
    (but often not one-to-one) correspondence between the language and the architecture’s machine code instructions.

  • 어셈블리어는 특정 컴퓨터 아키텍처에 따라 특정됩니다.

  • 뭔소린지 뭐르겠다. (어셈블리가 기계어와 일대일 대응이 되는 컴퓨터 프로그래밍 저급언어, 라는데 뭔소리인지 모르겟다. 같이 알아보자.)

아키텍쳐란?
아키텍처란 건축학을 의미한다고 한다. 컴퓨터 아키텍쳐(Computer architecture)의 경우" 비즈니스 요구사항을 만족하는 시스템을 구축하기 위한 전체 시스템에 대한 구조를 정의한 문서다. (컴퓨터 시스템의 하드웨어 구조를 말함., 하드웨어 장치인 cpu,레지스터, 기억장치, 입출력 장치 등과 같은 여러가지 컴퓨터 구성 요소들에 대한 전반적인 기계 구조와 이를 설계하는 방법입니다 .)

Each assembly language is specific to a particular computer
architecture. In contrast, most high-level programming languages are generally portable

  • 각 어셈블리어는 컴퓨터에 따라 다릅니다., 반대로 대부분의 고급 프로그래밍 언어는 일반적으로 이식이 가능합니다.
  • c언어의 경우 컴파일 하면서, 다른 컴퓨터에서도 작동하게 만들어줌.
    across multiple architectures but require interpreting or compiling. Assembly language
    may also be called symbolic machine code
  • 고수준 언어는 여러 아키텍처에 걸쳐 이식이 가능하지만, 인터프리팅 또는 컴파일이 필요합니다, 어셈블리코드 또한 심볼릭 머신코드라고 불린다.

챕터2!

과제 소개

  • Your functions should not quit unexpectedly (segmentation fault, bus error, double
    free, etc) apart from undefined behaviors. If this happens, your project will be
    considered non functional and you will receive a 0 during the evaluation.
  • 너가 만든 함수는, 갑자기 종료 되면 안됩니다!, (세그먼트 에러, 버스 에러, 프리 에러! 등등) 정의 되지 않는 에러들은 용납하지 않을거다!!! (공격적이군.)
  • 만약 당신이 만든 함수에서 세그먼트나, 버스 에러등 용납 할수 없는 에러가 발견된다면 0 점을 줄거다. 빌어도 소용없다.

• Your Makefile must at least contain the rules $(NAME), all, clean, fclean and
re. And must recompile/relink only necessary files.

  • 자아 넌 메이크 파일을 만들어라!, all, clean, fclean,그리고 re까지. 메이크 파일 만들떈, 필요한 파일 들만, 링크 걸어라, 안봐준다!

To turn in bonuses to your project, you must include a rule bonus to your Makefile,
which will add all the various headers, librairies or functions that are forbidden on
the main part of the project. Bonuses must be in a different file _bonus.{c/h}.
Mandatory and bonus part evaluation is done separately.

  • 너 만약에 보너스 파트도 하고 싶으면, 보너스 규칙도 메이크 파일에 포함해라!
  • 다양한 헤더를 추가 할수 잇고, 뒤에말은 몰라. 보너스 파일들은 파일 이름 뒤에 _bonus.{c/h}를 붙여주시오!

We encourage you to create test programs for your project even though this work
won’t have to be submitted and won’t be graded. It will give you a chance
to easily test your work and your peers’ work. You will find those tests especially
useful during your defence. Indeed, during defence, you are free to use your tests
and/or the tests of the peer you are evaluating.

  • 글고 우린 너에게 테스트 프로그램 만드는걸 권장한다.
  • 제출할 필요는 없지만, 그냥 좋잖아?
  • 너의 과제를 다른 사람에게 쉽게 평가 받을 수 있어, 얼마나 좋아? (그거 만드는게 더 귀찮겠다:)
  • 우리가, 너 평가 받을때 테스트 프로그램 쓰는거 허락해줄게, (엄청 고맙네;)

Submit your work to your assigned git repository. Only the work in the git repository will be graded. If Deepthought is assigned to grade your work, it will be done
after your peer-evaluations. If an error happens in any section of your work during
Deepthought’s grading, the evaluation will stop.

  • 제출은 깃에다가 똑바로 올려두고,
  • Deepthouht이 작업등급을 지정해 준다. 그리고 동료평가 하면 끝~.~

You must write 64 bits ASM. Beware of the "calling convention".

  • 64비트 asm을 작성해야한다. 호출 규칙을 주의 하라는데 뭔소리야?

You can’t do inline ASM, you must do ’.s’ files.

  • 너는 .s파일로 파일을 만들어라.

You must compile your assembly code with nasm.

  • 너는 nasm을 이용해서 컴파일 해야한다.

You must use the Intel syntax, not the AT&T

  • 너는 인텔 구문을 사용해야한다. AT&T가 아니라,

챕터 III

Mandatory part
• The library must be called libasm.a.
• You must submit a main that will test your functions and that will compile with
your library to show that it’s functional.
• You must rewrite the following functions in asm:
◦ ft_strlen (man 3 strlen)
◦ ft_strcpy (man 3 strcpy)
◦ ft_strcmp (man 3 strcmp)
◦ ft_write (man 2 write)
◦ ft_read (man 2 read)
◦ ft_strdup (man 3 strdup, you can call to malloc)
• You must check for errors during syscalls and properly set them when needed
• Your code must set the variable errno properly.
• For that, you are allowed to call the extern ___error.

  • 라이브러리 이름은 libasm.a으로 짓기!
  • 너는 너의 함수를 테스트할 메인문을 제출해야한다. 그것은 커파일 할수 잇어야하고, 그것과 함께 너의 라이브러리가 작동하는지 보여줄수 있어야한다.
  • 너는 어셈블리로 작동하는 함수를 새로 만들어야한다.
  • ft_strlen(man 3 strlen), ft_strcpy (man 3 strcpy), ft_strcmp (man 3 strcmp), ft_write (man 2 write), ft_read (man 2 read), ft_strdup(man 3 strdup, you can call to malloc)
  • 코드에서 errno변수를 올바르게 설정해야합니다. (이게 은근히 힘들던데... ㅠ.ㅠ.)

챕터 IV

Bonus part
You can rewrite these functions in asm. The linked list function will use the following

  • 밑에 꺼도 만들면 점수 더 줄게~ 오예~
    structure:
    • ft_atoi_base (like the one in the piscine)
    • ft_list_push_front (like the one in the piscine)
    • ft_list_size (like the one in the piscine)
    • ft_list_sort (like the one in the piscine)
    • ft_list_remove_if (like the one in the piscine)

0개의 댓글