main.c (cff4cbedc3ae945442034970c828f4a631fedcab) main.c (7a3148a955e3350720a01f57163ab230b72aca7e)
1/*
2 * qemu user main
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 1520 unchanged lines hidden (view full) ---

1529 cpu_dump_state(env, stderr, fprintf, 0);
1530 abort();
1531 }
1532 process_pending_signals(env);
1533 }
1534}
1535#endif /* TARGET_M68K */
1536
1/*
2 * qemu user main
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 1520 unchanged lines hidden (view full) ---

1529 cpu_dump_state(env, stderr, fprintf, 0);
1530 abort();
1531 }
1532 process_pending_signals(env);
1533 }
1534}
1535#endif /* TARGET_M68K */
1536
1537#ifdef TARGET_ALPHA
1538void cpu_loop (CPUState *env)
1539{
1540 int trapnr, ret;
1541 target_siginfo_t info;
1542
1543 while (1) {
1544 trapnr = cpu_alpha_exec (env);
1545
1546 switch (trapnr) {
1547 case EXCP_RESET:
1548 fprintf(stderr, "Reset requested. Exit\n");
1549 exit(1);
1550 break;
1551 case EXCP_MCHK:
1552 fprintf(stderr, "Machine check exception. Exit\n");
1553 exit(1);
1554 break;
1555 case EXCP_ARITH:
1556 fprintf(stderr, "Arithmetic trap.\n");
1557 exit(1);
1558 break;
1559 case EXCP_HW_INTERRUPT:
1560 fprintf(stderr, "External interrupt. Exit\n");
1561 exit(1);
1562 break;
1563 case EXCP_DFAULT:
1564 fprintf(stderr, "MMU data fault\n");
1565 exit(1);
1566 break;
1567 case EXCP_DTB_MISS_PAL:
1568 fprintf(stderr, "MMU data TLB miss in PALcode\n");
1569 exit(1);
1570 break;
1571 case EXCP_ITB_MISS:
1572 fprintf(stderr, "MMU instruction TLB miss\n");
1573 exit(1);
1574 break;
1575 case EXCP_ITB_ACV:
1576 fprintf(stderr, "MMU instruction access violation\n");
1577 exit(1);
1578 break;
1579 case EXCP_DTB_MISS_NATIVE:
1580 fprintf(stderr, "MMU data TLB miss\n");
1581 exit(1);
1582 break;
1583 case EXCP_UNALIGN:
1584 fprintf(stderr, "Unaligned access\n");
1585 exit(1);
1586 break;
1587 case EXCP_OPCDEC:
1588 fprintf(stderr, "Invalid instruction\n");
1589 exit(1);
1590 break;
1591 case EXCP_FEN:
1592 fprintf(stderr, "Floating-point not allowed\n");
1593 exit(1);
1594 break;
1595 case EXCP_CALL_PAL ... (EXCP_CALL_PALP - 1):
1596 fprintf(stderr, "Call to PALcode\n");
1597 call_pal(env, (trapnr >> 6) | 0x80);
1598 break;
1599 case EXCP_CALL_PALP ... (EXCP_CALL_PALE - 1):
1600 fprintf(stderr, "Priviledged call to PALcode\n");
1601 exit(1);
1602 break;
1603 case EXCP_DEBUG:
1604 {
1605 int sig;
1606
1607 sig = gdb_handlesig (env, TARGET_SIGTRAP);
1608 if (sig)
1609 {
1610 info.si_signo = sig;
1611 info.si_errno = 0;
1612 info.si_code = TARGET_TRAP_BRKPT;
1613 queue_signal(info.si_signo, &info);
1614 }
1615 }
1616 break;
1617 default:
1618 printf ("Unhandled trap: 0x%x\n", trapnr);
1619 cpu_dump_state(env, stderr, fprintf, 0);
1620 exit (1);
1621 }
1622 process_pending_signals (env);
1623 }
1624}
1625#endif /* TARGET_ALPHA */
1626
1537void usage(void)
1538{
1539 printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003-2007 Fabrice Bellard\n"
1540 "usage: qemu-" TARGET_ARCH " [-h] [-g] [-d opts] [-L path] [-s size] [-cpu model] program [arguments...]\n"
1541 "Linux CPU emulator (compiled for %s emulation)\n"
1542 "\n"
1543 "-h print this help\n"
1544 "-g port wait gdb connection to port\n"

--- 327 unchanged lines hidden (view full) ---

1872 {
1873 int i;
1874
1875 for(i = 0; i < 16; i++) {
1876 env->gregs[i] = regs->regs[i];
1877 }
1878 env->pc = regs->pc;
1879 }
1627void usage(void)
1628{
1629 printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003-2007 Fabrice Bellard\n"
1630 "usage: qemu-" TARGET_ARCH " [-h] [-g] [-d opts] [-L path] [-s size] [-cpu model] program [arguments...]\n"
1631 "Linux CPU emulator (compiled for %s emulation)\n"
1632 "\n"
1633 "-h print this help\n"
1634 "-g port wait gdb connection to port\n"

--- 327 unchanged lines hidden (view full) ---

1962 {
1963 int i;
1964
1965 for(i = 0; i < 16; i++) {
1966 env->gregs[i] = regs->regs[i];
1967 }
1968 env->pc = regs->pc;
1969 }
1970#elif defined(TARGET_ALPHA)
1971 {
1972 int i;
1973
1974 for(i = 0; i < 28; i++) {
1975 env->ir[i] = ((target_ulong *)regs)[i];
1976 }
1977 env->ipr[IPR_USP] = regs->usp;
1978 env->ir[30] = regs->usp;
1979 env->pc = regs->pc;
1980 env->unique = regs->unique;
1981 }
1880#else
1881#error unsupported target CPU
1882#endif
1883
1884 if (gdbstub_port) {
1885 gdbserver_start (gdbstub_port);
1886 gdb_handlesig(env, 0);
1887 }
1888 cpu_loop(env);
1889 /* never exits */
1890 return 0;
1891}
1982#else
1983#error unsupported target CPU
1984#endif
1985
1986 if (gdbstub_port) {
1987 gdbserver_start (gdbstub_port);
1988 gdb_handlesig(env, 0);
1989 }
1990 cpu_loop(env);
1991 /* never exits */
1992 return 0;
1993}