__schedule() 함수의 구현부
MX:FFFFFFC010AD0898|A9B77BFD __schedule: stp x29,x30,[sp,#-0x90]! ; x29,x30,[sp,#-144]!
MX:FFFFFFC010AD089C|910003FD mov x29,sp
MX:FFFFFFC010AD08A0|A90153F3 stp x19,x20,[sp,#0x10] ; x19,x20,[sp,#16]
MX:FFFFFFC010AD08A4|A9025BF5 stp x21,x22,[sp,#0x20] ; x21,x22,[sp,#32]
MX:FFFFFFC010AD08A8|12001C16 and w22,w0,#0xFF ; w22,preempt,#255
MX:FFFFFFC010AD08AC|D0002935 adrp x21,0xFFFFFFC010FF6000 ; x21,dummy_timer_evt
MX:FFFFFFC010AD08B0|A90363F7 stp x23,x24,[sp,#0x30] ; x23,x24,[sp,#48]
MX:FFFFFFC010AD08B4|D5384117 mrs x23,#0x3,#0x0,c4,c1,#0x0 ; x23, SP_EL0
MX:FFFFFFC010AD08B8|D00029D8 adrp x24,0xFFFFFFC01100A000
MX:FFFFFFC010AD08BC|A9046BF9 stp x25,x26,[sp,#0x40] ; x25,x26,[sp,#64]
MX:FFFFFFC010AD08C0|91188318 add x24,x24,#0x620 ; x24,x24,#1568
MX:FFFFFFC010AD08C4|913502B5 add x21,x21,#0xD40 ; x21,x21,#3392
MX:FFFFFFC010AD08C8|A90573FB stp x27,x28,[sp,#0x50] ; x27,x28,[sp,#80]
MX:FFFFFFC010AD08CC|AA1503F3 mov x19,x21
0xFFFFFFC010AD0898가 vmlinux에서 본 __schedule() 함수의 가상 주소다.
kimage_voffset인 0xffffffbf90000000을 빼자.
0x80AD0898 = 0xFFFFFFC010AD0898 - 0xffffffbf90000000
0x80AD0898 주소에 있는 명령어를 보자. __schedule() 함수의 명령어와 완전히 같다.
____addr/line|code_____|label____|mnemonic________________|comment
MX:80AD0898|A9B77BFD stp x29,x30,[sp,#-0x90]! ; x29,x30,[sp,#-144]!
MX:80AD089C|910003FD mov x29,sp
MX:80AD08A0|A90153F3 stp x19,x20,[sp,#0x10] ; x19,x20,[sp,#16]
MX:80AD08A4|A9025BF5 stp x21,x22,[sp,#0x20] ; x21,x22,[sp,#32]
MX:80AD08A8|12001C16 and w22,w0,#0xFF ; w22,w0,#255
MX:80AD08AC|D0002935 adrp x21,0x80FF6000
MX:80AD08B0|A90363F7 stp x23,x24,[sp,#0x30] ; x23,x24,[sp,#48]
MX:80AD08B4|D5384117 mrs x23,#0x3,#0x0,c4,c1,#0x0 ; x23, SP_EL0
MX:80AD08B8|D00029D8 adrp x24,0x8100A000
MX:80AD08BC|A9046BF9 stp x25,x26,[sp,#0x40] ; x25,x26,[sp,#64]
MX:80AD08C0|91188318 add x24,x24,#0x620 ; x24,x24,#1568
MX:80AD08C4|913502B5 add x21,x21,#0xD40 ; x21,x21,#3392
MX:80AD08C8|A90573FB stp x27,x28,[sp,#0x50] ; x27,x28,[sp,#80]
MX:80AD08CC|AA1503F3 mov x19,x21
MX:80AD08D0|F90037BE str x30,[x29,#0x68] ; x30,[x29,#104]
MX:80AD08D4|F9428AE0 ldr x0,[x23,#0x510] ; x0,[x23,#1296]
MX:80AD08D8|F90047A0 str x0,[x29,#0x88] ; x0,[x29,#136]
MX:80AD08DC|D2800000 mov x0,#0x0 ; x0,#0
MX:80AD08E0|97E6697A bl 0x8046AEC8
이번에는 vmlinux에서 swapper_pg_dir의 주소를 체크하자
(pgd_t [512] *) &swapper_pg_dir = 0xFFFFFFC010F45000 = swapper_pg_dir -> ([0 = 0x0] = ((pgdval_t)
0xFFFFFFC010F45000 가 가상 주소다.
kimage_voffset인 0xffffffbf90000000을 빼자.
0x80F45000 = 0xFFFFFFC010F45000 - 0xffffffbf90000000
0x80F45000로 확인된다.
linux_banner
(const char [110] *) &linux_banner = 0xFFFFFFC010AE0090 = linux_banner -> "Linux version 5.4.61 (o
____________address|________0________4________8________C_0123456789ABCDEF
MD:FFFFFFC010AE0090|>756E694C 65762078 6F697372 2E35206E Linux version 5.
MD:FFFFFFC010AE00A0| 31362E34 656F2820 6573752D 656F4072 4.61 (oe-user@oe
MD:FFFFFFC010AE00B0| 736F682D 28202974 20636367 73726576 -host) (gcc vers
MD:FFFFFFC010AE00C0| 206E6F69 2E332E39 47282030 29294343 ion 9.3.0 (GCC))
MD:FFFFFFC010AE00D0| 20312320 20504D53 45455250 2054504D #1 SMP PREEMPT
MD:FFFFFFC010AE00E0| 20646557 20636544 30203232 37353A33 Wed Dec 22 03:57
MD:FFFFFFC010AE00F0| 2035333A 20435455 31323032 0000000A :35 UTC 2021....
0x80AE0090 = FFFFFFC010AE0090 - 0xffffffbf90000000
____address|________0________4________8________C_0123456789ABCDEF
MD:80AE0090|>756E694C 65762078 6F697372 2E35206E Linux version 5.
MD:80AE00A0| 31362E34 656F2820 6573752D 656F4072 4.61 (oe-user@oe
MD:80AE00B0| 736F682D 28202974 20636367 73726576 -host) (gcc vers
MD:80AE00C0| 206E6F69 2E332E39 47282030 29294343 ion 9.3.0 (GCC))
MD:80AE00D0| 20312320 20504D53 45455250 2054504D #1 SMP PREEMPT
MD:80AE00E0| 20646557 20636544 30203232 37353A33 Wed Dec 22 03:57
MD:80AE00F0| 2035333A 20435455 31323032 0000000A :35 UTC 2021....
MD:80AE0100| 10D69260 FFFFFFC0 00000000 00000000 `...............
'Core BSP 분석 > 리눅스 커널 핵심 분석' 카테고리의 다른 글
[리눅스커널] IPI(Inter Processor Interrupt) Call 요청 루틴(하이 레벨 뷰) (0) | 2023.05.07 |
---|---|
[LinuxKernel] Tip: How to disable CONFIG_SCHED_INFO (0) | 2023.05.07 |
[리눅스커널] tracing: 파일 오픈 내역 확인하기 (0) | 2023.05.07 |
[리눅스커널] tracing: 부팅 과정에서 ftrace ring-buffer 늘리기 (0) | 2023.05.07 |
[리눅스커널] tracing: 부팅 과정에서 자동으로 ftrace 활성화하기 (0) | 2023.05.06 |