Commit 242011157f0d454bf5a57541ebeba2c17611298e

Authored by pbrook
1 parent 2ae23e75

Fix Arm big-endian host bug.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1762 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 20 additions and 18 deletions
hw/integratorcp.c
@@ -1135,22 +1135,22 @@ static void set_kernel_args(uint32_t ram_size, int initrd_size, @@ -1135,22 +1135,22 @@ static void set_kernel_args(uint32_t ram_size, int initrd_size,
1135 1135
1136 p = (uint32_t *)(phys_ram_base + KERNEL_ARGS_ADDR); 1136 p = (uint32_t *)(phys_ram_base + KERNEL_ARGS_ADDR);
1137 /* ATAG_CORE */ 1137 /* ATAG_CORE */
1138 - *(p++) = 5;  
1139 - *(p++) = 0x54410001;  
1140 - *(p++) = 1;  
1141 - *(p++) = 0x1000;  
1142 - *(p++) = 0; 1138 + stl_raw(p++, 5);
  1139 + stl_raw(p++, 0x54410001);
  1140 + stl_raw(p++, 1);
  1141 + stl_raw(p++, 0x1000);
  1142 + stl_raw(p++, 0);
1143 /* ATAG_MEM */ 1143 /* ATAG_MEM */
1144 - *(p++) = 4;  
1145 - *(p++) = 0x54410002;  
1146 - *(p++) = ram_size;  
1147 - *(p++) = 0; 1144 + stl_raw(p++, 4);
  1145 + stl_raw(p++, 0x54410002);
  1146 + stl_raw(p++, ram_size);
  1147 + stl_raw(p++, 0);
1148 if (initrd_size) { 1148 if (initrd_size) {
1149 /* ATAG_INITRD2 */ 1149 /* ATAG_INITRD2 */
1150 - *(p++) = 4;  
1151 - *(p++) = 0x54420005;  
1152 - *(p++) = INITRD_LOAD_ADDR;  
1153 - *(p++) = initrd_size; 1150 + stl_raw(p++, 4);
  1151 + stl_raw(p++, 0x54420005);
  1152 + stl_raw(p++, INITRD_LOAD_ADDR);
  1153 + stl_raw(p++, initrd_size);
1154 } 1154 }
1155 if (kernel_cmdline && *kernel_cmdline) { 1155 if (kernel_cmdline && *kernel_cmdline) {
1156 /* ATAG_CMDLINE */ 1156 /* ATAG_CMDLINE */
@@ -1159,13 +1159,13 @@ static void set_kernel_args(uint32_t ram_size, int initrd_size, @@ -1159,13 +1159,13 @@ static void set_kernel_args(uint32_t ram_size, int initrd_size,
1159 cmdline_size = strlen(kernel_cmdline); 1159 cmdline_size = strlen(kernel_cmdline);
1160 memcpy (p + 2, kernel_cmdline, cmdline_size + 1); 1160 memcpy (p + 2, kernel_cmdline, cmdline_size + 1);
1161 cmdline_size = (cmdline_size >> 2) + 1; 1161 cmdline_size = (cmdline_size >> 2) + 1;
1162 - *(p++) = cmdline_size + 2;  
1163 - *(p++) = 0x54410009; 1162 + stl_raw(p++, cmdline_size + 2);
  1163 + stl_raw(p++, 0x54410009);
1164 p += cmdline_size; 1164 p += cmdline_size;
1165 } 1165 }
1166 /* ATAG_END */ 1166 /* ATAG_END */
1167 - *(p++) = 0;  
1168 - *(p++) = 0; 1167 + stl_raw(p++, 0);
  1168 + stl_raw(p++, 0);
1169 } 1169 }
1170 1170
1171 /* Board init. */ 1171 /* Board init. */
@@ -1180,6 +1180,7 @@ static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device, @@ -1180,6 +1180,7 @@ static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device,
1180 icp_pic_state *pic; 1180 icp_pic_state *pic;
1181 int kernel_size; 1181 int kernel_size;
1182 int initrd_size; 1182 int initrd_size;
  1183 + int n;
1183 1184
1184 env = cpu_init(); 1185 env = cpu_init();
1185 bios_offset = ram_size + vga_ram_size; 1186 bios_offset = ram_size + vga_ram_size;
@@ -1234,7 +1235,8 @@ static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device, @@ -1234,7 +1235,8 @@ static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device,
1234 } 1235 }
1235 bootloader[5] = KERNEL_ARGS_ADDR; 1236 bootloader[5] = KERNEL_ARGS_ADDR;
1236 bootloader[6] = KERNEL_LOAD_ADDR; 1237 bootloader[6] = KERNEL_LOAD_ADDR;
1237 - memcpy(phys_ram_base, bootloader, sizeof(bootloader)); 1238 + for (n = 0; n < sizeof(bootloader) / 4; n++)
  1239 + stl_raw(phys_ram_base + (n * 4), bootloader[n]);
1238 set_kernel_args(ram_size, initrd_size, kernel_cmdline); 1240 set_kernel_args(ram_size, initrd_size, kernel_cmdline);
1239 } 1241 }
1240 1242