# the PKRU using ptrace, see commit 4a804c4f8356 ("x86/fpu: Allow PKRU to be
# (once again) written by ptrace.").
set have_xfail 0
-if { [istarget *-*-linux*] } {
- set res [remote_exec target "uname -r"]
- set status [lindex $res 0]
- set output [lindex $res 1]
-
- set re ^($decimal)\\.($decimal)\\.($decimal)
- if { $status == 0
- && [regexp $re $output dummy v1 v2 v3] == 1 } {
- set v [list $v1 $v2 $v3]
- set have_xfail \
- [expr \
- [version_compare [list 5 14 0] <= $v] \
- && [version_compare $v < [list 6 2 0]]]
- }
+set v [linux_kernel_version]
+if { $v != {} } {
+ set have_xfail \
+ [expr \
+ [version_compare [list 5 14 0] <= $v] \
+ && [version_compare $v < [list 6 2 0]]]
}
# Test pkru register at startup
return [regexp $dep $output]
}
+# Detect linux kernel version and return as list of 3 numbers: major, minor,
+# and patchlevel. On failure, return an empty list.
+
+gdb_caching_proc linux_kernel_version {
+ if { ![istarget *-*-linux*] } {
+ return {}
+ }
+
+ set res [remote_exec target "uname -r"]
+ set status [lindex $res 0]
+ set output [lindex $res 1]
+ if { $status != 0 } {
+ return {}
+ }
+
+ set re ^($::decimal)\\.($::decimal)\\.($::decimal)
+ if { [regexp $re $output dummy v1 v2 v3] != 1 } {
+ return {}
+ }
+
+ return [list $v1 $v2 $v3]
+}
+
# Always load compatibility stuff.
load_lib future.exp