Revision 363a37d5 hw/sun4m.c
b/hw/sun4m.c | ||
---|---|---|
159 | 159 |
for (i = 0; i < sizeof(image); i++) |
160 | 160 |
image[i] = m48t59_read(nvram, i) & 0xff; |
161 | 161 |
|
162 |
strcpy((char *)header->boot_devices, boot_device); |
|
162 |
pstrcpy((char *)header->boot_devices, sizeof(header->boot_devices), |
|
163 |
boot_device); |
|
163 | 164 |
header->nboot_devices = strlen(boot_device) & 0xff; |
164 | 165 |
header->crc = cpu_to_be16(OHW_compute_crc(header, 0x00, 0xF8)); |
165 | 166 |
|
... | ... | |
187 | 188 |
memset(image, '\0', sizeof(image)); |
188 | 189 |
|
189 | 190 |
// Try to match PPC NVRAM |
190 |
strcpy((char *)header->struct_ident, "QEMU_BIOS"); |
|
191 |
pstrcpy((char *)header->struct_ident, sizeof(header->struct_ident), |
|
192 |
"QEMU_BIOS"); |
|
191 | 193 |
header->struct_version = cpu_to_be32(3); /* structure v3 */ |
192 | 194 |
|
193 | 195 |
header->nvram_size = cpu_to_be16(0x2000); |
194 | 196 |
header->nvram_arch_ptr = cpu_to_be16(sizeof(ohwcfg_v3_t)); |
195 | 197 |
header->nvram_arch_size = cpu_to_be16(sizeof(struct sparc_arch_cfg)); |
196 |
strcpy((char *)header->arch, arch);
|
|
198 |
pstrcpy((char *)header->arch, sizeof(header->arch), arch);
|
|
197 | 199 |
header->nb_cpus = smp_cpus & 0xff; |
198 | 200 |
header->RAM0_base = 0; |
199 | 201 |
header->RAM0_size = cpu_to_be64((uint64_t)RAM_size); |
200 |
strcpy((char *)header->boot_devices, boot_devices); |
|
202 |
pstrcpy((char *)header->boot_devices, sizeof(header->boot_devices), |
|
203 |
boot_devices); |
|
201 | 204 |
header->nboot_devices = strlen(boot_devices) & 0xff; |
202 | 205 |
header->kernel_image = cpu_to_be64((uint64_t)KERNEL_LOAD_ADDR); |
203 | 206 |
header->kernel_size = cpu_to_be64((uint64_t)kernel_size); |
... | ... | |
225 | 228 |
// Variable partition |
226 | 229 |
part_header = (struct OpenBIOS_nvpart_v1 *)&image[start]; |
227 | 230 |
part_header->signature = OPENBIOS_PART_SYSTEM; |
228 |
strcpy(part_header->name, "system");
|
|
231 |
pstrcpy(part_header->name, sizeof(part_header->name), "system");
|
|
229 | 232 |
|
230 | 233 |
end = start + sizeof(struct OpenBIOS_nvpart_v1); |
231 | 234 |
for (i = 0; i < nb_prom_envs; i++) |
... | ... | |
241 | 244 |
start = end; |
242 | 245 |
part_header = (struct OpenBIOS_nvpart_v1 *)&image[start]; |
243 | 246 |
part_header->signature = OPENBIOS_PART_FREE; |
244 |
strcpy(part_header->name, "free");
|
|
247 |
pstrcpy(part_header->name, sizeof(part_header->name), "free");
|
|
245 | 248 |
|
246 | 249 |
end = 0x1fd0; |
247 | 250 |
OpenBIOS_finish_partition(part_header, end - start); |
Also available in: Unified diff