Consequently use uint32 for the physical page directory address.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37011 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -20,7 +20,7 @@ struct iframe *i386_get_user_iframe(void);
|
|||||||
struct iframe *i386_get_current_iframe(void);
|
struct iframe *i386_get_current_iframe(void);
|
||||||
struct iframe *i386_get_thread_user_iframe(struct thread *thread);
|
struct iframe *i386_get_thread_user_iframe(struct thread *thread);
|
||||||
|
|
||||||
void *x86_next_page_directory(struct thread *from, struct thread *to);
|
uint32 x86_next_page_directory(struct thread *from, struct thread *to);
|
||||||
|
|
||||||
void x86_restart_syscall(struct iframe* frame);
|
void x86_restart_syscall(struct iframe* frame);
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,6 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
#endif
|
#endif
|
||||||
void *i386_translation_map_get_pgdir(VMTranslationMap *map);
|
uint32 i386_translation_map_get_pgdir(VMTranslationMap *map);
|
||||||
|
|
||||||
#endif /* _KERNEL_ARCH_x86_VM_TRANSLATION_MAP_H */
|
#endif /* _KERNEL_ARCH_x86_VM_TRANSLATION_MAP_H */
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ struct X86VMTranslationMap : VMTranslationMap {
|
|||||||
|
|
||||||
inline vm_translation_map_arch_info* ArchData() const
|
inline vm_translation_map_arch_info* ArchData() const
|
||||||
{ return fArchData; }
|
{ return fArchData; }
|
||||||
inline void* PhysicalPageDir() const
|
inline uint32 PhysicalPageDir() const
|
||||||
{ return fArchData->pgdir_phys; }
|
{ return fArchData->pgdir_phys; }
|
||||||
|
|
||||||
virtual status_t InitPostSem();
|
virtual status_t InitPostSem();
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ setup_for_thread(char *arg, struct thread **_thread, uint32 *_ebp,
|
|||||||
if (id != thread_get_current_thread_id()) {
|
if (id != thread_get_current_thread_id()) {
|
||||||
// switch to the page directory of the new thread to be
|
// switch to the page directory of the new thread to be
|
||||||
// able to follow the stack trace into userland
|
// able to follow the stack trace into userland
|
||||||
uint32 newPageDirectory = (uint32)x86_next_page_directory(
|
uint32 newPageDirectory = x86_next_page_directory(
|
||||||
thread_get_current_thread(), thread);
|
thread_get_current_thread(), thread);
|
||||||
|
|
||||||
if (newPageDirectory != 0) {
|
if (newPageDirectory != 0) {
|
||||||
@@ -931,7 +931,7 @@ cmd_in_context(int argc, char** argv)
|
|||||||
// switch the page directory, if necessary
|
// switch the page directory, if necessary
|
||||||
uint32 oldPageDirectory = 0;
|
uint32 oldPageDirectory = 0;
|
||||||
if (thread != thread_get_current_thread()) {
|
if (thread != thread_get_current_thread()) {
|
||||||
uint32 newPageDirectory = (uint32)x86_next_page_directory(
|
uint32 newPageDirectory = x86_next_page_directory(
|
||||||
thread_get_current_thread(), thread);
|
thread_get_current_thread(), thread);
|
||||||
|
|
||||||
if (newPageDirectory != 0) {
|
if (newPageDirectory != 0) {
|
||||||
|
|||||||
@@ -189,13 +189,13 @@ i386_get_current_iframe(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void *
|
uint32
|
||||||
x86_next_page_directory(struct thread *from, struct thread *to)
|
x86_next_page_directory(struct thread *from, struct thread *to)
|
||||||
{
|
{
|
||||||
VMAddressSpace* toAddressSpace = to->team->address_space;
|
VMAddressSpace* toAddressSpace = to->team->address_space;
|
||||||
if (from->team->address_space == toAddressSpace) {
|
if (from->team->address_space == toAddressSpace) {
|
||||||
// don't change the pgdir, same address space
|
// don't change the pgdir, same address space
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toAddressSpace == NULL)
|
if (toAddressSpace == NULL)
|
||||||
@@ -389,7 +389,7 @@ arch_thread_context_switch(struct thread *from, struct thread *to)
|
|||||||
cpuData->arch.active_translation_map = toMap;
|
cpuData->arch.active_translation_map = toMap;
|
||||||
|
|
||||||
// get the new page directory
|
// get the new page directory
|
||||||
newPageDirectory = (uint32)toMap->pgdir_phys;
|
newPageDirectory = toMap->pgdir_phys;
|
||||||
} else {
|
} else {
|
||||||
newPageDirectory = 0;
|
newPageDirectory = 0;
|
||||||
// this means no change
|
// this means no change
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
static page_table_entry *sPageHole = NULL;
|
static page_table_entry *sPageHole = NULL;
|
||||||
static page_directory_entry *sPageHolePageDir = NULL;
|
static page_directory_entry *sPageHolePageDir = NULL;
|
||||||
static page_directory_entry *sKernelPhysicalPageDirectory = NULL;
|
static uint32 sKernelPhysicalPageDirectory = 0;
|
||||||
static page_directory_entry *sKernelVirtualPageDirectory = NULL;
|
static page_directory_entry *sKernelVirtualPageDirectory = NULL;
|
||||||
|
|
||||||
static X86PhysicalPageMapper* sPhysicalPageMapper;
|
static X86PhysicalPageMapper* sPhysicalPageMapper;
|
||||||
@@ -117,7 +117,7 @@ vm_translation_map_arch_info::Delete()
|
|||||||
// overwriting an active page directory is suspected
|
// overwriting an active page directory is suspected
|
||||||
uint32 activePageDirectory;
|
uint32 activePageDirectory;
|
||||||
read_cr3(activePageDirectory);
|
read_cr3(activePageDirectory);
|
||||||
if (activePageDirectory == (uint32)pgdir_phys)
|
if (activePageDirectory == pgdir_phys)
|
||||||
panic("deleting a still active page directory\n");
|
panic("deleting a still active page directory\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ put_page_table_entry_in_pgtable(page_table_entry* entry,
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void *
|
uint32
|
||||||
i386_translation_map_get_pgdir(VMTranslationMap* map)
|
i386_translation_map_get_pgdir(VMTranslationMap* map)
|
||||||
{
|
{
|
||||||
return static_cast<X86VMTranslationMap*>(map)->PhysicalPageDir();
|
return static_cast<X86VMTranslationMap*>(map)->PhysicalPageDir();
|
||||||
@@ -340,7 +340,7 @@ X86VMTranslationMap::Init(bool kernel)
|
|||||||
vm_get_page_mapping(VMAddressSpace::KernelID(),
|
vm_get_page_mapping(VMAddressSpace::KernelID(),
|
||||||
(addr_t)fArchData->pgdir_virt,
|
(addr_t)fArchData->pgdir_virt,
|
||||||
&physicalPageDir);
|
&physicalPageDir);
|
||||||
fArchData->pgdir_phys = (page_directory_entry*)(addr_t)physicalPageDir;
|
fArchData->pgdir_phys = physicalPageDir;
|
||||||
} else {
|
} else {
|
||||||
// kernel
|
// kernel
|
||||||
// get the physical page mapper
|
// get the physical page mapper
|
||||||
@@ -1346,15 +1346,14 @@ arch_vm_translation_map_init(kernel_args *args,
|
|||||||
memset(sPageHolePageDir + FIRST_USER_PGDIR_ENT, 0,
|
memset(sPageHolePageDir + FIRST_USER_PGDIR_ENT, 0,
|
||||||
sizeof(page_directory_entry) * NUM_USER_PGDIR_ENTS);
|
sizeof(page_directory_entry) * NUM_USER_PGDIR_ENTS);
|
||||||
|
|
||||||
sKernelPhysicalPageDirectory = (page_directory_entry*)
|
sKernelPhysicalPageDirectory = args->arch_args.phys_pgdir;
|
||||||
args->arch_args.phys_pgdir;
|
|
||||||
sKernelVirtualPageDirectory = (page_directory_entry*)
|
sKernelVirtualPageDirectory = (page_directory_entry*)
|
||||||
args->arch_args.vir_pgdir;
|
args->arch_args.vir_pgdir;
|
||||||
|
|
||||||
#ifdef TRACE_VM_TMAP
|
#ifdef TRACE_VM_TMAP
|
||||||
TRACE("page hole: %p, page dir: %p\n", sPageHole, sPageHolePageDir);
|
TRACE("page hole: %p, page dir: %p\n", sPageHole, sPageHolePageDir);
|
||||||
TRACE("page dir: %p (physical: %p)\n", sKernelVirtualPageDirectory,
|
TRACE("page dir: %p (physical: %#" B_PRIx32 ")\n",
|
||||||
sKernelPhysicalPageDirectory);
|
sKernelVirtualPageDirectory, sKernelPhysicalPageDirectory);
|
||||||
|
|
||||||
TRACE("physical memory ranges:\n");
|
TRACE("physical memory ranges:\n");
|
||||||
for (uint32 i = 0; i < args->num_physical_memory_ranges; i++) {
|
for (uint32 i = 0; i < args->num_physical_memory_ranges; i++) {
|
||||||
@@ -1515,7 +1514,7 @@ arch_vm_translation_map_is_kernel_page_accessible(addr_t virtualAddress,
|
|||||||
page_directory_entry pageDirectoryEntry;
|
page_directory_entry pageDirectoryEntry;
|
||||||
uint32 index = VADDR_TO_PDENT(virtualAddress);
|
uint32 index = VADDR_TO_PDENT(virtualAddress);
|
||||||
|
|
||||||
if (physicalPageDirectory == (uint32)sKernelPhysicalPageDirectory) {
|
if (physicalPageDirectory == sKernelPhysicalPageDirectory) {
|
||||||
pageDirectoryEntry = sKernelVirtualPageDirectory[index];
|
pageDirectoryEntry = sKernelVirtualPageDirectory[index];
|
||||||
} else if (sPhysicalPageMapper != NULL) {
|
} else if (sPhysicalPageMapper != NULL) {
|
||||||
// map the original page directory and get the entry
|
// map the original page directory and get the entry
|
||||||
@@ -1553,7 +1552,7 @@ arch_vm_translation_map_is_kernel_page_accessible(addr_t virtualAddress,
|
|||||||
pageTableEntry = 0;
|
pageTableEntry = 0;
|
||||||
|
|
||||||
// switch back to the original page directory
|
// switch back to the original page directory
|
||||||
if (physicalPageDirectory != (uint32)sKernelPhysicalPageDirectory)
|
if (physicalPageDirectory != sKernelPhysicalPageDirectory)
|
||||||
write_cr3(physicalPageDirectory);
|
write_cr3(physicalPageDirectory);
|
||||||
|
|
||||||
if ((pageTableEntry & X86_PTE_PRESENT) == 0)
|
if ((pageTableEntry & X86_PTE_PRESENT) == 0)
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ typedef uint32 page_directory_entry;
|
|||||||
|
|
||||||
struct vm_translation_map_arch_info : DeferredDeletable {
|
struct vm_translation_map_arch_info : DeferredDeletable {
|
||||||
page_directory_entry* pgdir_virt;
|
page_directory_entry* pgdir_virt;
|
||||||
page_directory_entry* pgdir_phys;
|
uint32 pgdir_phys;
|
||||||
TranslationMapPhysicalPageMapper* page_mapper;
|
TranslationMapPhysicalPageMapper* page_mapper;
|
||||||
vint32 ref_count;
|
vint32 ref_count;
|
||||||
vint32 active_on_cpus;
|
vint32 active_on_cpus;
|
||||||
|
|||||||
Reference in New Issue
Block a user