Problem mit der erstellung von daten für die mmu



  • ich schreibe im ein keines os
    im mom bin ich dabei es vom unteren speicher in den "normalbereich" von 3gb zu mappen

    es sind verschiedene versuche dort, die ich duch umsetzen eines symbols auswählen kann

    leider funktioniert das nicht so wie gedacht

    .section .kickstart
    .global _loader
    
    #stack
    .set STACKSIZE, 0x4000          # that's 16k.
    .comm stack, STACKSIZE, 32      # reserve 16k stack on a quadword boundary
    
    .set VIRTUAL_BASE, 0xc0000000 # mapping-target
    
    #trying with pgdir and pgtable
    .set PGSIZE, 0x1000
    
    .align PGSIZE
    .comm _i_pgdir, PGSIZE, 32
    .comm _i_pgtab, PGSIZE, 32
    .comm _ops  , PGSIZE, 32;
    
    #trying with superpages (4mb) and 1 pgdir
    _bootpgdir:
        .fill 1024,4,0x00000083
    
    .align 4
    _s_outplace_loader:
        #set up mmu-ptr
        mov $(_bootpgdir-VIRTUAL_BASE),%ecx
        mov %ecx,%cr3
    
        #enable superpages
        mov %cr4,%ecx
        or $0x00000010,%eax
        mov %ecx,%cr4
    
        #enable paging
        mov %cr0,%ecx
        or $0x80000000,%ecx
        mov %ecx,%cr0
    
        mov $_inplace_loader, %ecx
        call *%ecx
    
    _loader:
    _outplace_loader:
    
        #boostrap stack
        mov $(_ops+PGSIZE-VIRTUAL_BASE), %esp
        pusha
    
        #set pgdir reg, and destination register
        mov $(_i_pgdir-VIRTUAL_BASE) , %edi
        mov %edi,%cr3
    
        #set 4mb pages flag
        mov %cr4,%eax
        or $0x00000010,%eax
        mov %eax,%cr4
    
        #fixme trying 4mb pages ;)
    
        #values needed for identity mapping all 4mb pages to the first physical mb
        mov $0x00000083 , %eax
        mov $0x1000 , %ecx
    
        #fill
        rep stosl
    
        #enable paging
        mov %cr0,%eax
        or $0x80000000,%eax
        mov %eax,%cr0
    
        popa
        mov $_inplace_loader, %ecx
        call *%ecx
    
    #_loader:
    _inplace_loader:
    
    #   movl $BootPageDirectory, 0
    #   invlpg 0
    
        mov   $(stack + STACKSIZE), %esp # set up the stack
    
        push %eax             # push bootparams
        push %ebx
    
        call _save_bootparams # save them
    
        pop %eax
        pop %ebx
    
        call asm_clrscr # =)
    
        call _ctors
    
        call _setup_gdt
    
        call _runner # run it
    
        call _dtors
    

    als loader benutze ich im moment grub, da er einiges leichter macht


Anmelden zum Antworten