zoukankan      html  css  js  c++  java
  • 内核空间和用户空间的分界 PAGE_OFFSET

     
    PAGE_OFFSET
    首先看看PAGE_OFFSET的功能
     
    1. 内存映射
    2.     |            用户空间                  |   内核空间   |
    3.     |——————+——————+——————+———————|
    4. 物理 A:0        1G                         B:3G          C:4G
    5.     B: 定义为    PAGE_OFFSET
    6.     0-1G: 和内核空间又有丰富的内容,我还没有整理,以后再说。
     
     
    -------------------------------------
    1. arch/x86/include/asm/page_types.h
    2.      #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET
    3. -> __PAGE_OFFSET
    4.         arch/x86/include/asm/page_64_types.h:
    5.             #define __PAGE_OFFSET _AC(0xffff880000000000, UL)
    6.         arch/x86/include/asm/page_32_types.h:
    7.             #define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
    8.  
    9. -->CONFIG_PAGE_OFFSET
    10.         arch/x86/configs/i386_defconfig:
    11.             CONFIG_PAGE_OFFSET=0xC0000000
    12. -->AC
    13.          include/linux/const.h
    14.             #ifdef __ASSEMBLY__
    15.             #define _AC(X,Y) X
    16.             #else
    17.             #define __AC(X,Y) (X##Y)
    18.             #define _AC(X,Y) __AC(X,Y)
    19.             #endif
    =====================================
    我们就很清晰的看到,在x86下,32时PAGE_OFFSET 为0xC0000000(3G),也是内核空间和用户空间的分界。
     
  • 相关阅读:
    POJ 3258 (NOIP2015 D2T1跳石头)
    POJ 3122 二分
    POJ 3104 二分
    POJ 1995 快速幂
    409. Longest Palindrome
    389. Find the Difference
    381. Insert Delete GetRandom O(1)
    380. Insert Delete GetRandom O(1)
    355. Design Twitter
    347. Top K Frequent Elements (sort map)
  • 原文地址:https://www.cnblogs.com/timssd/p/4781099.html
Copyright © 2011-2022 走看看