toaruos/kernel/task.S

65 lines
1.1 KiB
ArmAsm
Raw Normal View History

2015-05-20 10:12:20 +03:00
.section .text
.align 4
2015-05-20 11:46:10 +03:00
/* Disable paging mask */
2015-05-20 10:12:20 +03:00
.set dp, 0x7FFFFFFF
2015-05-20 11:46:10 +03:00
/* Enable paging mask */
2015-05-20 10:12:20 +03:00
.set ep, 0x80000000
2015-05-20 11:46:10 +03:00
.global copy_page_physical
.type copy_page_physical, @function
2015-05-20 10:12:20 +03:00
copy_page_physical:
/* Preserve contents of EBX */
push %ebx
/* Preserve contents of EFLAGS */
pushf
cli
/* Load source and destination addresses */
mov 12(%esp), %ebx
mov 16(%esp), %ecx
/* Get control register and disable paging*/
mov %cr0, %edx
and $dp, %edx
mov %edx, %cr0
/* Copy 4096 bytes */
mov $0x400, %edx
.page_loop:
/* Get word at source address */
mov (%ebx), %eax
/* Store it at destination address */
mov %eax, (%ecx)
/* Increment source and destination addresses to next word */
add $4, %ebx
add $4, %ecx
/* One less word to copy */
dec %edx
jnz .page_loop
/* Get control register again and enable paging */
mov %cr0, %edx
or $ep, %edx
mov %edx, %cr0
/* Restore EFLAGS */
popf
/* Restore EBX */
pop %ebx
ret
/* Read EIP */
.global read_eip
.type read_eip, @function
read_eip:
mov (%esp), %eax
ret