Print this page
10568 bop_trap() should report %cr2


2000          */
2001         if (++depth > 2)
2002                 bop_panic("Nested trap");
2003 
2004         bop_printf(NULL, "Unexpected trap\n");
2005 
2006         /*
2007          * adjust the tf for optional error_code by detecting the code selector
2008          */
2009         if (tf->code_seg != B64CODE_SEL)
2010                 tf = (struct trapframe *)(tfp - 1);
2011         else
2012                 bop_printf(NULL, "error code           0x%lx\n",
2013                     tf->error_code & 0xffffffff);
2014 
2015         bop_printf(NULL, "instruction pointer  0x%lx\n", tf->inst_ptr);
2016         bop_printf(NULL, "code segment         0x%lx\n", tf->code_seg & 0xffff);
2017         bop_printf(NULL, "flags register       0x%lx\n", tf->flags_reg);
2018         bop_printf(NULL, "return %%rsp          0x%lx\n", tf->stk_ptr);
2019         bop_printf(NULL, "return %%ss           0x%lx\n", tf->stk_seg & 0xffff);

2020 
2021         /* grab %[er]bp pushed by our code from the stack */
2022         fakeframe.old_frame = (bop_frame_t *)*(tfp - 3);
2023         fakeframe.retaddr = (pc_t)tf->inst_ptr;
2024         bop_printf(NULL, "Attempting stack backtrace:\n");
2025         bop_traceback(&fakeframe);
2026         bop_panic("unexpected trap in early boot");
2027 }
2028 
2029 extern void bop_trap_handler(void);
2030 
2031 static gate_desc_t *bop_idt;
2032 
2033 static desctbr_t bop_idt_info;
2034 
2035 /*
2036  * Install a temporary IDT that lets us catch errors in the boot time code.
2037  * We shouldn't get any faults at all while this is installed, so we'll
2038  * just generate a traceback and exit.
2039  */




2000          */
2001         if (++depth > 2)
2002                 bop_panic("Nested trap");
2003 
2004         bop_printf(NULL, "Unexpected trap\n");
2005 
2006         /*
2007          * adjust the tf for optional error_code by detecting the code selector
2008          */
2009         if (tf->code_seg != B64CODE_SEL)
2010                 tf = (struct trapframe *)(tfp - 1);
2011         else
2012                 bop_printf(NULL, "error code           0x%lx\n",
2013                     tf->error_code & 0xffffffff);
2014 
2015         bop_printf(NULL, "instruction pointer  0x%lx\n", tf->inst_ptr);
2016         bop_printf(NULL, "code segment         0x%lx\n", tf->code_seg & 0xffff);
2017         bop_printf(NULL, "flags register       0x%lx\n", tf->flags_reg);
2018         bop_printf(NULL, "return %%rsp          0x%lx\n", tf->stk_ptr);
2019         bop_printf(NULL, "return %%ss           0x%lx\n", tf->stk_seg & 0xffff);
2020         bop_printf(NULL, "%%cr2                 0x%lx\n", getcr2());
2021 
2022         /* grab %[er]bp pushed by our code from the stack */
2023         fakeframe.old_frame = (bop_frame_t *)*(tfp - 3);
2024         fakeframe.retaddr = (pc_t)tf->inst_ptr;
2025         bop_printf(NULL, "Attempting stack backtrace:\n");
2026         bop_traceback(&fakeframe);
2027         bop_panic("unexpected trap in early boot");
2028 }
2029 
2030 extern void bop_trap_handler(void);
2031 
2032 static gate_desc_t *bop_idt;
2033 
2034 static desctbr_t bop_idt_info;
2035 
2036 /*
2037  * Install a temporary IDT that lets us catch errors in the boot time code.
2038  * We shouldn't get any faults at all while this is installed, so we'll
2039  * just generate a traceback and exit.
2040  */