Changeset 64f6ef04 in mainline for kernel/arch/amd64/src/boot/boot.S


Ignore:
Timestamp:
2010-06-27T23:54:45Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
05e3cb8
Parents:
a1f60f3
Message:

amd64: create identity mapping of the first 8 GB of physical memory (instead of just 4 GB) during the bootstrap process
remove the crude on-demand identity mapping creation which could lead to livelocks (unmapping the page pointing to 0 MB physical while trying to map the page pointing to 4096 MB physical)

(currently the implementation is in no way closer to the ideal solution of ticket #3, but at least it allows to debug non-trivial cases of physical memory sizes > 4 GB during the approach to solving #3)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/boot/boot.S

    ra1f60f3 r64f6ef04  
    263263#
    264264.macro ptl2gen cnt g
    265 .if \cnt
    266         ptl2gen "\cnt - 8" \g
    267         .quad ((\cnt - 8) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
    268         .quad ((\cnt - 7) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
    269         .quad ((\cnt - 6) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
    270         .quad ((\cnt - 5) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
    271         .quad ((\cnt - 4) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
    272         .quad ((\cnt - 3) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
    273         .quad ((\cnt - 2) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
    274         .quad ((\cnt - 1) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
    275 .endif
     265        .if \cnt
     266                ptl2gen "\cnt - 8" \g
     267                .quad ((\cnt - 8) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
     268                .quad ((\cnt - 7) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
     269                .quad ((\cnt - 6) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
     270                .quad ((\cnt - 5) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
     271                .quad ((\cnt - 4) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
     272                .quad ((\cnt - 3) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
     273                .quad ((\cnt - 2) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
     274                .quad ((\cnt - 1) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
     275        .endif
    276276.endm
    277277
    278 # Page table for pages in the first gigabyte.
    279 .align 4096
    280 .global ptl_2_0g
     278# Page table for pages in the 1st gigabyte.
     279.align 4096
    281280ptl_2_0g:
    282281        ptl2gen 512 0
    283282
    284 # Page table for pages in the second gigabyte.
    285 .align 4096
    286 .global ptl_2_1g
     283# Page table for pages in the 2nd gigabyte.
     284.align 4096
    287285ptl_2_1g:
    288286        ptl2gen 512 1
    289287
    290 # Page table for pages in the third gigabyte.
    291 .align 4096
    292 .global ptl_2_2g
     288# Page table for pages in the 3rd gigabyte.
     289.align 4096
    293290ptl_2_2g:
    294291        ptl2gen 512 2
    295292
    296 # Page table for pages in the fourth gigabyte.
    297 .align 4096
    298 .global ptl_2_3g
     293# Page table for pages in the 4th gigabyte.
     294.align 4096
    299295ptl_2_3g:
    300296        ptl2gen 512 3
    301297
    302 .align 4096
    303 .global ptl_1
     298# Page table for pages in the 5th gigabyte.
     299.align 4096
     300ptl_2_4g:
     301        ptl2gen 512 3
     302
     303# Page table for pages in the 6th gigabyte.
     304.align 4096
     305ptl_2_5g:
     306        ptl2gen 512 3
     307
     308# Page table for pages in the 7th gigabyte.
     309.align 4096
     310ptl_2_6g:
     311        ptl2gen 512 3
     312
     313# Page table for pages in the 8th gigabyte.
     314.align 4096
     315ptl_2_7g:
     316        ptl2gen 512 3
     317
     318.align 4096
    304319ptl_1:
    305         # Identity mapping for [0; 4G)
     320        # Identity mapping for [0; 8G)
    306321        .quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
    307322        .quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
    308323        .quad ptl_2_2g + (PTL_WRITABLE | PTL_PRESENT)
    309324        .quad ptl_2_3g + (PTL_WRITABLE | PTL_PRESENT)
    310         .fill 508, 8, 0
     325        .quad ptl_2_4g + (PTL_WRITABLE | PTL_PRESENT)
     326        .quad ptl_2_5g + (PTL_WRITABLE | PTL_PRESENT)
     327        .quad ptl_2_6g + (PTL_WRITABLE | PTL_PRESENT)
     328        .quad ptl_2_7g + (PTL_WRITABLE | PTL_PRESENT)
     329        .fill 504, 8, 0
    311330
    312331.align 4096
Note: See TracChangeset for help on using the changeset viewer.