qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: "Bad ram offset"?


From: Blue Swirl
Subject: [Qemu-devel] Re: "Bad ram offset"?
Date: Tue, 28 Sep 2010 19:45:56 +0000

On Tue, Sep 28, 2010 at 7:31 PM, Artyom Tarasenko
<address@hidden> wrote:
> 2010/9/28 Blue Swirl <address@hidden>:
>> On Mon, Sep 27, 2010 at 9:19 PM, Artyom Tarasenko
>> <address@hidden> wrote:
>>> In today's git master:
>>>
>>> $ ./qemu-system-sparc64 -M sun4u -m 2048
>>> Bad ram offset ffffffff80000000
>>
>> Smells like unwanted sign extension somewhere.
>
> fwiw, tested -m 2048 with i386 and x86-64 and they both are fine with
> it. So it must be something platform-specific.

In a way, on SS-20 the problem is with cpu_physical_memory_write_rom
for idreg, which is at 0xef0000000. The sign extension happens in
qemu_get_ram_ptr() or just before that.

Here's my 'work in progress' patch:

diff --git a/exec.c b/exec.c
index 9b5464f..892aa06 100644
--- a/exec.c
+++ b/exec.c
@@ -154,7 +154,7 @@ typedef struct PageDesc {

 /* Size of the L2 (and L3, etc) page tables.  */
 #define L2_BITS 10
-#define L2_SIZE (1 << L2_BITS)
+#define L2_SIZE (1ULL << L2_BITS)

 /* The bits remaining after N lower levels of page tables.  */
 #define P_L1_BITS_REM \
@@ -432,7 +432,8 @@ static PhysPageDesc
*phys_page_find_alloc(target_phys_addr_t index, int alloc)

         for (i = 0; i < L2_SIZE; i++) {
             pd[i].phys_offset = IO_MEM_UNASSIGNED;
-            pd[i].region_offset = (index + i) << TARGET_PAGE_BITS;
+            pd[i].region_offset = (index + (target_phys_addr_t)i)
+                << TARGET_PAGE_BITS;
         }
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]