iamroot12CD / linux

linux kernel 4.1.6 for raspberrypi2
http://www.iamroot.org/
Other
6 stars 27 forks source link

45주차 2016년 2월 27일 스터디 #34

Open norux opened 8 years ago

norux commented 8 years ago

시간: 2016년 2월 27일 토요일 오후 3시 - 10시 장소: 강남 토즈타워점

rilts commented 8 years ago

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

norux commented 8 years ago

https://github.com/raspberrypi/linux/commit/72a20e22f49e2dad3180c23980a9df1c63faab0a

billpark commented 8 years ago

define DEFINE(sym, val) \

    asm volatile("\n->" #sym " %0 " #val : : "i" (val))

http://stackoverflow.com/questions/25294649/how-does-this-inline-assembly-define-a-variable

fehead commented 8 years ago

inline 어셈블리 문서 https://wiki.kldp.org/KoreanDoc/html/EmbeddedKernel-KLDP/app3.basic.html

fehead commented 8 years ago

리즈베리파이 vmlinux objectdump 결과

$ arm-linux-gnueabihf-objdump -d vmlinux |head -200

vmlinux:     file format elf32-littlearm

Disassembly of section .head.text:

80008000 <stext>:
80008000:   eb0055a6    bl  8001d6a0 <__hyp_stub_install>
80008004:   e10f9000    mrs r9, CPSR
80008008:   e229901a    eor r9, r9, #26
8000800c:   e319001f    tst r9, #31
80008010:   e3c9901f    bic r9, r9, #31
80008014:   e38990d3    orr r9, r9, #211    ; 0xd3
80008018:   1a000004    bne 80008030 <stext+0x30>
8000801c:   e3899c01    orr r9, r9, #256    ; 0x100
80008020:   e28fe00c    add lr, pc, #12
80008024:   e16ff009    msr SPSR_fsxc, r9
80008028:   e12ef30e    .word   0xe12ef30e
8000802c:   e160006e    .word   0xe160006e
80008030:   e121f009    msr CPSR_c, r9
80008034:   ee109f10    mrc 15, 0, r9, cr0, cr0, {0}
80008038:   eb00052b    bl  800094ec <__lookup_processor_type>
8000803c:   e1b0a005    movs    sl, r5
80008040:   0a00053b    beq 80009534 <__error>
80008044:   e28f3034    add r3, pc, #52 ; 0x34
80008048:   e8930110    ldm r3, {r4, r8}
8000804c:   e0434004    sub r4, r3, r4
80008050:   e0888004    add r8, r8, r4
80008054:   eb00005c    bl  800081cc <__vet_atags>
80008058:   eb000038    bl  80008140 <__fixup_smp>
8000805c:   eb000009    bl  80008088 <__create_page_tables>
80008060:   e59fd014    ldr sp, [pc, #20]   ; 8000807c <stext+0x7c>
80008064:   e28fe00c    add lr, pc, #12
80008068:   e1a08004    mov r8, r4
8000806c:   e59ac010    ldr ip, [sl, #16]
80008070:   e08cc00a    add ip, ip, sl
80008074:   e1a0f00c    mov pc, ip
80008078:   ea00050b    b   800094ac <__enable_mmu>
8000807c:   807752e0    .word   0x807752e0
80008080:   80008080    .word   0x80008080
80008084:   80000000    .word   0x80000000

80008088 <__create_page_tables>:
80008088:   e2884902    add r4, r8, #32768  ; 0x8000
8000808c:   e2444901    sub r4, r4, #16384  ; 0x4000
80008090:   e1a00004    mov r0, r4
80008094:   e3a03000    mov r3, #0
80008098:   e2806901    add r6, r0, #16384  ; 0x4000
8000809c:   e4803004    str r3, [r0], #4
800080a0:   e4803004    str r3, [r0], #4
800080a4:   e4803004    str r3, [r0], #4
800080a8:   e4803004    str r3, [r0], #4
800080ac:   e1300006    teq r0, r6
800080b0:   1afffff9    bne 8000809c <__create_page_tables+0x14>
800080b4:   e59a7008    ldr r7, [sl, #8]
800080b8:   e28f0074    add r0, pc, #116    ; 0x74
800080bc:   e8900068    ldm r0, {r3, r5, r6}
800080c0:   e0400003    sub r0, r0, r3
800080c4:   e0855000    add r5, r5, r0
800080c8:   e0866000    add r6, r6, r0
800080cc:   e1a05a25    lsr r5, r5, #20
800080d0:   e1a06a26    lsr r6, r6, #20
800080d4:   e1873a05    orr r3, r7, r5, lsl #20
800080d8:   e7843105    str r3, [r4, r5, lsl #2]
800080dc:   e1550006    cmp r5, r6
800080e0:   32855001    addcc   r5, r5, #1
800080e4:   3afffffa    bcc 800080d4 <__create_page_tables+0x4c>
800080e8:   e2840a02    add r0, r4, #8192   ; 0x2000
800080ec:   e59f603c    ldr r6, [pc, #60]   ; 80008130 <__create_page_tables+0xa8>
800080f0:   e1883007    orr r3, r8, r7
800080f4:   e0846926    add r6, r4, r6, lsr #18
800080f8:   e4803004    str r3, [r0], #4
800080fc:   e2833601    add r3, r3, #1048576    ; 0x100000
80008100:   e1500006    cmp r0, r6
80008104:   9afffffb    bls 800080f8 <__create_page_tables+0x70>
80008108:   e1a00a22    lsr r0, r2, #20
8000810c:   e1b00a00    lsls    r0, r0, #20
80008110:   10403008    subne   r3, r0, r8
80008114:   12833102    addne   r3, r3, #-2147483648    ; 0x80000000
80008118:   10843923    addne   r3, r4, r3, lsr #18
8000811c:   11876000    orrne   r6, r7, r0
80008120:   14836004    strne   r6, [r3], #4
80008124:   12866601    addne   r6, r6, #1048576    ; 0x100000
80008128:   15836000    strne   r6, [r3]
8000812c:   e12fff1e    bx  lr
80008130:   8092378b    .word   0x8092378b

80008134 <__turn_mmu_on_loc>:
80008134:   80008134    .word   0x80008134
80008138:   80008240    .word   0x80008240
8000813c:   80008260    .word   0x80008260

80008140 <__fixup_smp>:
80008140:   e209380f    and r3, r9, #983040 ; 0xf0000
80008144:   e333080f    teq r3, #983040 ; 0xf0000
80008148:   1a000016    bne 800081a8 <__fixup_smp_on_up>
8000814c:   e3c938ff    bic r3, r9, #16711680   ; 0xff0000
80008150:   e3c3300f    bic r3, r3, #15
80008154:   e3a04441    mov r4, #1090519040 ; 0x41000000
80008158:   e3844a0b    orr r4, r4, #45056  ; 0xb000
8000815c:   e3844020    orr r4, r4, #32
80008160:   e1330004    teq r3, r4
80008164:   012fff1e    bxeq    lr
80008168:   ee100fb0    mrc 15, 0, r0, cr0, cr0, {5}
8000816c:   e2000103    and r0, r0, #-1073741824    ; 0xc0000000
80008170:   e3300102    teq r0, #-2147483648    ; 0x80000000
80008174:   1a00000b    bne 800081a8 <__fixup_smp_on_up>
80008178:   e3a04441    mov r4, #1090519040 ; 0x41000000
8000817c:   e3844903    orr r4, r4, #49152  ; 0xc000
80008180:   e3844090    orr r4, r4, #144    ; 0x90
80008184:   e1330004    teq r3, r4
80008188:   112fff1e    bxne    lr
8000818c:   ee9f0f10    mrc 15, 4, r0, cr15, cr0, {0}
80008190:   e3300000    teq r0, #0
80008194:   0a000003    beq 800081a8 <__fixup_smp_on_up>
80008198:   e5900004    ldr r0, [r0, #4]
8000819c:   e2000003    and r0, r0, #3
800081a0:   e3300000    teq r0, #0
800081a4:   112fff1e    bxne    lr

800081a8 <__fixup_smp_on_up>:
800081a8:   e28f0010    add r0, pc, #16
800081ac:   e8900038    ldm r0, {r3, r4, r5}
800081b0:   e0403003    sub r3, r0, r3
800081b4:   e0844003    add r4, r4, r3
800081b8:   e0855003    add r5, r5, r3
800081bc:   ea0004bf    b   800094c0 <__do_fixup_smp_on_up>
800081c0:   800081c0    .word   0x800081c0
800081c4:   807b30ac    .word   0x807b30ac
800081c8:   807b957c    .word   0x807b957c

800081cc <__vet_atags>:
800081cc:   e3120003    tst r2, #3
800081d0:   1a00000b    bne 80008204 <__vet_atags+0x38>
800081d4:   e5925000    ldr r5, [r2]
800081d8:   e59f602c    ldr r6, [pc, #44]   ; 8000820c <__vet_atags+0x40>
800081dc:   e1550006    cmp r5, r6
800081e0:   0a000006    beq 80008200 <__vet_atags+0x34>
800081e4:   e3550005    cmp r5, #5
800081e8:   13550002    cmpne   r5, #2
800081ec:   1a000004    bne 80008204 <__vet_atags+0x38>
800081f0:   e5925004    ldr r5, [r2, #4]
800081f4:   e59f6014    ldr r6, [pc, #20]   ; 80008210 <__vet_atags+0x44>
800081f8:   e1550006    cmp r5, r6
800081fc:   1a000000    bne 80008204 <__vet_atags+0x38>
80008200:   e12fff1e    bx  lr
80008204:   e3a02000    mov r2, #0
80008208:   e12fff1e    bx  lr
8000820c:   edfe0dd0    .word   0xedfe0dd0
80008210:   54410001    .word   0x54410001

Disassembly of section .text:

80008240 <__turn_mmu_on>:
80008240:   e1a00000    nop         ; (mov r0, r0)
80008244:   f57ff06f    isb sy
80008248:   ee010f10    mcr 15, 0, r0, cr1, cr0, {0}
8000824c:   ee103f10    mrc 15, 0, r3, cr0, cr0, {0}
80008250:   f57ff06f    isb sy
80008254:   e1a03003    mov r3, r3
80008258:   e1a0300d    mov r3, sp
8000825c:   e1a0f003    mov pc, r3
minidump commented 8 years ago

아까 스터디 진행중에 나왔던 sed관련 메모 추가

fehead commented 8 years ago

45차 스터디를 정리한 PDF 문서 입니다. kernel_d_45.zip

elinjkim commented 8 years ago

페이지테이블엔트리

kakaotalk_photo_2016-03-01-01-11-10_6


__create_page_tables: 페이지테이블을 0으로 초기화하는 과정

kakaotalk_photo_2016-03-01-01-11-12_86


__lookup_process_type

각 비트들 설정, 여기까지하면 플래그 값이 0x11c0e kakaotalk_photo_2016-03-01-01-11-13_78

kakaotalk_photo_2016-03-01-01-11-15_14