[커널 18차] 7주차

2021.07.12 01:39

Runixs 조회 수:129

2021/07/10 스터디 7차

 

 

1) 입장하신 분들은 오후 3:00 시작전까지 참가자명을 한글 실명으로 변경.

2) 출첵을 위해 구글 문서의 다음 참석 항목에 성함을 기록.

    jake.dothome.co.kr 에 링크가 있습니다.

3) 접속 후 3시 정각에 웹캠 on.

참석

42명 참석(문영일, 김각래, 권효만, 조만재, 장철연, 문연수, 송준영, 황성민, 정동훈, 임채훈, 송기원, 정은식, 서민혁, 강혁, 박진현, 김정임, 김현우, 이일영, 한동수, 류호은, 이민욱, 김형종, 권경환, 최서정, 김준영, 안성원, 황바른, 이재훈, 김태완, 최영민, 김원우, 금승원, 안유빈, 차민희, 이정재, 김택우, 안이수, 유원상, 김성준, 최준근, 민호기, 이형래)

진도 및 내용,

서기: 김태완

 

  • 문영일 제외 66명: 

  • 강혁, 권경환, 권대엽, 권효만, 금승원, 김각래, 김경인, 김동훈, 김성원, 김성준, 김원우, 김정임, 김준영, 김지태, 김태완, 김택우, 김한구, 김현우, 김형종, 류호은, 문연수, 민호기, 박노은, 박소연, 박시현, 박청수, 박현진, 봉하승, 서민혁, 송기원, 송준영,  신보현, 안성원, 안유빈, 안이수, 위대한, 유민호, 유원상, 유재홍, 이민욱, 이일영, 이재훈, 이정민*, 이정아, 이정재, 이한솔, 이형래, 임채훈, 장철연, 정동훈, 정은식, 정주희, 조기석, 조만재, 조안나, 조현철, 지영근, 차민희, 최서정, 최연욱, 최영민, 최준근, 한동수, 한윤재, 황바른, 황성민

 

 

 

스터디 내용

교재: ARM System Developers Guide-Designing and Optimizing System Software (~69p)

  • Chapter 1, ARM Embedded Systems

    • RISC, CISC

    • ARM Bus (APB, AHB, AXI, CHI, AMBA, ...)

    • Memory Remapping

  • Chapter 2. ARM Processor Fundamentals

    • ARM Core dataflow model(+Thumb)

    • ARM Registers

    • Current Program Status Register(CPSR)

    • Processor modes(+NMI, IRQ, FIQ)

    • ARM Instruction Pipeline

    • Exceptions, Interrupts, Vector table

    • Cache

  • Chapter 3. Introduction To The ARM Instruction SET

    • ARM instruction set

    • Comparison Instructions

    • Multiply Instructions

    • Brnach Instructions

    • Load-Store Instructions

 

아키텍처 스터디:

http://jake.dothome.co.kr/image1/

http://jake.dothome.co.kr/head-64-510/


코드분석: head.S 

105 b        primary_entry   <-- 분석중

 

구글 독스

 

 

 

다음주에 볼 페이지: Chapter 3.3.3.1 Stack Operations

 

$ vim ~./vimrc
map <F9> <ESC>a/* IAMROOT, <C-R>=strftime("%Y.%m.%d")<CR>:<SPACE>*/<LEFT><ESC>
map <F10> <ESC>o/*<CR> * IAMROOT, <C-R>=strftime("%Y.%m.%d")<CR>: <CR> */<CR><ESC><UP><UP><END>a

 

커널에서의 링크 스크립트: vmlix.lds.S는?

 

vmlinux 타겟이 실행되면 링커가 실행될 때 linux/arch/armnommu/kernel/vmlinux.lds.s 파일을 이용하게 된다. 이 파일은 주어진 오브젝트 파일들을 어떤 식으로 링크하여 vmlinux 파일을 생성할 지에 대한 정보를 명시한 링커 스크립트 파일로 linux/arch/armnommu/kernel/Makefile 파일에 의해 linux/arch/armnommu/kernel/vmlinux.lds.S(대문자임에 주의) 파일로부터 생성된다 --- (https://zdnet.co.kr/view/?no=00000039134536)


 

링커 스크립트에서 “.”?

컴파일 시 사용되는 현재 가상 주소

The special symbol ‘.’ refers to the current address that as is assembling into.





 

-166jbiTn8GMqnroPL2Ffr1Jgxc1vaKHWbuMoAgA

*GE(>=) / LT(<=) / GT(>) / LE(<)


 

ARM7 Three-stage pipeline

-1ub40c7ijCzyOC7GdXIkv-s0ekmIGaEpY7xvipI

Fetch = Instruction Read

총 3 Cycle

 

처음 3cycle 후에는 매 cycle마다 1개의 instruction 수행

 

ARM9 five-stage pipeline

8w87406hQgFBBDPxWR_MIfbK10Z_moVa6ihTgsgA


 

*NOP - 아무것도 안함 == 잠깐 쉼

 

ARM32 Interrupt 종류

A0FL_Lw2vdISJSIDmLM0trhjvd0LkmwsEIJdJPzk

<Address> 가상주소(4byte)

[UNDEF] 발생시 Kernel은 panic, Usermode에서는 kill

[SWI] Syscall

[PABT] 명령을 읽다가 error


 

~ARMv7 : 32bit

ARMv8~ : 64bit


 

ARM ISA(Instruction Set Architecture)

 

AySiXys7qu1NuLK4UNBBzV0vscec89MvWn1TrtHW

32MB == 2^25



 

d8Gjd201u5phPQqGdRWXNrZyw2_ImTn3mhuHQ5N0


 

Rd= Rn +Rm


 

IF ‘ADC’가 없다면, 

Carry를 clear하는 명령이 추가되면서 cycle이 늘어남

 

banked registers?

mode 별로 사용하는 register들이 다른것. 물리적으로 다른 register들이 존재하는 것임. r0 - r15용 user/system registers, r8 - r14 fiq용 register가 존재. 예) fiq는 r8 - r14로 제한인데 r0 - r7 사용 가능하지만 접근 X, 부득이하게 하려면 해당 값을 백업해야 함.


 

Q.다른 C파일의 static을 assembly로 호출 가능한가?



 

Code 분석 - Day1

http://jake.dothome.co.kr/image1/

http://jake.dothome.co.kr/head-64-510/


 

${5.10}/arch/arm64/kernel/head.S

${5.10}/arch/arm64/kernel/vmlinux.lds.S


 

.section “.head.text”,”ax” 에서 ax 의미

GNU syntax

The .section directive instructs the assembler to assemble a new code or data section.

Flags provide information about the section. Available section flags include the following:

  • a specifies that the section is allocatable. // runtime에 메모리에 로드

  • x specifies that the section is executable. // runtime에 실행가능?

  • w specifies that the section is writable.

  • S specifies that the section contains null-terminated strings.

For example:

.section  mysection,"ax"



 

<head.S>

  

  45 /*

  46  * Kernel startup entry point.

  47  * ---------------------------                                                                                                         

  48  *

  49  * The requirements are:    <--------- 필수

  50  *   MMU = off, D-cache = off, I-cache = on or off,

  51  *   x0 = physical address to the FDT blob.

  52  *

  53  * This code is mostly position independent so you call this at

  54  * __pa(PAGE_OFFSET).

  55  *

  56  * Note that the callee-saved registers are used for storing variables

  57  * that are useful before the MMU is enabled. The allocations are described

  58  * in the entry routines.

  59  */


 

Kernel의 Device Tree란?


 

${5.10}/arch/arm64/Kconfig

Kconfig 문법에 대해 분석

1862 config EFI

1863         bool "UEFI runtime support"

1864         depends on OF && !CPU_BIG_ENDIAN

1865         depends on KERNEL_MODE_NEON

1866         select ARCH_SUPPORTS_ACPI

1867         select LIBFDT

1868         select UCS2_STRING

1869         select EFI_PARAMS_FROM_FDT

1870         select EFI_RUNTIME_WRAPPERS

1871         select EFI_STUB

1872         select EFI_GENERIC_STUB

1873         default y

1874         help

1875           This option provides support for runtime services provided

1876           by UEFI firmware (such as non-volatile variables, realtime

1877           clock, and platform reset). A UEFI stub is also provided to

1878           allow the kernel to be booted as an EFI application. This

1879           is only useful on systems that have UEFI firmware.


 

${5.10}/include/linux/linkage.h

#define SYM_CODE_START


 

__ALIGN ---> .align

https://sourceware.org/binutils/docs/as/Align.html

<arch/arm64/include/asm/linkage.h>

  4 #define __ALIGN         .align 2

  5 #define __ALIGN_STR     ".align 2"

<include/linux/linkage.h>

 71 #ifndef __ALIGN

 72 #define __ALIGN         .align 4,0x90

 73 #define __ALIGN_STR     ".align 4,0x90"

 74 #endif

 

-> 류호은님이 채팅창에 적어준 내용을 첨부하면 정확합니다.

XE Login