Commit 6d5e216de979afdc0a26410580ad31376f7107f7
1 parent
e8af50a3
SPARC fixes (Blue Swirl)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1084 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
436 additions
and
0 deletions
linux-user/signal.c
@@ -1271,6 +1271,346 @@ badframe: | @@ -1271,6 +1271,346 @@ badframe: | ||
1271 | return 0; | 1271 | return 0; |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | +#elif defined(TARGET_SPARC) | ||
1275 | +#define __SUNOS_MAXWIN 31 | ||
1276 | + | ||
1277 | +/* This is what SunOS does, so shall I. */ | ||
1278 | +struct target_sigcontext { | ||
1279 | + target_ulong sigc_onstack; /* state to restore */ | ||
1280 | + | ||
1281 | + target_ulong sigc_mask; /* sigmask to restore */ | ||
1282 | + target_ulong sigc_sp; /* stack pointer */ | ||
1283 | + target_ulong sigc_pc; /* program counter */ | ||
1284 | + target_ulong sigc_npc; /* next program counter */ | ||
1285 | + target_ulong sigc_psr; /* for condition codes etc */ | ||
1286 | + target_ulong sigc_g1; /* User uses these two registers */ | ||
1287 | + target_ulong sigc_o0; /* within the trampoline code. */ | ||
1288 | + | ||
1289 | + /* Now comes information regarding the users window set | ||
1290 | + * at the time of the signal. | ||
1291 | + */ | ||
1292 | + target_ulong sigc_oswins; /* outstanding windows */ | ||
1293 | + | ||
1294 | + /* stack ptrs for each regwin buf */ | ||
1295 | + char *sigc_spbuf[__SUNOS_MAXWIN]; | ||
1296 | + | ||
1297 | + /* Windows to restore after signal */ | ||
1298 | + struct { | ||
1299 | + target_ulong locals[8]; | ||
1300 | + target_ulong ins[8]; | ||
1301 | + } sigc_wbuf[__SUNOS_MAXWIN]; | ||
1302 | +}; | ||
1303 | +/* A Sparc stack frame */ | ||
1304 | +struct sparc_stackf { | ||
1305 | + target_ulong locals[8]; | ||
1306 | + target_ulong ins[6]; | ||
1307 | + struct sparc_stackf *fp; | ||
1308 | + target_ulong callers_pc; | ||
1309 | + char *structptr; | ||
1310 | + target_ulong xargs[6]; | ||
1311 | + target_ulong xxargs[1]; | ||
1312 | +}; | ||
1313 | + | ||
1314 | +typedef struct { | ||
1315 | + struct { | ||
1316 | + target_ulong psr; | ||
1317 | + target_ulong pc; | ||
1318 | + target_ulong npc; | ||
1319 | + target_ulong y; | ||
1320 | + target_ulong u_regs[16]; /* globals and ins */ | ||
1321 | + } si_regs; | ||
1322 | + int si_mask; | ||
1323 | +} __siginfo_t; | ||
1324 | + | ||
1325 | +typedef struct { | ||
1326 | + unsigned long si_float_regs [32]; | ||
1327 | + unsigned long si_fsr; | ||
1328 | + unsigned long si_fpqdepth; | ||
1329 | + struct { | ||
1330 | + unsigned long *insn_addr; | ||
1331 | + unsigned long insn; | ||
1332 | + } si_fpqueue [16]; | ||
1333 | +} __siginfo_fpu_t; | ||
1334 | + | ||
1335 | + | ||
1336 | +struct target_signal_frame { | ||
1337 | + struct sparc_stackf ss; | ||
1338 | + __siginfo_t info; | ||
1339 | + __siginfo_fpu_t *fpu_save; | ||
1340 | + target_ulong insns[2] __attribute__ ((aligned (8))); | ||
1341 | + target_ulong extramask[TARGET_NSIG_WORDS - 1]; | ||
1342 | + target_ulong extra_size; /* Should be 0 */ | ||
1343 | + __siginfo_fpu_t fpu_state; | ||
1344 | +}; | ||
1345 | +struct target_rt_signal_frame { | ||
1346 | + struct sparc_stackf ss; | ||
1347 | + siginfo_t info; | ||
1348 | + target_ulong regs[20]; | ||
1349 | + sigset_t mask; | ||
1350 | + __siginfo_fpu_t *fpu_save; | ||
1351 | + unsigned int insns[2]; | ||
1352 | + stack_t stack; | ||
1353 | + unsigned int extra_size; /* Should be 0 */ | ||
1354 | + __siginfo_fpu_t fpu_state; | ||
1355 | +}; | ||
1356 | + | ||
1357 | +#define UREG_O0 0 | ||
1358 | +#define UREG_O6 6 | ||
1359 | +#define UREG_I0 16 | ||
1360 | +#define UREG_I1 17 | ||
1361 | +#define UREG_I2 18 | ||
1362 | +#define UREG_I6 22 | ||
1363 | +#define UREG_I7 23 | ||
1364 | +#define UREG_FP UREG_I6 | ||
1365 | +#define UREG_SP UREG_O6 | ||
1366 | + | ||
1367 | +static inline void *get_sigframe(struct emulated_sigaction *sa, CPUState *env, unsigned long framesize) | ||
1368 | +{ | ||
1369 | + unsigned long sp; | ||
1370 | + | ||
1371 | + sp = env->regwptr[UREG_FP]; | ||
1372 | +#if 0 | ||
1373 | + | ||
1374 | + /* This is the X/Open sanctioned signal stack switching. */ | ||
1375 | + if (sa->sa_flags & TARGET_SA_ONSTACK) { | ||
1376 | + if (!on_sig_stack(sp) && !((current->sas_ss_sp + current->sas_ss_size) & 7)) | ||
1377 | + sp = current->sas_ss_sp + current->sas_ss_size; | ||
1378 | + } | ||
1379 | +#endif | ||
1380 | + return (void *)(sp - framesize); | ||
1381 | +} | ||
1382 | + | ||
1383 | +static int | ||
1384 | +setup___siginfo(__siginfo_t *si, CPUState *env, target_ulong mask) | ||
1385 | +{ | ||
1386 | + int err = 0, i; | ||
1387 | + | ||
1388 | + fprintf(stderr, "2.a %lx psr: %lx regs: %lx\n", si, env->psr, si->si_regs.psr); | ||
1389 | + err |= __put_user(env->psr, &si->si_regs.psr); | ||
1390 | + fprintf(stderr, "2.a1 pc:%lx\n", si->si_regs.pc); | ||
1391 | + err |= __put_user(env->pc, &si->si_regs.pc); | ||
1392 | + err |= __put_user(env->npc, &si->si_regs.npc); | ||
1393 | + err |= __put_user(env->y, &si->si_regs.y); | ||
1394 | + fprintf(stderr, "2.b\n"); | ||
1395 | + for (i=0; i < 7; i++) { | ||
1396 | + err |= __put_user(env->gregs[i], &si->si_regs.u_regs[i]); | ||
1397 | + } | ||
1398 | + for (i=0; i < 7; i++) { | ||
1399 | + err |= __put_user(env->regwptr[i+16], &si->si_regs.u_regs[i+8]); | ||
1400 | + } | ||
1401 | + fprintf(stderr, "2.c\n"); | ||
1402 | + err |= __put_user(mask, &si->si_mask); | ||
1403 | + return err; | ||
1404 | +} | ||
1405 | +static int | ||
1406 | +setup_sigcontext(struct target_sigcontext *sc, /*struct _fpstate *fpstate,*/ | ||
1407 | + CPUState *env, unsigned long mask) | ||
1408 | +{ | ||
1409 | + int err = 0; | ||
1410 | + | ||
1411 | + err |= __put_user(mask, &sc->sigc_mask); | ||
1412 | + err |= __put_user(env->regwptr[UREG_SP], &sc->sigc_sp); | ||
1413 | + err |= __put_user(env->pc, &sc->sigc_pc); | ||
1414 | + err |= __put_user(env->npc, &sc->sigc_npc); | ||
1415 | + err |= __put_user(env->psr, &sc->sigc_psr); | ||
1416 | + err |= __put_user(env->gregs[1], &sc->sigc_g1); | ||
1417 | + err |= __put_user(env->regwptr[UREG_O0], &sc->sigc_o0); | ||
1418 | + | ||
1419 | + return err; | ||
1420 | +} | ||
1421 | +#define NF_ALIGNEDSZ (((sizeof(struct target_signal_frame) + 7) & (~7))) | ||
1422 | + | ||
1423 | +static void setup_frame(int sig, struct emulated_sigaction *ka, | ||
1424 | + target_sigset_t *set, CPUState *env) | ||
1425 | +{ | ||
1426 | + struct target_signal_frame *sf; | ||
1427 | + int sigframe_size, err, i; | ||
1428 | + | ||
1429 | + /* 1. Make sure everything is clean */ | ||
1430 | + //synchronize_user_stack(); | ||
1431 | + | ||
1432 | + sigframe_size = NF_ALIGNEDSZ; | ||
1433 | + | ||
1434 | + sf = (struct target_signal_frame *) | ||
1435 | + get_sigframe(ka, env, sigframe_size); | ||
1436 | + | ||
1437 | +#if 0 | ||
1438 | + if (invalid_frame_pointer(sf, sigframe_size)) | ||
1439 | + goto sigill_and_return; | ||
1440 | +#endif | ||
1441 | + /* 2. Save the current process state */ | ||
1442 | + err = setup___siginfo(&sf->info, env, set->sig[0]); | ||
1443 | + err |= __put_user(0, &sf->extra_size); | ||
1444 | + | ||
1445 | + //err |= save_fpu_state(regs, &sf->fpu_state); | ||
1446 | + //err |= __put_user(&sf->fpu_state, &sf->fpu_save); | ||
1447 | + | ||
1448 | + err |= __put_user(set->sig[0], &sf->info.si_mask); | ||
1449 | + for (i = 0; i < TARGET_NSIG_WORDS - 1; i++) { | ||
1450 | + err |= __put_user(set->sig[i + 1], &sf->extramask[i]); | ||
1451 | + } | ||
1452 | + | ||
1453 | + for (i = 0; i < 7; i++) { | ||
1454 | + err |= __put_user(env->regwptr[i + 8], &sf->ss.locals[i]); | ||
1455 | + } | ||
1456 | + for (i = 0; i < 7; i++) { | ||
1457 | + err |= __put_user(env->regwptr[i + 16], &sf->ss.ins[i]); | ||
1458 | + } | ||
1459 | + //err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP], | ||
1460 | + // sizeof(struct reg_window)); | ||
1461 | + if (err) | ||
1462 | + goto sigsegv; | ||
1463 | + | ||
1464 | + /* 3. signal handler back-trampoline and parameters */ | ||
1465 | + env->regwptr[UREG_FP] = (target_ulong) sf; | ||
1466 | + env->regwptr[UREG_I0] = sig; | ||
1467 | + env->regwptr[UREG_I1] = (target_ulong) &sf->info; | ||
1468 | + env->regwptr[UREG_I2] = (target_ulong) &sf->info; | ||
1469 | + | ||
1470 | + /* 4. signal handler */ | ||
1471 | + env->pc = (unsigned long) ka->sa._sa_handler; | ||
1472 | + env->npc = (env->pc + 4); | ||
1473 | + /* 5. return to kernel instructions */ | ||
1474 | + if (ka->sa.sa_restorer) | ||
1475 | + env->regwptr[UREG_I7] = (unsigned long)ka->sa.sa_restorer; | ||
1476 | + else { | ||
1477 | + env->regwptr[UREG_I7] = (unsigned long)(&(sf->insns[0]) - 2); | ||
1478 | + | ||
1479 | + /* mov __NR_sigreturn, %g1 */ | ||
1480 | + err |= __put_user(0x821020d8, &sf->insns[0]); | ||
1481 | + | ||
1482 | + /* t 0x10 */ | ||
1483 | + err |= __put_user(0x91d02010, &sf->insns[1]); | ||
1484 | + if (err) | ||
1485 | + goto sigsegv; | ||
1486 | + | ||
1487 | + /* Flush instruction space. */ | ||
1488 | + //flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0])); | ||
1489 | + //tb_flush(env); | ||
1490 | + } | ||
1491 | + return; | ||
1492 | + | ||
1493 | +sigill_and_return: | ||
1494 | + force_sig(TARGET_SIGILL); | ||
1495 | +sigsegv: | ||
1496 | + force_sig(TARGET_SIGSEGV); | ||
1497 | +} | ||
1498 | +static inline int | ||
1499 | +restore_fpu_state(CPUState *env, __siginfo_fpu_t *fpu) | ||
1500 | +{ | ||
1501 | + int err; | ||
1502 | +#if 0 | ||
1503 | +#ifdef CONFIG_SMP | ||
1504 | + if (current->flags & PF_USEDFPU) | ||
1505 | + regs->psr &= ~PSR_EF; | ||
1506 | +#else | ||
1507 | + if (current == last_task_used_math) { | ||
1508 | + last_task_used_math = 0; | ||
1509 | + regs->psr &= ~PSR_EF; | ||
1510 | + } | ||
1511 | +#endif | ||
1512 | + current->used_math = 1; | ||
1513 | + current->flags &= ~PF_USEDFPU; | ||
1514 | +#endif | ||
1515 | +#if 0 | ||
1516 | + if (verify_area (VERIFY_READ, fpu, sizeof(*fpu))) | ||
1517 | + return -EFAULT; | ||
1518 | +#endif | ||
1519 | + | ||
1520 | + err = __copy_from_user(&env->fpr[0], &fpu->si_float_regs[0], | ||
1521 | + (sizeof(unsigned long) * 32)); | ||
1522 | + err |= __get_user(env->fsr, &fpu->si_fsr); | ||
1523 | +#if 0 | ||
1524 | + err |= __get_user(current->thread.fpqdepth, &fpu->si_fpqdepth); | ||
1525 | + if (current->thread.fpqdepth != 0) | ||
1526 | + err |= __copy_from_user(¤t->thread.fpqueue[0], | ||
1527 | + &fpu->si_fpqueue[0], | ||
1528 | + ((sizeof(unsigned long) + | ||
1529 | + (sizeof(unsigned long *)))*16)); | ||
1530 | +#endif | ||
1531 | + return err; | ||
1532 | +} | ||
1533 | + | ||
1534 | + | ||
1535 | +static void setup_rt_frame(int sig, struct emulated_sigaction *ka, | ||
1536 | + target_siginfo_t *info, | ||
1537 | + target_sigset_t *set, CPUState *env) | ||
1538 | +{ | ||
1539 | + fprintf(stderr, "setup_rt_frame: not implemented\n"); | ||
1540 | +} | ||
1541 | + | ||
1542 | +long do_sigreturn(CPUState *env) | ||
1543 | +{ | ||
1544 | + struct target_signal_frame *sf; | ||
1545 | + unsigned long up_psr, pc, npc; | ||
1546 | + target_sigset_t set; | ||
1547 | + __siginfo_fpu_t *fpu_save; | ||
1548 | + int err; | ||
1549 | + | ||
1550 | + sf = (struct new_signal_frame *) env->regwptr[UREG_FP]; | ||
1551 | + fprintf(stderr, "sigreturn sf: %lx\n", &sf); | ||
1552 | + | ||
1553 | + /* 1. Make sure we are not getting garbage from the user */ | ||
1554 | +#if 0 | ||
1555 | + if (verify_area (VERIFY_READ, sf, sizeof (*sf))) | ||
1556 | + goto segv_and_exit; | ||
1557 | +#endif | ||
1558 | + | ||
1559 | + if (((uint) sf) & 3) | ||
1560 | + goto segv_and_exit; | ||
1561 | + | ||
1562 | + err = __get_user(pc, &sf->info.si_regs.pc); | ||
1563 | + err |= __get_user(npc, &sf->info.si_regs.npc); | ||
1564 | + | ||
1565 | + fprintf(stderr, "pc: %lx npc %lx\n", pc, npc); | ||
1566 | + if ((pc | npc) & 3) | ||
1567 | + goto segv_and_exit; | ||
1568 | + | ||
1569 | + /* 2. Restore the state */ | ||
1570 | + up_psr = env->psr; | ||
1571 | + //err |= __copy_from_user(regs, &sf->info.si_regs, sizeof (struct pt_regs) | ||
1572 | + //); | ||
1573 | + /* User can only change condition codes and FPU enabling in %psr. */ | ||
1574 | + env->psr = (up_psr & ~(PSR_ICC /* | PSR_EF */)) | ||
1575 | + | (env->psr & (PSR_ICC /* | PSR_EF */)); | ||
1576 | + fprintf(stderr, "psr: %lx\n", env->psr); | ||
1577 | + | ||
1578 | + err |= __get_user(fpu_save, &sf->fpu_save); | ||
1579 | + | ||
1580 | + if (fpu_save) | ||
1581 | + err |= restore_fpu_state(env, fpu_save); | ||
1582 | + | ||
1583 | + /* This is pretty much atomic, no amount locking would prevent | ||
1584 | + * the races which exist anyways. | ||
1585 | + */ | ||
1586 | + err |= __get_user(set.sig[0], &sf->info.si_mask); | ||
1587 | + //err |= __copy_from_user(&set.sig[1], &sf->extramask, | ||
1588 | + // (_NSIG_WORDS-1) * sizeof(unsigned int)); | ||
1589 | + | ||
1590 | + if (err) | ||
1591 | + goto segv_and_exit; | ||
1592 | + | ||
1593 | +#if 0 | ||
1594 | + sigdelsetmask(&set, ~_BLOCKABLE); | ||
1595 | + spin_lock_irq(¤t->sigmask_lock); | ||
1596 | + current->blocked = set; | ||
1597 | + recalc_sigpending(current); | ||
1598 | + spin_unlock_irq(¤t->sigmask_lock); | ||
1599 | +#endif | ||
1600 | + fprintf(stderr, "returning %lx\n", env->regwptr[0]); | ||
1601 | + return env->regwptr[0]; | ||
1602 | + | ||
1603 | +segv_and_exit: | ||
1604 | + force_sig(TARGET_SIGSEGV); | ||
1605 | +} | ||
1606 | + | ||
1607 | +long do_rt_sigreturn(CPUState *env) | ||
1608 | +{ | ||
1609 | + fprintf(stderr, "do_rt_sigreturn: not implemented\n"); | ||
1610 | + return -ENOSYS; | ||
1611 | +} | ||
1612 | + | ||
1613 | + | ||
1274 | #else | 1614 | #else |
1275 | 1615 | ||
1276 | static void setup_frame(int sig, struct emulated_sigaction *ka, | 1616 | static void setup_frame(int sig, struct emulated_sigaction *ka, |
linux-user/syscall_defs.h
@@ -294,6 +294,7 @@ int do_sigaction(int sig, const struct target_sigaction *act, | @@ -294,6 +294,7 @@ int do_sigaction(int sig, const struct target_sigaction *act, | ||
294 | 294 | ||
295 | #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_PPC) | 295 | #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_PPC) |
296 | 296 | ||
297 | +#if !defined(TARGET_SPARC) | ||
297 | #define TARGET_SA_NOCLDSTOP 0x00000001 | 298 | #define TARGET_SA_NOCLDSTOP 0x00000001 |
298 | #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ | 299 | #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ |
299 | #define TARGET_SA_SIGINFO 0x00000004 | 300 | #define TARGET_SA_SIGINFO 0x00000004 |
@@ -302,6 +303,57 @@ int do_sigaction(int sig, const struct target_sigaction *act, | @@ -302,6 +303,57 @@ int do_sigaction(int sig, const struct target_sigaction *act, | ||
302 | #define TARGET_SA_NODEFER 0x40000000 | 303 | #define TARGET_SA_NODEFER 0x40000000 |
303 | #define TARGET_SA_RESETHAND 0x80000000 | 304 | #define TARGET_SA_RESETHAND 0x80000000 |
304 | #define TARGET_SA_RESTORER 0x04000000 | 305 | #define TARGET_SA_RESTORER 0x04000000 |
306 | +#else /* TARGET_SPARC */ | ||
307 | +#define TARGET_SA_NOCLDSTOP 8u | ||
308 | +#define TARGET_SA_NOCLDWAIT 0x100u | ||
309 | +#define TARGET_SA_SIGINFO 0x200u | ||
310 | +#define TARGET_SA_ONSTACK 1u | ||
311 | +#define TARGET_SA_RESTART 2u | ||
312 | +#define TARGET_SA_NODEFER 0x20u | ||
313 | +#define TARGET_SA_RESETHAND 4u | ||
314 | +#endif | ||
315 | + | ||
316 | +#if defined(TARGET_SPARC) | ||
317 | + | ||
318 | +#define TARGET_SIGHUP 1 | ||
319 | +#define TARGET_SIGINT 2 | ||
320 | +#define TARGET_SIGQUIT 3 | ||
321 | +#define TARGET_SIGILL 4 | ||
322 | +#define TARGET_SIGTRAP 5 | ||
323 | +#define TARGET_SIGABRT 6 | ||
324 | +#define TARGET_SIGIOT 6 | ||
325 | +#define TARGET_SIGSTKFLT 7 /* actually EMT */ | ||
326 | +#define TARGET_SIGFPE 8 | ||
327 | +#define TARGET_SIGKILL 9 | ||
328 | +#define TARGET_SIGBUS 10 | ||
329 | +#define TARGET_SIGSEGV 11 | ||
330 | +#define TARGET_SIGSYS 12 | ||
331 | +#define TARGET_SIGPIPE 13 | ||
332 | +#define TARGET_SIGALRM 14 | ||
333 | +#define TARGET_SIGTERM 15 | ||
334 | +#define TARGET_SIGURG 16 | ||
335 | +#define TARGET_SIGSTOP 17 | ||
336 | +#define TARGET_SIGTSTP 18 | ||
337 | +#define TARGET_SIGCONT 19 | ||
338 | +#define TARGET_SIGCHLD 20 | ||
339 | +#define TARGET_SIGTTIN 21 | ||
340 | +#define TARGET_SIGTTOU 22 | ||
341 | +#define TARGET_SIGIO 23 | ||
342 | +#define TARGET_SIGXCPU 24 | ||
343 | +#define TARGET_SIGXFSZ 25 | ||
344 | +#define TARGET_SIGVTALRM 26 | ||
345 | +#define TARGET_SIGPROF 27 | ||
346 | +#define TARGET_SIGWINCH 28 | ||
347 | +#define TARGET_SIGPWR 29 | ||
348 | +#define TARGET_SIGUSR1 30 | ||
349 | +#define TARGET_SIGUSR2 31 | ||
350 | +#define TARGET_SIGRTMIN 32 | ||
351 | + | ||
352 | +#define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ | ||
353 | +#define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ | ||
354 | +#define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ | ||
355 | + | ||
356 | +#else | ||
305 | 357 | ||
306 | #define TARGET_SIGHUP 1 | 358 | #define TARGET_SIGHUP 1 |
307 | #define TARGET_SIGINT 2 | 359 | #define TARGET_SIGINT 2 |
@@ -341,6 +393,8 @@ int do_sigaction(int sig, const struct target_sigaction *act, | @@ -341,6 +393,8 @@ int do_sigaction(int sig, const struct target_sigaction *act, | ||
341 | #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ | 393 | #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ |
342 | #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ | 394 | #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ |
343 | 395 | ||
396 | +#endif | ||
397 | + | ||
344 | struct target_old_sigaction { | 398 | struct target_old_sigaction { |
345 | target_ulong _sa_handler; | 399 | target_ulong _sa_handler; |
346 | target_ulong sa_mask; | 400 | target_ulong sa_mask; |
@@ -359,6 +413,30 @@ typedef union target_sigval { | @@ -359,6 +413,30 @@ typedef union target_sigval { | ||
359 | int sival_int; | 413 | int sival_int; |
360 | target_ulong sival_ptr; | 414 | target_ulong sival_ptr; |
361 | } target_sigval_t; | 415 | } target_sigval_t; |
416 | +#if 0 | ||
417 | +#if defined (TARGET_SPARC) | ||
418 | +typedef struct { | ||
419 | + struct { | ||
420 | + target_ulong psr; | ||
421 | + target_ulong pc; | ||
422 | + target_ulong npc; | ||
423 | + target_ulong y; | ||
424 | + target_ulong u_regs[16]; /* globals and ins */ | ||
425 | + } si_regs; | ||
426 | + int si_mask; | ||
427 | +} __siginfo_t; | ||
428 | + | ||
429 | +typedef struct { | ||
430 | + unsigned long si_float_regs [32]; | ||
431 | + unsigned long si_fsr; | ||
432 | + unsigned long si_fpqdepth; | ||
433 | + struct { | ||
434 | + unsigned long *insn_addr; | ||
435 | + unsigned long insn; | ||
436 | + } si_fpqueue [16]; | ||
437 | +} __siginfo_fpu_t; | ||
438 | +#endif | ||
439 | +#endif | ||
362 | 440 | ||
363 | #define TARGET_SI_MAX_SIZE 128 | 441 | #define TARGET_SI_MAX_SIZE 128 |
364 | #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3) | 442 | #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3) |
@@ -954,6 +1032,24 @@ struct target_stat64 { | @@ -954,6 +1032,24 @@ struct target_stat64 { | ||
954 | #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ | 1032 | #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ |
955 | #define TARGET_O_LARGEFILE 0200000 | 1033 | #define TARGET_O_LARGEFILE 0200000 |
956 | #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ | 1034 | #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ |
1035 | +#elif defined (TARGET_SPARC) | ||
1036 | +#define TARGET_O_RDONLY 0x0000 | ||
1037 | +#define TARGET_O_WRONLY 0x0001 | ||
1038 | +#define TARGET_O_RDWR 0x0002 | ||
1039 | +#define TARGET_O_ACCMODE 0x0003 | ||
1040 | +#define TARGET_O_APPEND 0x0008 | ||
1041 | +#define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ | ||
1042 | +#define TARGET_O_CREAT 0x0200 /* not fcntl */ | ||
1043 | +#define TARGET_O_TRUNC 0x0400 /* not fcntl */ | ||
1044 | +#define TARGET_O_EXCL 0x0800 /* not fcntl */ | ||
1045 | +#define TARGET_O_SYNC 0x2000 | ||
1046 | +#define TARGET_O_NONBLOCK 0x4000 | ||
1047 | +#define TARGET_O_NDELAY (0x0004 | O_NONBLOCK) | ||
1048 | +#define TARGET_O_NOCTTY 0x8000 /* not fcntl */ | ||
1049 | +#define TARGET_O_DIRECTORY 0x10000 /* must be a directory */ | ||
1050 | +#define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */ | ||
1051 | +#define TARGET_O_LARGEFILE 0x40000 | ||
1052 | +#define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ | ||
957 | #else | 1053 | #else |
958 | #define TARGET_O_ACCMODE 0003 | 1054 | #define TARGET_O_ACCMODE 0003 |
959 | #define TARGET_O_RDONLY 00 | 1055 | #define TARGET_O_RDONLY 00 |