https://elixir.bootlin.com/linux/v5.15.30/source/arch/arm64/include/asm/pgtable-hwdef.h#L151
#define PTE_VALID (_AT(pteval_t, 1) << 0)
#define PTE_TYPE_MASK (_AT(pteval_t, 3) << 0)
#define PTE_TYPE_PAGE (_AT(pteval_t, 3) << 0)
#define PTE_TABLE_BIT (_AT(pteval_t, 1) << 1)
#define PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */
#define PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */
#define PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */
#define PTE_AF (_AT(pteval_t, 1) << 10) /* Access Flag */
#define PTE_NG (_AT(pteval_t, 1) << 11) /* nG */
#define PTE_GP (_AT(pteval_t, 1) << 50) /* BTI guarded */
#define PTE_DBM (_AT(pteval_t, 1) << 51) /* Dirty Bit Management */
#define PTE_CONT (_AT(pteval_t, 1) << 52) /* Contiguous range */
#define PTE_PXN (_AT(pteval_t, 1) << 53) /* Privileged XN */
#define PTE_UXN (_AT(pteval_t, 1) << 54) /* User XN */
68 void trace_pte_value(void)
69 {
70 printk("PTE: %lx \n", PTE_VALID);
71 printk("PTE: %lx \n", PTE_TYPE_MASK);
72 printk("PTE: %lx \n", PTE_TYPE_PAGE);
73 printk("PTE: %lx \n", PTE_TABLE_BIT);
74 printk("PTE: %lx \n", PTE_USER);
75 printk("PTE: %lx \n", PTE_RDONLY);
76 printk("PTE: %lx \n", PTE_SHARED);
77 printk("PTE: %lx \n", PTE_AF);
78 printk("PTE: %lx \n", PTE_NG);
79 printk("PTE: %lx \n", PTE_GP);
80 printk("PTE: %lx \n", PTE_DBM);
81 printk("PTE: %lx \n", PTE_CONT);
82 printk("PTE: %lx \n", PTE_PXN);
83 printk("PTE: %lx \n", PTE_UXN);
84 }
85
86
87
ffffffc0080370f0 <trace_pte_value>:
ffffffc0080370f0: stp x29, x30, [sp, #-32]!
ffffffc0080370f4: mov x29, sp
ffffffc0080370f8: str x19, [sp, #16]
ffffffc0080370fc: adrp x19, ffffffc008e04000 <kallsyms_token_index+0x6e70>
ffffffc008037100: mov x0, x30
ffffffc008037104: add x19, x19, #0x718
ffffffc008037108: bl ffffffc00802c674 <_mcount>
ffffffc00803710c: mov x1, #0x1 // PTE_VALID ; 0b01
ffffffc008037110: mov x0, x19
ffffffc008037114: bl ffffffc008b41ea0 <_printk>
ffffffc008037118: mov x1, #0x3 // PTE_TYPE_MASK ; 0b11
ffffffc00803711c: mov x0, x19
ffffffc008037120: bl ffffffc008b41ea0 <_printk>
ffffffc008037124: mov x1, #0x3 // PTE_TYPE_MASK ; 0b11
ffffffc008037128: mov x0, x19
ffffffc00803712c: bl ffffffc008b41ea0 <_printk>
ffffffc008037130: mov x1, #0x2 // PTE_TABLE_BIT ; 0b10
ffffffc008037134: mov x0, x19
ffffffc008037138: bl ffffffc008b41ea0 <_printk>
ffffffc00803713c: mov x1, #0x40 // PTE_USER ; 0b1000000 // 6th bit
ffffffc008037140: mov x0, x19
ffffffc008037144: bl ffffffc008b41ea0 <_printk>
ffffffc008037148: mov x1, #0x80 // PTE_RDONLY ; 0b10000000 // 7th bit
ffffffc00803714c: mov x0, x19
ffffffc008037150: bl ffffffc008b41ea0 <_printk>
ffffffc008037154: mov x1, #0x300 // PTE_SHARED ; 11|0000|0000 // (8+9)th bit
ffffffc008037158: mov x0, x19
ffffffc00803715c: bl ffffffc008b41ea0 <_printk>
ffffffc008037160: mov x1, #0x400 // PTE_AF ; 100|0000|0000 // (10)th bit
ffffffc008037164: mov x0, x19
ffffffc008037168: bl ffffffc008b41ea0 <_printk>
ffffffc00803716c: mov x1, #0x800 // PTE_NG ; 1000|0000|0000 // (11)th bit
ffffffc008037170: mov x0, x19
ffffffc008037174: bl ffffffc008b41ea0 <_printk>
ffffffc008037178: mov x1, #0x4000000000000 // PTE_GP ; // (50)th bit
ffffffc00803717c: mov x0, x19
ffffffc008037180: bl ffffffc008b41ea0 <_printk>
ffffffc008037184: mov x1, #0x8000000000000 // PTE_DBM ; // (51)th bit
ffffffc008037188: mov x0, x19
ffffffc00803718c: bl ffffffc008b41ea0 <_printk>
ffffffc008037190: mov x1, #0x10000000000000 // PTE_CONT ; // (52)th bit
ffffffc008037194: mov x0, x19
ffffffc008037198: bl ffffffc008b41ea0 <_printk>
ffffffc00803719c: mov x1, #0x20000000000000 // PTE_PXN ; // (53)th bit
ffffffc0080371a0: mov x0, x19
ffffffc0080371a4: bl ffffffc008b41ea0 <_printk>
ffffffc0080371a8: mov x1, #0x40000000000000 // PTE_UXN ; // (54)th bit
ffffffc0080371ac: mov x0, x19
ffffffc0080371b0: bl ffffffc008b41ea0 <_printk>
ffffffc0080371b4: ldr x19, [sp, #16]
ffffffc0080371b8: ldp x29, x30, [sp], #32
ffffffc0080371bc: ret
< '시스템 소프트웨어 개발을 위한 Arm 아키텍처의 구조와 원리' 저자>
'리눅스 커널의 구조와 원리 > 14. 메모리 관리' 카테고리의 다른 글
[Linux kernel] Quick Review over OOM(Out of Memory) Killer routine (0) | 2023.09.09 |
---|---|
[mm] 'vm_flags' of 'struct vm_area_struct' (2) | 2023.09.07 |
[mm] anon page debugging (0) | 2023.08.06 |
[mm] OOM Killer log and kernel code review (0) | 2023.08.06 |
[Linux] mm: memory layout (0) | 2023.07.30 |