提交 2a29ca73 编写于 作者: B bellard

more exception tests


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@159 c046a42c-6fe2-441c-8c8c-71466251a162
上级 54936004
...@@ -67,7 +67,7 @@ int tab[2]; ...@@ -67,7 +67,7 @@ int tab[2];
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
struct sigaction act; struct sigaction act;
int val; volatile int val;
act.sa_sigaction = sig_handler; act.sa_sigaction = sig_handler;
sigemptyset(&act.sa_mask); sigemptyset(&act.sa_mask);
...@@ -75,6 +75,7 @@ int main(int argc, char **argv) ...@@ -75,6 +75,7 @@ int main(int argc, char **argv)
sigaction(SIGFPE, &act, NULL); sigaction(SIGFPE, &act, NULL);
sigaction(SIGILL, &act, NULL); sigaction(SIGILL, &act, NULL);
sigaction(SIGSEGV, &act, NULL); sigaction(SIGSEGV, &act, NULL);
sigaction(SIGTRAP, &act, NULL);
/* test division by zero reporting */ /* test division by zero reporting */
if (setjmp(jmp_env) == 0) { if (setjmp(jmp_env) == 0) {
...@@ -112,6 +113,11 @@ int main(int argc, char **argv) ...@@ -112,6 +113,11 @@ int main(int argc, char **argv)
asm volatile ("int $0xfd"); asm volatile ("int $0xfd");
} }
printf("INT3 exception:\n");
if (setjmp(jmp_env) == 0) {
asm volatile ("int3");
}
printf("CLI exception:\n"); printf("CLI exception:\n");
if (setjmp(jmp_env) == 0) { if (setjmp(jmp_env) == 0) {
asm volatile ("cli"); asm volatile ("cli");
...@@ -158,10 +164,20 @@ int main(int argc, char **argv) ...@@ -158,10 +164,20 @@ int main(int argc, char **argv)
printf("HLT exception:\n"); printf("HLT exception:\n");
if (setjmp(jmp_env) == 0) { if (setjmp(jmp_env) == 0) {
asm volatile ("hlt" : : "d" (0x4321), "D" (tab), "c" (1)); asm volatile ("hlt");
} }
#if 0 printf("single step exception:\n");
val = 0;
if (setjmp(jmp_env) == 0) {
asm volatile ("pushf\n"
"orl $0x00100, (%%esp)\n"
"popf\n"
"movl $0xabcd, %0\n" : "=m" (val) : : "cc", "memory");
}
printf("val=0x%x\n", val);
#if 1
{ {
int i; int i;
act.sa_handler = alarm_handler; act.sa_handler = alarm_handler;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册