Skip to contentSkip to conversation

microblaze: Trap on unaligned data accesses.

Qemu-devel Blue Swirl 2 participants 2 messages Sep 3, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Blue Swirl

author
#1 lore raw

Review

Quoted 12 lines · Anthony Liguori

From: Edgar E. Iglesias <[email protected]>

(quoted diff) +10 -0
+void helper_memalign(uint32_t addr, uint32_t dr, uint32_t wr, uint32_t size)
+{
+    uint32_t mask;
+
+    switch (size) {
+        case 4: mask = 3; break;
+        case 2: mask = 1; break;
+        default:
+        case 1: mask = 0; break;
+    }

For additional performance (and to avoid the check for mask == 0 case ;-)), you could perform most of the math above during translation.

Sparc32 actually avoids most of these explicit tests, but I still can't understand Fabrice's magic that made it possible.

#2 lore raw
Quoted 16 lines · Blue Swirl

Review

Quoted 12 lines · Anthony Liguori

From: Edgar E. Iglesias <[email protected]>

(quoted diff) +10 -0
+void helper_memalign(uint32_t addr, uint32_t dr, uint32_t wr, uint32_t size)
+{
+    uint32_t mask;
+
+    switch (size) {
+        case 4: mask = 3; break;
+        case 2: mask = 1; break;
+        default:
+        case 1: mask = 0; break;
+    }

For additional performance (and to avoid the check for mask == 0 case ;-)), you could perform most of the math above during translation.

Thanks, I beleive part of what you say is already done. The case 1 is there for completeness but translate.c doesn't call the helper for size 1.

I'll move the computing of the mask into translate.c.

Thanks,
Edgar

Quoted 3 lines

Sparc32 actually avoids most of these explicit tests, but I still can't understand Fabrice's magic that made it possible.