BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / blob / master / memory / copy.S

// Related

Nucleus

Barry Per-CPU Scheduler bb0cb77 (3 years, 2 months ago)
/*
 * 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
	popf
	pop %ebx
	ret