Revision e1833e1f

b/darwin-user/main.c
139 139
    cpu_ppc_store_tb(env, ((uint64_t)cpu_ppc_load_tbl(env) << 32) | value);
140 140
}
141 141

  
142
uint32_t cpu_ppc_load_decr (CPUState *env)
143
{
144
    /* TO FIX */
145
    return -1;
146
}
147

  
148
void cpu_ppc_store_decr (CPUState *env, uint32_t value)
149
{
150
    /* TO FIX */
151
}
152

  
153 142
void cpu_ppc601_store_rtcu (CPUState *env, uint32_t value)
154 143
{
155 144
    cpu_ppc_store_tbu( env, value );
......
165 154
    return cpu_ppc_load_tbl(env) & 0x3FFFFF80;
166 155
}
167 156

  
157
/* XXX: to be fixed */
158
int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, target_ulong *valp)
159
{
160
    return -1;
161
}
162

  
163
int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val)
164
{
165
    return -1;
166
}
167

  
168
#define EXCP_DUMP(env, fmt, args...)                                         \
169
do {                                                                          \
170
    fprintf(stderr, fmt , ##args);                                            \
171
    cpu_dump_state(env, stderr, fprintf, 0);                                  \
172
    if (loglevel != 0) {                                                      \
173
        fprintf(logfile, fmt , ##args);                                       \
174
        cpu_dump_state(env, logfile, fprintf, 0);                             \
175
    }                                                                         \
176
} while (0)
177

  
168 178
void cpu_loop(CPUPPCState *env)
169 179
{
170 180
    int trapnr;
......
173 183

  
174 184
    for(;;) {
175 185
        trapnr = cpu_ppc_exec(env);
176
        if (trapnr != EXCP_SYSCALL_USER && trapnr != EXCP_BRANCH &&
177
            trapnr != EXCP_TRACE) {
178
            if (loglevel > 0) {
179
                cpu_dump_state(env, logfile, fprintf, 0);
180
            }
181
        }
182 186
        switch(trapnr) {
183
        case EXCP_NONE:
187
        case POWERPC_EXCP_NONE:
188
            /* Just go on */
184 189
            break;
185
        case EXCP_SYSCALL_USER:
186
            /* system call */
187
            if(((int)env->gpr[0]) <= SYS_MAXSYSCALL && ((int)env->gpr[0])>0)
188
                ret = do_unix_syscall(env, env->gpr[0]/*, env->gpr[3], env->gpr[4],
189
                                      env->gpr[5], env->gpr[6], env->gpr[7],
190
                                      env->gpr[8], env->gpr[9], env->gpr[10]*/);
191
            else if(((int)env->gpr[0])<0)
192
                ret = do_mach_syscall(env, env->gpr[0], env->gpr[3], env->gpr[4],
193
                                      env->gpr[5], env->gpr[6], env->gpr[7],
194
                                      env->gpr[8], env->gpr[9], env->gpr[10]);
195
            else
196
                ret = do_thread_syscall(env, env->gpr[0], env->gpr[3], env->gpr[4],
197
                                        env->gpr[5], env->gpr[6], env->gpr[7],
198
                                        env->gpr[8], env->gpr[9], env->gpr[10]);
199

  
200
            /* Unix syscall error signaling */
201
            if(((int)env->gpr[0]) <= SYS_MAXSYSCALL && ((int)env->gpr[0])>0)
202
            {
203
                if( (int)ret < 0 )
204
                    env->nip += 0;
205
                else
206
                    env->nip += 4;
207
            }
208

  
209
            /* Return value */
210
            env->gpr[3] = ret;
190
        case POWERPC_EXCP_CRITICAL: /* Critical input                        */
191
            cpu_abort(env, "Critical interrupt while in user mode. "
192
                      "Aborting\n");
211 193
            break;
212
        case EXCP_RESET:
213
            /* Should not happen ! */
214
            fprintf(stderr, "RESET asked... Stop emulation\n");
215
            if (loglevel)
216
                fprintf(logfile, "RESET asked... Stop emulation\n");
217
                abort();
218
        case EXCP_MACHINE_CHECK:
219
            fprintf(stderr, "Machine check exeption...  Stop emulation\n");
220
            if (loglevel)
221
                fprintf(logfile, "RESET asked... Stop emulation\n");
222
                info.si_signo = SIGBUS;
223
            info.si_errno = 0;
224
            info.si_code = BUS_OBJERR;
225
            info.si_addr = (void*)(env->nip - 4);
226
            queue_signal(info.si_signo, &info);
227
        case EXCP_DSI:
194
        case POWERPC_EXCP_MCHECK:   /* Machine check exception               */
195
            cpu_abort(env, "Machine check exception while in user mode. "
196
                      "Aborting\n");
197
            break;
198
        case POWERPC_EXCP_DSI:      /* Data storage exception                */
228 199
#ifndef DAR
229 200
/* To deal with multiple qemu header version as host for the darwin-user code */
230 201
# define DAR SPR_DAR
231 202
#endif
232
            fprintf(stderr, "Invalid data memory access: 0x%08x\n", env->spr[DAR]);
233
            if (loglevel) {
234
                fprintf(logfile, "Invalid data memory access: 0x%08x\n",
235
                        env->spr[DAR]);
236
            }
203
            EXCP_DUMP(env, "Invalid data memory access: 0x" ADDRX "\n",
204
                      env->spr[SPR_DAR]);
237 205
            /* Handle this via the gdb */
238 206
            gdb_handlesig (env, SIGSEGV);
239 207

  
240 208
            info.si_addr = (void*)env->nip;
241 209
            queue_signal(info.si_signo, &info);
242 210
            break;
243
        case EXCP_ISI:
244
            fprintf(stderr, "Invalid instruction fetch\n");
245
            if (loglevel)
246
                fprintf(logfile, "Invalid instruction fetch\n");
211
        case POWERPC_EXCP_ISI:      /* Instruction storage exception         */
212
            EXCP_DUMP(env, "Invalid instruction fetch: 0x\n" ADDRX "\n",
213
                      env->spr[SPR_DAR]);
247 214
            /* Handle this via the gdb */
248 215
            gdb_handlesig (env, SIGSEGV);
249 216

  
250 217
            info.si_addr = (void*)(env->nip - 4);
251 218
            queue_signal(info.si_signo, &info);
252 219
            break;
253
        case EXCP_EXTERNAL:
254
            /* Should not happen ! */
255
            fprintf(stderr, "External interruption... Stop emulation\n");
256
            if (loglevel)
257
                fprintf(logfile, "External interruption... Stop emulation\n");
258
                abort();
259
        case EXCP_ALIGN:
260
            fprintf(stderr, "Invalid unaligned memory access\n");
261
            if (loglevel)
262
                fprintf(logfile, "Invalid unaligned memory access\n");
263
                info.si_signo = SIGBUS;
220
        case POWERPC_EXCP_EXTERNAL: /* External input                        */
221
            cpu_abort(env, "External interrupt while in user mode. "
222
                      "Aborting\n");
223
            break;
224
        case POWERPC_EXCP_ALIGN:    /* Alignment exception                   */
225
            EXCP_DUMP(env, "Unaligned memory access\n");
264 226
            info.si_errno = 0;
265 227
            info.si_code = BUS_ADRALN;
266 228
            info.si_addr = (void*)(env->nip - 4);
267 229
            queue_signal(info.si_signo, &info);
268 230
            break;
269
        case EXCP_PROGRAM:
231
        case POWERPC_EXCP_PROGRAM:  /* Program exception                     */
232
            /* XXX: check this */
270 233
            switch (env->error_code & ~0xF) {
271
                case EXCP_FP:
272
                    fprintf(stderr, "Program exception\n");
273
                    if (loglevel)
274
                        fprintf(logfile, "Program exception\n");
275
                        /* Set FX */
276
                        env->fpscr[7] |= 0x8;
277
                    /* Finally, update FEX */
278
                    if ((((env->fpscr[7] & 0x3) << 3) | (env->fpscr[6] >> 1)) &
279
                        ((env->fpscr[1] << 1) | (env->fpscr[0] >> 3)))
280
                        env->fpscr[7] |= 0x4;
281
                        info.si_signo = SIGFPE;
282
                    info.si_errno = 0;
283
                    switch (env->error_code & 0xF) {
284
                        case EXCP_FP_OX:
285
                            info.si_code = FPE_FLTOVF;
286
                            break;
287
                        case EXCP_FP_UX:
288
                            info.si_code = FPE_FLTUND;
289
                            break;
290
                        case EXCP_FP_ZX:
291
                        case EXCP_FP_VXZDZ:
292
                            info.si_code = FPE_FLTDIV;
293
                            break;
294
                        case EXCP_FP_XX:
295
                            info.si_code = FPE_FLTRES;
296
                            break;
297
                        case EXCP_FP_VXSOFT:
298
                            info.si_code = FPE_FLTINV;
299
                            break;
300
                        case EXCP_FP_VXNAN:
301
                        case EXCP_FP_VXISI:
302
                        case EXCP_FP_VXIDI:
303
                        case EXCP_FP_VXIMZ:
304
                        case EXCP_FP_VXVC:
305
                        case EXCP_FP_VXSQRT:
306
                        case EXCP_FP_VXCVI:
307
                            info.si_code = FPE_FLTSUB;
308
                            break;
309
                        default:
310
                            fprintf(stderr, "Unknown floating point exception "
311
                                    "(%02x)\n", env->error_code);
312
                            if (loglevel) {
313
                                fprintf(logfile, "Unknown floating point exception "
314
                                        "(%02x)\n", env->error_code & 0xF);
315
                            }
316
                    }
317
                        break;
318
                case EXCP_INVAL:
319
                    fprintf(stderr, "Invalid instruction\n");
320
                    if (loglevel)
321
                        fprintf(logfile, "Invalid instruction\n");
322
                        info.si_signo = SIGILL;
323
                    info.si_errno = 0;
324
                    switch (env->error_code & 0xF) {
325
                        case EXCP_INVAL_INVAL:
326
                            info.si_code = ILL_ILLOPC;
327
                            break;
328
                        case EXCP_INVAL_LSWX:
329
                            info.si_code = ILL_ILLOPN;
330
                            break;
331
                        case EXCP_INVAL_SPR:
332
                            info.si_code = ILL_PRVREG;
333
                            break;
334
                        case EXCP_INVAL_FP:
335
                            info.si_code = ILL_COPROC;
336
                            break;
337
                        default:
338
                            fprintf(stderr, "Unknown invalid operation (%02x)\n",
339
                                    env->error_code & 0xF);
340
                            if (loglevel) {
341
                                fprintf(logfile, "Unknown invalid operation (%02x)\n",
342
                                        env->error_code & 0xF);
343
                            }
344
                                info.si_code = ILL_ILLADR;
345
                            break;
346
                    }
347
                        /* Handle this via the gdb */
348
                        gdb_handlesig (env, SIGSEGV);
234
            case POWERPC_EXCP_FP:
235
                EXCP_DUMP(env, "Floating point program exception\n");
236
                /* Set FX */
237
                env->fpscr[7] |= 0x8;
238
                /* Finally, update FEX */
239
                if ((((env->fpscr[7] & 0x3) << 3) | (env->fpscr[6] >> 1)) &
240
                    ((env->fpscr[1] << 1) | (env->fpscr[0] >> 3)))
241
                    env->fpscr[7] |= 0x4;
242
                info.si_signo = SIGFPE;
243
                info.si_errno = 0;
244
                switch (env->error_code & 0xF) {
245
                case POWERPC_EXCP_FP_OX:
246
                    info.si_code = FPE_FLTOVF;
247
                    break;
248
                case POWERPC_EXCP_FP_UX:
249
                    info.si_code = FPE_FLTUND;
250
                    break;
251
                case POWERPC_EXCP_FP_ZX:
252
                case POWERPC_EXCP_FP_VXZDZ:
253
                    info.si_code = FPE_FLTDIV;
254
                    break;
255
                case POWERPC_EXCP_FP_XX:
256
                    info.si_code = FPE_FLTRES;
257
                    break;
258
                case POWERPC_EXCP_FP_VXSOFT:
259
                    info.si_code = FPE_FLTINV;
260
                    break;
261
                case POWERPC_EXCP_FP_VXNAN:
262
                case POWERPC_EXCP_FP_VXISI:
263
                case POWERPC_EXCP_FP_VXIDI:
264
                case POWERPC_EXCP_FP_VXIMZ:
265
                case POWERPC_EXCP_FP_VXVC:
266
                case POWERPC_EXCP_FP_VXSQRT:
267
                case POWERPC_EXCP_FP_VXCVI:
268
                    info.si_code = FPE_FLTSUB;
269
                    break;
270
                default:
271
                    EXCP_DUMP(env, "Unknown floating point exception (%02x)\n",
272
                              env->error_code);
273
                    break;
274
                }
275
                break;
276
            case POWERPC_EXCP_INVAL:
277
                EXCP_DUMP(env, "Invalid instruction\n");
278
                info.si_signo = SIGILL;
279
                info.si_errno = 0;
280
                switch (env->error_code & 0xF) {
281
                case POWERPC_EXCP_INVAL_INVAL:
282
                    info.si_code = ILL_ILLOPC;
283
                    break;
284
                case POWERPC_EXCP_INVAL_LSWX:
285
                    info.si_code = ILL_ILLOPN;
286
                    break;
287
                case POWERPC_EXCP_INVAL_SPR:
288
                    info.si_code = ILL_PRVREG;
289
                    break;
290
                case POWERPC_EXCP_INVAL_FP:
291
                    info.si_code = ILL_COPROC;
292
                    break;
293
                default:
294
                    EXCP_DUMP(env, "Unknown invalid operation (%02x)\n",
295
                              env->error_code & 0xF);
296
                    info.si_code = ILL_ILLADR;
297
                    break;
298
                }
299
                /* Handle this via the gdb */
300
                gdb_handlesig (env, SIGSEGV);
301
                break;
302
            case POWERPC_EXCP_PRIV:
303
                EXCP_DUMP(env, "Privilege violation\n");
304
                info.si_signo = SIGILL;
305
                info.si_errno = 0;
306
                switch (env->error_code & 0xF) {
307
                case POWERPC_EXCP_PRIV_OPC:
308
                    info.si_code = ILL_PRVOPC;
309
                    break;
310
                case POWERPC_EXCP_PRIV_REG:
311
                    info.si_code = ILL_PRVREG;
349 312
                    break;
350
                case EXCP_PRIV:
351
                    fprintf(stderr, "Privilege violation\n");
352
                    if (loglevel)
353
                        fprintf(logfile, "Privilege violation\n");
354
                        info.si_signo = SIGILL;
355
                    info.si_errno = 0;
356
                    switch (env->error_code & 0xF) {
357
                        case EXCP_PRIV_OPC:
358
                            info.si_code = ILL_PRVOPC;
359
                            break;
360
                        case EXCP_PRIV_REG:
361
                            info.si_code = ILL_PRVREG;
362
                            break;
363
                        default:
364
                            fprintf(stderr, "Unknown privilege violation (%02x)\n",
365
                                    env->error_code & 0xF);
366
                            info.si_code = ILL_PRVOPC;
367
                            break;
368
                    }
369
                        break;
370
                case EXCP_TRAP:
371
                    fprintf(stderr, "Tried to call a TRAP\n");
372
                    if (loglevel)
373
                        fprintf(logfile, "Tried to call a TRAP\n");
374
                        abort();
375 313
                default:
376
                    /* Should not happen ! */
377
                    fprintf(stderr, "Unknown program exception (%02x)\n",
378
                            env->error_code);
379
                    if (loglevel) {
380
                        fprintf(logfile, "Unknwon program exception (%02x)\n",
381
                                env->error_code);
382
                    }
383
                        abort();
314
                    EXCP_DUMP(env, "Unknown privilege violation (%02x)\n",
315
                              env->error_code & 0xF);
316
                    info.si_code = ILL_PRVOPC;
317
                    break;
318
                }
319
                break;
320
            case POWERPC_EXCP_TRAP:
321
                cpu_abort(env, "Tried to call a TRAP\n");
322
                break;
323
            default:
324
                /* Should not happen ! */
325
                cpu_abort(env, "Unknown program exception (%02x)\n",
326
                          env->error_code);
327
                break;
384 328
            }
385 329
            info.si_addr = (void*)(env->nip - 4);
386 330
            queue_signal(info.si_signo, &info);
387 331
            break;
388
        case EXCP_NO_FP:
389
            fprintf(stderr, "No floating point allowed\n");
390
            if (loglevel)
391
                fprintf(logfile, "No floating point allowed\n");
392
                info.si_signo = SIGILL;
332
        case POWERPC_EXCP_FPU:      /* Floating-point unavailable exception  */
333
            EXCP_DUMP(env, "No floating point allowed\n");
334
            info.si_signo = SIGILL;
393 335
            info.si_errno = 0;
394 336
            info.si_code = ILL_COPROC;
395 337
            info.si_addr = (void*)(env->nip - 4);
396 338
            queue_signal(info.si_signo, &info);
397 339
            break;
398
        case EXCP_DECR:
399
            /* Should not happen ! */
400
            fprintf(stderr, "Decrementer exception\n");
401
            if (loglevel)
402
                fprintf(logfile, "Decrementer exception\n");
403
            abort();
404
        case EXCP_TRACE:
405
            /* Pass to gdb: we use this to trace execution */
406
            gdb_handlesig (env, SIGTRAP);
340
        case POWERPC_EXCP_SYSCALL:  /* System call exception                 */
341
            cpu_abort(env, "Syscall exception while in user mode. "
342
                      "Aborting\n");
407 343
            break;
408
        case EXCP_FP_ASSIST:
409
            /* Should not happen ! */
410
            fprintf(stderr, "Floating point assist exception\n");
411
            if (loglevel)
412
                fprintf(logfile, "Floating point assist exception\n");
413
            abort();
414
        case EXCP_MTMSR:
415
            /* We reloaded the msr, just go on */
416
            if (msr_pr == 0) {
417
                fprintf(stderr, "Tried to go into supervisor mode !\n");
418
                if (loglevel)
419
                    fprintf(logfile, "Tried to go into supervisor mode !\n");
420
                abort();
421
            }
344
        case POWERPC_EXCP_APU:      /* Auxiliary processor unavailable       */
345
            EXCP_DUMP(env, "No APU instruction allowed\n");
346
            info.si_signo = SIGILL;
347
            info.si_errno = 0;
348
            info.si_code = ILL_COPROC;
349
            info.si_addr = (void*)(env->nip - 4);
350
            queue_signal(info.si_signo, &info);
422 351
            break;
423
        case EXCP_BRANCH:
424
            /* We stopped because of a jump... */
352
        case POWERPC_EXCP_DECR:     /* Decrementer exception                 */
353
            cpu_abort(env, "Decrementer interrupt while in user mode. "
354
                      "Aborting\n");
425 355
            break;
426
        case EXCP_INTERRUPT:
427
            /* Don't know why this should ever happen... */
428
            fprintf(stderr, "EXCP_INTERRUPT\n");
356
        case POWERPC_EXCP_FIT:      /* Fixed-interval timer interrupt        */
357
            cpu_abort(env, "Fix interval timer interrupt while in user mode. "
358
                      "Aborting\n");
429 359
            break;
430
        case EXCP_DEBUG:
360
        case POWERPC_EXCP_WDT:      /* Watchdog timer interrupt              */
361
            cpu_abort(env, "Watchdog timer interrupt while in user mode. "
362
                      "Aborting\n");
363
            break;
364
        case POWERPC_EXCP_DTLB:     /* Data TLB error                        */
365
            cpu_abort(env, "Data TLB exception while in user mode. "
366
                      "Aborting\n");
367
            break;
368
        case POWERPC_EXCP_ITLB:     /* Instruction TLB error                 */
369
            cpu_abort(env, "Instruction TLB exception while in user mode. "
370
                      "Aborting\n");
371
            break;
372
        case POWERPC_EXCP_DEBUG:    /* Debug interrupt                       */
431 373
            gdb_handlesig (env, SIGTRAP);
432 374
            break;
433
        default:
434
            fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
435
                    trapnr);
436
            if (loglevel) {
437
                fprintf(logfile, "qemu: unhandled CPU exception 0x%02x - "
438
                        "0x%02x - aborting\n", trapnr, env->error_code);
375
#if defined(TARGET_PPCEMB)
376
        case POWERPC_EXCP_SPEU:     /* SPE/embedded floating-point unavail.  */
377
            EXCP_DUMP(env, "No SPE/floating-point instruction allowed\n");
378
            info.si_signo = SIGILL;
379
            info.si_errno = 0;
380
            info.si_code = ILL_COPROC;
381
            info.si_addr = (void*)(env->nip - 4);
382
            queue_signal(info.si_signo, &info);
383
            break;
384
        case POWERPC_EXCP_EFPDI:    /* Embedded floating-point data IRQ      */
385
            cpu_abort(env, "Embedded floating-point data IRQ not handled\n");
386
            break;
387
        case POWERPC_EXCP_EFPRI:    /* Embedded floating-point round IRQ     */
388
            cpu_abort(env, "Embedded floating-point round IRQ not handled\n");
389
            break;
390
        case POWERPC_EXCP_EPERFM:   /* Embedded performance monitor IRQ      */
391
            cpu_abort(env, "Performance monitor exception not handled\n");
392
            break;
393
        case POWERPC_EXCP_DOORI:    /* Embedded doorbell interrupt           */
394
            cpu_abort(env, "Doorbell interrupt while in user mode. "
395
                       "Aborting\n");
396
            break;
397
        case POWERPC_EXCP_DOORCI:   /* Embedded doorbell critical interrupt  */
398
            cpu_abort(env, "Doorbell critical interrupt while in user mode. "
399
                      "Aborting\n");
400
            break;
401
#endif /* defined(TARGET_PPCEMB) */
402
        case POWERPC_EXCP_RESET:    /* System reset exception                */
403
            cpu_abort(env, "Reset interrupt while in user mode. "
404
                      "Aborting\n");
405
            break;
406
#if defined(TARGET_PPC64) /* PowerPC 64 */
407
        case POWERPC_EXCP_DSEG:     /* Data segment exception                */
408
            cpu_abort(env, "Data segment exception while in user mode. "
409
                      "Aborting\n");
410
            break;
411
        case POWERPC_EXCP_ISEG:     /* Instruction segment exception         */
412
            cpu_abort(env, "Instruction segment exception "
413
                      "while in user mode. Aborting\n");
414
            break;
415
#endif /* defined(TARGET_PPC64) */
416
#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */
417
        case POWERPC_EXCP_HDECR:    /* Hypervisor decrementer exception      */
418
            cpu_abort(env, "Hypervisor decrementer interrupt "
419
                      "while in user mode. Aborting\n");
420
            break;
421
#endif /* defined(TARGET_PPC64H) */
422
        case POWERPC_EXCP_TRACE:    /* Trace exception                       */
423
            /* Nothing to do:
424
             * we use this exception to emulate step-by-step execution mode.
425
             */
426
            break;
427
#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */
428
        case POWERPC_EXCP_HDSI:     /* Hypervisor data storage exception     */
429
            cpu_abort(env, "Hypervisor data storage exception "
430
                      "while in user mode. Aborting\n");
431
            break;
432
        case POWERPC_EXCP_HISI:     /* Hypervisor instruction storage excp   */
433
            cpu_abort(env, "Hypervisor instruction storage exception "
434
                      "while in user mode. Aborting\n");
435
            break;
436
        case POWERPC_EXCP_HDSEG:    /* Hypervisor data segment exception     */
437
            cpu_abort(env, "Hypervisor data segment exception "
438
                      "while in user mode. Aborting\n");
439
            break;
440
        case POWERPC_EXCP_HISEG:    /* Hypervisor instruction segment excp   */
441
            cpu_abort(env, "Hypervisor instruction segment exception "
442
                      "while in user mode. Aborting\n");
443
            break;
444
#endif /* defined(TARGET_PPC64H) */
445
        case POWERPC_EXCP_VPU:      /* Vector unavailable exception          */
446
            EXCP_DUMP(env, "No Altivec instructions allowed\n");
447
            info.si_signo = SIGILL;
448
            info.si_errno = 0;
449
            info.si_code = ILL_COPROC;
450
            info.si_addr = (void*)(env->nip - 4);
451
            queue_signal(info.si_signo, &info);
452
            break;
453
        case POWERPC_EXCP_PIT:      /* Programmable interval timer IRQ       */
454
            cpu_abort(env, "Programable interval timer interrupt "
455
                      "while in user mode. Aborting\n");
456
            break;
457
        case POWERPC_EXCP_IO:       /* IO error exception                    */
458
            cpu_abort(env, "IO error exception while in user mode. "
459
                      "Aborting\n");
460
            break;
461
        case POWERPC_EXCP_RUNM:     /* Run mode exception                    */
462
            cpu_abort(env, "Run mode exception while in user mode. "
463
                      "Aborting\n");
464
            break;
465
        case POWERPC_EXCP_EMUL:     /* Emulation trap exception              */
466
            cpu_abort(env, "Emulation trap exception not handled\n");
467
            break;
468
        case POWERPC_EXCP_IFTLB:    /* Instruction fetch TLB error           */
469
            cpu_abort(env, "Instruction fetch TLB exception "
470
                      "while in user-mode. Aborting");
471
            break;
472
        case POWERPC_EXCP_DLTLB:    /* Data load TLB miss                    */
473
            cpu_abort(env, "Data load TLB exception while in user-mode. "
474
                      "Aborting");
475
            break;
476
        case POWERPC_EXCP_DSTLB:    /* Data store TLB miss                   */
477
            cpu_abort(env, "Data store TLB exception while in user-mode. "
478
                      "Aborting");
479
            break;
480
        case POWERPC_EXCP_FPA:      /* Floating-point assist exception       */
481
            cpu_abort(env, "Floating-point assist exception not handled\n");
482
            break;
483
        case POWERPC_EXCP_IABR:     /* Instruction address breakpoint        */
484
            cpu_abort(env, "Instruction address breakpoint exception "
485
                      "not handled\n");
486
            break;
487
        case POWERPC_EXCP_SMI:      /* System management interrupt           */
488
            cpu_abort(env, "System management interrupt while in user mode. "
489
                      "Aborting\n");
490
            break;
491
        case POWERPC_EXCP_THERM:    /* Thermal interrupt                     */
492
            cpu_abort(env, "Thermal interrupt interrupt while in user mode. "
493
                      "Aborting\n");
494
            break;
495
        case POWERPC_EXCP_PERFM:    /* Embedded performance monitor IRQ      */
496
            cpu_abort(env, "Performance monitor exception not handled\n");
497
            break;
498
        case POWERPC_EXCP_VPUA:     /* Vector assist exception               */
499
            cpu_abort(env, "Vector assist exception not handled\n");
500
            break;
501
        case POWERPC_EXCP_SOFTP:    /* Soft patch exception                  */
502
            cpu_abort(env, "Soft patch exception not handled\n");
503
            break;
504
        case POWERPC_EXCP_MAINT:    /* Maintenance exception                 */
505
            cpu_abort(env, "Maintenance exception while in user mode. "
506
                      "Aborting\n");
507
            break;
508
        case POWERPC_EXCP_STOP:     /* stop translation                      */
509
            /* We did invalidate the instruction cache. Go on */
510
            break;
511
        case POWERPC_EXCP_BRANCH:   /* branch instruction:                   */
512
            /* We just stopped because of a branch. Go on */
513
            break;
514
        case POWERPC_EXCP_SYSCALL_USER:
515
            /* system call in user-mode emulation */
516
            /* system call */
517
            if(((int)env->gpr[0]) <= SYS_MAXSYSCALL && ((int)env->gpr[0])>0)
518
                ret = do_unix_syscall(env, env->gpr[0]/*, env->gpr[3], env->gpr[4],
519
                                      env->gpr[5], env->gpr[6], env->gpr[7],
520
                                      env->gpr[8], env->gpr[9], env->gpr[10]*/);
521
            else if(((int)env->gpr[0])<0)
522
                ret = do_mach_syscall(env, env->gpr[0], env->gpr[3], env->gpr[4],
523
                                      env->gpr[5], env->gpr[6], env->gpr[7],
524
                                      env->gpr[8], env->gpr[9], env->gpr[10]);
525
            else
526
                ret = do_thread_syscall(env, env->gpr[0], env->gpr[3], env->gpr[4],
527
                                        env->gpr[5], env->gpr[6], env->gpr[7],
528
                                        env->gpr[8], env->gpr[9], env->gpr[10]);
529

  
530
            /* Unix syscall error signaling */
531
            if(((int)env->gpr[0]) <= SYS_MAXSYSCALL && ((int)env->gpr[0])>0)
532
            {
533
                if( (int)ret < 0 )
534
                    env->nip += 0;
535
                else
536
                    env->nip += 4;
439 537
            }
440
                abort();
538

  
539
            /* Return value */
540
            env->gpr[3] = ret;
541
            break;
542
        default:
543
            cpu_abort(env, "Unknown exception 0x%d. Aborting\n", trapnr);
544
            break;
441 545
        }
442 546
        process_pending_signals(env);
443 547
    }
b/linux-user/main.c
723 723
    return -1;
724 724
}
725 725

  
726
#define EXCP_DUMP(env, fmt, args...)                                         \
727
do {                                                                          \
728
    fprintf(stderr, fmt , ##args);                                            \
729
    cpu_dump_state(env, stderr, fprintf, 0);                                  \
730
    if (loglevel != 0) {                                                      \
731
        fprintf(logfile, fmt , ##args);                                       \
732
        cpu_dump_state(env, logfile, fprintf, 0);                             \
733
    }                                                                         \
734
} while (0)
735

  
726 736
void cpu_loop(CPUPPCState *env)
727 737
{
728 738
    target_siginfo_t info;
......
731 741

  
732 742
    for(;;) {
733 743
        trapnr = cpu_ppc_exec(env);
734
        if (trapnr != EXCP_SYSCALL_USER && trapnr != EXCP_BRANCH &&
735
            trapnr != EXCP_TRACE) {
736
            if (loglevel > 0) {
737
                cpu_dump_state(env, logfile, fprintf, 0);
738
            }
739
        }
740 744
        switch(trapnr) {
741
        case EXCP_NONE:
745
        case POWERPC_EXCP_NONE:
746
            /* Just go on */
742 747
            break;
743
        case EXCP_SYSCALL_USER:
744
            /* system call */
745
            /* WARNING:
746
             * PPC ABI uses overflow flag in cr0 to signal an error
747
             * in syscalls.
748
             */
749
#if 0
750
            printf("syscall %d 0x%08x 0x%08x 0x%08x 0x%08x\n", env->gpr[0],
751
                   env->gpr[3], env->gpr[4], env->gpr[5], env->gpr[6]);
752
#endif
753
            env->crf[0] &= ~0x1;
754
            ret = do_syscall(env, env->gpr[0], env->gpr[3], env->gpr[4],
755
                             env->gpr[5], env->gpr[6], env->gpr[7],
756
                             env->gpr[8]);
757
            if (ret > (uint32_t)(-515)) {
758
                env->crf[0] |= 0x1;
759
                ret = -ret;
760
            }
761
            env->gpr[3] = ret;
762
#if 0
763
            printf("syscall returned 0x%08x (%d)\n", ret, ret);
764
#endif
748
        case POWERPC_EXCP_CRITICAL: /* Critical input                        */
749
            cpu_abort(env, "Critical interrupt while in user mode. "
750
                      "Aborting\n");
765 751
            break;
766
        case EXCP_RESET:
767
            /* Should not happen ! */
768
            fprintf(stderr, "RESET asked... Stop emulation\n");
769
            if (loglevel)
770
                fprintf(logfile, "RESET asked... Stop emulation\n");
771
            abort();
772
        case EXCP_MACHINE_CHECK:
773
            fprintf(stderr, "Machine check exeption...  Stop emulation\n");
774
            if (loglevel)
775
                fprintf(logfile, "Machine check exception. Stop emulation\n");
776
            info.si_signo = TARGET_SIGBUS;
777
            info.si_errno = 0;
778
            info.si_code = TARGET_BUS_OBJERR;
779
            info._sifields._sigfault._addr = env->nip - 4;
780
            queue_signal(info.si_signo, &info);
781
        case EXCP_DSI:
782
            fprintf(stderr, "Invalid data memory access: 0x" ADDRX "\n",
783
                    env->spr[SPR_DAR]);
784
            if (loglevel) {
785
                fprintf(logfile, "Invalid data memory access: 0x" ADDRX "\n",
786
                        env->spr[SPR_DAR]);
787
            }
752
        case POWERPC_EXCP_MCHECK:   /* Machine check exception               */
753
            cpu_abort(env, "Machine check exception while in user mode. "
754
                      "Aborting\n");
755
            break;
756
        case POWERPC_EXCP_DSI:      /* Data storage exception                */
757
            EXCP_DUMP(env, "Invalid data memory access: 0x" ADDRX "\n",
758
                      env->spr[SPR_DAR]);
759
            /* XXX: check this. Seems bugged */
788 760
            switch (env->error_code & 0xFF000000) {
789 761
            case 0x40000000:
790 762
                info.si_signo = TARGET_SIGSEGV;
......
803 775
                break;
804 776
            default:
805 777
                /* Let's send a regular segfault... */
806
                fprintf(stderr, "Invalid segfault errno (%02x)\n",
807
                        env->error_code);
808
                if (loglevel) {
809
                    fprintf(logfile, "Invalid segfault errno (%02x)\n",
810
                            env->error_code);
811
                }
778
                EXCP_DUMP(env, "Invalid segfault errno (%02x)\n",
779
                          env->error_code);
812 780
                info.si_signo = TARGET_SIGSEGV;
813 781
                info.si_errno = 0;
814 782
                info.si_code = TARGET_SEGV_MAPERR;
......
817 785
            info._sifields._sigfault._addr = env->nip;
818 786
            queue_signal(info.si_signo, &info);
819 787
            break;
820
        case EXCP_ISI:
821
            fprintf(stderr, "Invalid instruction fetch\n");
822
            if (loglevel)
823
                fprintf(logfile, "Invalid instruction fetch\n");
788
        case POWERPC_EXCP_ISI:      /* Instruction storage exception         */
789
            EXCP_DUMP(env, "Invalid instruction fetch: 0x\n" ADDRX "\n",
790
                      env->spr[SPR_DAR]);
791
            /* XXX: check this */
824 792
            switch (env->error_code & 0xFF000000) {
825 793
            case 0x40000000:
826 794
                info.si_signo = TARGET_SIGSEGV;
......
835 803
                break;
836 804
            default:
837 805
                /* Let's send a regular segfault... */
838
                fprintf(stderr, "Invalid segfault errno (%02x)\n",
839
                        env->error_code);
840
                if (loglevel) {
841
                    fprintf(logfile, "Invalid segfault errno (%02x)\n",
842
                            env->error_code);
843
                }
806
                EXCP_DUMP(env, "Invalid segfault errno (%02x)\n",
807
                          env->error_code);
844 808
                info.si_signo = TARGET_SIGSEGV;
845 809
                info.si_errno = 0;
846 810
                info.si_code = TARGET_SEGV_MAPERR;
......
849 813
            info._sifields._sigfault._addr = env->nip - 4;
850 814
            queue_signal(info.si_signo, &info);
851 815
            break;
852
        case EXCP_EXTERNAL:
853
            /* Should not happen ! */
854
            fprintf(stderr, "External interruption... Stop emulation\n");
855
            if (loglevel)
856
                fprintf(logfile, "External interruption... Stop emulation\n");
857
            abort();
858
        case EXCP_ALIGN:
859
            fprintf(stderr, "Invalid unaligned memory access\n");
860
            if (loglevel)
861
                fprintf(logfile, "Invalid unaligned memory access\n");
816
        case POWERPC_EXCP_EXTERNAL: /* External input                        */
817
            cpu_abort(env, "External interrupt while in user mode. "
818
                      "Aborting\n");
819
            break;
820
        case POWERPC_EXCP_ALIGN:    /* Alignment exception                   */
821
            EXCP_DUMP(env, "Unaligned memory access\n");
822
            /* XXX: check this */
862 823
            info.si_signo = TARGET_SIGBUS;
863 824
            info.si_errno = 0;
864 825
            info.si_code = TARGET_BUS_ADRALN;
865 826
            info._sifields._sigfault._addr = env->nip - 4;
866 827
            queue_signal(info.si_signo, &info);
867 828
            break;
868
        case EXCP_PROGRAM:
829
        case POWERPC_EXCP_PROGRAM:  /* Program exception                     */
830
            /* XXX: check this */
869 831
            switch (env->error_code & ~0xF) {
870
            case EXCP_FP:
871
            fprintf(stderr, "Program exception\n");
872
                if (loglevel)
873
                    fprintf(logfile, "Program exception\n");
832
            case POWERPC_EXCP_FP:
833
                EXCP_DUMP(env, "Floating point program exception\n");
874 834
                /* Set FX */
875 835
                env->fpscr[7] |= 0x8;
876 836
                /* Finally, update FEX */
......
880 840
                info.si_signo = TARGET_SIGFPE;
881 841
                info.si_errno = 0;
882 842
                switch (env->error_code & 0xF) {
883
                case EXCP_FP_OX:
843
                case POWERPC_EXCP_FP_OX:
884 844
                    info.si_code = TARGET_FPE_FLTOVF;
885 845
                    break;
886
                case EXCP_FP_UX:
846
                case POWERPC_EXCP_FP_UX:
887 847
                    info.si_code = TARGET_FPE_FLTUND;
888 848
                    break;
889
                case EXCP_FP_ZX:
890
                case EXCP_FP_VXZDZ:
849
                case POWERPC_EXCP_FP_ZX:
850
                case POWERPC_EXCP_FP_VXZDZ:
891 851
                    info.si_code = TARGET_FPE_FLTDIV;
892 852
                    break;
893
                case EXCP_FP_XX:
853
                case POWERPC_EXCP_FP_XX:
894 854
                    info.si_code = TARGET_FPE_FLTRES;
895 855
                    break;
896
                case EXCP_FP_VXSOFT:
856
                case POWERPC_EXCP_FP_VXSOFT:
897 857
                    info.si_code = TARGET_FPE_FLTINV;
898 858
                    break;
899
                case EXCP_FP_VXNAN:
900
                case EXCP_FP_VXISI:
901
                case EXCP_FP_VXIDI:
902
                case EXCP_FP_VXIMZ:
903
                case EXCP_FP_VXVC:
904
                case EXCP_FP_VXSQRT:
905
                case EXCP_FP_VXCVI:
859
                case POWERPC_EXCP_FP_VXNAN:
860
                case POWERPC_EXCP_FP_VXISI:
861
                case POWERPC_EXCP_FP_VXIDI:
862
                case POWERPC_EXCP_FP_VXIMZ:
863
                case POWERPC_EXCP_FP_VXVC:
864
                case POWERPC_EXCP_FP_VXSQRT:
865
                case POWERPC_EXCP_FP_VXCVI:
906 866
                    info.si_code = TARGET_FPE_FLTSUB;
907 867
                    break;
908 868
                default:
909
                    fprintf(stderr, "Unknown floating point exception "
910
                            "(%02x)\n", env->error_code);
911
                    if (loglevel) {
912
                        fprintf(logfile, "Unknown floating point exception "
913
                                "(%02x)\n", env->error_code & 0xF);
914
                    }
869
                    EXCP_DUMP(env, "Unknown floating point exception (%02x)\n",
870
                              env->error_code);
871
                    break;
915 872
                }
916
            break;
917
        case EXCP_INVAL:
918
                fprintf(stderr, "Invalid instruction\n");
919
                if (loglevel)
920
                    fprintf(logfile, "Invalid instruction\n");
873
                break;
874
            case POWERPC_EXCP_INVAL:
875
                EXCP_DUMP(env, "Invalid instruction\n");
921 876
                info.si_signo = TARGET_SIGILL;
922 877
                info.si_errno = 0;
923 878
                switch (env->error_code & 0xF) {
924
                case EXCP_INVAL_INVAL:
879
                case POWERPC_EXCP_INVAL_INVAL:
925 880
                    info.si_code = TARGET_ILL_ILLOPC;
926 881
                    break;
927
                case EXCP_INVAL_LSWX:
882
                case POWERPC_EXCP_INVAL_LSWX:
928 883
                    info.si_code = TARGET_ILL_ILLOPN;
929 884
                    break;
930
                case EXCP_INVAL_SPR:
885
                case POWERPC_EXCP_INVAL_SPR:
931 886
                    info.si_code = TARGET_ILL_PRVREG;
932 887
                    break;
933
                case EXCP_INVAL_FP:
888
                case POWERPC_EXCP_INVAL_FP:
934 889
                    info.si_code = TARGET_ILL_COPROC;
935 890
                    break;
936 891
                default:
937
                    fprintf(stderr, "Unknown invalid operation (%02x)\n",
938
                            env->error_code & 0xF);
939
                    if (loglevel) {
940
                        fprintf(logfile, "Unknown invalid operation (%02x)\n",
941
                                env->error_code & 0xF);
942
                    }
892
                    EXCP_DUMP(env, "Unknown invalid operation (%02x)\n",
893
                              env->error_code & 0xF);
943 894
                    info.si_code = TARGET_ILL_ILLADR;
944 895
                    break;
945 896
                }
946 897
                break;
947
            case EXCP_PRIV:
948
                fprintf(stderr, "Privilege violation\n");
949
                if (loglevel)
950
                    fprintf(logfile, "Privilege violation\n");
898
            case POWERPC_EXCP_PRIV:
899
                EXCP_DUMP(env, "Privilege violation\n");
951 900
                info.si_signo = TARGET_SIGILL;
952 901
                info.si_errno = 0;
953 902
                switch (env->error_code & 0xF) {
954
                case EXCP_PRIV_OPC:
903
                case POWERPC_EXCP_PRIV_OPC:
955 904
                    info.si_code = TARGET_ILL_PRVOPC;
956 905
                    break;
957
                case EXCP_PRIV_REG:
906
                case POWERPC_EXCP_PRIV_REG:
958 907
                    info.si_code = TARGET_ILL_PRVREG;
959
                break;
908
                    break;
960 909
                default:
961
                    fprintf(stderr, "Unknown privilege violation (%02x)\n",
962
                            env->error_code & 0xF);
910
                    EXCP_DUMP(env, "Unknown privilege violation (%02x)\n",
911
                              env->error_code & 0xF);
963 912
                    info.si_code = TARGET_ILL_PRVOPC;
964 913
                    break;
965 914
                }
966 915
                break;
967
            case EXCP_TRAP:
968
                fprintf(stderr, "Tried to call a TRAP\n");
969
                if (loglevel)
970
                    fprintf(logfile, "Tried to call a TRAP\n");
971
                abort();
916
            case POWERPC_EXCP_TRAP:
917
                cpu_abort(env, "Tried to call a TRAP\n");
918
                break;
972 919
            default:
973 920
                /* Should not happen ! */
974
                fprintf(stderr, "Unknown program exception (%02x)\n",
975
                        env->error_code);
976
                if (loglevel) {
977
                    fprintf(logfile, "Unknwon program exception (%02x)\n",
978
                            env->error_code);
979
                }
980
                abort();
921
                cpu_abort(env, "Unknown program exception (%02x)\n",
922
                          env->error_code);
923
                break;
981 924
            }
982 925
            info._sifields._sigfault._addr = env->nip - 4;
983 926
            queue_signal(info.si_signo, &info);
984 927
            break;
985
        case EXCP_NO_FP:
986
            fprintf(stderr, "No floating point allowed\n");
987
            if (loglevel)
988
                fprintf(logfile, "No floating point allowed\n");
928
        case POWERPC_EXCP_FPU:      /* Floating-point unavailable exception  */
929
            EXCP_DUMP(env, "No floating point allowed\n");
989 930
            info.si_signo = TARGET_SIGILL;
990 931
            info.si_errno = 0;
991 932
            info.si_code = TARGET_ILL_COPROC;
992 933
            info._sifields._sigfault._addr = env->nip - 4;
993 934
            queue_signal(info.si_signo, &info);
994 935
            break;
995
        case EXCP_DECR:
996
            /* Should not happen ! */
997
            fprintf(stderr, "Decrementer exception\n");
998
            if (loglevel)
999
                fprintf(logfile, "Decrementer exception\n");
1000
            abort();
1001
        case EXCP_TRACE:
1002
            /* Do nothing: we use this to trace execution */
1003
            break;
1004
        case EXCP_FP_ASSIST:
1005
            /* Should not happen ! */
1006
            fprintf(stderr, "Floating point assist exception\n");
1007
            if (loglevel)
1008
                fprintf(logfile, "Floating point assist exception\n");
1009
            abort();
1010
        case EXCP_MTMSR:
1011
            /* We reloaded the msr, just go on */
1012
            if (msr_pr == 0) {
1013
                fprintf(stderr, "Tried to go into supervisor mode !\n");
1014
                if (loglevel)
1015
                    fprintf(logfile, "Tried to go into supervisor mode !\n");
1016
                abort();
1017
            }
936
        case POWERPC_EXCP_SYSCALL:  /* System call exception                 */
937
            cpu_abort(env, "Syscall exception while in user mode. "
938
                      "Aborting\n");
1018 939
            break;
1019
        case EXCP_BRANCH:
1020
            /* We stopped because of a jump... */
940
        case POWERPC_EXCP_APU:      /* Auxiliary processor unavailable       */
941
            EXCP_DUMP(env, "No APU instruction allowed\n");
942
            info.si_signo = TARGET_SIGILL;
943
            info.si_errno = 0;
944
            info.si_code = TARGET_ILL_COPROC;
945
            info._sifields._sigfault._addr = env->nip - 4;
946
            queue_signal(info.si_signo, &info);
1021 947
            break;
1022
        case EXCP_INTERRUPT:
1023
            /* Don't know why this should ever happen... */
948
        case POWERPC_EXCP_DECR:     /* Decrementer exception                 */
949
            cpu_abort(env, "Decrementer interrupt while in user mode. "
950
                      "Aborting\n");
1024 951
            break;
1025
        case EXCP_DEBUG:
952
        case POWERPC_EXCP_FIT:      /* Fixed-interval timer interrupt        */
953
            cpu_abort(env, "Fix interval timer interrupt while in user mode. "
954
                      "Aborting\n");
955
            break;
956
        case POWERPC_EXCP_WDT:      /* Watchdog timer interrupt              */
957
            cpu_abort(env, "Watchdog timer interrupt while in user mode. "
958
                      "Aborting\n");
959
            break;
960
        case POWERPC_EXCP_DTLB:     /* Data TLB error                        */
961
            cpu_abort(env, "Data TLB exception while in user mode. "
962
                      "Aborting\n");
963
            break;
964
        case POWERPC_EXCP_ITLB:     /* Instruction TLB error                 */
965
            cpu_abort(env, "Instruction TLB exception while in user mode. "
966
                      "Aborting\n");
967
            break;
968
        case POWERPC_EXCP_DEBUG:    /* Debug interrupt                       */
969
            /* XXX: check this */
1026 970
            {
1027 971
                int sig;
1028 972

  
1029
                sig = gdb_handlesig (env, TARGET_SIGTRAP);
1030
                if (sig)
1031
                  {
973
                sig = gdb_handlesig(env, TARGET_SIGTRAP);
974
                if (sig) {
1032 975
                    info.si_signo = sig;
1033 976
                    info.si_errno = 0;
1034 977
                    info.si_code = TARGET_TRAP_BRKPT;
......
1036 979
                  }
1037 980
            }
1038 981
            break;
1039
        default:
1040
            fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
1041
                    trapnr);
1042
            if (loglevel) {
1043
                fprintf(logfile, "qemu: unhandled CPU exception 0x%02x - "
1044
                        "0x%02x - aborting\n", trapnr, env->error_code);
982
#if defined(TARGET_PPCEMB)
983
        case POWERPC_EXCP_SPEU:     /* SPE/embedded floating-point unavail.  */
984
            EXCP_DUMP(env, "No SPE/floating-point instruction allowed\n");
985
            info.si_signo = TARGET_SIGILL;
986
            info.si_errno = 0;
987
            info.si_code = TARGET_ILL_COPROC;
988
            info._sifields._sigfault._addr = env->nip - 4;
989
            queue_signal(info.si_signo, &info);
990
            break;
991
        case POWERPC_EXCP_EFPDI:    /* Embedded floating-point data IRQ      */
992
            cpu_abort(env, "Embedded floating-point data IRQ not handled\n");
993
            break;
994
        case POWERPC_EXCP_EFPRI:    /* Embedded floating-point round IRQ     */
995
            cpu_abort(env, "Embedded floating-point round IRQ not handled\n");
996
            break;
997
        case POWERPC_EXCP_EPERFM:   /* Embedded performance monitor IRQ      */
998
            cpu_abort(env, "Performance monitor exception not handled\n");
999
            break;
1000
        case POWERPC_EXCP_DOORI:    /* Embedded doorbell interrupt           */
1001
            cpu_abort(env, "Doorbell interrupt while in user mode. "
1002
                       "Aborting\n");
1003
            break;
1004
        case POWERPC_EXCP_DOORCI:   /* Embedded doorbell critical interrupt  */
1005
            cpu_abort(env, "Doorbell critical interrupt while in user mode. "
1006
                      "Aborting\n");
1007
            break;
1008
        case POWERPC_EXCP_RESET:    /* System reset exception                */
1009
            cpu_abort(env, "Reset interrupt while in user mode. "
1010
                      "Aborting\n");
1011
            break;
1012
#endif /* defined(TARGET_PPCEMB) */
1013
#if defined(TARGET_PPC64) /* PowerPC 64 */
1014
        case POWERPC_EXCP_DSEG:     /* Data segment exception                */
1015
            cpu_abort(env, "Data segment exception while in user mode. "
1016
                      "Aborting\n");
1017
            break;
1018
        case POWERPC_EXCP_ISEG:     /* Instruction segment exception         */
1019
            cpu_abort(env, "Instruction segment exception "
1020
                      "while in user mode. Aborting\n");
1021
            break;
1022
#endif /* defined(TARGET_PPC64) */
1023
#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */
1024
        case POWERPC_EXCP_HDECR:    /* Hypervisor decrementer exception      */
1025
            cpu_abort(env, "Hypervisor decrementer interrupt "
1026
                      "while in user mode. Aborting\n");
1027
            break;
1028
#endif /* defined(TARGET_PPC64H) */
1029
        case POWERPC_EXCP_TRACE:    /* Trace exception                       */
1030
            /* Nothing to do:
1031
             * we use this exception to emulate step-by-step execution mode.
1032
             */
1033
            break;
1034
#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */
1035
        case POWERPC_EXCP_HDSI:     /* Hypervisor data storage exception     */
1036
            cpu_abort(env, "Hypervisor data storage exception "
1037
                      "while in user mode. Aborting\n");
1038
            break;
1039
        case POWERPC_EXCP_HISI:     /* Hypervisor instruction storage excp   */
1040
            cpu_abort(env, "Hypervisor instruction storage exception "
1041
                      "while in user mode. Aborting\n");
1042
            break;
1043
        case POWERPC_EXCP_HDSEG:    /* Hypervisor data segment exception     */
1044
            cpu_abort(env, "Hypervisor data segment exception "
1045
                      "while in user mode. Aborting\n");
1046
            break;
1047
        case POWERPC_EXCP_HISEG:    /* Hypervisor instruction segment excp   */
1048
            cpu_abort(env, "Hypervisor instruction segment exception "
1049
                      "while in user mode. Aborting\n");
1050
            break;
1051
#endif /* defined(TARGET_PPC64H) */
1052
        case POWERPC_EXCP_VPU:      /* Vector unavailable exception          */
1053
            EXCP_DUMP(env, "No Altivec instructions allowed\n");
1054
            info.si_signo = TARGET_SIGILL;
1055
            info.si_errno = 0;
1056
            info.si_code = TARGET_ILL_COPROC;
1057
            info._sifields._sigfault._addr = env->nip - 4;
1058
            queue_signal(info.si_signo, &info);
1059
            break;
1060
        case POWERPC_EXCP_PIT:      /* Programmable interval timer IRQ       */
1061
            cpu_abort(env, "Programable interval timer interrupt "
1062
                      "while in user mode. Aborting\n");
1063
            break;
1064
        case POWERPC_EXCP_IO:       /* IO error exception                    */
1065
            cpu_abort(env, "IO error exception while in user mode. "
1066
                      "Aborting\n");
1067
            break;
1068
        case POWERPC_EXCP_RUNM:     /* Run mode exception                    */
1069
            cpu_abort(env, "Run mode exception while in user mode. "
1070
                      "Aborting\n");
1071
            break;
1072
        case POWERPC_EXCP_EMUL:     /* Emulation trap exception              */
1073
            cpu_abort(env, "Emulation trap exception not handled\n");
1074
            break;
1075
        case POWERPC_EXCP_IFTLB:    /* Instruction fetch TLB error           */
1076
            cpu_abort(env, "Instruction fetch TLB exception "
1077
                      "while in user-mode. Aborting");
1078
            break;
1079
        case POWERPC_EXCP_DLTLB:    /* Data load TLB miss                    */
1080
            cpu_abort(env, "Data load TLB exception while in user-mode. "
1081
                      "Aborting");
1082
            break;
1083
        case POWERPC_EXCP_DSTLB:    /* Data store TLB miss                   */
1084
            cpu_abort(env, "Data store TLB exception while in user-mode. "
1085
                      "Aborting");
1086
            break;
1087
        case POWERPC_EXCP_FPA:      /* Floating-point assist exception       */
1088
            cpu_abort(env, "Floating-point assist exception not handled\n");
1089
            break;
1090
        case POWERPC_EXCP_IABR:     /* Instruction address breakpoint        */
1091
            cpu_abort(env, "Instruction address breakpoint exception "
1092
                      "not handled\n");
1093
            break;
1094
        case POWERPC_EXCP_SMI:      /* System management interrupt           */
1095
            cpu_abort(env, "System management interrupt while in user mode. "
1096
                      "Aborting\n");
1097
            break;
1098
        case POWERPC_EXCP_THERM:    /* Thermal interrupt                     */
1099
            cpu_abort(env, "Thermal interrupt interrupt while in user mode. "
1100
                      "Aborting\n");
1101
            break;
1102
        case POWERPC_EXCP_PERFM:   /* Embedded performance monitor IRQ      */
1103
            cpu_abort(env, "Performance monitor exception not handled\n");
1104
            break;
1105
        case POWERPC_EXCP_VPUA:     /* Vector assist exception               */
1106
            cpu_abort(env, "Vector assist exception not handled\n");
1107
            break;
1108
        case POWERPC_EXCP_SOFTP:    /* Soft patch exception                  */
1109
            cpu_abort(env, "Soft patch exception not handled\n");
1110
            break;
1111
        case POWERPC_EXCP_MAINT:    /* Maintenance exception                 */
1112
            cpu_abort(env, "Maintenance exception while in user mode. "
1113
                      "Aborting\n");
1114
            break;
1115
        case POWERPC_EXCP_STOP:     /* stop translation                      */
1116
            /* We did invalidate the instruction cache. Go on */
1117
            break;
1118
        case POWERPC_EXCP_BRANCH:   /* branch instruction:                   */
1119
            /* We just stopped because of a branch. Go on */
1120
            break;
1121
        case POWERPC_EXCP_SYSCALL_USER:
1122
            /* system call in user-mode emulation */
1123
            /* WARNING:
1124
             * PPC ABI uses overflow flag in cr0 to signal an error
1125
             * in syscalls.
1126
             */
1127
#if 0
1128
            printf("syscall %d 0x%08x 0x%08x 0x%08x 0x%08x\n", env->gpr[0],
1129
                   env->gpr[3], env->gpr[4], env->gpr[5], env->gpr[6]);
1130
#endif
1131
            env->crf[0] &= ~0x1;
1132
            ret = do_syscall(env, env->gpr[0], env->gpr[3], env->gpr[4],
1133
                             env->gpr[5], env->gpr[6], env->gpr[7],
1134
                             env->gpr[8]);
1135
            if (ret > (uint32_t)(-515)) {
1136
                env->crf[0] |= 0x1;
1137
                ret = -ret;
1045 1138
            }
1046
            abort();
1139
            env->gpr[3] = ret;
1140
#if 0
1141
            printf("syscall returned 0x%08x (%d)\n", ret, ret);
1142
#endif
1143
            break;
1144
        default:
1145
            cpu_abort(env, "Unknown exception 0x%d. Aborting\n", trapnr);
1146
            break;
1047 1147
        }
1048 1148
        process_pending_signals(env);
1049 1149
    }
b/target-ppc/cpu.h
149 149
};
150 150

  
151 151
/*****************************************************************************/
152
/* Exception vectors definitions                                             */
153
enum {
154
    POWERPC_EXCP_NONE    = -1,
155
    /* The 64 first entries are used by the PowerPC embedded specification   */
156
    POWERPC_EXCP_CRITICAL = 0,  /* Critical input                            */
157
    POWERPC_EXCP_MCHECK   = 1,  /* Machine check exception                   */
158
    POWERPC_EXCP_DSI      = 2,  /* Data storage exception                    */
159
    POWERPC_EXCP_ISI      = 3,  /* Instruction storage exception             */
160
    POWERPC_EXCP_EXTERNAL = 4,  /* External input                            */
161
    POWERPC_EXCP_ALIGN    = 5,  /* Alignment exception                       */
162
    POWERPC_EXCP_PROGRAM  = 6,  /* Program exception                         */
163
    POWERPC_EXCP_FPU      = 7,  /* Floating-point unavailable exception      */
164
    POWERPC_EXCP_SYSCALL  = 8,  /* System call exception                     */
165
    POWERPC_EXCP_APU      = 9,  /* Auxiliary processor unavailable           */
166
    POWERPC_EXCP_DECR     = 10, /* Decrementer exception                     */
167
    POWERPC_EXCP_FIT      = 11, /* Fixed-interval timer interrupt            */
168
    POWERPC_EXCP_WDT      = 12, /* Watchdog timer interrupt                  */
169
    POWERPC_EXCP_DTLB     = 13, /* Data TLB error                            */
170
    POWERPC_EXCP_ITLB     = 14, /* Instruction TLB error                     */
171
    POWERPC_EXCP_DEBUG    = 15, /* Debug interrupt                           */
172
    /* Vectors 16 to 31 are reserved                                         */
173
#if defined(TARGET_PPCEMB)
174
    POWERPC_EXCP_SPEU     = 32, /* SPE/embedded floating-point unavailable   */
175
    POWERPC_EXCP_EFPDI    = 33, /* Embedded floating-point data interrupt    */
176
    POWERPC_EXCP_EFPRI    = 34, /* Embedded floating-point round interrupt   */
177
    POWERPC_EXCP_EPERFM   = 35, /* Embedded performance monitor interrupt    */
178
    POWERPC_EXCP_DOORI    = 36, /* Embedded doorbell interrupt               */
179
    POWERPC_EXCP_DOORCI   = 37, /* Embedded doorbell critical interrupt      */
180
#endif /* defined(TARGET_PPCEMB) */
181
    /* Vectors 38 to 63 are reserved                                         */
182
    /* Exceptions defined in the PowerPC server specification                */
183
    POWERPC_EXCP_RESET    = 64, /* System reset exception                    */
184
#if defined(TARGET_PPC64) /* PowerPC 64 */
185
    POWERPC_EXCP_DSEG     = 65, /* Data segment exception                    */
186
    POWERPC_EXCP_ISEG     = 66, /* Instruction segment exception             */
187
#endif /* defined(TARGET_PPC64) */
188
#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */
189
    POWERPC_EXCP_HDECR    = 67, /* Hypervisor decrementer exception          */
190
#endif /* defined(TARGET_PPC64H) */
191
    POWERPC_EXCP_TRACE    = 68, /* Trace exception                           */
192
#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */
193
    POWERPC_EXCP_HDSI     = 69, /* Hypervisor data storage exception         */
194
    POWERPC_EXCP_HISI     = 70, /* Hypervisor instruction storage exception  */
195
    POWERPC_EXCP_HDSEG    = 71, /* Hypervisor data segment exception         */
196
    POWERPC_EXCP_HISEG    = 72, /* Hypervisor instruction segment exception  */
197
#endif /* defined(TARGET_PPC64H) */
198
    POWERPC_EXCP_VPU      = 73, /* Vector unavailable exception              */
199
    /* 40x specific exceptions                                               */
200
    POWERPC_EXCP_PIT      = 74, /* Programmable interval timer interrupt     */
201
    /* 601 specific exceptions                                               */
202
    POWERPC_EXCP_IO       = 75, /* IO error exception                        */
203
    POWERPC_EXCP_RUNM     = 76, /* Run mode exception                        */
204
    /* 602 specific exceptions                                               */
205
    POWERPC_EXCP_EMUL     = 77, /* Emulation trap exception                  */
206
    /* 602/603 specific exceptions                                           */
207
    POWERPC_EXCP_IFTLB    = 78, /* Instruction fetch TLB error               */
208
    POWERPC_EXCP_DLTLB    = 79, /* Data load TLB miss                        */
209
    POWERPC_EXCP_DSTLB    = 80, /* Data store TLB miss                       */
210
    /* Exceptions available on most PowerPC                                  */
211
    POWERPC_EXCP_FPA      = 81, /* Floating-point assist exception           */
212
    POWERPC_EXCP_IABR     = 82, /* Instruction address breakpoint            */
213
    POWERPC_EXCP_SMI      = 83, /* System management interrupt               */
214
    POWERPC_EXCP_PERFM    = 84, /* Embedded performance monitor interrupt    */
215
    /* 7xx/74xx specific exceptions                                          */
216
    POWERPC_EXCP_THERM    = 85, /* Thermal interrupt                         */
217
    /* 74xx specific exceptions                                              */
218
    POWERPC_EXCP_VPUA     = 86, /* Vector assist exception                   */
219
    /* 970FX specific exceptions                                             */
220
    POWERPC_EXCP_SOFTP    = 87, /* Soft patch exception                      */
221
    POWERPC_EXCP_MAINT    = 88, /* Maintenance exception                     */
222
    /* EOL                                                                   */
223
    POWERPC_EXCP_NB       = 96,
224
    /* Qemu exceptions: used internally during code translation              */
225
    POWERPC_EXCP_STOP         = 0x200, /* stop translation                   */
226
    POWERPC_EXCP_BRANCH       = 0x201, /* branch instruction                 */
227
    /* Qemu exceptions: special cases we want to stop translation            */
228
    POWERPC_EXCP_SYNC         = 0x202, /* context synchronizing instruction  */
229
    POWERPC_EXCP_SYSCALL_USER = 0x203, /* System call in user mode only      */
230
};
231

  
232

  
233
/* Exceptions error codes                                                    */
234
enum {
235
    /* Exception subtypes for POWERPC_EXCP_ALIGN                             */
236
    POWERPC_EXCP_ALIGN_FP      = 0x01,  /* FP alignment exception            */
237
    POWERPC_EXCP_ALIGN_LST     = 0x02,  /* Unaligned mult/extern load/store  */
238
    POWERPC_EXCP_ALIGN_LE      = 0x03,  /* Multiple little-endian access     */
239
    POWERPC_EXCP_ALIGN_PROT    = 0x04,  /* Access cross protection boundary  */
240
    POWERPC_EXCP_ALIGN_BAT     = 0x05,  /* Access cross a BAT/seg boundary   */
241
    POWERPC_EXCP_ALIGN_CACHE   = 0x06,  /* Impossible dcbz access            */
242
    /* Exception subtypes for POWERPC_EXCP_PROGRAM                           */
243
    /* FP exceptions                                                         */
244
    POWERPC_EXCP_FP            = 0x10,
245
    POWERPC_EXCP_FP_OX         = 0x01,  /* FP overflow                       */
246
    POWERPC_EXCP_FP_UX         = 0x02,  /* FP underflow                      */
247
    POWERPC_EXCP_FP_ZX         = 0x03,  /* FP divide by zero                 */
248
    POWERPC_EXCP_FP_XX         = 0x04,  /* FP inexact                        */
249
    POWERPC_EXCP_FP_VXNAN      = 0x05,  /* FP invalid SNaN op                */
250
    POWERPC_EXCP_FP_VXISI      = 0x06,  /* FP invalid infinite subtraction   */
251
    POWERPC_EXCP_FP_VXIDI      = 0x07,  /* FP invalid infinite divide        */
252
    POWERPC_EXCP_FP_VXZDZ      = 0x08,  /* FP invalid zero divide            */
253
    POWERPC_EXCP_FP_VXIMZ      = 0x09,  /* FP invalid infinite * zero        */
254
    POWERPC_EXCP_FP_VXVC       = 0x0A,  /* FP invalid compare                */
255
    POWERPC_EXCP_FP_VXSOFT     = 0x0B,  /* FP invalid operation              */
256
    POWERPC_EXCP_FP_VXSQRT     = 0x0C,  /* FP invalid square root            */
257
    POWERPC_EXCP_FP_VXCVI      = 0x0D,  /* FP invalid integer conversion     */
258
    /* Invalid instruction                                                   */
259
    POWERPC_EXCP_INVAL         = 0x20,
260
    POWERPC_EXCP_INVAL_INVAL   = 0x01,  /* Invalid instruction               */
261
    POWERPC_EXCP_INVAL_LSWX    = 0x02,  /* Invalid lswx instruction          */
262
    POWERPC_EXCP_INVAL_SPR     = 0x03,  /* Invalid SPR access                */
263
    POWERPC_EXCP_INVAL_FP      = 0x04,  /* Unimplemented mandatory fp instr  */
264
    /* Privileged instruction                                                */
265
    POWERPC_EXCP_PRIV          = 0x30,
266
    POWERPC_EXCP_PRIV_OPC      = 0x01,  /* Privileged operation exception    */
267
    POWERPC_EXCP_PRIV_REG      = 0x02,  /* Privileged register exception     */
268
    /* Trap                                                                  */
269
    POWERPC_EXCP_TRAP          = 0x40,
270
};
271

  
272
/*****************************************************************************/
152 273
/* Input pins model                                                          */
153 274
enum {
154 275
    PPC_FLAGS_INPUT_UNKNOWN = 0,
......
411 532
     */
412 533
    uint32_t irq_input_state;
413 534
    void **irq_inputs;
535
    /* Exception vectors */
536
    target_ulong excp_vectors[POWERPC_EXCP_NB];
537
    target_ulong excp_prefix;
538
    target_ulong ivor_mask;
539
    target_ulong ivpr_mask;
414 540
#endif
415 541

  
416 542
    /* Those resources are used only during code translation */
......
634 760
#define SPR_BOOKE_IAC1   (0x138)
635 761
#define SPR_HRMOR        (0x139)
636 762
#define SPR_BOOKE_IAC2   (0x139)
637
#define SPR_HSSR0        (0x13A)
763
#define SPR_HSRR0        (0x13A)
638 764
#define SPR_BOOKE_IAC3   (0x13A)
639
#define SPR_HSSR1        (0x13B)
765
#define SPR_HSRR1        (0x13B)
640 766
#define SPR_BOOKE_IAC4   (0x13B)
641 767
#define SPR_LPCR         (0x13C)
642 768
#define SPR_BOOKE_DAC1   (0x13C)
......
948 1074
    ACCESS_CACHE = 0x60, /* Cache manipulation               */
949 1075
};
950 1076

  
951
/*****************************************************************************/
952
/* Exceptions */
953
#define EXCP_NONE          -1
954
/* PowerPC hardware exceptions : exception vectors defined in PowerPC book 3 */
955
#define EXCP_RESET         0x0100 /* System reset                            */
956
#define EXCP_MACHINE_CHECK 0x0200 /* Machine check exception                 */
957
#define EXCP_DSI           0x0300 /* Data storage exception                  */
958
#define EXCP_DSEG          0x0380 /* Data segment exception                  */
959
#define EXCP_ISI           0x0400 /* Instruction storage exception           */
960
#define EXCP_ISEG          0x0480 /* Instruction segment exception           */
961
#define EXCP_EXTERNAL      0x0500 /* External interruption                   */
962
#define EXCP_ALIGN         0x0600 /* Alignment exception                     */
963
#define EXCP_PROGRAM       0x0700 /* Program exception                       */
964
#define EXCP_NO_FP         0x0800 /* Floating point unavailable exception    */
965
#define EXCP_DECR          0x0900 /* Decrementer exception                   */
966
#define EXCP_HDECR         0x0980 /* Hypervisor decrementer exception        */
967
#define EXCP_SYSCALL       0x0C00 /* System call                             */
968
#define EXCP_TRACE         0x0D00 /* Trace exception                         */
969
#define EXCP_PERF          0x0F00 /* Performance monitor exception           */
970
/* Exceptions defined in PowerPC 32 bits programming environment manual      */
971
#define EXCP_FP_ASSIST     0x0E00 /* Floating-point assist                   */
972
/* Implementation specific exceptions                                        */
973
/* 40x exceptions                                                            */
974
#define EXCP_40x_PIT       0x1000 /* Programmable interval timer interrupt   */
975
#define EXCP_40x_FIT       0x1010 /* Fixed interval timer interrupt          */
976
#define EXCP_40x_WATCHDOG  0x1020 /* Watchdog timer exception                */
977
#define EXCP_40x_DTLBMISS  0x1100 /* Data TLB miss exception                 */
978
#define EXCP_40x_ITLBMISS  0x1200 /* Instruction TLB miss exception          */
979
#define EXCP_40x_DEBUG     0x2000 /* Debug exception                         */
980
/* 405 specific exceptions                                                   */
981
#define EXCP_405_APU       0x0F20 /* APU unavailable exception               */
982
/* 440 specific exceptions                                                   */
983
#define EXCP_440_CRIT      0x0100 /* Critical interrupt                      */
984
#define EXCP_440_SPEU      0x1600 /* SPE unavailable exception               */
985
#define EXCP_440_SPED      0x1700 /* SPE floating-point data exception       */
986
#define EXCP_440_SPER      0x1800 /* SPE floating-point round exception      */
987
/* TLB assist exceptions (602/603)                                           */
988
#define EXCP_I_TLBMISS     0x1000 /* Instruction TLB miss                    */
989
#define EXCP_DL_TLBMISS    0x1100 /* Data load TLB miss                      */
990
#define EXCP_DS_TLBMISS    0x1200 /* Data store TLB miss                     */
991
/* Breakpoint exceptions (602/603/604/620/740/745/750/755...)                */
992
#define EXCP_IABR          0x1300 /* Instruction address breakpoint          */
993
#define EXCP_SMI           0x1400 /* System management interrupt             */
994
/* Altivec related exceptions                                                */
995
#define EXCP_VPU           0x0F20 /* VPU unavailable exception               */
996
/* 601 specific exceptions                                                   */
997
#define EXCP_601_IO        0x0A00 /* IO error exception                      */
998
#define EXCP_601_RUNM      0x2000 /* Run mode exception                      */
999
/* 602 specific exceptions                                                   */
1000
#define EXCP_602_WATCHDOG  0x1500 /* Watchdog exception                      */
1001
#define EXCP_602_EMUL      0x1600 /* Emulation trap exception                */
1002
/* G2 specific exceptions                                                    */
1003
#define EXCP_G2_CRIT       0x0A00 /* Critical interrupt                      */
1004
/* MPC740/745/750 & IBM 750 specific exceptions                              */
1005
#define EXCP_THRM          0x1700 /* Thermal management interrupt            */
1006
/* 74xx specific exceptions                                                  */
1007
#define EXCP_74xx_VPUA     0x1600 /* VPU assist exception                    */
1008
/* 970FX specific exceptions                                                 */
1009
#define EXCP_970_SOFTP     0x1500 /* Soft patch exception                    */
1010
#define EXCP_970_MAINT     0x1600 /* Maintenance exception                   */
1011
#define EXCP_970_THRM      0x1800 /* Thermal exception                       */
1012
#define EXCP_970_VPUA      0x1700 /* VPU assist exception                    */
1013
/* SPE related exceptions                                                    */
1014
#define EXCP_NO_SPE        0x0F20 /* SPE unavailable exception               */
1015
/* End of exception vectors area                                             */
1016
#define EXCP_PPC_MAX       0x4000
1017
/* Qemu exceptions: special cases we want to stop translation                */
1018
#define EXCP_MTMSR         0x11000 /* mtmsr instruction:                     */
1019
                                   /* may change privilege level             */
1020
#define EXCP_BRANCH        0x11001 /* branch instruction                     */
1021
#define EXCP_SYSCALL_USER  0x12000 /* System call in user mode only          */
1022

  
1023
/* Error codes */
1024
enum {
1025
    /* Exception subtypes for EXCP_ALIGN                            */
1026
    EXCP_ALIGN_FP      = 0x01,  /* FP alignment exception           */
1027
    EXCP_ALIGN_LST     = 0x02,  /* Unaligned mult/extern load/store */
1028
    EXCP_ALIGN_LE      = 0x03,  /* Multiple little-endian access    */
1029
    EXCP_ALIGN_PROT    = 0x04,  /* Access cross protection boundary */
1030
    EXCP_ALIGN_BAT     = 0x05,  /* Access cross a BAT/seg boundary  */
1031
    EXCP_ALIGN_CACHE   = 0x06,  /* Impossible dcbz access           */
1032
    /* Exception subtypes for EXCP_PROGRAM                          */
1033
    /* FP exceptions */
1034
    EXCP_FP            = 0x10,
1035
    EXCP_FP_OX         = 0x01,  /* FP overflow                      */
1036
    EXCP_FP_UX         = 0x02,  /* FP underflow                     */
1037
    EXCP_FP_ZX         = 0x03,  /* FP divide by zero                */
1038
    EXCP_FP_XX         = 0x04,  /* FP inexact                       */
1039
    EXCP_FP_VXNAN      = 0x05,  /* FP invalid SNaN op               */
1040
    EXCP_FP_VXISI      = 0x06,  /* FP invalid infinite subtraction */
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff