Changeset 0637ddb in mainline


Ignore:
Timestamp:
2016-05-09T07:33:15Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fa9f8ad
Parents:
4928165
Message:

Use PAGE_SIZE and KA2PA() instead of numeric constants

Location:
kernel/arch/ia32/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/boot/multiboot.S

    r4928165 r0637ddb  
    221221               
    222222                /* Align address down to 4k */
    223                 andl $(~4095), %esi
     223                andl $(~(PAGE_SIZE - 1)), %esi
    224224               
    225225        use_kernel_end:
    226226               
    227227                /* Align address to 4k */
    228                 addl $4095, %esi
    229                 andl $(~4095), %esi
     228                addl $(PAGE_SIZE - 1), %esi
     229                andl $(~(PAGE_SIZE - 1)), %esi
    230230               
    231231                /* Allocate space for page tables */
    232232                movl %esi, pt_loc
    233                 movl $ballocs, %edi
    234                 andl $0x7fffffff, %edi
     233                movl $KA2PA(ballocs), %edi
    235234               
    236235                movl %esi, (%edi)
     
    246245                        orl %ebx, %eax
    247246                        movl %eax, (%esi, %ecx, 4)
    248                         addl $(4 * 1024), %ebx
     247                        addl $PAGE_SIZE, %ebx
    249248                       
    250249                        incl %ecx
     
    268267                        /* Mapping 0x80000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
    269268                        movl %eax, (%edi, %ecx, 4)
    270                         addl $(4 * 1024), %ebx
     269                        addl $PAGE_SIZE, %ebx
    271270                       
    272271                        incl %ecx
     
    286285/** Calculate unmapped address of the end of the kernel. */
    287286calc_kernel_end:
    288         movl $hardcoded_load_address, %edi
    289         andl $0x7fffffff, %edi
     287        movl $KA2PA(hardcoded_load_address), %edi
    290288        movl (%edi), %esi
    291         andl $0x7fffffff, %esi
    292        
    293         movl $hardcoded_ktext_size, %edi
    294         andl $0x7fffffff, %edi
     289        leal KA2PA(0)(%esi), %esi
     290       
     291        movl $KA2PA(hardcoded_ktext_size), %edi
    295292        addl (%edi), %esi
    296         andl $0x7fffffff, %esi
    297        
    298         movl $hardcoded_kdata_size, %edi
    299         andl $0x7fffffff, %edi
     293        leal KA2PA(0)(%esi), %esi
     294       
     295        movl $KA2PA(hardcoded_kdata_size), %edi
    300296        addl (%edi), %esi
    301         andl $0x7fffffff, %esi
     297        leal KA2PA(0)(%esi), %esi
    302298        movl %esi, kernel_end
    303299       
  • kernel/arch/ia32/src/smp/ap.S

    r4928165 r0637ddb  
    7575        movw %ax, %es
    7676        movw %ax, %ss
    77         movl $KA2PA(ctx), %eax  /* KA2PA((uintptr_t) &ctx) */
     77        movl $KA2PA(ctx), %eax          /* KA2PA((uintptr_t) &ctx) */
    7878        movl CONTEXT_OFFSET_SP(%eax), %esp
    79         subl $PA2KA(0), %esp    /* KA2PA(ctx.sp) */
     79        leal KA2PA(0)(%esp), %esp       /* KA2PA(ctx.sp) */
    8080
    8181        /*
     
    8585        call map_kernel_pse
    8686       
    87         addl $PA2KA(0), %esp    /* PA2KA(ctx.sp) */
     87        addl $PA2KA(0), %esp            /* PA2KA(ctx.sp) */
    8888       
    8989        /* create the first stack frame */
Note: See TracChangeset for help on using the changeset viewer.