Skip to content

Commit e570bb7

Browse files
committed
Added patch for debug inline
1 parent da412a0 commit e570bb7

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

build.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,34 @@ function build_version {
3434
echo "Checking out repo for kernel at version: $version"
3535
git checkout "$(get_tag "$version")"
3636

37+
echo "Applying debug FPU instrumentation"
38+
patch -p1 <<'EOF' > /dev/null
39+
*** arch/x86/kernel/fpu/xstate.c
40+
@@
41+
struct xregs_state *xsave = &fpstate->regs.xsave;
42+
- unsigned int offset, size;
43+
+ unsigned int offset, size;
44+
@@
45+
- if (copy_from_buffer(&hdr, offset, sizeof(hdr), kbuf, ubuf))
46+
- return -EFAULT;
47+
+ if (copy_from_buffer(&hdr, offset, sizeof(hdr), kbuf, ubuf))
48+
+ return -EFAULT;
49+
+
50+
+ pr_info("fpu: copy_uabi_to_xstate hdr.xfeatures=%#llx hdr.xcomp_bv=%#llx fpstate->header=%#llx xcr0=%#llx\n",
51+
+ hdr.xfeatures, hdr.xcomp_bv, fpstate->regs.xsave.header.xfeatures,
52+
+ this_cpu_read(x86_xcr0));
53+
*** arch/x86/kernel/fpu/core.c
54+
@@
55+
-void restore_fpregs_from_fpstate(struct fpstate *fpstate, u64 mask)
56+
-{
57+
+void restore_fpregs_from_fpstate(struct fpstate *fpstate, u64 mask)
58+
+{
59+
+ pr_info("fpu: restore_fpregs_from_fpstate mask=%#llx fpstate->header=%#llx xcr0=%#llx\n",
60+
+ mask, fpstate->regs.xsave.header.xfeatures,
61+
+ this_cpu_read(x86_xcr0));
62+
***
63+
EOF
64+
3765
echo "Building kernel version: $version"
3866
make olddefconfig
3967
make vmlinux -j "$(nproc)"

0 commit comments

Comments
 (0)