From f59cfb87a948b2fb9c18ab059b74b9141419643a Mon Sep 17 00:00:00 2001 From: wzx Date: Wed, 26 Oct 2022 09:53:14 +0800 Subject: [PATCH] Add sw64 architecture Signed-off-by: wzx --- configure | 2 ++ configure.ac | 2 ++ include/pt-bsd.h | 4 ++-- libblkid/src/partitions/bsd.c | 1 + libfdisk/src/bsd.c | 16 ++++++++-------- sys-utils/hwclock-rtc.c | 2 +- sys-utils/hwclock.c | 12 ++++++------ sys-utils/hwclock.h | 6 +++--- sys-utils/lscpu-cputype.c | 2 +- sys-utils/setarch.c | 4 ++++ tests/ts/fdisk/bsd | 5 ++++- 11 files changed, 34 insertions(+), 22 deletions(-) diff --git a/configure b/configure index 57b830a..48d3a36 100755 --- a/configure +++ b/configure @@ -36071,6 +36071,7 @@ else case $host_cpu in #( alpha) syscall="442" ;; #( + sw_64) syscall="442" ;; #( i*86) syscall="289" ;; #( ia64*) syscall="1274" ;; #( powerpc*) syscall="273" ;; #( @@ -36175,6 +36176,7 @@ else case $host_cpu in #( alpha) syscall="443" ;; #( + sw_64) syscall="443" ;; #( i*86) syscall="290" ;; #( ia64*) syscall="1275" ;; #( powerpc*) syscall="274" ;; #( diff --git a/configure.ac b/configure.ac index b12b48c..bf405da 100644 --- a/configure.ac +++ b/configure.ac @@ -2218,6 +2218,7 @@ UL_BUILD_INIT([ionice]) UL_REQUIRES_SYSCALL_CHECK([ionice], [UL_CHECK_SYSCALL([ioprio_set], [alpha], [442], + [sw_64], [442], [i*86], [289], [ia64*], [1274], [powerpc*], [273], @@ -2230,6 +2231,7 @@ UL_REQUIRES_SYSCALL_CHECK([ionice], UL_REQUIRES_SYSCALL_CHECK([ionice], [UL_CHECK_SYSCALL([ioprio_get], [alpha], [443], + [sw_64], [443], [i*86], [290], [ia64*], [1275], [powerpc*], [274], diff --git a/include/pt-bsd.h b/include/pt-bsd.h index 9bf47a5..c524c44 100644 --- a/include/pt-bsd.h +++ b/include/pt-bsd.h @@ -10,7 +10,7 @@ #define BSD_LINUX_BOOTDIR "/usr/ucb/mdec" -#if defined (__alpha__) || defined (__powerpc__) || \ +#if defined (__alpha__) || defined (__sw_64__) || defined (__powerpc__) || \ defined (__ia64__) || defined (__hppa__) # define BSD_LABELSECTOR 0 # define BSD_LABELOFFSET 64 @@ -137,7 +137,7 @@ struct bsd_disklabel { #define BSD_FS_ADVFS 16 /* Digital Unix AdvFS */ /* this is annoying, but it's also the way it is :-( */ -#ifdef __alpha__ +#if defined __alpha__ || defined __sw_64__ #define BSD_FS_EXT2 8 /* ext2 file system */ #else #define BSD_FS_MSDOS 8 /* MS-DOS file system */ diff --git a/libblkid/src/partitions/bsd.c b/libblkid/src/partitions/bsd.c index c745173..ad2bfda 100644 --- a/libblkid/src/partitions/bsd.c +++ b/libblkid/src/partitions/bsd.c @@ -166,6 +166,7 @@ nothing: * ------------------------+-------------+------------ * alpha luna88k mac68k | 0 | 64 * sparc(OpenBSD) vax | | + * sw_64 | | * ------------------------+-------------+------------ * sparc64 sparc(NetBSD) | 0 | 128 * ------------------------+-------------+------------ diff --git a/libfdisk/src/bsd.c b/libfdisk/src/bsd.c index 313ae5a..875fa11 100644 --- a/libfdisk/src/bsd.c +++ b/libfdisk/src/bsd.c @@ -55,7 +55,7 @@ static struct fdisk_parttype bsd_fstypes[] = { {BSD_FS_V71K, "4.1BSD"}, {BSD_FS_V8, "Eighth Edition"}, {BSD_FS_BSDFFS, "4.2BSD"}, -#ifdef __alpha__ +#if defined __alpha__ || defined __sw_64__ {BSD_FS_EXT2, "ext2"}, #else {BSD_FS_MSDOS, "MS-DOS"}, @@ -80,7 +80,7 @@ struct fdisk_bsd_label { struct dos_partition *dos_part; /* parent */ struct bsd_disklabel bsd; /* on disk label */ -#if defined (__alpha__) +#if defined (__alpha__) || defined (__sw_64__) /* We access this through a u_int64_t * when checksumming */ char bsdbuffer[BSD_BBSIZE] __attribute__((aligned(8))); #else @@ -120,7 +120,7 @@ static struct fdisk_parttype *bsd_partition_parttype( } -#if defined (__alpha__) +#if defined (__alpha__) || defined (__sw_64__) static void alpha_bootblock_checksum (char *boot) { uint64_t *dp = (uint64_t *) boot, sum = 0; @@ -606,7 +606,7 @@ int fdisk_bsd_edit_disklabel(struct fdisk_context *cxt) struct bsd_disklabel *d = self_disklabel(cxt); uintmax_t res; -#if defined (__alpha__) || defined (__ia64__) +#if defined (__alpha__) || defined (__sw_64__) || defined (__ia64__) if (fdisk_ask_number(cxt, DEFAULT_SECTOR_SIZE, d->d_secsize, UINT32_MAX, _("bytes/sector"), &res) == 0) d->d_secsize = res; @@ -712,7 +712,7 @@ int fdisk_bsd_write_bootstrap(struct fdisk_context *cxt) sector = 0; if (l->dos_part) sector = dos_partition_get_start(l->dos_part); -#if defined (__alpha__) +#if defined (__alpha__) || defined (__sw_64__) alpha_bootblock_checksum(l->bsdbuffer); #endif if (lseek(cxt->dev_fd, (off_t) sector * DEFAULT_SECTOR_SIZE, SEEK_SET) == -1) { @@ -769,7 +769,7 @@ static int bsd_initlabel (struct fdisk_context *cxt) else d -> d_type = BSD_DTYPE_ST506; -#if !defined (__alpha__) +#if !defined (__alpha__) && !defined (__sw_64__) d -> d_flags = BSD_D_DOSPART; #else d -> d_flags = 0; @@ -893,7 +893,7 @@ static int bsd_write_disklabel(struct fdisk_context *cxt) memmove(&l->bsdbuffer[BSD_LABELSECTOR * DEFAULT_SECTOR_SIZE + BSD_LABELOFFSET], d, sizeof(*d)); -#if defined (__alpha__) && BSD_LABELSECTOR == 0 +#if (defined (__alpha__) || defined (__sw_64__)) && BSD_LABELSECTOR == 0 /* Write the checksum to the end of the first sector. */ alpha_bootblock_checksum(l->bsdbuffer); #endif @@ -929,7 +929,7 @@ static int bsd_translate_fstype (int linux_type) case 0x06: /* DOS 16-bit >=32M */ case 0xe1: /* DOS access */ case 0xe3: /* DOS R/O */ -#if !defined (__alpha__) +#if !defined (__alpha__) && !defined (__sw_64__) case 0xf2: /* DOS secondary */ return BSD_FS_MSDOS; #endif diff --git a/sys-utils/hwclock-rtc.c b/sys-utils/hwclock-rtc.c index 07af9c8..885ca1e 100644 --- a/sys-utils/hwclock-rtc.c +++ b/sys-utils/hwclock-rtc.c @@ -390,7 +390,7 @@ struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl) return &rtc_interface; } -#ifdef __alpha__ +#if defined __alpha__ || defined __sw_64__ /* * Get the Hardware Clock epoch setting from the kernel. */ diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index 3609814..37ec0d0 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -1129,7 +1129,7 @@ manipulate_clock(const struct hwclock_control *ctl, const time_t set_time, * Get or set the kernel RTC driver's epoch on Alpha machines. * ISA machines are hard coded for 1900. */ -#if defined(__linux__) && defined(__alpha__) +#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__)) static void manipulate_epoch(const struct hwclock_control *ctl) { @@ -1172,7 +1172,7 @@ usage(void) puts(_(" -w, --systohc set the RTC from the system time")); puts(_(" --systz send timescale configurations to the kernel")); puts(_(" -a, --adjust adjust the RTC to account for systematic drift")); -#if defined(__linux__) && defined(__alpha__) +#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__)) puts(_(" --getepoch display the RTC epoch")); puts(_(" --setepoch set the RTC epoch according to --epoch")); #endif @@ -1188,7 +1188,7 @@ usage(void) " --directisa use the ISA bus instead of %1$s access\n"), _PATH_RTC_DEV); puts(_(" --date