diff options
author | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-04 22:23:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-04 22:23:34 -0500 |
commit | 91f433cacc9d1ae95ae46ce26d7bcf3a724c72d0 (patch) | |
tree | 058a5961548d489fdaffdbcfb7b34893946d37cf /arch | |
parent | 15a4cb9c25df05a5d4844e80a1aea83d66165868 (diff) | |
parent | 0004a9dfeaa709a7f853487aba19932c9b1a87c8 (diff) |
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus:
[MIPS] Cleanup memory barriers for weakly ordered systems.
[MIPS] Alchemy: Automatically enable CONFIG_RESOURCES_64BIT for PCI configs.
[MIPS] Unify csum_partial.S
[MIPS] SWARM: Fix a typo in #error directives
[MIPS] Fix atomic.h build errors.
[MIPS] Use SYSVIPC_COMPAT to fix various problems on N32
[MIPS] klconfig add missing bracket
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/Kconfig | 18 | ||||
-rw-r--r-- | arch/mips/kernel/linux32.c | 578 | ||||
-rw-r--r-- | arch/mips/kernel/scall64-n32.S | 14 | ||||
-rw-r--r-- | arch/mips/kernel/smp.c | 6 | ||||
-rw-r--r-- | arch/mips/lib-32/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/lib-32/csum_partial.S | 240 | ||||
-rw-r--r-- | arch/mips/lib-64/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/lib-64/csum_partial.S | 242 | ||||
-rw-r--r-- | arch/mips/lib/Makefile | 4 | ||||
-rw-r--r-- | arch/mips/lib/csum_partial.S | 258 | ||||
-rw-r--r-- | arch/mips/sibyte/swarm/setup.c | 8 |
11 files changed, 317 insertions, 1055 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 27f83e642968..4d64960be035 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -16,6 +16,7 @@ config MIPS_MTX1 | |||
16 | bool "4G Systems MTX-1 board" | 16 | bool "4G Systems MTX-1 board" |
17 | select DMA_NONCOHERENT | 17 | select DMA_NONCOHERENT |
18 | select HW_HAS_PCI | 18 | select HW_HAS_PCI |
19 | select RESOURCES_64BIT if PCI | ||
19 | select SOC_AU1500 | 20 | select SOC_AU1500 |
20 | select SYS_HAS_CPU_MIPS32_R1 | 21 | select SYS_HAS_CPU_MIPS32_R1 |
21 | select SYS_SUPPORTS_LITTLE_ENDIAN | 22 | select SYS_SUPPORTS_LITTLE_ENDIAN |
@@ -32,6 +33,7 @@ config MIPS_PB1000 | |||
32 | select SOC_AU1000 | 33 | select SOC_AU1000 |
33 | select DMA_NONCOHERENT | 34 | select DMA_NONCOHERENT |
34 | select HW_HAS_PCI | 35 | select HW_HAS_PCI |
36 | select RESOURCES_64BIT if PCI | ||
35 | select SWAP_IO_SPACE | 37 | select SWAP_IO_SPACE |
36 | select SYS_HAS_CPU_MIPS32_R1 | 38 | select SYS_HAS_CPU_MIPS32_R1 |
37 | select SYS_SUPPORTS_LITTLE_ENDIAN | 39 | select SYS_SUPPORTS_LITTLE_ENDIAN |
@@ -41,6 +43,7 @@ config MIPS_PB1100 | |||
41 | select SOC_AU1100 | 43 | select SOC_AU1100 |
42 | select DMA_NONCOHERENT | 44 | select DMA_NONCOHERENT |
43 | select HW_HAS_PCI | 45 | select HW_HAS_PCI |
46 | select RESOURCES_64BIT if PCI | ||
44 | select SWAP_IO_SPACE | 47 | select SWAP_IO_SPACE |
45 | select SYS_HAS_CPU_MIPS32_R1 | 48 | select SYS_HAS_CPU_MIPS32_R1 |
46 | select SYS_SUPPORTS_LITTLE_ENDIAN | 49 | select SYS_SUPPORTS_LITTLE_ENDIAN |
@@ -50,6 +53,7 @@ config MIPS_PB1500 | |||
50 | select SOC_AU1500 | 53 | select SOC_AU1500 |
51 | select DMA_NONCOHERENT | 54 | select DMA_NONCOHERENT |
52 | select HW_HAS_PCI | 55 | select HW_HAS_PCI |
56 | select RESOURCES_64BIT if PCI | ||
53 | select SYS_HAS_CPU_MIPS32_R1 | 57 | select SYS_HAS_CPU_MIPS32_R1 |
54 | select SYS_SUPPORTS_LITTLE_ENDIAN | 58 | select SYS_SUPPORTS_LITTLE_ENDIAN |
55 | 59 | ||
@@ -59,6 +63,7 @@ config MIPS_PB1550 | |||
59 | select DMA_NONCOHERENT | 63 | select DMA_NONCOHERENT |
60 | select HW_HAS_PCI | 64 | select HW_HAS_PCI |
61 | select MIPS_DISABLE_OBSOLETE_IDE | 65 | select MIPS_DISABLE_OBSOLETE_IDE |
66 | select RESOURCES_64BIT if PCI | ||
62 | select SYS_HAS_CPU_MIPS32_R1 | 67 | select SYS_HAS_CPU_MIPS32_R1 |
63 | select SYS_SUPPORTS_LITTLE_ENDIAN | 68 | select SYS_SUPPORTS_LITTLE_ENDIAN |
64 | 69 | ||
@@ -67,6 +72,7 @@ config MIPS_PB1200 | |||
67 | select SOC_AU1200 | 72 | select SOC_AU1200 |
68 | select DMA_NONCOHERENT | 73 | select DMA_NONCOHERENT |
69 | select MIPS_DISABLE_OBSOLETE_IDE | 74 | select MIPS_DISABLE_OBSOLETE_IDE |
75 | select RESOURCES_64BIT if PCI | ||
70 | select SYS_HAS_CPU_MIPS32_R1 | 76 | select SYS_HAS_CPU_MIPS32_R1 |
71 | select SYS_SUPPORTS_LITTLE_ENDIAN | 77 | select SYS_SUPPORTS_LITTLE_ENDIAN |
72 | 78 | ||
@@ -75,6 +81,7 @@ config MIPS_DB1000 | |||
75 | select SOC_AU1000 | 81 | select SOC_AU1000 |
76 | select DMA_NONCOHERENT | 82 | select DMA_NONCOHERENT |
77 | select HW_HAS_PCI | 83 | select HW_HAS_PCI |
84 | select RESOURCES_64BIT if PCI | ||
78 | select SYS_HAS_CPU_MIPS32_R1 | 85 | select SYS_HAS_CPU_MIPS32_R1 |
79 | select SYS_SUPPORTS_LITTLE_ENDIAN | 86 | select SYS_SUPPORTS_LITTLE_ENDIAN |
80 | 87 | ||
@@ -91,6 +98,7 @@ config MIPS_DB1500 | |||
91 | select DMA_NONCOHERENT | 98 | select DMA_NONCOHERENT |
92 | select HW_HAS_PCI | 99 | select HW_HAS_PCI |
93 | select MIPS_DISABLE_OBSOLETE_IDE | 100 | select MIPS_DISABLE_OBSOLETE_IDE |
101 | select RESOURCES_64BIT if PCI | ||
94 | select SYS_HAS_CPU_MIPS32_R1 | 102 | select SYS_HAS_CPU_MIPS32_R1 |
95 | select SYS_SUPPORTS_BIG_ENDIAN | 103 | select SYS_SUPPORTS_BIG_ENDIAN |
96 | select SYS_SUPPORTS_LITTLE_ENDIAN | 104 | select SYS_SUPPORTS_LITTLE_ENDIAN |
@@ -101,6 +109,7 @@ config MIPS_DB1550 | |||
101 | select HW_HAS_PCI | 109 | select HW_HAS_PCI |
102 | select DMA_NONCOHERENT | 110 | select DMA_NONCOHERENT |
103 | select MIPS_DISABLE_OBSOLETE_IDE | 111 | select MIPS_DISABLE_OBSOLETE_IDE |
112 | select RESOURCES_64BIT if PCI | ||
104 | select SYS_HAS_CPU_MIPS32_R1 | 113 | select SYS_HAS_CPU_MIPS32_R1 |
105 | select SYS_SUPPORTS_LITTLE_ENDIAN | 114 | select SYS_SUPPORTS_LITTLE_ENDIAN |
106 | 115 | ||
@@ -1268,6 +1277,7 @@ config CPU_RM9000 | |||
1268 | select CPU_SUPPORTS_32BIT_KERNEL | 1277 | select CPU_SUPPORTS_32BIT_KERNEL |
1269 | select CPU_SUPPORTS_64BIT_KERNEL | 1278 | select CPU_SUPPORTS_64BIT_KERNEL |
1270 | select CPU_SUPPORTS_HIGHMEM | 1279 | select CPU_SUPPORTS_HIGHMEM |
1280 | select WEAK_ORDERING | ||
1271 | 1281 | ||
1272 | config CPU_SB1 | 1282 | config CPU_SB1 |
1273 | bool "SB1" | 1283 | bool "SB1" |
@@ -1276,6 +1286,7 @@ config CPU_SB1 | |||
1276 | select CPU_SUPPORTS_32BIT_KERNEL | 1286 | select CPU_SUPPORTS_32BIT_KERNEL |
1277 | select CPU_SUPPORTS_64BIT_KERNEL | 1287 | select CPU_SUPPORTS_64BIT_KERNEL |
1278 | select CPU_SUPPORTS_HIGHMEM | 1288 | select CPU_SUPPORTS_HIGHMEM |
1289 | select WEAK_ORDERING | ||
1279 | 1290 | ||
1280 | endchoice | 1291 | endchoice |
1281 | 1292 | ||
@@ -1336,6 +1347,8 @@ config SYS_HAS_CPU_RM9000 | |||
1336 | config SYS_HAS_CPU_SB1 | 1347 | config SYS_HAS_CPU_SB1 |
1337 | bool | 1348 | bool |
1338 | 1349 | ||
1350 | config WEAK_ORDERING | ||
1351 | bool | ||
1339 | endmenu | 1352 | endmenu |
1340 | 1353 | ||
1341 | # | 1354 | # |
@@ -1940,6 +1953,11 @@ config COMPAT | |||
1940 | depends on MIPS32_COMPAT | 1953 | depends on MIPS32_COMPAT |
1941 | default y | 1954 | default y |
1942 | 1955 | ||
1956 | config SYSVIPC_COMPAT | ||
1957 | bool | ||
1958 | depends on COMPAT && SYSVIPC | ||
1959 | default y | ||
1960 | |||
1943 | config MIPS32_O32 | 1961 | config MIPS32_O32 |
1944 | bool "Kernel support for o32 binaries" | 1962 | bool "Kernel support for o32 binaries" |
1945 | depends on MIPS32_COMPAT | 1963 | depends on MIPS32_COMPAT |
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 7a3ebbeba1f3..b061c9aa6302 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
@@ -382,531 +382,6 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, | |||
382 | return ret; | 382 | return ret; |
383 | } | 383 | } |
384 | 384 | ||
385 | struct msgbuf32 { s32 mtype; char mtext[1]; }; | ||
386 | |||
387 | struct ipc_perm32 | ||
388 | { | ||
389 | key_t key; | ||
390 | __compat_uid_t uid; | ||
391 | __compat_gid_t gid; | ||
392 | __compat_uid_t cuid; | ||
393 | __compat_gid_t cgid; | ||
394 | compat_mode_t mode; | ||
395 | unsigned short seq; | ||
396 | }; | ||
397 | |||
398 | struct ipc64_perm32 { | ||
399 | key_t key; | ||
400 | __compat_uid_t uid; | ||
401 | __compat_gid_t gid; | ||
402 | __compat_uid_t cuid; | ||
403 | __compat_gid_t cgid; | ||
404 | compat_mode_t mode; | ||
405 | unsigned short seq; | ||
406 | unsigned short __pad1; | ||
407 | unsigned int __unused1; | ||
408 | unsigned int __unused2; | ||
409 | }; | ||
410 | |||
411 | struct semid_ds32 { | ||
412 | struct ipc_perm32 sem_perm; /* permissions .. see ipc.h */ | ||
413 | compat_time_t sem_otime; /* last semop time */ | ||
414 | compat_time_t sem_ctime; /* last change time */ | ||
415 | u32 sem_base; /* ptr to first semaphore in array */ | ||
416 | u32 sem_pending; /* pending operations to be processed */ | ||
417 | u32 sem_pending_last; /* last pending operation */ | ||
418 | u32 undo; /* undo requests on this array */ | ||
419 | unsigned short sem_nsems; /* no. of semaphores in array */ | ||
420 | }; | ||
421 | |||
422 | struct semid64_ds32 { | ||
423 | struct ipc64_perm32 sem_perm; | ||
424 | compat_time_t sem_otime; | ||
425 | compat_time_t sem_ctime; | ||
426 | unsigned int sem_nsems; | ||
427 | unsigned int __unused1; | ||
428 | unsigned int __unused2; | ||
429 | }; | ||
430 | |||
431 | struct msqid_ds32 | ||
432 | { | ||
433 | struct ipc_perm32 msg_perm; | ||
434 | u32 msg_first; | ||
435 | u32 msg_last; | ||
436 | compat_time_t msg_stime; | ||
437 | compat_time_t msg_rtime; | ||
438 | compat_time_t msg_ctime; | ||
439 | u32 wwait; | ||
440 | u32 rwait; | ||
441 | unsigned short msg_cbytes; | ||
442 | unsigned short msg_qnum; | ||
443 | unsigned short msg_qbytes; | ||
444 | compat_ipc_pid_t msg_lspid; | ||
445 | compat_ipc_pid_t msg_lrpid; | ||
446 | }; | ||
447 | |||
448 | struct msqid64_ds32 { | ||
449 | struct ipc64_perm32 msg_perm; | ||
450 | compat_time_t msg_stime; | ||
451 | unsigned int __unused1; | ||
452 | compat_time_t msg_rtime; | ||
453 | unsigned int __unused2; | ||
454 | compat_time_t msg_ctime; | ||
455 | unsigned int __unused3; | ||
456 | unsigned int msg_cbytes; | ||
457 | unsigned int msg_qnum; | ||
458 | unsigned int msg_qbytes; | ||
459 | compat_pid_t msg_lspid; | ||
460 | compat_pid_t msg_lrpid; | ||
461 | unsigned int __unused4; | ||
462 | unsigned int __unused5; | ||
463 | }; | ||
464 | |||
465 | struct shmid_ds32 { | ||
466 | struct ipc_perm32 shm_perm; | ||
467 | int shm_segsz; | ||
468 | compat_time_t shm_atime; | ||
469 | compat_time_t shm_dtime; | ||
470 | compat_time_t shm_ctime; | ||
471 | compat_ipc_pid_t shm_cpid; | ||
472 | compat_ipc_pid_t shm_lpid; | ||
473 | unsigned short shm_nattch; | ||
474 | }; | ||
475 | |||
476 | struct shmid64_ds32 { | ||
477 | struct ipc64_perm32 shm_perm; | ||
478 | compat_size_t shm_segsz; | ||
479 | compat_time_t shm_atime; | ||
480 | compat_time_t shm_dtime; | ||
481 | compat_time_t shm_ctime; | ||
482 | compat_pid_t shm_cpid; | ||
483 | compat_pid_t shm_lpid; | ||
484 | unsigned int shm_nattch; | ||
485 | unsigned int __unused1; | ||
486 | unsigned int __unused2; | ||
487 | }; | ||
488 | |||
489 | struct ipc_kludge32 { | ||
490 | u32 msgp; | ||
491 | s32 msgtyp; | ||
492 | }; | ||
493 | |||
494 | static int | ||
495 | do_sys32_semctl(int first, int second, int third, void __user *uptr) | ||
496 | { | ||
497 | union semun fourth; | ||
498 | u32 pad; | ||
499 | int err, err2; | ||
500 | struct semid64_ds s; | ||
501 | mm_segment_t old_fs; | ||
502 | |||
503 | if (!uptr) | ||
504 | return -EINVAL; | ||
505 | err = -EFAULT; | ||
506 | if (get_user (pad, (u32 __user *)uptr)) | ||
507 | return err; | ||
508 | if ((third & ~IPC_64) == SETVAL) | ||
509 | fourth.val = (int)pad; | ||
510 | else | ||
511 | fourth.__pad = (void __user *)A(pad); | ||
512 | switch (third & ~IPC_64) { | ||
513 | case IPC_INFO: | ||
514 | case IPC_RMID: | ||
515 | case IPC_SET: | ||
516 | case SEM_INFO: | ||
517 | case GETVAL: | ||
518 | case GETPID: | ||
519 | case GETNCNT: | ||
520 | case GETZCNT: | ||
521 | case GETALL: | ||
522 | case SETVAL: | ||
523 | case SETALL: | ||
524 | err = sys_semctl (first, second, third, fourth); | ||
525 | break; | ||
526 | |||
527 | case IPC_STAT: | ||
528 | case SEM_STAT: | ||
529 | fourth.__pad = (struct semid64_ds __user *)&s; | ||
530 | old_fs = get_fs(); | ||
531 | set_fs(KERNEL_DS); | ||
532 | err = sys_semctl(first, second, third | IPC_64, fourth); | ||
533 | set_fs(old_fs); | ||
534 | |||
535 | if (third & IPC_64) { | ||
536 | struct semid64_ds32 __user *usp64 = (struct semid64_ds32 __user *) A(pad); | ||
537 | |||
538 | if (!access_ok(VERIFY_WRITE, usp64, sizeof(*usp64))) { | ||
539 | err = -EFAULT; | ||
540 | break; | ||
541 | } | ||
542 | err2 = __put_user(s.sem_perm.key, &usp64->sem_perm.key); | ||
543 | err2 |= __put_user(s.sem_perm.uid, &usp64->sem_perm.uid); | ||
544 | err2 |= __put_user(s.sem_perm.gid, &usp64->sem_perm.gid); | ||
545 | err2 |= __put_user(s.sem_perm.cuid, &usp64->sem_perm.cuid); | ||
546 | err2 |= __put_user(s.sem_perm.cgid, &usp64->sem_perm.cgid); | ||
547 | err2 |= __put_user(s.sem_perm.mode, &usp64->sem_perm.mode); | ||
548 | err2 |= __put_user(s.sem_perm.seq, &usp64->sem_perm.seq); | ||
549 | err2 |= __put_user(s.sem_otime, &usp64->sem_otime); | ||
550 | err2 |= __put_user(s.sem_ctime, &usp64->sem_ctime); | ||
551 | err2 |= __put_user(s.sem_nsems, &usp64->sem_nsems); | ||
552 | } else { | ||
553 | struct semid_ds32 __user *usp32 = (struct semid_ds32 __user *) A(pad); | ||
554 | |||
555 | if (!access_ok(VERIFY_WRITE, usp32, sizeof(*usp32))) { | ||
556 | err = -EFAULT; | ||
557 | break; | ||
558 | } | ||
559 | err2 = __put_user(s.sem_perm.key, &usp32->sem_perm.key); | ||
560 | err2 |= __put_user(s.sem_perm.uid, &usp32->sem_perm.uid); | ||
561 | err2 |= __put_user(s.sem_perm.gid, &usp32->sem_perm.gid); | ||
562 | err2 |= __put_user(s.sem_perm.cuid, &usp32->sem_perm.cuid); | ||
563 | err2 |= __put_user(s.sem_perm.cgid, &usp32->sem_perm.cgid); | ||
564 | err2 |= __put_user(s.sem_perm.mode, &usp32->sem_perm.mode); | ||
565 | err2 |= __put_user(s.sem_perm.seq, &usp32->sem_perm.seq); | ||
566 | err2 |= __put_user(s.sem_otime, &usp32->sem_otime); | ||
567 | err2 |= __put_user(s.sem_ctime, &usp32->sem_ctime); | ||
568 | err2 |= __put_user(s.sem_nsems, &usp32->sem_nsems); | ||
569 | } | ||
570 | if (err2) | ||
571 | err = -EFAULT; | ||
572 | break; | ||
573 | |||
574 | default: | ||
575 | err = - EINVAL; | ||
576 | break; | ||
577 | } | ||
578 | |||
579 | return err; | ||
580 | } | ||
581 | |||
582 | static int | ||
583 | do_sys32_msgsnd (int first, int second, int third, void __user *uptr) | ||
584 | { | ||
585 | struct msgbuf32 __user *up = (struct msgbuf32 __user *)uptr; | ||
586 | struct msgbuf *p; | ||
587 | mm_segment_t old_fs; | ||
588 | int err; | ||
589 | |||
590 | if (second < 0) | ||
591 | return -EINVAL; | ||
592 | p = kmalloc (second + sizeof (struct msgbuf) | ||
593 | + 4, GFP_USER); | ||
594 | if (!p) | ||
595 | return -ENOMEM; | ||
596 | err = get_user (p->mtype, &up->mtype); | ||
597 | if (err) | ||
598 | goto out; | ||
599 | err |= __copy_from_user (p->mtext, &up->mtext, second); | ||
600 | if (err) | ||
601 | goto out; | ||
602 | old_fs = get_fs (); | ||
603 | set_fs (KERNEL_DS); | ||
604 | err = sys_msgsnd (first, (struct msgbuf __user *)p, second, third); | ||
605 | set_fs (old_fs); | ||
606 | out: | ||
607 | kfree (p); | ||
608 | |||
609 | return err; | ||
610 | } | ||
611 | |||
612 | static int | ||
613 | do_sys32_msgrcv (int first, int second, int msgtyp, int third, | ||
614 | int version, void __user *uptr) | ||
615 | { | ||
616 | struct msgbuf32 __user *up; | ||
617 | struct msgbuf *p; | ||
618 | mm_segment_t old_fs; | ||
619 | int err; | ||
620 | |||
621 | if (!version) { | ||
622 | struct ipc_kludge32 __user *uipck = (struct ipc_kludge32 __user *)uptr; | ||
623 | struct ipc_kludge32 ipck; | ||
624 | |||
625 | err = -EINVAL; | ||
626 | if (!uptr) | ||
627 | goto out; | ||
628 | err = -EFAULT; | ||
629 | if (copy_from_user (&ipck, uipck, sizeof (struct ipc_kludge32))) | ||
630 | goto out; | ||
631 | uptr = (void __user *)AA(ipck.msgp); | ||
632 | msgtyp = ipck.msgtyp; | ||
633 | } | ||
634 | |||
635 | if (second < 0) | ||
636 | return -EINVAL; | ||
637 | err = -ENOMEM; | ||
638 | p = kmalloc (second + sizeof (struct msgbuf) + 4, GFP_USER); | ||
639 | if (!p) | ||
640 | goto out; | ||
641 | old_fs = get_fs (); | ||
642 | set_fs (KERNEL_DS); | ||
643 | err = sys_msgrcv (first, (struct msgbuf __user *)p, second + 4, msgtyp, third); | ||
644 | set_fs (old_fs); | ||
645 | if (err < 0) | ||
646 | goto free_then_out; | ||
647 | up = (struct msgbuf32 __user *)uptr; | ||
648 | if (put_user (p->mtype, &up->mtype) || | ||
649 | __copy_to_user (&up->mtext, p->mtext, err)) | ||
650 | err = -EFAULT; | ||
651 | free_then_out: | ||
652 | kfree (p); | ||
653 | out: | ||
654 | return err; | ||
655 | } | ||
656 | |||
657 | static int | ||
658 | do_sys32_msgctl (int first, int second, void __user *uptr) | ||
659 | { | ||
660 | int err = -EINVAL, err2; | ||
661 | struct msqid64_ds m; | ||
662 | struct msqid_ds32 __user *up32 = (struct msqid_ds32 __user *)uptr; | ||
663 | struct msqid64_ds32 __user *up64 = (struct msqid64_ds32 __user *)uptr; | ||
664 | mm_segment_t old_fs; | ||
665 | |||
666 | switch (second & ~IPC_64) { | ||
667 | case IPC_INFO: | ||
668 | case IPC_RMID: | ||
669 | case MSG_INFO: | ||
670 | err = sys_msgctl (first, second, (struct msqid_ds __user *)uptr); | ||
671 | break; | ||
672 | |||
673 | case IPC_SET: | ||
674 | if (second & IPC_64) { | ||
675 | if (!access_ok(VERIFY_READ, up64, sizeof(*up64))) { | ||
676 | err = -EFAULT; | ||
677 | break; | ||
678 | } | ||
679 | err = __get_user(m.msg_perm.uid, &up64->msg_perm.uid); | ||
680 | err |= __get_user(m.msg_perm.gid, &up64->msg_perm.gid); | ||
681 | err |= __get_user(m.msg_perm.mode, &up64->msg_perm.mode); | ||
682 | err |= __get_user(m.msg_qbytes, &up64->msg_qbytes); | ||
683 | } else { | ||
684 | if (!access_ok(VERIFY_READ, up32, sizeof(*up32))) { | ||
685 | err = -EFAULT; | ||
686 | break; | ||
687 | } | ||
688 | err = __get_user(m.msg_perm.uid, &up32->msg_perm.uid); | ||
689 | err |= __get_user(m.msg_perm.gid, &up32->msg_perm.gid); | ||
690 | err |= __get_user(m.msg_perm.mode, &up32->msg_perm.mode); | ||
691 | err |= __get_user(m.msg_qbytes, &up32->msg_qbytes); | ||
692 | } | ||
693 | if (err) | ||
694 | break; | ||
695 | old_fs = get_fs(); | ||
696 | set_fs(KERNEL_DS); | ||
697 | err = sys_msgctl(first, second | IPC_64, (struct msqid_ds __user *)&m); | ||
698 | set_fs(old_fs); | ||
699 | break; | ||
700 | |||
701 | case IPC_STAT: | ||
702 | case MSG_STAT: | ||
703 | old_fs = get_fs(); | ||
704 | set_fs(KERNEL_DS); | ||
705 | err = sys_msgctl(first, second | IPC_64, (struct msqid_ds __user *)&m); | ||
706 | set_fs(old_fs); | ||
707 | if (second & IPC_64) { | ||
708 | if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) { | ||
709 | err = -EFAULT; | ||
710 | break; | ||
711 | } | ||
712 | err2 = __put_user(m.msg_perm.key, &up64->msg_perm.key); | ||
713 | err2 |= __put_user(m.msg_perm.uid, &up64->msg_perm.uid); | ||
714 | err2 |= __put_user(m.msg_perm.gid, &up64->msg_perm.gid); | ||
715 | err2 |= __put_user(m.msg_perm.cuid, &up64->msg_perm.cuid); | ||
716 | err2 |= __put_user(m.msg_perm.cgid, &up64->msg_perm.cgid); | ||
717 | err2 |= __put_user(m.msg_perm.mode, &up64->msg_perm.mode); | ||
718 | err2 |= __put_user(m.msg_perm.seq, &up64->msg_perm.seq); | ||
719 | err2 |= __put_user(m.msg_stime, &up64->msg_stime); | ||
720 | err2 |= __put_user(m.msg_rtime, &up64->msg_rtime); | ||
721 | err2 |= __put_user(m.msg_ctime, &up64->msg_ctime); | ||
722 | err2 |= __put_user(m.msg_cbytes, &up64->msg_cbytes); | ||
723 | err2 |= __put_user(m.msg_qnum, &up64->msg_qnum); | ||
724 | err2 |= __put_user(m.msg_qbytes, &up64->msg_qbytes); | ||
725 | err2 |= __put_user(m.msg_lspid, &up64->msg_lspid); | ||
726 | err2 |= __put_user(m.msg_lrpid, &up64->msg_lrpid); | ||
727 | if (err2) | ||
728 | err = -EFAULT; | ||
729 | } else { | ||
730 | if (!access_ok(VERIFY_WRITE, up32, sizeof(*up32))) { | ||
731 | err = -EFAULT; | ||
732 | break; | ||
733 | } | ||
734 | err2 = __put_user(m.msg_perm.key, &up32->msg_perm.key); | ||
735 | err2 |= __put_user(m.msg_perm.uid, &up32->msg_perm.uid); | ||
736 | err2 |= __put_user(m.msg_perm.gid, &up32->msg_perm.gid); | ||
737 | err2 |= __put_user(m.msg_perm.cuid, &up32->msg_perm.cuid); | ||
738 | err2 |= __put_user(m.msg_perm.cgid, &up32->msg_perm.cgid); | ||
739 | err2 |= __put_user(m.msg_perm.mode, &up32->msg_perm.mode); | ||
740 | err2 |= __put_user(m.msg_perm.seq, &up32->msg_perm.seq); | ||
741 | err2 |= __put_user(m.msg_stime, &up32->msg_stime); | ||
742 | err2 |= __put_user(m.msg_rtime, &up32->msg_rtime); | ||
743 | err2 |= __put_user(m.msg_ctime, &up32->msg_ctime); | ||
744 | err2 |= __put_user(m.msg_cbytes, &up32->msg_cbytes); | ||
745 | err2 |= __put_user(m.msg_qnum, &up32->msg_qnum); | ||
746 | err2 |= __put_user(m.msg_qbytes, &up32->msg_qbytes); | ||
747 | err2 |= __put_user(m.msg_lspid, &up32->msg_lspid); | ||
748 | err2 |= __put_user(m.msg_lrpid, &up32->msg_lrpid); | ||
749 | if (err2) | ||
750 | err = -EFAULT; | ||
751 | } | ||
752 | break; | ||
753 | } | ||
754 | |||
755 | return err; | ||
756 | } | ||
757 | |||
758 | static int | ||
759 | do_sys32_shmat (int first, int second, int third, int version, void __user *uptr) | ||
760 | { | ||
761 | unsigned long raddr; | ||
762 | u32 __user *uaddr = (u32 __user *)A((u32)third); | ||
763 | int err = -EINVAL; | ||
764 | |||
765 | if (version == 1) | ||
766 | return err; | ||
767 | err = do_shmat (first, uptr, second, &raddr); | ||
768 | if (err) | ||
769 | return err; | ||
770 | err = put_user (raddr, uaddr); | ||
771 | return err; | ||
772 | } | ||
773 | |||
774 | struct shm_info32 { | ||
775 | int used_ids; | ||
776 | u32 shm_tot, shm_rss, shm_swp; | ||
777 | u32 swap_attempts, swap_successes; | ||
778 | }; | ||
779 | |||
780 | static int | ||
781 | do_sys32_shmctl (int first, int second, void __user *uptr) | ||
782 | { | ||
783 | struct shmid64_ds32 __user *up64 = (struct shmid64_ds32 __user *)uptr; | ||
784 | struct shmid_ds32 __user *up32 = (struct shmid_ds32 __user *)uptr; | ||
785 | struct shm_info32 __user *uip = (struct shm_info32 __user *)uptr; | ||
786 | int err = -EFAULT, err2; | ||
787 | struct shmid64_ds s64; | ||
788 | mm_segment_t old_fs; | ||
789 | struct shm_info si; | ||
790 | struct shmid_ds s; | ||
791 | |||
792 | switch (second & ~IPC_64) { | ||
793 | case IPC_INFO: | ||
794 | second = IPC_INFO; /* So that we don't have to translate it */ | ||
795 | case IPC_RMID: | ||
796 | case SHM_LOCK: | ||
797 | case SHM_UNLOCK: | ||
798 | err = sys_shmctl(first, second, (struct shmid_ds __user *)uptr); | ||
799 | break; | ||
800 | case IPC_SET: | ||
801 | if (second & IPC_64) { | ||
802 | err = get_user(s.shm_perm.uid, &up64->shm_perm.uid); | ||
803 | err |= get_user(s.shm_perm.gid, &up64->shm_perm.gid); | ||
804 | err |= get_user(s.shm_perm.mode, &up64->shm_perm.mode); | ||
805 | } else { | ||
806 | err = get_user(s.shm_perm.uid, &up32->shm_perm.uid); | ||
807 | err |= get_user(s.shm_perm.gid, &up32->shm_perm.gid); | ||
808 | err |= get_user(s.shm_perm.mode, &up32->shm_perm.mode); | ||
809 | } | ||
810 | if (err) | ||
811 | break; | ||
812 | old_fs = get_fs(); | ||
813 | set_fs(KERNEL_DS); | ||
814 | err = sys_shmctl(first, second & ~IPC_64, (struct shmid_ds __user *)&s); | ||
815 | set_fs(old_fs); | ||
816 | break; | ||
817 | |||
818 | case IPC_STAT: | ||
819 | case SHM_STAT: | ||
820 | old_fs = get_fs(); | ||
821 | set_fs(KERNEL_DS); | ||
822 | err = sys_shmctl(first, second | IPC_64, (void __user *) &s64); | ||
823 | set_fs(old_fs); | ||
824 | if (err < 0) | ||
825 | break; | ||
826 | if (second & IPC_64) { | ||
827 | if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) { | ||
828 | err = -EFAULT; | ||
829 | break; | ||
830 | } | ||
831 | err2 = __put_user(s64.shm_perm.key, &up64->shm_perm.key); | ||
832 | err2 |= __put_user(s64.shm_perm.uid, &up64->shm_perm.uid); | ||
833 | err2 |= __put_user(s64.shm_perm.gid, &up64->shm_perm.gid); | ||
834 | err2 |= __put_user(s64.shm_perm.cuid, &up64->shm_perm.cuid); | ||
835 | err2 |= __put_user(s64.shm_perm.cgid, &up64->shm_perm.cgid); | ||
836 | err2 |= __put_user(s64.shm_perm.mode, &up64->shm_perm.mode); | ||
837 | err2 |= __put_user(s64.shm_perm.seq, &up64->shm_perm.seq); | ||
838 | err2 |= __put_user(s64.shm_atime, &up64->shm_atime); | ||
839 | err2 |= __put_user(s64.shm_dtime, &up64->shm_dtime); | ||
840 | err2 |= __put_user(s64.shm_ctime, &up64->shm_ctime); | ||
841 | err2 |= __put_user(s64.shm_segsz, &up64->shm_segsz); | ||
842 | err2 |= __put_user(s64.shm_nattch, &up64->shm_nattch); | ||
843 | err2 |= __put_user(s64.shm_cpid, &up64->shm_cpid); | ||
844 | err2 |= __put_user(s64.shm_lpid, &up64->shm_lpid); | ||
845 | } else { | ||
846 | if (!access_ok(VERIFY_WRITE, up32, sizeof(*up32))) { | ||
847 | err = -EFAULT; | ||
848 | break; | ||
849 | } | ||
850 | err2 = __put_user(s64.shm_perm.key, &up32->shm_perm.key); | ||
851 | err2 |= __put_user(s64.shm_perm.uid, &up32->shm_perm.uid); | ||
852 | err2 |= __put_user(s64.shm_perm.gid, &up32->shm_perm.gid); | ||
853 | err2 |= __put_user(s64.shm_perm.cuid, &up32->shm_perm.cuid); | ||
854 | err2 |= __put_user(s64.shm_perm.cgid, &up32->shm_perm.cgid); | ||
855 | err2 |= __put_user(s64.shm_perm.mode, &up32->shm_perm.mode); | ||
856 | err2 |= __put_user(s64.shm_perm.seq, &up32->shm_perm.seq); | ||
857 | err2 |= __put_user(s64.shm_atime, &up32->shm_atime); | ||
858 | err2 |= __put_user(s64.shm_dtime, &up32->shm_dtime); | ||
859 | err2 |= __put_user(s64.shm_ctime, &up32->shm_ctime); | ||
860 | err2 |= __put_user(s64.shm_segsz, &up32->shm_segsz); | ||
861 | err2 |= __put_user(s64.shm_nattch, &up32->shm_nattch); | ||
862 | err2 |= __put_user(s64.shm_cpid, &up32->shm_cpid); | ||
863 | err2 |= __put_user(s64.shm_lpid, &up32->shm_lpid); | ||
864 | } | ||
865 | if (err2) | ||
866 | err = -EFAULT; | ||
867 | break; | ||
868 | |||
869 | case SHM_INFO: | ||
870 | old_fs = get_fs(); | ||
871 | set_fs(KERNEL_DS); | ||
872 | err = sys_shmctl(first, second, (void __user *)&si); | ||
873 | set_fs(old_fs); | ||
874 | if (err < 0) | ||
875 | break; | ||
876 | err2 = put_user(si.used_ids, &uip->used_ids); | ||
877 | err2 |= __put_user(si.shm_tot, &uip->shm_tot); | ||
878 | err2 |= __put_user(si.shm_rss, &uip->shm_rss); | ||
879 | err2 |= __put_user(si.shm_swp, &uip->shm_swp); | ||
880 | err2 |= __put_user(si.swap_attempts, &uip->swap_attempts); | ||
881 | err2 |= __put_user (si.swap_successes, &uip->swap_successes); | ||
882 | if (err2) | ||
883 | err = -EFAULT; | ||
884 | break; | ||
885 | |||
886 | default: | ||
887 | err = -EINVAL; | ||
888 | break; | ||
889 | } | ||
890 | |||
891 | return err; | ||
892 | } | ||
893 | |||
894 | static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems, | ||
895 | const struct compat_timespec __user *timeout32) | ||
896 | { | ||
897 | struct compat_timespec t32; | ||
898 | struct timespec __user *t64 = compat_alloc_user_space(sizeof(*t64)); | ||
899 | |||
900 | if (copy_from_user(&t32, timeout32, sizeof(t32))) | ||
901 | return -EFAULT; | ||
902 | |||
903 | if (put_user(t32.tv_sec, &t64->tv_sec) || | ||
904 | put_user(t32.tv_nsec, &t64->tv_nsec)) | ||
905 | return -EFAULT; | ||
906 | |||
907 | return sys_semtimedop(semid, tsems, nsems, t64); | ||
908 | } | ||
909 | |||
910 | asmlinkage long | 385 | asmlinkage long |
911 | sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) | 386 | sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) |
912 | { | 387 | { |
@@ -918,48 +393,43 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) | |||
918 | switch (call) { | 393 | switch (call) { |
919 | case SEMOP: | 394 | case SEMOP: |
920 | /* struct sembuf is the same on 32 and 64bit :)) */ | 395 | /* struct sembuf is the same on 32 and 64bit :)) */ |
921 | err = sys_semtimedop (first, (struct sembuf __user *)AA(ptr), second, | 396 | err = sys_semtimedop(first, compat_ptr(ptr), second, NULL); |
922 | NULL); | ||
923 | break; | 397 | break; |
924 | case SEMTIMEDOP: | 398 | case SEMTIMEDOP: |
925 | err = sys32_semtimedop (first, (struct sembuf __user *)AA(ptr), second, | 399 | err = compat_sys_semtimedop(first, compat_ptr(ptr), second, |
926 | (const struct compat_timespec __user *)AA(fifth)); | 400 | compat_ptr(fifth)); |
927 | break; | 401 | break; |
928 | case SEMGET: | 402 | case SEMGET: |
929 | err = sys_semget (first, second, third); | 403 | err = sys_semget(first, second, third); |
930 | break; | 404 | break; |
931 | case SEMCTL: | 405 | case SEMCTL: |
932 | err = do_sys32_semctl (first, second, third, | 406 | err = compat_sys_semctl(first, second, third, compat_ptr(ptr)); |
933 | (void __user *)AA(ptr)); | ||
934 | break; | 407 | break; |
935 | |||
936 | case MSGSND: | 408 | case MSGSND: |
937 | err = do_sys32_msgsnd (first, second, third, | 409 | err = compat_sys_msgsnd(first, second, third, compat_ptr(ptr)); |
938 | (void __user *)AA(ptr)); | ||
939 | break; | 410 | break; |
940 | case MSGRCV: | 411 | case MSGRCV: |
941 | err = do_sys32_msgrcv (first, second, fifth, third, | 412 | err = compat_sys_msgrcv(first, second, fifth, third, |
942 | version, (void __user *)AA(ptr)); | 413 | version, compat_ptr(ptr)); |
943 | break; | 414 | break; |
944 | case MSGGET: | 415 | case MSGGET: |
945 | err = sys_msgget ((key_t) first, second); | 416 | err = sys_msgget((key_t) first, second); |
946 | break; | 417 | break; |
947 | case MSGCTL: | 418 | case MSGCTL: |
948 | err = do_sys32_msgctl (first, second, (void __user *)AA(ptr)); | 419 | err = compat_sys_msgctl(first, second, compat_ptr(ptr)); |
949 | break; | 420 | break; |
950 | |||
951 | case SHMAT: | 421 | case SHMAT: |
952 | err = do_sys32_shmat (first, second, third, | 422 | err = compat_sys_shmat(first, second, third, version, |
953 | version, (void __user *)AA(ptr)); | 423 | compat_ptr(ptr)); |
954 | break; | 424 | break; |
955 | case SHMDT: | 425 | case SHMDT: |
956 | err = sys_shmdt ((char __user *)A(ptr)); | 426 | err = sys_shmdt(compat_ptr(ptr)); |
957 | break; | 427 | break; |
958 | case SHMGET: | 428 | case SHMGET: |
959 | err = sys_shmget (first, (unsigned)second, third); | 429 | err = sys_shmget(first, (unsigned)second, third); |
960 | break; | 430 | break; |
961 | case SHMCTL: | 431 | case SHMCTL: |
962 | err = do_sys32_shmctl (first, second, (void __user *)AA(ptr)); | 432 | err = compat_sys_shmctl(first, second, compat_ptr(ptr)); |
963 | break; | 433 | break; |
964 | default: | 434 | default: |
965 | err = -EINVAL; | 435 | err = -EINVAL; |
@@ -969,18 +439,16 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) | |||
969 | return err; | 439 | return err; |
970 | } | 440 | } |
971 | 441 | ||
972 | asmlinkage long sys32_shmat(int shmid, char __user *shmaddr, | 442 | #ifdef CONFIG_MIPS32_N32 |
973 | int shmflg, int32_t __user *addr) | 443 | asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, union semun arg) |
974 | { | 444 | { |
975 | unsigned long raddr; | 445 | /* compat_sys_semctl expects a pointer to union semun */ |
976 | int err; | 446 | u32 __user *uptr = compat_alloc_user_space(sizeof(u32)); |
977 | 447 | if (put_user(ptr_to_compat(arg.__pad), uptr)) | |
978 | err = do_shmat(shmid, shmaddr, shmflg, &raddr); | 448 | return -EFAULT; |
979 | if (err) | 449 | return compat_sys_semctl(semid, semnum, cmd, uptr); |
980 | return err; | ||
981 | |||
982 | return put_user(raddr, addr); | ||
983 | } | 450 | } |
451 | #endif | ||
984 | 452 | ||
985 | struct sysctl_args32 | 453 | struct sysctl_args32 |
986 | { | 454 | { |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 5b18f265d75b..34567d81f940 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -149,8 +149,8 @@ EXPORT(sysn32_call_table) | |||
149 | PTR sys_mincore | 149 | PTR sys_mincore |
150 | PTR sys_madvise | 150 | PTR sys_madvise |
151 | PTR sys_shmget | 151 | PTR sys_shmget |
152 | PTR sys32_shmat | 152 | PTR sys_shmat |
153 | PTR sys_shmctl /* 6030 */ | 153 | PTR compat_sys_shmctl /* 6030 */ |
154 | PTR sys_dup | 154 | PTR sys_dup |
155 | PTR sys_dup2 | 155 | PTR sys_dup2 |
156 | PTR sys_pause | 156 | PTR sys_pause |
@@ -184,12 +184,12 @@ EXPORT(sysn32_call_table) | |||
184 | PTR sys32_newuname | 184 | PTR sys32_newuname |
185 | PTR sys_semget | 185 | PTR sys_semget |
186 | PTR sys_semop | 186 | PTR sys_semop |
187 | PTR sys_semctl | 187 | PTR sysn32_semctl |
188 | PTR sys_shmdt /* 6065 */ | 188 | PTR sys_shmdt /* 6065 */ |
189 | PTR sys_msgget | 189 | PTR sys_msgget |
190 | PTR sys_msgsnd | 190 | PTR compat_sys_msgsnd |
191 | PTR sys_msgrcv | 191 | PTR compat_sys_msgrcv |
192 | PTR sys_msgctl | 192 | PTR compat_sys_msgctl |
193 | PTR compat_sys_fcntl /* 6070 */ | 193 | PTR compat_sys_fcntl /* 6070 */ |
194 | PTR sys_flock | 194 | PTR sys_flock |
195 | PTR sys_fsync | 195 | PTR sys_fsync |
@@ -335,7 +335,7 @@ EXPORT(sysn32_call_table) | |||
335 | PTR compat_sys_fcntl64 | 335 | PTR compat_sys_fcntl64 |
336 | PTR sys_set_tid_address | 336 | PTR sys_set_tid_address |
337 | PTR sys_restart_syscall | 337 | PTR sys_restart_syscall |
338 | PTR sys_semtimedop /* 6215 */ | 338 | PTR compat_sys_semtimedop /* 6215 */ |
339 | PTR sys_fadvise64_64 | 339 | PTR sys_fadvise64_64 |
340 | PTR compat_sys_statfs64 | 340 | PTR compat_sys_statfs64 |
341 | PTR compat_sys_fstatfs64 | 341 | PTR compat_sys_fstatfs64 |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 49db516789e0..f2a8701e414d 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -172,7 +172,7 @@ int smp_call_function (void (*func) (void *info), void *info, int retry, | |||
172 | 172 | ||
173 | spin_lock(&smp_call_lock); | 173 | spin_lock(&smp_call_lock); |
174 | call_data = &data; | 174 | call_data = &data; |
175 | mb(); | 175 | smp_mb(); |
176 | 176 | ||
177 | /* Send a message to all other CPUs and wait for them to respond */ | 177 | /* Send a message to all other CPUs and wait for them to respond */ |
178 | for_each_online_cpu(i) | 178 | for_each_online_cpu(i) |
@@ -204,7 +204,7 @@ void smp_call_function_interrupt(void) | |||
204 | * Notify initiating CPU that I've grabbed the data and am | 204 | * Notify initiating CPU that I've grabbed the data and am |
205 | * about to execute the function. | 205 | * about to execute the function. |
206 | */ | 206 | */ |
207 | mb(); | 207 | smp_mb(); |
208 | atomic_inc(&call_data->started); | 208 | atomic_inc(&call_data->started); |
209 | 209 | ||
210 | /* | 210 | /* |
@@ -215,7 +215,7 @@ void smp_call_function_interrupt(void) | |||
215 | irq_exit(); | 215 | irq_exit(); |
216 | 216 | ||
217 | if (wait) { | 217 | if (wait) { |
218 | mb(); | 218 | smp_mb(); |
219 | atomic_inc(&call_data->finished); | 219 | atomic_inc(&call_data->finished); |
220 | } | 220 | } |
221 | } | 221 | } |
diff --git a/arch/mips/lib-32/Makefile b/arch/mips/lib-32/Makefile index ad285786e74b..dcd4d2ed2ac4 100644 --- a/arch/mips/lib-32/Makefile +++ b/arch/mips/lib-32/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for MIPS-specific library files.. | 2 | # Makefile for MIPS-specific library files.. |
3 | # | 3 | # |
4 | 4 | ||
5 | lib-y += csum_partial.o memset.o watch.o | 5 | lib-y += memset.o watch.o |
6 | 6 | ||
7 | obj-$(CONFIG_CPU_MIPS32) += dump_tlb.o | 7 | obj-$(CONFIG_CPU_MIPS32) += dump_tlb.o |
8 | obj-$(CONFIG_CPU_MIPS64) += dump_tlb.o | 8 | obj-$(CONFIG_CPU_MIPS64) += dump_tlb.o |
diff --git a/arch/mips/lib-32/csum_partial.S b/arch/mips/lib-32/csum_partial.S deleted file mode 100644 index ea257dbdcc40..000000000000 --- a/arch/mips/lib-32/csum_partial.S +++ /dev/null | |||
@@ -1,240 +0,0 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 1998 Ralf Baechle | ||
7 | */ | ||
8 | #include <asm/asm.h> | ||
9 | #include <asm/regdef.h> | ||
10 | |||
11 | #define ADDC(sum,reg) \ | ||
12 | addu sum, reg; \ | ||
13 | sltu v1, sum, reg; \ | ||
14 | addu sum, v1 | ||
15 | |||
16 | #define CSUM_BIGCHUNK(src, offset, sum, t0, t1, t2, t3) \ | ||
17 | lw t0, (offset + 0x00)(src); \ | ||
18 | lw t1, (offset + 0x04)(src); \ | ||
19 | lw t2, (offset + 0x08)(src); \ | ||
20 | lw t3, (offset + 0x0c)(src); \ | ||
21 | ADDC(sum, t0); \ | ||
22 | ADDC(sum, t1); \ | ||
23 | ADDC(sum, t2); \ | ||
24 | ADDC(sum, t3); \ | ||
25 | lw t0, (offset + 0x10)(src); \ | ||
26 | lw t1, (offset + 0x14)(src); \ | ||
27 | lw t2, (offset + 0x18)(src); \ | ||
28 | lw t3, (offset + 0x1c)(src); \ | ||
29 | ADDC(sum, t0); \ | ||
30 | ADDC(sum, t1); \ | ||
31 | ADDC(sum, t2); \ | ||
32 | ADDC(sum, t3); \ | ||
33 | |||
34 | /* | ||
35 | * a0: source address | ||
36 | * a1: length of the area to checksum | ||
37 | * a2: partial checksum | ||
38 | */ | ||
39 | |||
40 | #define src a0 | ||
41 | #define dest a1 | ||
42 | #define sum v0 | ||
43 | |||
44 | .text | ||
45 | .set noreorder | ||
46 | |||
47 | /* unknown src alignment and < 8 bytes to go */ | ||
48 | small_csumcpy: | ||
49 | move a1, t2 | ||
50 | |||
51 | andi t0, a1, 4 | ||
52 | beqz t0, 1f | ||
53 | andi t0, a1, 2 | ||
54 | |||
55 | /* Still a full word to go */ | ||
56 | ulw t1, (src) | ||
57 | addiu src, 4 | ||
58 | ADDC(sum, t1) | ||
59 | |||
60 | 1: move t1, zero | ||
61 | beqz t0, 1f | ||
62 | andi t0, a1, 1 | ||
63 | |||
64 | /* Still a halfword to go */ | ||
65 | ulhu t1, (src) | ||
66 | addiu src, 2 | ||
67 | |||
68 | 1: beqz t0, 1f | ||
69 | sll t1, t1, 16 | ||
70 | |||
71 | lbu t2, (src) | ||
72 | nop | ||
73 | |||
74 | #ifdef __MIPSEB__ | ||
75 | sll t2, t2, 8 | ||
76 | #endif | ||
77 | or t1, t2 | ||
78 | |||
79 | 1: ADDC(sum, t1) | ||
80 | |||
81 | /* fold checksum */ | ||
82 | sll v1, sum, 16 | ||
83 | addu sum, v1 | ||
84 | sltu v1, sum, v1 | ||
85 | srl sum, sum, 16 | ||
86 | addu sum, v1 | ||
87 | |||
88 | /* odd buffer alignment? */ | ||
89 | beqz t7, 1f | ||
90 | nop | ||
91 | sll v1, sum, 8 | ||
92 | srl sum, sum, 8 | ||
93 | or sum, v1 | ||
94 | andi sum, 0xffff | ||
95 | 1: | ||
96 | .set reorder | ||
97 | /* Add the passed partial csum. */ | ||
98 | ADDC(sum, a2) | ||
99 | jr ra | ||
100 | .set noreorder | ||
101 | |||
102 | /* ------------------------------------------------------------------------- */ | ||
103 | |||
104 | .align 5 | ||
105 | LEAF(csum_partial) | ||
106 | move sum, zero | ||
107 | move t7, zero | ||
108 | |||
109 | sltiu t8, a1, 0x8 | ||
110 | bnez t8, small_csumcpy /* < 8 bytes to copy */ | ||
111 | move t2, a1 | ||
112 | |||
113 | beqz a1, out | ||
114 | andi t7, src, 0x1 /* odd buffer? */ | ||
115 | |||
116 | hword_align: | ||
117 | beqz t7, word_align | ||
118 | andi t8, src, 0x2 | ||
119 | |||
120 | lbu t0, (src) | ||
121 | subu a1, a1, 0x1 | ||
122 | #ifdef __MIPSEL__ | ||
123 | sll t0, t0, 8 | ||
124 | #endif | ||
125 | ADDC(sum, t0) | ||
126 | addu src, src, 0x1 | ||
127 | andi t8, src, 0x2 | ||
128 | |||
129 | word_align: | ||
130 | beqz t8, dword_align | ||
131 | sltiu t8, a1, 56 | ||
132 | |||
133 | lhu t0, (src) | ||
134 | subu a1, a1, 0x2 | ||
135 | ADDC(sum, t0) | ||
136 | sltiu t8, a1, 56 | ||
137 | addu src, src, 0x2 | ||
138 | |||
139 | dword_align: | ||
140 | bnez t8, do_end_words | ||
141 | move t8, a1 | ||
142 | |||
143 | andi t8, src, 0x4 | ||
144 | beqz t8, qword_align | ||
145 | andi t8, src, 0x8 | ||
146 | |||
147 | lw t0, 0x00(src) | ||
148 | subu a1, a1, 0x4 | ||
149 | ADDC(sum, t0) | ||
150 | addu src, src, 0x4 | ||
151 | andi t8, src, 0x8 | ||
152 | |||
153 | qword_align: | ||
154 | beqz t8, oword_align | ||
155 | andi t8, src, 0x10 | ||
156 | |||
157 | lw t0, 0x00(src) | ||
158 | lw t1, 0x04(src) | ||
159 | subu a1, a1, 0x8 | ||
160 | ADDC(sum, t0) | ||
161 | ADDC(sum, t1) | ||
162 | addu src, src, 0x8 | ||
163 | andi t8, src, 0x10 | ||
164 | |||
165 | oword_align: | ||
166 | beqz t8, begin_movement | ||
167 | srl t8, a1, 0x7 | ||
168 | |||
169 | lw t3, 0x08(src) | ||
170 | lw t4, 0x0c(src) | ||
171 | lw t0, 0x00(src) | ||
172 | lw t1, 0x04(src) | ||
173 | ADDC(sum, t3) | ||
174 | ADDC(sum, t4) | ||
175 | ADDC(sum, t0) | ||
176 | ADDC(sum, t1) | ||
177 | subu a1, a1, 0x10 | ||
178 | addu src, src, 0x10 | ||
179 | srl t8, a1, 0x7 | ||
180 | |||
181 | begin_movement: | ||
182 | beqz t8, 1f | ||
183 | andi t2, a1, 0x40 | ||
184 | |||
185 | move_128bytes: | ||
186 | CSUM_BIGCHUNK(src, 0x00, sum, t0, t1, t3, t4) | ||
187 | CSUM_BIGCHUNK(src, 0x20, sum, t0, t1, t3, t4) | ||
188 | CSUM_BIGCHUNK(src, 0x40, sum, t0, t1, t3, t4) | ||
189 | CSUM_BIGCHUNK(src, 0x60, sum, t0, t1, t3, t4) | ||
190 | subu t8, t8, 0x01 | ||
191 | bnez t8, move_128bytes | ||
192 | addu src, src, 0x80 | ||
193 | |||
194 | 1: | ||
195 | beqz t2, 1f | ||
196 | andi t2, a1, 0x20 | ||
197 | |||
198 | move_64bytes: | ||
199 | CSUM_BIGCHUNK(src, 0x00, sum, t0, t1, t3, t4) | ||
200 | CSUM_BIGCHUNK(src, 0x20, sum, t0, t1, t3, t4) | ||
201 | addu src, src, 0x40 | ||
202 | |||
203 | 1: | ||
204 | beqz t2, do_end_words | ||
205 | andi t8, a1, 0x1c | ||
206 | |||
207 | move_32bytes: | ||
208 | CSUM_BIGCHUNK(src, 0x00, sum, t0, t1, t3, t4) | ||
209 | andi t8, a1, 0x1c | ||
210 | addu src, src, 0x20 | ||
211 | |||
212 | do_end_words: | ||
213 | beqz t8, maybe_end_cruft | ||
214 | srl t8, t8, 0x2 | ||
215 | |||
216 | end_words: | ||
217 | lw t0, (src) | ||
218 | subu t8, t8, 0x1 | ||
219 | ADDC(sum, t0) | ||
220 | bnez t8, end_words | ||
221 | addu src, src, 0x4 | ||
222 | |||
223 | maybe_end_cruft: | ||
224 | andi t2, a1, 0x3 | ||
225 | |||
226 | small_memcpy: | ||
227 | j small_csumcpy; move a1, t2 | ||
228 | beqz t2, out | ||
229 | move a1, t2 | ||
230 | |||
231 | end_bytes: | ||
232 | lb t0, (src) | ||
233 | subu a1, a1, 0x1 | ||
234 | bnez a2, end_bytes | ||
235 | addu src, src, 0x1 | ||
236 | |||
237 | out: | ||
238 | jr ra | ||
239 | move v0, sum | ||
240 | END(csum_partial) | ||
diff --git a/arch/mips/lib-64/Makefile b/arch/mips/lib-64/Makefile index ad285786e74b..dcd4d2ed2ac4 100644 --- a/arch/mips/lib-64/Makefile +++ b/arch/mips/lib-64/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for MIPS-specific library files.. | 2 | # Makefile for MIPS-specific library files.. |
3 | # | 3 | # |
4 | 4 | ||
5 | lib-y += csum_partial.o memset.o watch.o | 5 | lib-y += memset.o watch.o |
6 | 6 | ||
7 | obj-$(CONFIG_CPU_MIPS32) += dump_tlb.o | 7 | obj-$(CONFIG_CPU_MIPS32) += dump_tlb.o |
8 | obj-$(CONFIG_CPU_MIPS64) += dump_tlb.o | 8 | obj-$(CONFIG_CPU_MIPS64) += dump_tlb.o |
diff --git a/arch/mips/lib-64/csum_partial.S b/arch/mips/lib-64/csum_partial.S deleted file mode 100644 index 25aba660cc9c..000000000000 --- a/arch/mips/lib-64/csum_partial.S +++ /dev/null | |||
@@ -1,242 +0,0 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Quick'n'dirty IP checksum ... | ||
7 | * | ||
8 | * Copyright (C) 1998, 1999 Ralf Baechle | ||
9 | * Copyright (C) 1999 Silicon Graphics, Inc. | ||
10 | */ | ||
11 | #include <asm/asm.h> | ||
12 | #include <asm/regdef.h> | ||
13 | |||
14 | #define ADDC(sum,reg) \ | ||
15 | addu sum, reg; \ | ||
16 | sltu v1, sum, reg; \ | ||
17 | addu sum, v1 | ||
18 | |||
19 | #define CSUM_BIGCHUNK(src, offset, sum, t0, t1, t2, t3) \ | ||
20 | lw t0, (offset + 0x00)(src); \ | ||
21 | lw t1, (offset + 0x04)(src); \ | ||
22 | lw t2, (offset + 0x08)(src); \ | ||
23 | lw t3, (offset + 0x0c)(src); \ | ||
24 | ADDC(sum, t0); \ | ||
25 | ADDC(sum, t1); \ | ||
26 | ADDC(sum, t2); \ | ||
27 | ADDC(sum, t3); \ | ||
28 | lw t0, (offset + 0x10)(src); \ | ||
29 | lw t1, (offset + 0x14)(src); \ | ||
30 | lw t2, (offset + 0x18)(src); \ | ||
31 | lw t3, (offset + 0x1c)(src); \ | ||
32 | ADDC(sum, t0); \ | ||
33 | ADDC(sum, t1); \ | ||
34 | ADDC(sum, t2); \ | ||
35 | ADDC(sum, t3); \ | ||
36 | |||
37 | /* | ||
38 | * a0: source address | ||
39 | * a1: length of the area to checksum | ||
40 | * a2: partial checksum | ||
41 | */ | ||
42 | |||
43 | #define src a0 | ||
44 | #define sum v0 | ||
45 | |||
46 | .text | ||
47 | .set noreorder | ||
48 | |||
49 | /* unknown src alignment and < 8 bytes to go */ | ||
50 | small_csumcpy: | ||
51 | move a1, ta2 | ||
52 | |||
53 | andi ta0, a1, 4 | ||
54 | beqz ta0, 1f | ||
55 | andi ta0, a1, 2 | ||
56 | |||
57 | /* Still a full word to go */ | ||
58 | ulw ta1, (src) | ||
59 | daddiu src, 4 | ||
60 | ADDC(sum, ta1) | ||
61 | |||
62 | 1: move ta1, zero | ||
63 | beqz ta0, 1f | ||
64 | andi ta0, a1, 1 | ||
65 | |||
66 | /* Still a halfword to go */ | ||
67 | ulhu ta1, (src) | ||
68 | daddiu src, 2 | ||
69 | |||
70 | 1: beqz ta0, 1f | ||
71 | sll ta1, ta1, 16 | ||
72 | |||
73 | lbu ta2, (src) | ||
74 | nop | ||
75 | |||
76 | #ifdef __MIPSEB__ | ||
77 | sll ta2, ta2, 8 | ||
78 | #endif | ||
79 | or ta1, ta2 | ||
80 | |||
81 | 1: ADDC(sum, ta1) | ||
82 | |||
83 | /* fold checksum */ | ||
84 | sll v1, sum, 16 | ||
85 | addu sum, v1 | ||
86 | sltu v1, sum, v1 | ||
87 | srl sum, sum, 16 | ||
88 | addu sum, v1 | ||
89 | |||
90 | /* odd buffer alignment? */ | ||
91 | beqz t3, 1f | ||
92 | nop | ||
93 | sll v1, sum, 8 | ||
94 | srl sum, sum, 8 | ||
95 | or sum, v1 | ||
96 | andi sum, 0xffff | ||
97 | 1: | ||
98 | .set reorder | ||
99 | /* Add the passed partial csum. */ | ||
100 | ADDC(sum, a2) | ||
101 | jr ra | ||
102 | .set noreorder | ||
103 | |||
104 | /* ------------------------------------------------------------------------- */ | ||
105 | |||
106 | .align 5 | ||
107 | LEAF(csum_partial) | ||
108 | move sum, zero | ||
109 | move t3, zero | ||
110 | |||
111 | sltiu t8, a1, 0x8 | ||
112 | bnez t8, small_csumcpy /* < 8 bytes to copy */ | ||
113 | move ta2, a1 | ||
114 | |||
115 | beqz a1, out | ||
116 | andi t3, src, 0x1 /* odd buffer? */ | ||
117 | |||
118 | hword_align: | ||
119 | beqz t3, word_align | ||
120 | andi t8, src, 0x2 | ||
121 | |||
122 | lbu ta0, (src) | ||
123 | dsubu a1, a1, 0x1 | ||
124 | #ifdef __MIPSEL__ | ||
125 | sll ta0, ta0, 8 | ||
126 | #endif | ||
127 | ADDC(sum, ta0) | ||
128 | daddu src, src, 0x1 | ||
129 | andi t8, src, 0x2 | ||
130 | |||
131 | word_align: | ||
132 | beqz t8, dword_align | ||
133 | sltiu t8, a1, 56 | ||
134 | |||
135 | lhu ta0, (src) | ||
136 | dsubu a1, a1, 0x2 | ||
137 | ADDC(sum, ta0) | ||
138 | sltiu t8, a1, 56 | ||
139 | daddu src, src, 0x2 | ||
140 | |||
141 | dword_align: | ||
142 | bnez t8, do_end_words | ||
143 | move t8, a1 | ||
144 | |||
145 | andi t8, src, 0x4 | ||
146 | beqz t8, qword_align | ||
147 | andi t8, src, 0x8 | ||
148 | |||
149 | lw ta0, 0x00(src) | ||
150 | dsubu a1, a1, 0x4 | ||
151 | ADDC(sum, ta0) | ||
152 | daddu src, src, 0x4 | ||
153 | andi t8, src, 0x8 | ||
154 | |||
155 | qword_align: | ||
156 | beqz t8, oword_align | ||
157 | andi t8, src, 0x10 | ||
158 | |||
159 | lw ta0, 0x00(src) | ||
160 | lw ta1, 0x04(src) | ||
161 | dsubu a1, a1, 0x8 | ||
162 | ADDC(sum, ta0) | ||
163 | ADDC(sum, ta1) | ||
164 | daddu src, src, 0x8 | ||
165 | andi t8, src, 0x10 | ||
166 | |||
167 | oword_align: | ||
168 | beqz t8, begin_movement | ||
169 | dsrl t8, a1, 0x7 | ||
170 | |||
171 | lw ta3, 0x08(src) | ||
172 | lw t0, 0x0c(src) | ||
173 | lw ta0, 0x00(src) | ||
174 | lw ta1, 0x04(src) | ||
175 | ADDC(sum, ta3) | ||
176 | ADDC(sum, t0) | ||
177 | ADDC(sum, ta0) | ||
178 | ADDC(sum, ta1) | ||
179 | dsubu a1, a1, 0x10 | ||
180 | daddu src, src, 0x10 | ||
181 | dsrl t8, a1, 0x7 | ||
182 | |||
183 | begin_movement: | ||
184 | beqz t8, 1f | ||
185 | andi ta2, a1, 0x40 | ||
186 | |||
187 | move_128bytes: | ||
188 | CSUM_BIGCHUNK(src, 0x00, sum, ta0, ta1, ta3, t0) | ||
189 | CSUM_BIGCHUNK(src, 0x20, sum, ta0, ta1, ta3, t0) | ||
190 | CSUM_BIGCHUNK(src, 0x40, sum, ta0, ta1, ta3, t0) | ||
191 | CSUM_BIGCHUNK(src, 0x60, sum, ta0, ta1, ta3, t0) | ||
192 | dsubu t8, t8, 0x01 | ||
193 | bnez t8, move_128bytes | ||
194 | daddu src, src, 0x80 | ||
195 | |||
196 | 1: | ||
197 | beqz ta2, 1f | ||
198 | andi ta2, a1, 0x20 | ||
199 | |||
200 | move_64bytes: | ||
201 | CSUM_BIGCHUNK(src, 0x00, sum, ta0, ta1, ta3, t0) | ||
202 | CSUM_BIGCHUNK(src, 0x20, sum, ta0, ta1, ta3, t0) | ||
203 | daddu src, src, 0x40 | ||
204 | |||
205 | 1: | ||
206 | beqz ta2, do_end_words | ||
207 | andi t8, a1, 0x1c | ||
208 | |||
209 | move_32bytes: | ||
210 | CSUM_BIGCHUNK(src, 0x00, sum, ta0, ta1, ta3, t0) | ||
211 | andi t8, a1, 0x1c | ||
212 | daddu src, src, 0x20 | ||
213 | |||
214 | do_end_words: | ||
215 | beqz t8, maybe_end_cruft | ||
216 | dsrl t8, t8, 0x2 | ||
217 | |||
218 | end_words: | ||
219 | lw ta0, (src) | ||
220 | dsubu t8, t8, 0x1 | ||
221 | ADDC(sum, ta0) | ||
222 | bnez t8, end_words | ||
223 | daddu src, src, 0x4 | ||
224 | |||
225 | maybe_end_cruft: | ||
226 | andi ta2, a1, 0x3 | ||
227 | |||
228 | small_memcpy: | ||
229 | j small_csumcpy; move a1, ta2 /* XXX ??? */ | ||
230 | beqz t2, out | ||
231 | move a1, ta2 | ||
232 | |||
233 | end_bytes: | ||
234 | lb ta0, (src) | ||
235 | dsubu a1, a1, 0x1 | ||
236 | bnez a2, end_bytes | ||
237 | daddu src, src, 0x1 | ||
238 | |||
239 | out: | ||
240 | jr ra | ||
241 | move v0, sum | ||
242 | END(csum_partial) | ||
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile index b225543f5302..888b61ea12fe 100644 --- a/arch/mips/lib/Makefile +++ b/arch/mips/lib/Makefile | |||
@@ -2,8 +2,8 @@ | |||
2 | # Makefile for MIPS-specific library files.. | 2 | # Makefile for MIPS-specific library files.. |
3 | # | 3 | # |
4 | 4 | ||
5 | lib-y += csum_partial_copy.o memcpy.o promlib.o strlen_user.o strncpy_user.o \ | 5 | lib-y += csum_partial.o csum_partial_copy.o memcpy.o promlib.o \ |
6 | strnlen_user.o uncached.o | 6 | strlen_user.o strncpy_user.o strnlen_user.o uncached.o |
7 | 7 | ||
8 | obj-y += iomap.o | 8 | obj-y += iomap.o |
9 | 9 | ||
diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S new file mode 100644 index 000000000000..15611d9df7ac --- /dev/null +++ b/arch/mips/lib/csum_partial.S | |||
@@ -0,0 +1,258 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Quick'n'dirty IP checksum ... | ||
7 | * | ||
8 | * Copyright (C) 1998, 1999 Ralf Baechle | ||
9 | * Copyright (C) 1999 Silicon Graphics, Inc. | ||
10 | */ | ||
11 | #include <asm/asm.h> | ||
12 | #include <asm/regdef.h> | ||
13 | |||
14 | #ifdef CONFIG_64BIT | ||
15 | #define T0 ta0 | ||
16 | #define T1 ta1 | ||
17 | #define T2 ta2 | ||
18 | #define T3 ta3 | ||
19 | #define T4 t0 | ||
20 | #define T7 t3 | ||
21 | #else | ||
22 | #define T0 t0 | ||
23 | #define T1 t1 | ||
24 | #define T2 t2 | ||
25 | #define T3 t3 | ||
26 | #define T4 t4 | ||
27 | #define T7 t7 | ||
28 | #endif | ||
29 | |||
30 | #define ADDC(sum,reg) \ | ||
31 | addu sum, reg; \ | ||
32 | sltu v1, sum, reg; \ | ||
33 | addu sum, v1 | ||
34 | |||
35 | #define CSUM_BIGCHUNK(src, offset, sum, _t0, _t1, _t2, _t3) \ | ||
36 | lw _t0, (offset + 0x00)(src); \ | ||
37 | lw _t1, (offset + 0x04)(src); \ | ||
38 | lw _t2, (offset + 0x08)(src); \ | ||
39 | lw _t3, (offset + 0x0c)(src); \ | ||
40 | ADDC(sum, _t0); \ | ||
41 | ADDC(sum, _t1); \ | ||
42 | ADDC(sum, _t2); \ | ||
43 | ADDC(sum, _t3); \ | ||
44 | lw _t0, (offset + 0x10)(src); \ | ||
45 | lw _t1, (offset + 0x14)(src); \ | ||
46 | lw _t2, (offset + 0x18)(src); \ | ||
47 | lw _t3, (offset + 0x1c)(src); \ | ||
48 | ADDC(sum, _t0); \ | ||
49 | ADDC(sum, _t1); \ | ||
50 | ADDC(sum, _t2); \ | ||
51 | ADDC(sum, _t3); \ | ||
52 | |||
53 | /* | ||
54 | * a0: source address | ||
55 | * a1: length of the area to checksum | ||
56 | * a2: partial checksum | ||
57 | */ | ||
58 | |||
59 | #define src a0 | ||
60 | #define sum v0 | ||
61 | |||
62 | .text | ||
63 | .set noreorder | ||
64 | |||
65 | /* unknown src alignment and < 8 bytes to go */ | ||
66 | small_csumcpy: | ||
67 | move a1, T2 | ||
68 | |||
69 | andi T0, a1, 4 | ||
70 | beqz T0, 1f | ||
71 | andi T0, a1, 2 | ||
72 | |||
73 | /* Still a full word to go */ | ||
74 | ulw T1, (src) | ||
75 | PTR_ADDIU src, 4 | ||
76 | ADDC(sum, T1) | ||
77 | |||
78 | 1: move T1, zero | ||
79 | beqz T0, 1f | ||
80 | andi T0, a1, 1 | ||
81 | |||
82 | /* Still a halfword to go */ | ||
83 | ulhu T1, (src) | ||
84 | PTR_ADDIU src, 2 | ||
85 | |||
86 | 1: beqz T0, 1f | ||
87 | sll T1, T1, 16 | ||
88 | |||
89 | lbu T2, (src) | ||
90 | nop | ||
91 | |||
92 | #ifdef __MIPSEB__ | ||
93 | sll T2, T2, 8 | ||
94 | #endif | ||
95 | or T1, T2 | ||
96 | |||
97 | 1: ADDC(sum, T1) | ||
98 | |||
99 | /* fold checksum */ | ||
100 | sll v1, sum, 16 | ||
101 | addu sum, v1 | ||
102 | sltu v1, sum, v1 | ||
103 | srl sum, sum, 16 | ||
104 | addu sum, v1 | ||
105 | |||
106 | /* odd buffer alignment? */ | ||
107 | beqz T7, 1f | ||
108 | nop | ||
109 | sll v1, sum, 8 | ||
110 | srl sum, sum, 8 | ||
111 | or sum, v1 | ||
112 | andi sum, 0xffff | ||
113 | 1: | ||
114 | .set reorder | ||
115 | /* Add the passed partial csum. */ | ||
116 | ADDC(sum, a2) | ||
117 | jr ra | ||
118 | .set noreorder | ||
119 | |||
120 | /* ------------------------------------------------------------------------- */ | ||
121 | |||
122 | .align 5 | ||
123 | LEAF(csum_partial) | ||
124 | move sum, zero | ||
125 | move T7, zero | ||
126 | |||
127 | sltiu t8, a1, 0x8 | ||
128 | bnez t8, small_csumcpy /* < 8 bytes to copy */ | ||
129 | move T2, a1 | ||
130 | |||
131 | beqz a1, out | ||
132 | andi T7, src, 0x1 /* odd buffer? */ | ||
133 | |||
134 | hword_align: | ||
135 | beqz T7, word_align | ||
136 | andi t8, src, 0x2 | ||
137 | |||
138 | lbu T0, (src) | ||
139 | LONG_SUBU a1, a1, 0x1 | ||
140 | #ifdef __MIPSEL__ | ||
141 | sll T0, T0, 8 | ||
142 | #endif | ||
143 | ADDC(sum, T0) | ||
144 | PTR_ADDU src, src, 0x1 | ||
145 | andi t8, src, 0x2 | ||
146 | |||
147 | word_align: | ||
148 | beqz t8, dword_align | ||
149 | sltiu t8, a1, 56 | ||
150 | |||
151 | lhu T0, (src) | ||
152 | LONG_SUBU a1, a1, 0x2 | ||
153 | ADDC(sum, T0) | ||
154 | sltiu t8, a1, 56 | ||
155 | PTR_ADDU src, src, 0x2 | ||
156 | |||
157 | dword_align: | ||
158 | bnez t8, do_end_words | ||
159 | move t8, a1 | ||
160 | |||
161 | andi t8, src, 0x4 | ||
162 | beqz t8, qword_align | ||
163 | andi t8, src, 0x8 | ||
164 | |||
165 | lw T0, 0x00(src) | ||
166 | LONG_SUBU a1, a1, 0x4 | ||
167 | ADDC(sum, T0) | ||
168 | PTR_ADDU src, src, 0x4 | ||
169 | andi t8, src, 0x8 | ||
170 | |||
171 | qword_align: | ||
172 | beqz t8, oword_align | ||
173 | andi t8, src, 0x10 | ||
174 | |||
175 | lw T0, 0x00(src) | ||
176 | lw T1, 0x04(src) | ||
177 | LONG_SUBU a1, a1, 0x8 | ||
178 | ADDC(sum, T0) | ||
179 | ADDC(sum, T1) | ||
180 | PTR_ADDU src, src, 0x8 | ||
181 | andi t8, src, 0x10 | ||
182 | |||
183 | oword_align: | ||
184 | beqz t8, begin_movement | ||
185 | LONG_SRL t8, a1, 0x7 | ||
186 | |||
187 | lw T3, 0x08(src) | ||
188 | lw T4, 0x0c(src) | ||
189 | lw T0, 0x00(src) | ||
190 | lw T1, 0x04(src) | ||
191 | ADDC(sum, T3) | ||
192 | ADDC(sum, T4) | ||
193 | ADDC(sum, T0) | ||
194 | ADDC(sum, T1) | ||
195 | LONG_SUBU a1, a1, 0x10 | ||
196 | PTR_ADDU src, src, 0x10 | ||
197 | LONG_SRL t8, a1, 0x7 | ||
198 | |||
199 | begin_movement: | ||
200 | beqz t8, 1f | ||
201 | andi T2, a1, 0x40 | ||
202 | |||
203 | move_128bytes: | ||
204 | CSUM_BIGCHUNK(src, 0x00, sum, T0, T1, T3, T4) | ||
205 | CSUM_BIGCHUNK(src, 0x20, sum, T0, T1, T3, T4) | ||
206 | CSUM_BIGCHUNK(src, 0x40, sum, T0, T1, T3, T4) | ||
207 | CSUM_BIGCHUNK(src, 0x60, sum, T0, T1, T3, T4) | ||
208 | LONG_SUBU t8, t8, 0x01 | ||
209 | bnez t8, move_128bytes | ||
210 | PTR_ADDU src, src, 0x80 | ||
211 | |||
212 | 1: | ||
213 | beqz T2, 1f | ||
214 | andi T2, a1, 0x20 | ||
215 | |||
216 | move_64bytes: | ||
217 | CSUM_BIGCHUNK(src, 0x00, sum, T0, T1, T3, T4) | ||
218 | CSUM_BIGCHUNK(src, 0x20, sum, T0, T1, T3, T4) | ||
219 | PTR_ADDU src, src, 0x40 | ||
220 | |||
221 | 1: | ||
222 | beqz T2, do_end_words | ||
223 | andi t8, a1, 0x1c | ||
224 | |||
225 | move_32bytes: | ||
226 | CSUM_BIGCHUNK(src, 0x00, sum, T0, T1, T3, T4) | ||
227 | andi t8, a1, 0x1c | ||
228 | PTR_ADDU src, src, 0x20 | ||
229 | |||
230 | do_end_words: | ||
231 | beqz t8, maybe_end_cruft | ||
232 | LONG_SRL t8, t8, 0x2 | ||
233 | |||
234 | end_words: | ||
235 | lw T0, (src) | ||
236 | LONG_SUBU t8, t8, 0x1 | ||
237 | ADDC(sum, T0) | ||
238 | bnez t8, end_words | ||
239 | PTR_ADDU src, src, 0x4 | ||
240 | |||
241 | maybe_end_cruft: | ||
242 | andi T2, a1, 0x3 | ||
243 | |||
244 | small_memcpy: | ||
245 | j small_csumcpy; move a1, T2 /* XXX ??? */ | ||
246 | beqz t2, out | ||
247 | move a1, T2 | ||
248 | |||
249 | end_bytes: | ||
250 | lb T0, (src) | ||
251 | LONG_SUBU a1, a1, 0x1 | ||
252 | bnez a2, end_bytes | ||
253 | PTR_ADDU src, src, 0x1 | ||
254 | |||
255 | out: | ||
256 | jr ra | ||
257 | move v0, sum | ||
258 | END(csum_partial) | ||
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c index ac342f5643c9..defa1f1452ad 100644 --- a/arch/mips/sibyte/swarm/setup.c +++ b/arch/mips/sibyte/swarm/setup.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) | 43 | #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) |
44 | #include <asm/sibyte/sb1250_regs.h> | 44 | #include <asm/sibyte/sb1250_regs.h> |
45 | #else | 45 | #else |
46 | #error invalid SiByte board configuation | 46 | #error invalid SiByte board configuration |
47 | #endif | 47 | #endif |
48 | #include <asm/sibyte/sb1250_genbus.h> | 48 | #include <asm/sibyte/sb1250_genbus.h> |
49 | #include <asm/sibyte/board.h> | 49 | #include <asm/sibyte/board.h> |
@@ -53,7 +53,7 @@ extern void bcm1480_setup(void); | |||
53 | #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) | 53 | #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) |
54 | extern void sb1250_setup(void); | 54 | extern void sb1250_setup(void); |
55 | #else | 55 | #else |
56 | #error invalid SiByte board configuation | 56 | #error invalid SiByte board configuration |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | extern int xicor_probe(void); | 59 | extern int xicor_probe(void); |
@@ -90,7 +90,7 @@ void __init plat_timer_setup(struct irqaction *irq) | |||
90 | #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) | 90 | #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) |
91 | sb1250_time_init(); | 91 | sb1250_time_init(); |
92 | #else | 92 | #else |
93 | #error invalid SiByte board configuation | 93 | #error invalid SiByte board configuration |
94 | #endif | 94 | #endif |
95 | } | 95 | } |
96 | 96 | ||
@@ -111,7 +111,7 @@ void __init plat_mem_setup(void) | |||
111 | #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) | 111 | #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) |
112 | sb1250_setup(); | 112 | sb1250_setup(); |
113 | #else | 113 | #else |
114 | #error invalid SiByte board configuation | 114 | #error invalid SiByte board configuration |
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | panic_timeout = 5; /* For debug. */ | 117 | panic_timeout = 5; /* For debug. */ |