aboutsummaryrefslogtreecommitdiff
path: root/i686/macros.s
blob: a9b8b4dc98c670069cd83f40f6d96378341a12e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
.set PAGE_RO, 0x001
.set PAGE_RW, 0x003
/* write section to page table macro
 *
 * Registers used:
 * %ecx: loop counter   [ set to $1024 ]
 * %edx: temporary
 * %esi: current page being mapped
 * %edi: page entry     [ set to $page_addr ]
 */
.macro mmap_section begin, end, access
    mov  $\begin, %esi  # from $begin
1:  cmpl $\end, %esi    # until $end
    jge  2f

    movl %esi, %edx
    orl  $\access, %edx
    movl %edx, (%edi)

    addl $4096, %esi    # move to next page
    addl $4, %edi       # size of page entry is 4 bytes
    loop 1b             # loop according to %ecx
2:
.endm