代码拉取完成,页面将自动刷新
From f59cfb87a948b2fb9c18ab059b74b9141419643a Mon Sep 17 00:00:00 2001
From: wzx <wuzx1226@qq.com>
Date: Wed, 26 Oct 2022 09:53:14 +0800
Subject: [PATCH] Add sw64 architecture
Signed-off-by: wzx <wuzx1226@qq.com>
---
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 0671c06..6bd1f57 100755
--- a/configure
+++ b/configure
@@ -39881,6 +39881,7 @@ else $as_nop
case $host_cpu in
#(
alpha) syscall="442" ;; #(
+ sw_64) syscall="442" ;; #(
i*86) syscall="289" ;; #(
ia64*) syscall="1274" ;; #(
powerpc*) syscall="273" ;; #(
@@ -39986,6 +39987,7 @@ else $as_nop
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 2cb236f..d9d8691 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2392,6 +2392,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],
@@ -2404,6 +2405,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 20c24b7..b878258 100644
--- a/include/pt-bsd.h
+++ b/include/pt-bsd.h
@@ -14,7 +14,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
@@ -141,7 +141,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 ba12019..e7e4486 100644
--- a/libblkid/src/partitions/bsd.c
+++ b/libblkid/src/partitions/bsd.c
@@ -183,6 +183,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 7094cd0..11adb81 100644
--- a/sys-utils/hwclock-rtc.c
+++ b/sys-utils/hwclock-rtc.c
@@ -340,7 +340,7 @@ const 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 2a18443..87228b5 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -1133,7 +1133,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)
{
@@ -1208,7 +1208,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
@@ -1228,7 +1228,7 @@ usage(void)
" --directisa use the ISA bus instead of %1$s access\n"), _PATH_RTC_DEV);
puts(_(" --date <time> date/time input for --set and --predict"));
puts(_(" --delay <sec> delay used when set new RTC time"));
-#if defined(__linux__) && defined(__alpha__)
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
puts(_(" --epoch <year> epoch input for --setepoch"));
#endif
puts(_(" --update-drift update the RTC drift factor"));
@@ -1307,7 +1307,7 @@ int main(int argc, char **argv)
{ "ul-debug", required_argument, NULL, 'd' },
{ "verbose", no_argument, NULL, 'v' },
{ "set", no_argument, NULL, OPT_SET },
-#if defined(__linux__) && defined(__alpha__)
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
{ "getepoch", no_argument, NULL, OPT_GETEPOCH },
{ "setepoch", no_argument, NULL, OPT_SETEPOCH },
{ "epoch", required_argument, NULL, OPT_EPOCH },
@@ -1415,7 +1415,7 @@ int main(int argc, char **argv)
ctl.show = 0;
ctl.hwaudit_on = 1;
break;
-#if defined(__linux__) && defined(__alpha__)
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
case OPT_GETEPOCH:
ctl.getepoch = 1;
ctl.show = 0;
@@ -1542,7 +1542,7 @@ int main(int argc, char **argv)
}
#endif
-#if defined(__linux__) && defined(__alpha__)
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
if (ctl.getepoch || ctl.setepoch) {
manipulate_epoch(&ctl);
hwclock_exit(&ctl, EXIT_SUCCESS);
diff --git a/sys-utils/hwclock.h b/sys-utils/hwclock.h
index b5b72d4..d29d95e 100644
--- a/sys-utils/hwclock.h
+++ b/sys-utils/hwclock.h
@@ -24,7 +24,7 @@ struct hwclock_control {
char *date_opt;
char *adj_file_name;
double rtc_delay; /* --delay <seconds> */
-#if defined(__linux__) && defined(__alpha__)
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
char *epoch_option;
#endif
#ifdef __linux__
@@ -39,7 +39,7 @@ struct hwclock_control {
hctosys:1,
utc:1,
systohc:1,
-#if defined(__linux__) && defined(__alpha__)
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
getepoch:1,
setepoch:1,
#endif
@@ -72,7 +72,7 @@ extern const struct clock_ops *probe_for_rtc_clock(const struct hwclock_control
extern double time_diff(struct timeval subtrahend, struct timeval subtractor);
/* rtc.c */
-#if defined(__linux__) && defined(__alpha__)
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
extern int get_epoch_rtc(const struct hwclock_control *ctl, unsigned long *epoch);
extern int set_epoch_rtc(const struct hwclock_control *ctl);
#endif
diff --git a/sys-utils/lscpu-cputype.c b/sys-utils/lscpu-cputype.c
index 3fd5f7a..b01ed21 100644
--- a/sys-utils/lscpu-cputype.c
+++ b/sys-utils/lscpu-cputype.c
@@ -611,7 +611,7 @@ struct lscpu_arch *lscpu_read_architecture(struct lscpu_cxt *cxt)
* information about our real CPU */
;
else {
-#if defined(__alpha__) || defined(__ia64__)
+#if defined(__alpha__) || defined(__sw_64__) || defined(__ia64__)
ar->bit64 = 1; /* 64bit platforms only */
#endif
/* platforms with 64bit flag in /proc/cpuinfo, define
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index 78b5183..f4f6e56 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -229,6 +229,10 @@ static struct arch_domain *init_arch_domains(void)
{PER_LINUX32, "mips", "mips"},
{PER_LINUX, "mips64", "mips64"},
#endif
+#if defined(__sw_64__)
+ {PER_LINUX, "sw_64", "sw_64"},
+ {PER_LINUX, "sw_64sw6b", "sw_64"},
+#endif
#if defined(__alpha__)
{PER_LINUX, "alpha", "alpha"},
{PER_LINUX, "alphaev5", "alpha"},
diff --git a/tests/ts/fdisk/bsd b/tests/ts/fdisk/bsd
index 8477f92..48e2a35 100755
--- a/tests/ts/fdisk/bsd
+++ b/tests/ts/fdisk/bsd
@@ -48,7 +48,7 @@ BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order)
ARCH=$(uname -m)
case $ARCH in
# see include/pt-bsd.h
- *alpha* | *ppc* | *ia64* | *hppa* | *parisc* )
+ *sw_64* | *alpha* | *ppc* | *ia64* | *hppa* | *parisc* )
BSD_LABELSECTOR=0
BSD_LABELOFFSET=64
;;
@@ -61,6 +61,9 @@ esac
# and contains extra options for alpha
BSD_EXTRA=""
case $ARCH in
+ *sw_64*)
+ BSD_EXTRA="_sw_64"
+ ;;
*alpha*)
BSD_EXTRA="_alpha"
;;
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。