Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

How to manage paging in assembly/C kernel?

$
0
0

My project is to execute my own JVM on a little piece of kernel that i'm trying to code in C and assembly. So, I'm still learning how do the kernels do their main jobs.

Now, following some guides, I set up the paging

.map 
    mov         eax     , p3_t
    or          eax     , 0b11
    mov dword   [p4_t]  , eax
    mov         eax     , p2_t
    or          eax     , 0b11
    mov dword   [p3_t]  , eax

    mov     ecx     , 0
.map_pd:
    mov     eax, 0x200000
    mul     ecx
    or      eax , 0b10000011
    mov [p2_t+ecx*8]    , eax
    inc     ecx
    cmp ecx, 512

    jne     .map_pd
    mov eax, p4_t
    mov     cr3, eax
    mov eax, cr4
    or          eax, 1 << 5
    mov cr4, eax

    mov        ecx, 0xC0000080
    rdmsr
    or  eax, 1 << 8
    wrmsr

    mov     eax, cr0
    or      eax, 1 << 31
    or      eax , 1 << 16
    mov     cr0, eax

That should set up and enable paging. These guides unfortunately give me little information.

Now, how do I manage paging and virtual addresses in the C kernel? Could you guys maybe give me some other guides that talks about paging?


Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>