3 # Copyright (C) 2022-2024 Free Software Foundation, Inc.
5 # This file is part of GDB.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # Used to generate .xml.in files, like so:
21 # $ ./update-linux-from-src.sh ~/linux-stable.git
28 echo "dir argument needed"
35 if [ ! -d "$d" ]; then
41 gen_from_kernel_headers
()
52 trap 'rm -Rf $tmpdir/*' EXIT
57 install="$tmpdir"/install
61 include
="$usr"/include
63 mkdir
-p "$build" "$usr"
71 INSTALL_HDR_PATH
="$usr" \
73 > "$build"/header_install.log \
76 "$pwd"/update-linux.sh \
98 if [ "$h" != "" ]; then
100 belong_belongs
="belong"
101 files
=$
(echo -e "$prefix$f\n$prefix$h")
104 belong_belongs
="belongs"
112 <?xml version="1.0"?>
113 <!-- Copyright (C) $start_date-$year Free Software Foundation, Inc.
115 Copying and distribution of this file, with or without modification,
116 are permitted in any medium without royalty provided the copyright
117 notice and this notice are preserved. -->
119 <!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
121 <!-- This file was generated using the following $file_files:
125 The $file_files mentioned above $belong_belongs to the Linux Kernel. -->
130 echo '<syscalls_info>'
136 echo '</syscalls_info>'
153 trap 'rm -f $tmp' EXIT
155 pre
"$f" "$start_date" "$h"
157 # Print out num, abi, name.
158 grep -v "^#" "$d/$f" \
159 |
awk '{print $1, $2, $3}' \
163 decimal
="[0-9][0-9]*"
164 # Print out num, "removed", name.
165 grep -E "^# $decimal was sys_*" "$d/$f" \
166 |
awk '{print $2, "removed", gensub("^sys_", "", 1, $4)}' \
170 arch
/arm
/include
/uapi
/asm
/unistd.h
)
171 grep '#define __ARM_NR_[a-z].*__ARM_NR_BASE\+' "$d/$h" \
172 |
sed 's/#define //;s/__ARM_NR_BASE+//;s/[()]//g;s/__ARM_NR_/ARM_/' \
173 |
awk '{print $2 + 0x0f0000, "private", $1}' \
185 declare -A name_exists
192 while read -r -a line
; do
199 for a
in $select_abis; do
200 if [ "$a" = "$_abi" ]; then
209 if [ "${_name/reserved+([0-9])/}" = "" ]; then
213 if [ "${_name/unused+([0-9])/}" = "" ]; then
221 if [ "$_abi" != "removed" ]; then
222 name_exists
[$_name]=1
226 done < <(sort -V "$tmp")
231 for ((i
= 0 ; i
< n
; i
++)); do
234 _num
=$
((${nums[$i]} + offset
))
236 if [ "$_abi" = "removed" ] && [ "${name_exists[$_name]}" = 1 ]; then
240 echo -n " <syscall name=\"$_name\" number=\"$_num\"/>"
242 if [ "$_abi" = "removed" ]; then
243 echo " <!-- removed -->"
268 t
="arch/x86/entry/syscalls/syscall_64.tbl"
272 t
="arch/x86/entry/syscalls/syscall_32.tbl"
276 t
="arch/powerpc/kernel/syscalls/syscall.tbl"
277 abi
="common 64 nospu"
280 t
="arch/powerpc/kernel/syscalls/syscall.tbl"
281 abi
="common 32 nospu"
284 t
="arch/s390/kernel/syscalls/syscall.tbl"
288 t
="arch/s390/kernel/syscalls/syscall.tbl"
291 sparc64-linux.xml.
in)
292 t
="arch/sparc/kernel/syscalls/syscall.tbl"
297 t
="arch/sparc/kernel/syscalls/syscall.tbl"
301 mips-n32-linux.xml.
in)
302 t
="arch/mips/kernel/syscalls/syscall_n32.tbl"
307 mips-n64-linux.xml.
in)
308 t
="arch/mips/kernel/syscalls/syscall_n64.tbl"
313 mips-o32-linux.xml.
in)
314 t
="arch/mips/kernel/syscalls/syscall_o32.tbl"
320 echo "Skipping $f, no longer supported"
323 aarch64-linux.xml.
in)
325 gen_from_kernel_headers
"$f" arm64
329 t
="arch/arm/tools/syscall.tbl"
330 h
="arch/arm/include/uapi/asm/unistd.h"
331 abi
="common eabi oabi removed private"
333 loongarch-linux.xml.
in)
334 echo "Skipping $f, no syscall.tbl"
337 linux-defaults.xml.
in)
341 echo "Don't know how to generate $f"
347 one
"$t" "$abi" "$start_date" "$offset" "$h" > "$f"
358 for f
in *.xml.
in; do