| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: makesyscalls.sh,v 1.164 2016/01/26 23:46:37 pooka Exp $ | | 1 | # $NetBSD: makesyscalls.sh,v 1.165 2016/10/28 23:44:32 christos Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou | | 3 | # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou |
4 | # All rights reserved. | | 4 | # All rights reserved. |
5 | # | | 5 | # |
6 | # Redistribution and use in source and binary forms, with or without | | 6 | # Redistribution and use in source and binary forms, with or without |
7 | # modification, are permitted provided that the following conditions | | 7 | # modification, are permitted provided that the following conditions |
8 | # are met: | | 8 | # are met: |
9 | # 1. Redistributions of source code must retain the above copyright | | 9 | # 1. Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. | | 10 | # notice, this list of conditions and the following disclaimer. |
11 | # 2. Redistributions in binary form must reproduce the above copyright | | 11 | # 2. Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the | | 12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. | | 13 | # documentation and/or other materials provided with the distribution. |
14 | # 3. All advertising materials mentioning features or use of this software | | 14 | # 3. All advertising materials mentioning features or use of this software |
| @@ -460,26 +460,31 @@ $1 ~ /^#/ && intable { | | | @@ -460,26 +460,31 @@ $1 ~ /^#/ && intable { |
460 | # XXX: technically we do not want to have conditionals in rump, | | 460 | # XXX: technically we do not want to have conditionals in rump, |
461 | # but it is easier to just let the cpp handle them than try to | | 461 | # but it is easier to just let the cpp handle them than try to |
462 | # figure out what we want here in this script | | 462 | # figure out what we want here in this script |
463 | print > rumpsysent | | 463 | print > rumpsysent |
464 | next | | 464 | next |
465 | } | | 465 | } |
466 | syscall != $1 { | | 466 | syscall != $1 { |
467 | printf "%s: line %d: syscall number out of sync at %d\n", \ | | 467 | printf "%s: line %d: syscall number out of sync at %d\n", \ |
468 | infile, NR, syscall | | 468 | infile, NR, syscall |
469 | printf "line is:\n" | | 469 | printf "line is:\n" |
470 | print | | 470 | print |
471 | exit 1 | | 471 | exit 1 |
472 | } | | 472 | } |
| | | 473 | function isarg64(type) { |
| | | 474 | gsub("netbsd32_", "", type); |
| | | 475 | return type == "quad_t" || type == "off_t" \ |
| | | 476 | || type == "dev_t" || type == "time_t"; |
| | | 477 | } |
473 | function parserr(was, wanted) { | | 478 | function parserr(was, wanted) { |
474 | printf "%s: line %d: unexpected %s (expected <%s>)\n", \ | | 479 | printf "%s: line %d: unexpected %s (expected <%s>)\n", \ |
475 | infile, NR, was, wanted | | 480 | infile, NR, was, wanted |
476 | printf "line is:\n" | | 481 | printf "line is:\n" |
477 | print | | 482 | print |
478 | exit 1 | | 483 | exit 1 |
479 | } | | 484 | } |
480 | function fillerpsysent(syscall, flags, name, comment) { | | 485 | function fillerpsysent(syscall, flags, name, comment) { |
481 | return sprintf("\t{%s\n\t\t.sy_call = %s,\n\t},\t\t/* %d = filler */",\ | | 486 | return sprintf("\t{%s\n\t\t.sy_call = %s,\n\t},\t\t/* %d = filler */",\ |
482 | flags, name, syscall, comment); | | 487 | flags, name, syscall, comment); |
483 | } | | 488 | } |
484 | function parseline() { | | 489 | function parseline() { |
485 | f=3 # toss number and type | | 490 | f=3 # toss number and type |
| @@ -563,27 +568,27 @@ function parseline() { | | | @@ -563,27 +568,27 @@ function parseline() { |
563 | | | 568 | |
564 | # pipe is special in how to returns its values. | | 569 | # pipe is special in how to returns its values. |
565 | # So just generate it manually if present. | | 570 | # So just generate it manually if present. |
566 | if (rumpable == 1 && fbase == "pipe") { | | 571 | if (rumpable == 1 && fbase == "pipe") { |
567 | rumpable = 0; | | 572 | rumpable = 0; |
568 | rumphaspipe = 1; | | 573 | rumphaspipe = 1; |
569 | } | | 574 | } |
570 | | | 575 | |
571 | if (fcompat != "") { | | 576 | if (fcompat != "") { |
572 | funcname=fprefix "___" fbase "" fcompat | | 577 | funcname=fprefix "___" fbase "" fcompat |
573 | } else { | | 578 | } else { |
574 | funcname=fprefix "_" fbase | | 579 | funcname=fprefix "_" fbase |
575 | } | | 580 | } |
576 | if (returntype == "quad_t" || returntype == "off_t") { | | 581 | if (isarg64(returntype)) { |
577 | if (sycall_flags == "0") | | 582 | if (sycall_flags == "0") |
578 | sycall_flags = "SYCALL_RET_64"; | | 583 | sycall_flags = "SYCALL_RET_64"; |
579 | else | | 584 | else |
580 | sycall_flags = "SYCALL_RET_64 | " sycall_flags; | | 585 | sycall_flags = "SYCALL_RET_64 | " sycall_flags; |
581 | } | | 586 | } |
582 | | | 587 | |
583 | if (funcalias == "") { | | 588 | if (funcalias == "") { |
584 | funcalias=funcname | | 589 | funcalias=funcname |
585 | sub(/^([^_]+_)*sys_/, "", funcalias) | | 590 | sub(/^([^_]+_)*sys_/, "", funcalias) |
586 | realname=fbase | | 591 | realname=fbase |
587 | } else { | | 592 | } else { |
588 | realname=funcalias | | 593 | realname=funcalias |
589 | } | | 594 | } |
| @@ -636,28 +641,27 @@ function parseline() { | | | @@ -636,28 +641,27 @@ function parseline() { |
636 | f++ | | 641 | f++ |
637 | } | | 642 | } |
638 | if (argtype[argc] == "") | | 643 | if (argtype[argc] == "") |
639 | parserr($f, "argument definition") | | 644 | parserr($f, "argument definition") |
640 | if (argtype[argc] == "off_t" \ | | 645 | if (argtype[argc] == "off_t" \ |
641 | || argtype[argc] == "dev_t" \ | | 646 | || argtype[argc] == "dev_t" \ |
642 | || argtype[argc] == "time_t") { | | 647 | || argtype[argc] == "time_t") { |
643 | if ((argalign % 2) != 0 && sysalign && | | 648 | if ((argalign % 2) != 0 && sysalign && |
644 | funcname != "sys_posix_fadvise") # XXX for now | | 649 | funcname != "sys_posix_fadvise") # XXX for now |
645 | parserr($f, "a padding argument") | | 650 | parserr($f, "a padding argument") |
646 | } else { | | 651 | } else { |
647 | argalign++; | | 652 | argalign++; |
648 | } | | 653 | } |
649 | if (argtype[argc] == "quad_t" || argtype[argc] == "off_t" \ | | 654 | if (isarg64(argtype[argc])) { |
650 | || argtype[argc] == "dev_t" || argtype[argc] == "time_t") { | | | |
651 | if (sycall_flags == "0") | | 655 | if (sycall_flags == "0") |
652 | sycall_flags = "SYCALL_ARG"argc-1"_64"; | | 656 | sycall_flags = "SYCALL_ARG"argc-1"_64"; |
653 | else | | 657 | else |
654 | sycall_flags = "SYCALL_ARG"argc-1"_64 | " sycall_flags; | | 658 | sycall_flags = "SYCALL_ARG"argc-1"_64 | " sycall_flags; |
655 | args64++; | | 659 | args64++; |
656 | } | | 660 | } |
657 | if (index(argtype[argc], "*") != 0 && ptr == 0) { | | 661 | if (index(argtype[argc], "*") != 0 && ptr == 0) { |
658 | if (sycall_flags == "0") | | 662 | if (sycall_flags == "0") |
659 | sycall_flags = "SYCALL_ARG_PTR"; | | 663 | sycall_flags = "SYCALL_ARG_PTR"; |
660 | else | | 664 | else |
661 | sycall_flags = "SYCALL_ARG_PTR | " sycall_flags; | | 665 | sycall_flags = "SYCALL_ARG_PTR | " sycall_flags; |
662 | ptr = 1; | | 666 | ptr = 1; |
663 | } | | 667 | } |