lkml.org 
[lkml]   [2021]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [RFC][PATCH 07/22] x86,extable: Extend extable functionality
On Fri, Nov 05, 2021 at 09:15:57PM +0100, Peter Zijlstra wrote:

> That's really unfortunate that is... 6.4.4.1 item 5 of the C99 spec
> covers this gem :-( I suppose I'll go stick that (int) cast in the
> EX_IMM_MASK definition or something.

--- a/arch/x86/include/asm/extable_fixup_types.h
+++ b/arch/x86/include/asm/extable_fixup_types.h
@@ -2,10 +2,15 @@
#ifndef _ASM_X86_EXTABLE_FIXUP_TYPES_H
#define _ASM_X86_EXTABLE_FIXUP_TYPES_H

+/*
+ * Our IMM is signed, as such it must live at the top end of the word. Also,
+ * since C99 hex constants are of ambigious type, force cast the mask to 'int'
+ * so that FIELD_GET() will DTRT and sign extend the value when it extracts it.
+ */
#define EX_DATA_TYPE_MASK 0x000000FF
#define EX_DATA_REG_MASK 0x00000F00
#define EX_DATA_FLAG_MASK 0x0000F000
-#define EX_DATA_IMM_MASK 0xFFFF0000
+#define EX_DATA_IMM_MASK ((int)0xFFFF0000)

#define EX_DATA_REG_SHIFT 8
#define EX_DATA_FLAG_SHIFT 12
\
 
 \ /
  Last update: 2021-11-05 21:29    [W:1.128 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site