From 4f197ee2ef9ce35653471ff8dec13958666ec6c4 Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Sun, 3 Jun 2018 16:56:48 +0200 Subject: [PATCH] Provide sysctl(hw.cpu64bit_capable) (#304) --- src/kernel/emulation/linux/misc/sysctl_hw.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/kernel/emulation/linux/misc/sysctl_hw.c b/src/kernel/emulation/linux/misc/sysctl_hw.c index 8f6d218ee..dce14c12e 100644 --- a/src/kernel/emulation/linux/misc/sysctl_hw.c +++ b/src/kernel/emulation/linux/misc/sysctl_hw.c @@ -17,7 +17,8 @@ enum { _HW_LOGICAL_CPU_MAX, _HW_CPUTYPE, _HW_CPUSUBTYPE, - _HW_CPUTHREADTYPE + _HW_CPUTHREADTYPE, + _HW_64BITCAPABLE, }; static sysctl_handler(handle_availcpu); @@ -30,6 +31,7 @@ static sysctl_handler(handle_pagesize); static sysctl_handler(handle_cputype); static sysctl_handler(handle_cpusubtype); static sysctl_handler(handle_cputhreadtype); +static sysctl_handler(handle_cpu64bitcapable); static sysctl_handler(handle_machine); const struct known_sysctl sysctls_hw[] = { @@ -44,6 +46,7 @@ const struct known_sysctl sysctls_hw[] = { { .oid = _HW_CPUTYPE, .type = CTLTYPE_INT, .exttype = "", .name = "cputype", .handler = handle_cputype }, { .oid = _HW_CPUSUBTYPE, .type = CTLTYPE_INT, .exttype = "", .name = "cpusubtype", .handler = handle_cpusubtype }, { .oid = _HW_CPUTHREADTYPE, .type = CTLTYPE_INT, .exttype = "", .name = "cputhreadtype", .handler = handle_cputhreadtype }, + { .oid = _HW_64BITCAPABLE, .type = CTLTYPE_INT, .exttype = "", .name = "cpu64bit_capable", .handler = handle_cpu64bitcapable }, { .oid = HW_MACHINE, .type = CTLTYPE_STRING, .exttype = "S", .name = "machine", .handler = handle_machine }, { .oid = -1 } }; @@ -135,6 +138,13 @@ sysctl_handler(handle_cputhreadtype) return 0; } +sysctl_handler(handle_cpu64bitcapable) +{ + sysctl_handle_size(sizeof(int)); + *((int*) old) = 1; // Darling only supports 64-bit CPUs + return 0; +} + sysctl_handler(handle_machine) { copyout_string(need_uname()->machine, (char*) old, oldlen); -- 2.51.2