Hi,
i finished my physical and virtual memory manager right now.
So I searched a way how to implement a function called copy_physical_page, which should copy a physical Page. I found the Tutorial from JamesM, it was at the Multitasking-Part, but I don't like this way.
Could you tell me some possible Ways to copy a page without switching back to realmode?
Cheers Christian
Copy physical frame
Re: Copy physical frame
Why the change to real mode, you have access to the page data in protected mode, dont you
-
- Member
- Posts: 79
- Joined: Sun Jun 10, 2007 11:36 am
Re: Copy physical frame
I thought that too...
...but when I understand this Tutorial correctly: JamesM's Multitasking Tutorial (Point 9.2.3), I have to switch back to Real Mode to copy a physical frame.
May be I am misunderstanding something
Cheers Christian
...but when I understand this Tutorial correctly: JamesM's Multitasking Tutorial (Point 9.2.3), I have to switch back to Real Mode to copy a physical frame.
May be I am misunderstanding something
Cheers Christian
-
- Member
- Posts: 391
- Joined: Wed Jul 25, 2007 8:45 am
- Libera.chat IRC: aejsmith
- Location: London, UK
- Contact:
Re: Copy physical frame
JamesM's code doesn't switch to real mode. It remains in protected mode, but disables paging temporarily so that you have access to the physical address space. This method won't work without some extra work if your kernel's virtual location is different to its physical location.
An alternate method would be to map both pages somewhere in the virtual address space, copy the contents, and then unmap them.
An alternate method would be to map both pages somewhere in the virtual address space, copy the contents, and then unmap them.
-
- Member
- Posts: 79
- Joined: Sun Jun 10, 2007 11:36 am
Re: Copy physical frame
Sorry.
I meant turning off Paging, not switching back to real mode
So I could copy it easily for example with memcpy like this?
So I understand it now.
Thanks for the help.
Cheers Christian
I meant turning off Paging, not switching back to real mode
So I could copy it easily for example with memcpy like this?
Code: Select all
#define PAGE_SIZE 0x1000
//memcpy(virtual_address_dest, virtual_address_src, 0x1000);
memcpy(0xD0001000, 0xD0008000, PAGE_SIZE);
So I understand it now.
Thanks for the help.
Cheers Christian
42