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:
Ingo Weinhold 2010-06-04 22:23:22 +00:00
parent 2e04c067f9
commit 78dde7abd7
7 changed files with 18 additions and 19 deletions

View File

@ -20,7 +20,7 @@ struct iframe *i386_get_user_iframe(void);
struct iframe *i386_get_current_iframe(void);
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);

View File

@ -12,6 +12,6 @@
#ifdef __cplusplus
extern "C"
#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 */

View File

@ -17,7 +17,7 @@ struct X86VMTranslationMap : VMTranslationMap {
inline vm_translation_map_arch_info* ArchData() const
{ return fArchData; }
inline void* PhysicalPageDir() const
inline uint32 PhysicalPageDir() const
{ return fArchData->pgdir_phys; }
virtual status_t InitPostSem();

View File

@ -394,7 +394,7 @@ setup_for_thread(char *arg, struct thread **_thread, uint32 *_ebp,
if (id != thread_get_current_thread_id()) {
// switch to the page directory of the new thread to be
// 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);
if (newPageDirectory != 0) {
@ -931,7 +931,7 @@ cmd_in_context(int argc, char** argv)
// switch the page directory, if necessary
uint32 oldPageDirectory = 0;
if (thread != thread_get_current_thread()) {
uint32 newPageDirectory = (uint32)x86_next_page_directory(
uint32 newPageDirectory = x86_next_page_directory(
thread_get_current_thread(), thread);
if (newPageDirectory != 0) {

View File

@ -189,13 +189,13 @@ i386_get_current_iframe(void)
}
void *
uint32
x86_next_page_directory(struct thread *from, struct thread *to)
{
VMAddressSpace* toAddressSpace = to->team->address_space;
if (from->team->address_space == toAddressSpace) {
// don't change the pgdir, same address space
return NULL;
return 0;
}
if (toAddressSpace == NULL)
@ -389,7 +389,7 @@ arch_thread_context_switch(struct thread *from, struct thread *to)
cpuData->arch.active_translation_map = toMap;
// get the new page directory
newPageDirectory = (uint32)toMap->pgdir_phys;
newPageDirectory = toMap->pgdir_phys;
} else {
newPageDirectory = 0;
// this means no change

View File

@ -43,7 +43,7 @@
static page_table_entry *sPageHole = NULL;
static page_directory_entry *sPageHolePageDir = NULL;
static page_directory_entry *sKernelPhysicalPageDirectory = NULL;
static uint32 sKernelPhysicalPageDirectory = 0;
static page_directory_entry *sKernelVirtualPageDirectory = NULL;
static X86PhysicalPageMapper* sPhysicalPageMapper;
@ -117,7 +117,7 @@ vm_translation_map_arch_info::Delete()
// overwriting an active page directory is suspected
uint32 activePageDirectory;
read_cr3(activePageDirectory);
if (activePageDirectory == (uint32)pgdir_phys)
if (activePageDirectory == pgdir_phys)
panic("deleting a still active page directory\n");
#endif
@ -208,7 +208,7 @@ put_page_table_entry_in_pgtable(page_table_entry* entry,
// #pragma mark -
void *
uint32
i386_translation_map_get_pgdir(VMTranslationMap* map)
{
return static_cast<X86VMTranslationMap*>(map)->PhysicalPageDir();
@ -340,7 +340,7 @@ X86VMTranslationMap::Init(bool kernel)
vm_get_page_mapping(VMAddressSpace::KernelID(),
(addr_t)fArchData->pgdir_virt,
&physicalPageDir);
fArchData->pgdir_phys = (page_directory_entry*)(addr_t)physicalPageDir;
fArchData->pgdir_phys = physicalPageDir;
} else {
// kernel
// get the physical page mapper
@ -1346,15 +1346,14 @@ arch_vm_translation_map_init(kernel_args *args,
memset(sPageHolePageDir + FIRST_USER_PGDIR_ENT, 0,
sizeof(page_directory_entry) * NUM_USER_PGDIR_ENTS);
sKernelPhysicalPageDirectory = (page_directory_entry*)
args->arch_args.phys_pgdir;
sKernelPhysicalPageDirectory = args->arch_args.phys_pgdir;
sKernelVirtualPageDirectory = (page_directory_entry*)
args->arch_args.vir_pgdir;
#ifdef TRACE_VM_TMAP
TRACE("page hole: %p, page dir: %p\n", sPageHole, sPageHolePageDir);
TRACE("page dir: %p (physical: %p)\n", sKernelVirtualPageDirectory,
sKernelPhysicalPageDirectory);
TRACE("page dir: %p (physical: %#" B_PRIx32 ")\n",
sKernelVirtualPageDirectory, sKernelPhysicalPageDirectory);
TRACE("physical memory ranges:\n");
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;
uint32 index = VADDR_TO_PDENT(virtualAddress);
if (physicalPageDirectory == (uint32)sKernelPhysicalPageDirectory) {
if (physicalPageDirectory == sKernelPhysicalPageDirectory) {
pageDirectoryEntry = sKernelVirtualPageDirectory[index];
} else if (sPhysicalPageMapper != NULL) {
// 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;
// switch back to the original page directory
if (physicalPageDirectory != (uint32)sKernelPhysicalPageDirectory)
if (physicalPageDirectory != sKernelPhysicalPageDirectory)
write_cr3(physicalPageDirectory);
if ((pageTableEntry & X86_PTE_PRESENT) == 0)

View File

@ -65,7 +65,7 @@ typedef uint32 page_directory_entry;
struct vm_translation_map_arch_info : DeferredDeletable {
page_directory_entry* pgdir_virt;
page_directory_entry* pgdir_phys;
uint32 pgdir_phys;
TranslationMapPhysicalPageMapper* page_mapper;
vint32 ref_count;
vint32 active_on_cpus;