diff options
-rw-r--r-- | sys/amd64/amd64/db_trace.c | 6 | ||||
-rw-r--r-- | sys/amd64/amd64/exception.S | 29 | ||||
-rw-r--r-- | sys/amd64/amd64/exception.s | 29 | ||||
-rw-r--r-- | sys/amd64/amd64/machdep.c | 8 | ||||
-rw-r--r-- | sys/amd64/amd64/trap.c | 6 | ||||
-rw-r--r-- | sys/i386/i386/db_trace.c | 6 | ||||
-rw-r--r-- | sys/i386/i386/exception.s | 29 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 8 | ||||
-rw-r--r-- | sys/i386/i386/trap.c | 6 | ||||
-rw-r--r-- | sys/i386/include/asnames.h | 2 | ||||
-rw-r--r-- | sys/kern/subr_trap.c | 6 |
11 files changed, 46 insertions, 89 deletions
diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c index add84d9..682a644 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -168,10 +168,8 @@ db_nextframe(fp, ip) frame_type = TRAP; } else if (!strncmp(name, "Xresume", 7)) { frame_type = INTERRUPT; - } else if (!strcmp(name, "_Xsyscall") || - !strcmp(name, "Xsyscall") || - !strcmp(name, "_Xint0x80_syscall") || - !strcmp(name, "Xint0x80_syscall")) { + } else if (!strcmp(name, "Xlcall_syscall") || + !strcmp(name, "Xint0x80_syscall")) { frame_type = SYSCALL; } } diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S index 33ed923..cd2549f 100644 --- a/sys/amd64/amd64/exception.S +++ b/sys/amd64/amd64/exception.S @@ -234,25 +234,11 @@ calltrap: * does it will release the lock prior to returning. */ SUPERALIGN_TEXT -IDTVEC(syscall) - pushfl /* save eflags in tf_err for now */ - subl $4,%esp /* skip over tf_trapno */ - pushal - pushl %ds - pushl %es - pushl %fs - mov $KDSEL,%ax /* switch to kernel segments */ - mov %ax,%ds - mov %ax,%es - mov $KPSEL,%ax - mov %ax,%fs - movl TF_ERR(%esp),%eax /* copy saved eflags to final spot */ - movl %eax,TF_EFLAGS(%esp) - movl $7,TF_ERR(%esp) /* sizeof "lcall 7,0" */ - FAKE_MCOUNT(13*4(%esp)) - call _syscall - MEXITCOUNT - jmp _doreti +IDTVEC(lcall_syscall) + pushfl /* save eflags */ + popl 8(%esp) /* shuffle into tf_eflags */ + pushl $7 /* sizeof "lcall 7,0" */ + jmp syscall_with_err_pushed /* * Call gate entry for FreeBSD ELF and Linux/NetBSD syscall (int 0x80) @@ -266,7 +252,9 @@ IDTVEC(syscall) */ SUPERALIGN_TEXT IDTVEC(int0x80_syscall) - subl $8,%esp /* skip over tf_trapno and tf_err */ + pushl $2 /* sizeof "int 0x80" */ +syscall_with_err_pushed: + subl $4,%esp /* skip over tf_trapno */ pushal pushl %ds pushl %es @@ -276,7 +264,6 @@ IDTVEC(int0x80_syscall) mov %ax,%es mov $KPSEL,%ax mov %ax,%fs - movl $2,TF_ERR(%esp) /* sizeof "int 0x80" */ FAKE_MCOUNT(13*4(%esp)) call _syscall MEXITCOUNT diff --git a/sys/amd64/amd64/exception.s b/sys/amd64/amd64/exception.s index 33ed923..cd2549f 100644 --- a/sys/amd64/amd64/exception.s +++ b/sys/amd64/amd64/exception.s @@ -234,25 +234,11 @@ calltrap: * does it will release the lock prior to returning. */ SUPERALIGN_TEXT -IDTVEC(syscall) - pushfl /* save eflags in tf_err for now */ - subl $4,%esp /* skip over tf_trapno */ - pushal - pushl %ds - pushl %es - pushl %fs - mov $KDSEL,%ax /* switch to kernel segments */ - mov %ax,%ds - mov %ax,%es - mov $KPSEL,%ax - mov %ax,%fs - movl TF_ERR(%esp),%eax /* copy saved eflags to final spot */ - movl %eax,TF_EFLAGS(%esp) - movl $7,TF_ERR(%esp) /* sizeof "lcall 7,0" */ - FAKE_MCOUNT(13*4(%esp)) - call _syscall - MEXITCOUNT - jmp _doreti +IDTVEC(lcall_syscall) + pushfl /* save eflags */ + popl 8(%esp) /* shuffle into tf_eflags */ + pushl $7 /* sizeof "lcall 7,0" */ + jmp syscall_with_err_pushed /* * Call gate entry for FreeBSD ELF and Linux/NetBSD syscall (int 0x80) @@ -266,7 +252,9 @@ IDTVEC(syscall) */ SUPERALIGN_TEXT IDTVEC(int0x80_syscall) - subl $8,%esp /* skip over tf_trapno and tf_err */ + pushl $2 /* sizeof "int 0x80" */ +syscall_with_err_pushed: + subl $4,%esp /* skip over tf_trapno */ pushal pushl %ds pushl %es @@ -276,7 +264,6 @@ IDTVEC(int0x80_syscall) mov %ax,%es mov $KPSEL,%ax mov %ax,%fs - movl $2,TF_ERR(%esp) /* sizeof "int 0x80" */ FAKE_MCOUNT(13*4(%esp)) call _syscall MEXITCOUNT diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index f1a5bb0..0118473 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1417,7 +1417,7 @@ extern inthand_t IDTVEC(bnd), IDTVEC(ill), IDTVEC(dna), IDTVEC(fpusegm), IDTVEC(tss), IDTVEC(missing), IDTVEC(stk), IDTVEC(prot), IDTVEC(page), IDTVEC(mchk), IDTVEC(rsvd), IDTVEC(fpu), IDTVEC(align), - IDTVEC(syscall), IDTVEC(int0x80_syscall); + IDTVEC(lcall_syscall), IDTVEC(int0x80_syscall); void sdtossd(sd, ssd) @@ -2030,14 +2030,14 @@ init386(first) /* make a call gate to reenter kernel with */ gdp = &ldt[LSYS5CALLS_SEL].gd; - x = (int) &IDTVEC(syscall); - gdp->gd_looffset = x++; + x = (int) &IDTVEC(lcall_syscall); + gdp->gd_looffset = x; gdp->gd_selector = GSEL(GCODE_SEL,SEL_KPL); gdp->gd_stkcpy = 1; gdp->gd_type = SDT_SYS386CGT; gdp->gd_dpl = SEL_UPL; gdp->gd_p = 1; - gdp->gd_hioffset = ((int) &IDTVEC(syscall)) >>16; + gdp->gd_hioffset = x >> 16; /* XXX does this work? */ ldt[LBSDICALLS_SEL] = ldt[LSYS5CALLS_SEL]; diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index b418c04..bb03fa6 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -112,7 +112,7 @@ static int trap_pfault __P((struct trapframe *, int, vm_offset_t)); static void trap_fatal __P((struct trapframe *, vm_offset_t)); void dblfault_handler __P((void)); -extern inthand_t IDTVEC(syscall); +extern inthand_t IDTVEC(lcall_syscall); #define MAX_TRAP_MSG 28 static char *trap_msg[] = { @@ -565,7 +565,7 @@ restart: break; case T_TRCTRAP: /* trace trap */ - if (frame.tf_eip == (int)IDTVEC(syscall)) { + if (frame.tf_eip == (int)IDTVEC(lcall_syscall)) { /* * We've just entered system mode via the * syscall lcall. Continue single stepping @@ -574,7 +574,7 @@ restart: */ goto out; } - if (frame.tf_eip == (int)IDTVEC(syscall) + 1) { + if (frame.tf_eip == (int)IDTVEC(lcall_syscall) + 1) { /* * The syscall handler has now saved the * flags. Stop single stepping it. diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c index add84d9..682a644 100644 --- a/sys/i386/i386/db_trace.c +++ b/sys/i386/i386/db_trace.c @@ -168,10 +168,8 @@ db_nextframe(fp, ip) frame_type = TRAP; } else if (!strncmp(name, "Xresume", 7)) { frame_type = INTERRUPT; - } else if (!strcmp(name, "_Xsyscall") || - !strcmp(name, "Xsyscall") || - !strcmp(name, "_Xint0x80_syscall") || - !strcmp(name, "Xint0x80_syscall")) { + } else if (!strcmp(name, "Xlcall_syscall") || + !strcmp(name, "Xint0x80_syscall")) { frame_type = SYSCALL; } } diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s index 33ed923..cd2549f 100644 --- a/sys/i386/i386/exception.s +++ b/sys/i386/i386/exception.s @@ -234,25 +234,11 @@ calltrap: * does it will release the lock prior to returning. */ SUPERALIGN_TEXT -IDTVEC(syscall) - pushfl /* save eflags in tf_err for now */ - subl $4,%esp /* skip over tf_trapno */ - pushal - pushl %ds - pushl %es - pushl %fs - mov $KDSEL,%ax /* switch to kernel segments */ - mov %ax,%ds - mov %ax,%es - mov $KPSEL,%ax - mov %ax,%fs - movl TF_ERR(%esp),%eax /* copy saved eflags to final spot */ - movl %eax,TF_EFLAGS(%esp) - movl $7,TF_ERR(%esp) /* sizeof "lcall 7,0" */ - FAKE_MCOUNT(13*4(%esp)) - call _syscall - MEXITCOUNT - jmp _doreti +IDTVEC(lcall_syscall) + pushfl /* save eflags */ + popl 8(%esp) /* shuffle into tf_eflags */ + pushl $7 /* sizeof "lcall 7,0" */ + jmp syscall_with_err_pushed /* * Call gate entry for FreeBSD ELF and Linux/NetBSD syscall (int 0x80) @@ -266,7 +252,9 @@ IDTVEC(syscall) */ SUPERALIGN_TEXT IDTVEC(int0x80_syscall) - subl $8,%esp /* skip over tf_trapno and tf_err */ + pushl $2 /* sizeof "int 0x80" */ +syscall_with_err_pushed: + subl $4,%esp /* skip over tf_trapno */ pushal pushl %ds pushl %es @@ -276,7 +264,6 @@ IDTVEC(int0x80_syscall) mov %ax,%es mov $KPSEL,%ax mov %ax,%fs - movl $2,TF_ERR(%esp) /* sizeof "int 0x80" */ FAKE_MCOUNT(13*4(%esp)) call _syscall MEXITCOUNT diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index f1a5bb0..0118473 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -1417,7 +1417,7 @@ extern inthand_t IDTVEC(bnd), IDTVEC(ill), IDTVEC(dna), IDTVEC(fpusegm), IDTVEC(tss), IDTVEC(missing), IDTVEC(stk), IDTVEC(prot), IDTVEC(page), IDTVEC(mchk), IDTVEC(rsvd), IDTVEC(fpu), IDTVEC(align), - IDTVEC(syscall), IDTVEC(int0x80_syscall); + IDTVEC(lcall_syscall), IDTVEC(int0x80_syscall); void sdtossd(sd, ssd) @@ -2030,14 +2030,14 @@ init386(first) /* make a call gate to reenter kernel with */ gdp = &ldt[LSYS5CALLS_SEL].gd; - x = (int) &IDTVEC(syscall); - gdp->gd_looffset = x++; + x = (int) &IDTVEC(lcall_syscall); + gdp->gd_looffset = x; gdp->gd_selector = GSEL(GCODE_SEL,SEL_KPL); gdp->gd_stkcpy = 1; gdp->gd_type = SDT_SYS386CGT; gdp->gd_dpl = SEL_UPL; gdp->gd_p = 1; - gdp->gd_hioffset = ((int) &IDTVEC(syscall)) >>16; + gdp->gd_hioffset = x >> 16; /* XXX does this work? */ ldt[LBSDICALLS_SEL] = ldt[LSYS5CALLS_SEL]; diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index b418c04..bb03fa6 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -112,7 +112,7 @@ static int trap_pfault __P((struct trapframe *, int, vm_offset_t)); static void trap_fatal __P((struct trapframe *, vm_offset_t)); void dblfault_handler __P((void)); -extern inthand_t IDTVEC(syscall); +extern inthand_t IDTVEC(lcall_syscall); #define MAX_TRAP_MSG 28 static char *trap_msg[] = { @@ -565,7 +565,7 @@ restart: break; case T_TRCTRAP: /* trace trap */ - if (frame.tf_eip == (int)IDTVEC(syscall)) { + if (frame.tf_eip == (int)IDTVEC(lcall_syscall)) { /* * We've just entered system mode via the * syscall lcall. Continue single stepping @@ -574,7 +574,7 @@ restart: */ goto out; } - if (frame.tf_eip == (int)IDTVEC(syscall) + 1) { + if (frame.tf_eip == (int)IDTVEC(lcall_syscall) + 1) { /* * The syscall handler has now saved the * flags. Stop single stepping it. diff --git a/sys/i386/include/asnames.h b/sys/i386/include/asnames.h index d5ea905..cd75f50 100644 --- a/sys/i386/include/asnames.h +++ b/sys/i386/include/asnames.h @@ -153,7 +153,7 @@ #define _Xrsvd Xrsvd #define _Xspuriousint Xspuriousint #define _Xstk Xstk -#define _Xsyscall Xsyscall +#define _Xlcall_syscall Xlcall_syscall #define _Xtss Xtss #define __default_ldt _default_ldt #define __ucodesel _ucodesel diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index b418c04..bb03fa6 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -112,7 +112,7 @@ static int trap_pfault __P((struct trapframe *, int, vm_offset_t)); static void trap_fatal __P((struct trapframe *, vm_offset_t)); void dblfault_handler __P((void)); -extern inthand_t IDTVEC(syscall); +extern inthand_t IDTVEC(lcall_syscall); #define MAX_TRAP_MSG 28 static char *trap_msg[] = { @@ -565,7 +565,7 @@ restart: break; case T_TRCTRAP: /* trace trap */ - if (frame.tf_eip == (int)IDTVEC(syscall)) { + if (frame.tf_eip == (int)IDTVEC(lcall_syscall)) { /* * We've just entered system mode via the * syscall lcall. Continue single stepping @@ -574,7 +574,7 @@ restart: */ goto out; } - if (frame.tf_eip == (int)IDTVEC(syscall) + 1) { + if (frame.tf_eip == (int)IDTVEC(lcall_syscall) + 1) { /* * The syscall handler has now saved the * flags. Stop single stepping it. |