Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.

https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html
> Use proper signedness for the LIF file system data structures.

mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.
This commit is contained in:
tsutsui 2024-05-11 22:10:27 +00:00
parent a3cbce7519
commit 7f4c51639c
2 changed files with 31 additions and 30 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bootblock.h,v 1.58 2017/04/29 00:05:35 nonaka Exp $ */ /* $NetBSD: bootblock.h,v 1.59 2024/05/11 22:10:27 tsutsui Exp $ */
/*- /*-
* Copyright (c) 2002-2004 The NetBSD Foundation, Inc. * Copyright (c) 2002-2004 The NetBSD Foundation, Inc.
@ -949,41 +949,41 @@ struct apple_blockzeroblock {
/* volume header for "LIF" format volumes */ /* volume header for "LIF" format volumes */
struct hp300_lifvol { struct hp300_lifvol {
int16_t vol_id; uint16_t vol_id;
char vol_label[6]; char vol_label[6];
int32_t vol_addr; uint32_t vol_addr;
int16_t vol_oct; uint16_t vol_oct;
int16_t vol_dummy; uint16_t vol_dummy;
int32_t vol_dirsize; uint32_t vol_dirsize;
int16_t vol_version; uint16_t vol_version;
int16_t vol_zero; uint16_t vol_zero;
int32_t vol_huh1; uint32_t vol_huh1;
int32_t vol_huh2; uint32_t vol_huh2;
int32_t vol_length; uint32_t vol_length;
}; };
/* LIF directory entry format */ /* LIF directory entry format */
struct hp300_lifdir { struct hp300_lifdir {
char dir_name[10]; char dir_name[10];
int16_t dir_type; uint16_t dir_type;
int32_t dir_addr; uint32_t dir_addr;
int32_t dir_length; uint32_t dir_length;
char dir_toc[6]; char dir_toc[6];
int16_t dir_flag; uint16_t dir_flag;
int32_t dir_exec; uint32_t dir_exec;
}; };
/* load header for boot rom */ /* load header for boot rom */
struct hp300_load { struct hp300_load {
int32_t address; uint32_t address;
int32_t count; uint32_t count;
}; };
#define HP300_VOL_ID -32768 #define HP300_VOL_ID 0x8000 /* always $8000 */
#define HP300_VOL_OCT 4096 #define HP300_VOL_OCT 4096
#define HP300_DIR_TYPE -5822 #define HP300_DIR_TYPE 0xe942 /* "SYS9k Series 9000" */
#define HP300_DIR_FLAG 0x8001 /* dont ask me! */ #define HP300_DIR_FLAG 0x8001 /* don't ask me! */
#define HP300_SECTSIZE 256 #define HP300_SECTSIZE 256

View File

@ -1,4 +1,4 @@
/* $NetBSD: hp300.c,v 1.17 2021/12/05 05:01:50 msaitoh Exp $ */ /* $NetBSD: hp300.c,v 1.18 2024/05/11 22:10:27 tsutsui Exp $ */
/*- /*-
* Copyright (c) 2003 The NetBSD Foundation, Inc. * Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if !defined(__lint) #if !defined(__lint)
__RCSID("$NetBSD: hp300.c,v 1.17 2021/12/05 05:01:50 msaitoh Exp $"); __RCSID("$NetBSD: hp300.c,v 1.18 2024/05/11 22:10:27 tsutsui Exp $");
#endif /* !__lint */ #endif /* !__lint */
/* We need the target disklabel.h, not the hosts one..... */ /* We need the target disklabel.h, not the hosts one..... */
@ -167,11 +167,12 @@ hp300_setboot(ib_params *params)
/* Relocate files, sanity check LIF directory on the way */ /* Relocate files, sanity check LIF directory on the way */
lifdir = (void *)(bootstrap + HP300_SECTSIZE * 2); lifdir = (void *)(bootstrap + HP300_SECTSIZE * 2);
for (i = 0; i < 8; lifdir++, i++) { for (i = 0; i < 8; lifdir++, i++) {
int32_t addr = be32toh(lifdir->dir_addr); uint32_t addr = be32toh(lifdir->dir_addr);
int32_t limit = (params->s1stat.st_size - 1) / HP300_SECTSIZE + 1; uint32_t limit = (params->s1stat.st_size - 1) / HP300_SECTSIZE
int32_t end = addr + be32toh(lifdir->dir_length); + 1;
uint32_t end = addr + be32toh(lifdir->dir_length);
if (end > limit) { if (end > limit) {
warnx("LIF entry %d larger (%d %d) than LIF file", warnx("LIF entry %d larger (%u %u) than LIF file",
i, end, limit); i, end, limit);
goto done; goto done;
} }