From 8da276934dbf7dc60081025c00a6744bd857d50a Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Mon, 6 Jun 2005 19:38:07 +0000 Subject: [PATCH] Manage RESIDENT page entry --- second/MMU040.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/second/MMU040.c b/second/MMU040.c index 5d7da4e..ab8de81 100644 --- a/second/MMU040.c +++ b/second/MMU040.c @@ -1,6 +1,6 @@ /* * - * (c) 2004 Laurent Vivier + * (c) 2004,2005 Laurent Vivier * * a lot of parts from penguin booter */ @@ -17,8 +17,10 @@ #define GET_TC_PAGE_SIZE(TC) (IS_8K_PAGE(TC) ? 8192 : 4096) -#define UDT_IS_INVALID(PDT) (!(PDT & 2)) -#define UDT_IS_RESIDENT(PDT) (PDT & 2) +#define GET_PDT(PDT) (PDT&3) +#define UDT_IS_INVALID(PDT) (GET_PDT(PDT) == 0) +#define UDT_IS_RESIDENT(PDT) ((GET_PDT(PDT) == 1) || (GET_PDT(PDT) == 3)) +#define UDT_IS_INDIRECT(PDT) (GET_PDT(PDT) == 2) #define GET_RP_UDT(RP) (RP & 0x00000003) #define GET_RP_W(RP) (RP & 0x00000004) @@ -116,9 +118,10 @@ int MMU040_logical2physicalAttr(unsigned long logicalAddr, unsigned long *physic rootEntry = MMU040_read_phys(rootTable + 4 * rootIndex); TRACE("Root Entry: %08lx\n", rootEntry); - if (UDT_IS_INVALID(rootEntry)) + if ( UDT_IS_INVALID(rootEntry) || UDT_IS_RESIDENT(rootEntry) ) { - return -1; + *physicalAddr = logicalAddr; + return 0; } ptrTable = GET_RP_ADDR(rootEntry); @@ -126,13 +129,12 @@ int MMU040_logical2physicalAttr(unsigned long logicalAddr, unsigned long *physic tableEntry = MMU040_read_phys(ptrTable + 4 * ptrIndex); TRACE("table Entry: %08lx\n", tableEntry); - if (UDT_IS_INVALID(tableEntry)) + if ( UDT_IS_INVALID(tableEntry) || UDT_IS_RESIDENT(tableEntry) ) { - return -1; + *physicalAddr = logicalAddr; + return 0; } - - if (IS_8K_PAGE(TC)) { pageTable = GET_TD_8K_ADDR(tableEntry);