aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i386/i386/pcb.c10
-rw-r--r--i386/i386/thread.h3
-rw-r--r--i386/i386/trap.c4
3 files changed, 16 insertions, 1 deletions
diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c
index a261ae1f..5ac487b7 100644
--- a/i386/i386/pcb.c
+++ b/i386/i386/pcb.c
@@ -147,6 +147,9 @@ void switch_ktss(pcb_t pcb)
pcb_stack_top = (pcb->iss.efl & EFL_VM)
? (long) (&pcb->iss + 1)
: (long) (&pcb->iss.v86_segs);
+#ifdef __x86_64__
+ assert((pcb_stack_top & 0xF) == 0);
+#endif
#ifdef MACH_RING1
/* No IO mask here */
@@ -375,7 +378,12 @@ thread_t switch_context(
void pcb_module_init(void)
{
- kmem_cache_init(&pcb_cache, "pcb", sizeof(struct pcb), 0,
+ kmem_cache_init(&pcb_cache, "pcb", sizeof(struct pcb),
+#ifdef __x86_64__
+ 16,
+#else
+ 0,
+#endif
NULL, 0);
fpu_module_init();
diff --git a/i386/i386/thread.h b/i386/i386/thread.h
index 4a9c1987..cb317bee 100644
--- a/i386/i386/thread.h
+++ b/i386/i386/thread.h
@@ -200,6 +200,9 @@ struct i386_machine_state {
typedef struct pcb {
struct i386_interrupt_state iis[2]; /* interrupt and NMI */
+#ifdef __x86_64__
+ unsigned long pad; /* ensure exception stack is aligned to 16 */
+#endif
struct i386_saved_state iss;
struct i386_machine_state ims;
decl_simple_lock_data(, lock)
diff --git a/i386/i386/trap.c b/i386/i386/trap.c
index 4f8612bc..23cb9f17 100644
--- a/i386/i386/trap.c
+++ b/i386/i386/trap.c
@@ -361,6 +361,10 @@ int user_trap(struct i386_saved_state *regs)
int type;
thread_t thread = current_thread();
+#ifdef __x86_64__
+ assert(regs == &thread->pcb->iss);
+#endif
+
type = regs->trapno;
code = 0;
subcode = 0;