summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--i386/i386/db_interface.c10
-rw-r--r--i386/i386/kttd_interface.c10
-rw-r--r--i386/i386/locore.S42
-rw-r--r--i386/i386/thread.h2
-rw-r--r--linux/src/include/asm-i386/irq.h1
6 files changed, 52 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index 2aadcd2..154abf9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2007-07-09 Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+ * i386/i386/db_interface.c (int_regs): Drop gs and fs fields.
+ (kdb_kentry): Get fs and gs from struct i386_interrupt_state instead of
+ struct int_regs.
+ * i386/i386/kttd_interface.c (int_regs, kttd_netentry): Likewise.
+ * i386/i386/locore.S (all_intrs): Save fs and gs and set them to kernel
+ segment too.
+ (return_to_iret): Restore fs and gs too.
+ (return_to_iret_i): Likewise.
+ (ast_from_interrupt): Set fs and gs to kernel segment too.
+ (kdb_from_iret): Don't save/restore fs and gs either.
+ (ttd_from_iret): Likewise.
+ * i386/i386/thread.h (i386_interrupt_state): Add gs and fs fields.
+ * linux/src/include/asm-i386/irq.h (SAVE_ALL): Set gs to kernel
+ segment too.
+
2007-08-04 Samuel Thibault <samuel.thibault@ens-lyon.org>
* i386/i386/locore.S (TIME_TRAP_UENTRY, TIME_TRAP_SENTRY)
diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c
index cf1e1c4..b8968de 100644
--- a/i386/i386/db_interface.c
+++ b/i386/i386/db_interface.c
@@ -187,8 +187,6 @@ kdb_trap(
* instead of those at its call to KDB.
*/
struct int_regs {
- int gs;
- int fs;
int edi;
int esi;
int ebp;
@@ -227,8 +225,8 @@ kdb_kentry(
ddb_regs.edi = int_regs->edi;
ddb_regs.ds = is->ds;
ddb_regs.es = is->es;
- ddb_regs.fs = int_regs->fs;
- ddb_regs.gs = int_regs->gs;
+ ddb_regs.fs = is->fs;
+ ddb_regs.gs = is->gs;
cnpollc(TRUE);
db_task_trap(-1, 0, (ddb_regs.cs & 0x3) != 0);
@@ -250,8 +248,8 @@ kdb_kentry(
int_regs->edi = ddb_regs.edi;
is->ds = ddb_regs.ds & 0xffff;
is->es = ddb_regs.es & 0xffff;
- int_regs->fs = ddb_regs.fs & 0xffff;
- int_regs->gs = ddb_regs.gs & 0xffff;
+ is->fs = ddb_regs.fs & 0xffff;
+ is->gs = ddb_regs.gs & 0xffff;
}
#if NCPUS > 1
db_leave();
diff --git a/i386/i386/kttd_interface.c b/i386/i386/kttd_interface.c
index d744c0e..9097061 100644
--- a/i386/i386/kttd_interface.c
+++ b/i386/i386/kttd_interface.c
@@ -491,8 +491,6 @@ boolean_t kttd_trap(int type, int code, struct i386_saved_state *regs)
* instead of those at its call to KDB.
*/
struct int_regs {
- int gs;
- int fs;
int edi;
int esi;
int ebp;
@@ -541,8 +539,8 @@ kttd_netentry(int_regs)
kttd_regs.edi = int_regs->edi;
kttd_regs.ds = is->ds;
kttd_regs.es = is->es;
- kttd_regs.fs = int_regs->fs;
- kttd_regs.gs = int_regs->gs;
+ kttd_regs.fs = is->fs;
+ kttd_regs.gs = is->gs;
kttd_active++;
kttd_task_trap(-1, 0, (kttd_regs.cs & 0x3) != 0);
@@ -564,8 +562,8 @@ kttd_netentry(int_regs)
int_regs->edi = kttd_regs.edi;
is->ds = kttd_regs.ds & 0xffff;
is->es = kttd_regs.es & 0xffff;
- int_regs->fs = kttd_regs.fs & 0xffff;
- int_regs->gs = kttd_regs.gs & 0xffff;
+ is->fs = kttd_regs.fs & 0xffff;
+ is->gs = kttd_regs.gs & 0xffff;
if (kttd_run_status == RUNNING)
printf("kttd_netentry: %%%%% run_status already RUNNING! %%%%%\n");
diff --git a/i386/i386/locore.S b/i386/i386/locore.S
index 56da469..eb97267 100644
--- a/i386/i386/locore.S
+++ b/i386/i386/locore.S
@@ -641,9 +641,13 @@ ENTRY(all_intrs)
pushl %ds /* save segment registers */
pushl %es
+ pushl %fs
+ pushl %gs
mov %ss,%dx /* switch to kernel segments */
mov %dx,%ds
mov %dx,%es
+ mov %dx,%fs
+ mov %dx,%gs
CPU_NUMBER(%edx)
@@ -681,7 +685,9 @@ LEXT(return_to_iret) /* ( label for kdb_kintr and hardclock) */
cmpl $0,CX(EXT(need_ast),%edx)
jnz ast_from_interrupt /* take it if so */
1:
- pop %es /* restore segment regs */
+ pop %gs /* restore segment regs */
+ pop %fs
+ pop %es
pop %ds
pop %edx
pop %ecx
@@ -699,11 +705,13 @@ _return_to_iret_i: /* ( label for kdb_kintr) */
/*
* Take an AST from an interrupt.
* On PCB stack.
- * sp-> es -> edx
- * ds -> ecx
- * edx -> eax
- * ecx -> trapno
- * eax -> code
+ * sp-> gs -> edx
+ * fs -> ecx
+ * es -> eax
+ * ds -> trapno
+ * edx -> code
+ * ecx
+ * eax
* eip
* cs
* efl
@@ -711,7 +719,9 @@ _return_to_iret_i: /* ( label for kdb_kintr) */
* ss
*/
ast_from_interrupt:
- pop %es /* restore all registers ... */
+ pop %gs /* restore all registers ... */
+ pop %fs
+ pop %es
pop %ds
popl %edx
popl %ecx
@@ -726,6 +736,8 @@ ast_from_interrupt:
mov %ss,%dx /* switch to kernel segments */
mov %dx,%ds
mov %dx,%es
+ mov %dx,%fs
+ mov %dx,%gs
CPU_NUMBER(%edx)
TIME_TRAP_UENTRY
@@ -763,7 +775,9 @@ ast_from_interrupt:
* pointer to save area on old stack
* [ saved %ebx, if accurate timing ]
*
- * old stack: saved %es
+ * old stack: saved %gs
+ * saved %fs
+ * saved %es
* saved %ds
* saved %edx
* saved %ecx
@@ -815,14 +829,10 @@ kdb_from_iret:
pushl %ebp
pushl %esi
pushl %edi
- push %fs
- push %gs
pushl %esp /* pass regs */
call EXT(kdb_kentry) /* to kdb */
addl $4,%esp /* pop parameters */
- pop %gs /* restore registers */
- pop %fs
- popl %edi
+ popl %edi /* restore registers */
popl %esi
popl %ebp
#if STAT_TIME
@@ -901,14 +911,10 @@ ttd_from_iret:
pushl %ebp
pushl %esi
pushl %edi
- push %fs
- push %gs
pushl %esp /* pass regs */
call _kttd_netentry /* to kdb */
addl $4,%esp /* pop parameters */
- pop %gs /* restore registers */
- pop %fs
- popl %edi
+ popl %edi /* restore registers */
popl %esi
popl %ebp
#if STAT_TIME
diff --git a/i386/i386/thread.h b/i386/i386/thread.h
index 0caf6d6..76aa1ef 100644
--- a/i386/i386/thread.h
+++ b/i386/i386/thread.h
@@ -139,6 +139,8 @@ struct v86_assist_state {
*/
struct i386_interrupt_state {
+ int gs;
+ int fs;
int es;
int ds;
int edx;
diff --git a/linux/src/include/asm-i386/irq.h b/linux/src/include/asm-i386/irq.h
index feb504a..c75744a 100644
--- a/linux/src/include/asm-i386/irq.h
+++ b/linux/src/include/asm-i386/irq.h
@@ -38,6 +38,7 @@ extern void enable_irq(unsigned int);
"movl $" STR(KERNEL_DS) ",%edx\n\t" \
"mov %dx,%ds\n\t" \
"mov %dx,%es\n\t" \
+ "mov %dx,%gs\n\t" \
"movl $" STR(USER_DS) ",%edx\n\t" \
"mov %dx,%fs\n\t" \
"movl $0,%edx\n\t" \