Nucleus
Barry Kernel heap + paging functions 27ddc7f (3 years, 3 months ago)diff --git a/memory/copy.S b/memory/copy.S new file mode 100644 index 0000000..1d1c6a3 --- /dev/null +++ b/memory/copy.S @@ -0,0 +1,35 @@ +/* + * This is a small routine to copy the contents of one page frame to another. + * In the 32-bit kernel, only pages in the current page directory are + * accessible, so this routine disables paging to copy the physical frames. + */ + +.section .text +.global copy_page_frame +.type copy_page_frame, @function +.align 4 +copy_page_frame: +.code32 + push %ebx + pushf + cli + mov 12(%esp), %ebx + mov 16(%esp), %ecx + mov %cr0, %edx + and $0x7FFFFFFF, %edx + mov %edx, %cr0 + mov $1024, %edx +.loop: + mov (%ebx), %eax + mov %eax, (%ecx) + add $4, %ebx + add $4, %ecx + dec %edx + jnz .loop + mov %cr0, %edx + or $0x80000000, %edx + mov %edx, %cr0 + sti + popf + pop %ebx + ret