4 * Copyright (c) 2003-2008 Fabrice Bellard
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 /* Needed early for CONFIG_BSD etc. */
26 #include "config-host.h"
38 #include <sys/prctl.h>
42 #define SIG_IPI (SIGRTMIN+4)
44 #define SIG_IPI SIGUSR1
48 #define PR_MCE_KILL 33
51 static CPUState
*next_cpu
;
53 /***********************************************************/
54 void hw_error(const char *fmt
, ...)
60 fprintf(stderr
, "qemu: hardware error: ");
61 vfprintf(stderr
, fmt
, ap
);
62 fprintf(stderr
, "\n");
63 for(env
= first_cpu
; env
!= NULL
; env
= env
->next_cpu
) {
64 fprintf(stderr
, "CPU #%d:\n", env
->cpu_index
);
66 cpu_dump_state(env
, stderr
, fprintf
, X86_DUMP_FPU
);
68 cpu_dump_state(env
, stderr
, fprintf
, 0);
75 void cpu_synchronize_all_states(void)
79 for (cpu
= first_cpu
; cpu
; cpu
= cpu
->next_cpu
) {
80 cpu_synchronize_state(cpu
);
84 void cpu_synchronize_all_post_reset(void)
88 for (cpu
= first_cpu
; cpu
; cpu
= cpu
->next_cpu
) {
89 cpu_synchronize_post_reset(cpu
);
93 void cpu_synchronize_all_post_init(void)
97 for (cpu
= first_cpu
; cpu
; cpu
= cpu
->next_cpu
) {
98 cpu_synchronize_post_init(cpu
);
102 int cpu_is_stopped(CPUState
*env
)
104 return !vm_running
|| env
->stopped
;
107 static void do_vm_stop(int reason
)
113 vm_state_notify(0, reason
);
116 monitor_protocol_event(QEVENT_STOP
, NULL
);
120 static int cpu_can_run(CPUState
*env
)
124 if (env
->stopped
|| !vm_running
)
129 static int cpu_has_work(CPUState
*env
)
133 if (env
->queued_work_first
)
135 if (env
->stopped
|| !vm_running
)
139 if (qemu_cpu_has_work(env
))
144 static int any_cpu_has_work(void)
148 for (env
= first_cpu
; env
!= NULL
; env
= env
->next_cpu
)
149 if (cpu_has_work(env
))
154 static void cpu_debug_handler(CPUState
*env
)
156 gdb_set_stop_cpu(env
);
157 debug_requested
= EXCP_DEBUG
;
162 static int io_thread_fd
= -1;
164 static void qemu_event_increment(void)
166 /* Write 8 bytes to be compatible with eventfd. */
167 static const uint64_t val
= 1;
170 if (io_thread_fd
== -1)
174 ret
= write(io_thread_fd
, &val
, sizeof(val
));
175 } while (ret
< 0 && errno
== EINTR
);
177 /* EAGAIN is fine, a read must be pending. */
178 if (ret
< 0 && errno
!= EAGAIN
) {
179 fprintf(stderr
, "qemu_event_increment: write() filed: %s\n",
185 static void qemu_event_read(void *opaque
)
187 int fd
= (unsigned long)opaque
;
191 /* Drain the notify pipe. For eventfd, only 8 bytes will be read. */
193 len
= read(fd
, buffer
, sizeof(buffer
));
194 } while ((len
== -1 && errno
== EINTR
) || len
== sizeof(buffer
));
197 static int qemu_event_init(void)
202 err
= qemu_eventfd(fds
);
206 err
= fcntl_setfl(fds
[0], O_NONBLOCK
);
210 err
= fcntl_setfl(fds
[1], O_NONBLOCK
);
214 qemu_set_fd_handler2(fds
[0], NULL
, qemu_event_read
, NULL
,
215 (void *)(unsigned long)fds
[0]);
217 io_thread_fd
= fds
[1];
226 static void dummy_signal(int sig
)
230 /* If we have signalfd, we mask out the signals we want to handle and then
231 * use signalfd to listen for them. We rely on whatever the current signal
232 * handler is to dispatch the signals when we receive them.
234 static void sigfd_handler(void *opaque
)
236 int fd
= (unsigned long) opaque
;
237 struct qemu_signalfd_siginfo info
;
238 struct sigaction action
;
243 len
= read(fd
, &info
, sizeof(info
));
244 } while (len
== -1 && errno
== EINTR
);
246 if (len
== -1 && errno
== EAGAIN
) {
250 if (len
!= sizeof(info
)) {
251 printf("read from sigfd returned %zd: %m\n", len
);
255 sigaction(info
.ssi_signo
, NULL
, &action
);
256 if ((action
.sa_flags
& SA_SIGINFO
) && action
.sa_sigaction
) {
257 action
.sa_sigaction(info
.ssi_signo
,
258 (siginfo_t
*)&info
, NULL
);
259 } else if (action
.sa_handler
) {
260 action
.sa_handler(info
.ssi_signo
);
265 static int qemu_signalfd_init(sigset_t mask
)
269 sigfd
= qemu_signalfd(&mask
);
271 fprintf(stderr
, "failed to create signalfd\n");
275 fcntl_setfl(sigfd
, O_NONBLOCK
);
277 qemu_set_fd_handler2(sigfd
, NULL
, sigfd_handler
, NULL
,
278 (void *)(unsigned long) sigfd
);
283 static void sigbus_reraise(void);
285 static void qemu_kvm_eat_signals(CPUState
*env
)
287 struct timespec ts
= { 0, 0 };
293 sigemptyset(&waitset
);
294 sigaddset(&waitset
, SIG_IPI
);
295 sigaddset(&waitset
, SIGBUS
);
298 r
= sigtimedwait(&waitset
, &siginfo
, &ts
);
299 if (r
== -1 && !(errno
== EAGAIN
|| errno
== EINTR
)) {
300 perror("sigtimedwait");
305 #ifdef CONFIG_IOTHREAD
307 if (kvm_on_sigbus_vcpu(env
, siginfo
.si_code
, siginfo
.si_addr
)) {
316 r
= sigpending(&chkset
);
318 perror("sigpending");
321 } while (sigismember(&chkset
, SIG_IPI
) || sigismember(&chkset
, SIGBUS
));
326 HANDLE qemu_event_handle
;
328 static void dummy_event_handler(void *opaque
)
332 static int qemu_event_init(void)
334 qemu_event_handle
= CreateEvent(NULL
, FALSE
, FALSE
, NULL
);
335 if (!qemu_event_handle
) {
336 fprintf(stderr
, "Failed CreateEvent: %ld\n", GetLastError());
339 qemu_add_wait_object(qemu_event_handle
, dummy_event_handler
, NULL
);
343 static void qemu_event_increment(void)
345 if (!SetEvent(qemu_event_handle
)) {
346 fprintf(stderr
, "qemu_event_increment: SetEvent failed: %ld\n",
352 static void qemu_kvm_eat_signals(CPUState
*env
)
357 #ifndef CONFIG_IOTHREAD
358 static void qemu_kvm_init_cpu_signals(CPUState
*env
)
363 struct sigaction sigact
;
365 memset(&sigact
, 0, sizeof(sigact
));
366 sigact
.sa_handler
= dummy_signal
;
367 sigaction(SIG_IPI
, &sigact
, NULL
);
370 sigaddset(&set
, SIG_IPI
);
371 pthread_sigmask(SIG_BLOCK
, &set
, NULL
);
373 pthread_sigmask(SIG_BLOCK
, NULL
, &set
);
374 sigdelset(&set
, SIG_IPI
);
375 sigdelset(&set
, SIGBUS
);
376 r
= kvm_set_signal_mask(env
, &set
);
378 fprintf(stderr
, "kvm_set_signal_mask: %s\n", strerror(-r
));
384 int qemu_init_main_loop(void)
387 sigset_t blocked_signals
;
390 sigemptyset(&blocked_signals
);
392 ret
= qemu_signalfd_init(blocked_signals
);
397 cpu_set_debug_excp_handler(cpu_debug_handler
);
399 return qemu_event_init();
402 void qemu_main_loop_start(void)
406 void qemu_init_vcpu(void *_env
)
408 CPUState
*env
= _env
;
411 env
->nr_cores
= smp_cores
;
412 env
->nr_threads
= smp_threads
;
415 r
= kvm_init_vcpu(env
);
417 fprintf(stderr
, "kvm_init_vcpu failed: %s\n", strerror(-r
));
420 qemu_kvm_init_cpu_signals(env
);
424 int qemu_cpu_self(void *env
)
429 void run_on_cpu(CPUState
*env
, void (*func
)(void *data
), void *data
)
434 void resume_all_vcpus(void)
438 void pause_all_vcpus(void)
442 void qemu_cpu_kick(void *env
)
447 void qemu_notify_event(void)
449 CPUState
*env
= cpu_single_env
;
451 qemu_event_increment ();
455 if (next_cpu
&& env
!= next_cpu
) {
461 void qemu_mutex_lock_iothread(void) {}
462 void qemu_mutex_unlock_iothread(void) {}
464 void cpu_stop_current(void)
468 void vm_stop(int reason
)
473 #else /* CONFIG_IOTHREAD */
475 #include "qemu-thread.h"
477 QemuMutex qemu_global_mutex
;
478 static QemuMutex qemu_fair_mutex
;
480 static QemuThread io_thread
;
482 static QemuThread
*tcg_cpu_thread
;
483 static QemuCond
*tcg_halt_cond
;
485 static int qemu_system_ready
;
487 static QemuCond qemu_cpu_cond
;
489 static QemuCond qemu_system_cond
;
490 static QemuCond qemu_pause_cond
;
491 static QemuCond qemu_work_cond
;
493 static void cpu_signal(int sig
)
495 if (cpu_single_env
) {
496 cpu_exit(cpu_single_env
);
501 static void qemu_kvm_init_cpu_signals(CPUState
*env
)
505 struct sigaction sigact
;
507 memset(&sigact
, 0, sizeof(sigact
));
508 sigact
.sa_handler
= dummy_signal
;
509 sigaction(SIG_IPI
, &sigact
, NULL
);
511 pthread_sigmask(SIG_BLOCK
, NULL
, &set
);
512 sigdelset(&set
, SIG_IPI
);
513 sigdelset(&set
, SIGBUS
);
514 r
= kvm_set_signal_mask(env
, &set
);
516 fprintf(stderr
, "kvm_set_signal_mask: %s\n", strerror(-r
));
521 static void qemu_tcg_init_cpu_signals(void)
524 struct sigaction sigact
;
526 memset(&sigact
, 0, sizeof(sigact
));
527 sigact
.sa_handler
= cpu_signal
;
528 sigaction(SIG_IPI
, &sigact
, NULL
);
531 sigaddset(&set
, SIG_IPI
);
532 pthread_sigmask(SIG_UNBLOCK
, &set
, NULL
);
535 static void sigbus_handler(int n
, struct qemu_signalfd_siginfo
*siginfo
,
538 static sigset_t
block_io_signals(void)
541 struct sigaction action
;
543 /* SIGUSR2 used by posix-aio-compat.c */
545 sigaddset(&set
, SIGUSR2
);
546 pthread_sigmask(SIG_UNBLOCK
, &set
, NULL
);
549 sigaddset(&set
, SIGIO
);
550 sigaddset(&set
, SIGALRM
);
551 sigaddset(&set
, SIG_IPI
);
552 sigaddset(&set
, SIGBUS
);
553 pthread_sigmask(SIG_BLOCK
, &set
, NULL
);
555 memset(&action
, 0, sizeof(action
));
556 action
.sa_flags
= SA_SIGINFO
;
557 action
.sa_sigaction
= (void (*)(int, siginfo_t
*, void*))sigbus_handler
;
558 sigaction(SIGBUS
, &action
, NULL
);
559 prctl(PR_MCE_KILL
, 1, 1, 0, 0);
564 int qemu_init_main_loop(void)
567 sigset_t blocked_signals
;
569 cpu_set_debug_excp_handler(cpu_debug_handler
);
571 blocked_signals
= block_io_signals();
573 ret
= qemu_signalfd_init(blocked_signals
);
577 /* Note eventfd must be drained before signalfd handlers run */
578 ret
= qemu_event_init();
582 qemu_cond_init(&qemu_pause_cond
);
583 qemu_cond_init(&qemu_system_cond
);
584 qemu_mutex_init(&qemu_fair_mutex
);
585 qemu_mutex_init(&qemu_global_mutex
);
586 qemu_mutex_lock(&qemu_global_mutex
);
588 qemu_thread_self(&io_thread
);
593 void qemu_main_loop_start(void)
595 qemu_system_ready
= 1;
596 qemu_cond_broadcast(&qemu_system_cond
);
599 void run_on_cpu(CPUState
*env
, void (*func
)(void *data
), void *data
)
601 struct qemu_work_item wi
;
603 if (qemu_cpu_self(env
)) {
610 if (!env
->queued_work_first
)
611 env
->queued_work_first
= &wi
;
613 env
->queued_work_last
->next
= &wi
;
614 env
->queued_work_last
= &wi
;
620 CPUState
*self_env
= cpu_single_env
;
622 qemu_cond_wait(&qemu_work_cond
, &qemu_global_mutex
);
623 cpu_single_env
= self_env
;
627 static void flush_queued_work(CPUState
*env
)
629 struct qemu_work_item
*wi
;
631 if (!env
->queued_work_first
)
634 while ((wi
= env
->queued_work_first
)) {
635 env
->queued_work_first
= wi
->next
;
639 env
->queued_work_last
= NULL
;
640 qemu_cond_broadcast(&qemu_work_cond
);
643 static void qemu_wait_io_event_common(CPUState
*env
)
648 qemu_cond_signal(&qemu_pause_cond
);
650 flush_queued_work(env
);
651 env
->thread_kicked
= false;
654 static void qemu_tcg_wait_io_event(void)
658 while (!any_cpu_has_work())
659 qemu_cond_timedwait(tcg_halt_cond
, &qemu_global_mutex
, 1000);
661 qemu_mutex_unlock(&qemu_global_mutex
);
664 * Users of qemu_global_mutex can be starved, having no chance
665 * to acquire it since this path will get to it first.
666 * So use another lock to provide fairness.
668 qemu_mutex_lock(&qemu_fair_mutex
);
669 qemu_mutex_unlock(&qemu_fair_mutex
);
671 qemu_mutex_lock(&qemu_global_mutex
);
673 for (env
= first_cpu
; env
!= NULL
; env
= env
->next_cpu
) {
674 qemu_wait_io_event_common(env
);
678 static void sigbus_reraise(void)
681 struct sigaction action
;
683 memset(&action
, 0, sizeof(action
));
684 action
.sa_handler
= SIG_DFL
;
685 if (!sigaction(SIGBUS
, &action
, NULL
)) {
688 sigaddset(&set
, SIGBUS
);
689 sigprocmask(SIG_UNBLOCK
, &set
, NULL
);
691 perror("Failed to re-raise SIGBUS!\n");
695 static void sigbus_handler(int n
, struct qemu_signalfd_siginfo
*siginfo
,
698 if (kvm_on_sigbus(siginfo
->ssi_code
, (void *)(intptr_t)siginfo
->ssi_addr
)) {
703 static void qemu_kvm_wait_io_event(CPUState
*env
)
705 while (!cpu_has_work(env
))
706 qemu_cond_timedwait(env
->halt_cond
, &qemu_global_mutex
, 1000);
708 qemu_kvm_eat_signals(env
);
709 qemu_wait_io_event_common(env
);
712 static int qemu_cpu_exec(CPUState
*env
);
714 static void *kvm_cpu_thread_fn(void *arg
)
719 qemu_mutex_lock(&qemu_global_mutex
);
720 qemu_thread_self(env
->thread
);
722 r
= kvm_init_vcpu(env
);
724 fprintf(stderr
, "kvm_init_vcpu failed: %s\n", strerror(-r
));
728 qemu_kvm_init_cpu_signals(env
);
730 /* signal CPU creation */
732 qemu_cond_signal(&qemu_cpu_cond
);
734 /* and wait for machine initialization */
735 while (!qemu_system_ready
)
736 qemu_cond_timedwait(&qemu_system_cond
, &qemu_global_mutex
, 100);
739 if (cpu_can_run(env
))
741 qemu_kvm_wait_io_event(env
);
747 static void *tcg_cpu_thread_fn(void *arg
)
751 qemu_tcg_init_cpu_signals();
752 qemu_thread_self(env
->thread
);
754 /* signal CPU creation */
755 qemu_mutex_lock(&qemu_global_mutex
);
756 for (env
= first_cpu
; env
!= NULL
; env
= env
->next_cpu
)
758 qemu_cond_signal(&qemu_cpu_cond
);
760 /* and wait for machine initialization */
761 while (!qemu_system_ready
)
762 qemu_cond_timedwait(&qemu_system_cond
, &qemu_global_mutex
, 100);
766 qemu_tcg_wait_io_event();
772 void qemu_cpu_kick(void *_env
)
774 CPUState
*env
= _env
;
775 qemu_cond_broadcast(env
->halt_cond
);
776 if (!env
->thread_kicked
) {
777 qemu_thread_signal(env
->thread
, SIG_IPI
);
778 env
->thread_kicked
= true;
782 int qemu_cpu_self(void *_env
)
784 CPUState
*env
= _env
;
787 qemu_thread_self(&this);
789 return qemu_thread_equal(&this, env
->thread
);
792 void qemu_mutex_lock_iothread(void)
795 qemu_mutex_lock(&qemu_global_mutex
);
797 qemu_mutex_lock(&qemu_fair_mutex
);
798 if (qemu_mutex_trylock(&qemu_global_mutex
)) {
799 qemu_thread_signal(tcg_cpu_thread
, SIG_IPI
);
800 qemu_mutex_lock(&qemu_global_mutex
);
802 qemu_mutex_unlock(&qemu_fair_mutex
);
806 void qemu_mutex_unlock_iothread(void)
808 qemu_mutex_unlock(&qemu_global_mutex
);
811 static int all_vcpus_paused(void)
813 CPUState
*penv
= first_cpu
;
818 penv
= (CPUState
*)penv
->next_cpu
;
824 void pause_all_vcpus(void)
826 CPUState
*penv
= first_cpu
;
831 penv
= (CPUState
*)penv
->next_cpu
;
834 while (!all_vcpus_paused()) {
835 qemu_cond_timedwait(&qemu_pause_cond
, &qemu_global_mutex
, 100);
839 penv
= (CPUState
*)penv
->next_cpu
;
844 void resume_all_vcpus(void)
846 CPUState
*penv
= first_cpu
;
852 penv
= (CPUState
*)penv
->next_cpu
;
856 static void tcg_init_vcpu(void *_env
)
858 CPUState
*env
= _env
;
859 /* share a single thread for all cpus with TCG */
860 if (!tcg_cpu_thread
) {
861 env
->thread
= qemu_mallocz(sizeof(QemuThread
));
862 env
->halt_cond
= qemu_mallocz(sizeof(QemuCond
));
863 qemu_cond_init(env
->halt_cond
);
864 qemu_thread_create(env
->thread
, tcg_cpu_thread_fn
, env
);
865 while (env
->created
== 0)
866 qemu_cond_timedwait(&qemu_cpu_cond
, &qemu_global_mutex
, 100);
867 tcg_cpu_thread
= env
->thread
;
868 tcg_halt_cond
= env
->halt_cond
;
870 env
->thread
= tcg_cpu_thread
;
871 env
->halt_cond
= tcg_halt_cond
;
875 static void kvm_start_vcpu(CPUState
*env
)
877 env
->thread
= qemu_mallocz(sizeof(QemuThread
));
878 env
->halt_cond
= qemu_mallocz(sizeof(QemuCond
));
879 qemu_cond_init(env
->halt_cond
);
880 qemu_thread_create(env
->thread
, kvm_cpu_thread_fn
, env
);
881 while (env
->created
== 0)
882 qemu_cond_timedwait(&qemu_cpu_cond
, &qemu_global_mutex
, 100);
885 void qemu_init_vcpu(void *_env
)
887 CPUState
*env
= _env
;
889 env
->nr_cores
= smp_cores
;
890 env
->nr_threads
= smp_threads
;
897 void qemu_notify_event(void)
899 qemu_event_increment();
902 static void qemu_system_vmstop_request(int reason
)
904 vmstop_requested
= reason
;
908 void cpu_stop_current(void)
910 if (cpu_single_env
) {
911 cpu_single_env
->stopped
= 1;
912 cpu_exit(cpu_single_env
);
916 void vm_stop(int reason
)
919 qemu_thread_self(&me
);
921 if (!qemu_thread_equal(&me
, &io_thread
)) {
922 qemu_system_vmstop_request(reason
);
924 * FIXME: should not return to device code in case
925 * vm_stop() has been requested.
935 static int qemu_cpu_exec(CPUState
*env
)
938 #ifdef CONFIG_PROFILER
942 #ifdef CONFIG_PROFILER
943 ti
= profile_getclock();
948 qemu_icount
-= (env
->icount_decr
.u16
.low
+ env
->icount_extra
);
949 env
->icount_decr
.u16
.low
= 0;
950 env
->icount_extra
= 0;
951 count
= qemu_icount_round (qemu_next_deadline());
952 qemu_icount
+= count
;
953 decr
= (count
> 0xffff) ? 0xffff : count
;
955 env
->icount_decr
.u16
.low
= decr
;
956 env
->icount_extra
= count
;
959 #ifdef CONFIG_PROFILER
960 qemu_time
+= profile_getclock() - ti
;
963 /* Fold pending instructions back into the
964 instruction counter, and clear the interrupt flag. */
965 qemu_icount
-= (env
->icount_decr
.u16
.low
966 + env
->icount_extra
);
967 env
->icount_decr
.u32
= 0;
968 env
->icount_extra
= 0;
973 bool cpu_exec_all(void)
977 if (next_cpu
== NULL
)
978 next_cpu
= first_cpu
;
979 for (; next_cpu
!= NULL
&& !exit_request
; next_cpu
= next_cpu
->next_cpu
) {
980 CPUState
*env
= next_cpu
;
982 qemu_clock_enable(vm_clock
,
983 (env
->singlestep_enabled
& SSTEP_NOTIMER
) == 0);
985 if (qemu_alarm_pending())
987 if (cpu_can_run(env
)) {
988 r
= qemu_cpu_exec(env
);
990 qemu_kvm_eat_signals(env
);
992 if (r
== EXCP_DEBUG
) {
995 } else if (env
->stop
) {
1000 return any_cpu_has_work();
1003 void set_numa_modes(void)
1008 for (env
= first_cpu
; env
!= NULL
; env
= env
->next_cpu
) {
1009 for (i
= 0; i
< nb_numa_nodes
; i
++) {
1010 if (node_cpumask
[i
] & (1 << env
->cpu_index
)) {
1017 void set_cpu_log(const char *optarg
)
1020 const CPULogItem
*item
;
1022 mask
= cpu_str_to_log_mask(optarg
);
1024 printf("Log items (comma separated):\n");
1025 for (item
= cpu_log_items
; item
->mask
!= 0; item
++) {
1026 printf("%-10s %s\n", item
->name
, item
->help
);
1033 /* Return the virtual CPU time, based on the instruction counter. */
1034 int64_t cpu_get_icount(void)
1037 CPUState
*env
= cpu_single_env
;;
1039 icount
= qemu_icount
;
1041 if (!can_do_io(env
)) {
1042 fprintf(stderr
, "Bad clock read\n");
1044 icount
-= (env
->icount_decr
.u16
.low
+ env
->icount_extra
);
1046 return qemu_icount_bias
+ (icount
<< icount_time_shift
);
1049 void list_cpus(FILE *f
, fprintf_function cpu_fprintf
, const char *optarg
)
1051 /* XXX: implement xxx_cpu_list for targets that still miss it */
1052 #if defined(cpu_list_id)
1053 cpu_list_id(f
, cpu_fprintf
, optarg
);
1054 #elif defined(cpu_list)
1055 cpu_list(f
, cpu_fprintf
); /* deprecated */