@@ -76,7 +76,7 @@ static void warn_bad_vsyscall(const char *level, struct pt_regs *regs,
if (!show_unhandled_signals)
return;
- printk_ratelimited("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n",
+ printk_ratelimited("%s%s[%d] %s ip:%lx cs:%x sp:%lx ax:%lx si:%lx di:%lx\n",
level, current->comm, task_pid_nr(current),
message, regs->ip, regs->cs,
regs->sp, regs->ax, regs->si, regs->di);
@@ -80,15 +80,66 @@ struct pt_regs {
/*
* On syscall entry, this is syscall#. On CPU exception, this is error code.
* On hw interrupt, it's IRQ number:
+ *
+ * A FRED stack frame starts here:
+ * 1) It _always_ includes an error code;
+ * 2) The return frame for eretu/erets starts here.
*/
unsigned long orig_ax;
/* Return frame for iretq */
unsigned long ip;
- unsigned long cs;
+ union {
+/* CS extended: CS + any fields above it */
+ unsigned long csx;
+ struct {
+/* CS selector proper */
+ unsigned short cs;
+/* The stack level (SL) at the time the event occurred */
+ unsigned int sl : 2;
+/* Set to indicate that indirect branch tracker in WAIT_FOR_ENDBRANCH state */
+ unsigned int wfe : 1;
+ unsigned int __csx_resv1: 13;
+ unsigned int __csx_resv2: 32;
+ } __packed;
+ };
unsigned long flags;
unsigned long sp;
- unsigned long ss;
-/* top of stack page */
+ union {
+/* SS extended: SS + any fields above it */
+ unsigned long ssx;
+ struct {
+/* SS selector proper */
+ unsigned short ss;
+/* Set to indicate that interrupt blocking by STI was in effect */
+ unsigned int sti : 1;
+/* For SYSCALL, SYSENTER, or INT n (for any value of n) */
+ unsigned int sys : 1;
+ unsigned int nmi : 1;
+ unsigned int __ssx_resv1: 13;
+/* Event information fields, ignored by the FRED return instructions */
+ unsigned int vector : 8;
+ unsigned int __ssx_resv2: 8;
+ unsigned int type : 4;
+ unsigned int __ssx_resv3: 4;
+/* Set to indicate that the event was incident to enclave execution */
+ unsigned int enc : 1;
+/* Set to indicate that the logical processor had been in 64-bit mode */
+ unsigned int l : 1;
+/*
+ * Set to indicate the event is a nested exception encountered during FRED
+ * event delivery of another event. This bit is not set if the event is
+ * double fault (#DF).
+ */
+ unsigned int nst : 1;
+ unsigned int __ssx_resv4: 1;
+/* The length of the instruction causing the event */
+ unsigned int instr_len : 4;
+ } __packed;
+ };
+/*
+ * Top of stack page on IDT systems, while FRED systems have extra fields
+ * defined above, see <asm/fred.h>.
+ */
};
#endif /* !__i386__ */
@@ -117,7 +117,7 @@ void __show_regs(struct pt_regs *regs, enum show_regs_mode mode,
printk("%sFS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n",
log_lvl, fs, fsindex, gs, gsindex, shadowgs);
- printk("%sCS: %04lx DS: %04x ES: %04x CR0: %016lx\n",
+ printk("%sCS: %04x DS: %04x ES: %04x CR0: %016lx\n",
log_lvl, regs->cs, ds, es, cr0);
printk("%sCR2: %016lx CR3: %016lx CR4: %016lx\n",
log_lvl, cr2, cr3, cr4);