aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-11-16 18:14:33 -0500
committerKevin O'Connor <kevin@koconnor.net>2008-11-16 18:14:33 -0500
commit952974e3eccaefc667466e8309e15a7fbb867326 (patch)
tree3388804ea0ca999a065103e0a1af92542a65cbfa /tools
parent3eac009553c4ecee2840a1d56358e0bb6bb0bf45 (diff)
downloadseabios-952974e3eccaefc667466e8309e15a7fbb867326.tar.gz
Add tool for generating assembler offset definition file.
Replace __call16 hardcoded offsets with auto generated struct offsets. Also, load/save %ds register in __call16().
Diffstat (limited to 'tools')
-rwxr-xr-xtools/gen-offsets.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/gen-offsets.sh b/tools/gen-offsets.sh
new file mode 100755
index 00000000..99fdc53c
--- /dev/null
+++ b/tools/gen-offsets.sh
@@ -0,0 +1,17 @@
+:
+# Extract definitions from an assembler file. This is based on code
+# from the Linux Kernel.
+INFILE=$1
+OUTFILE=$2
+cat > "$OUTFILE" <<EOF
+// This is an auto-generated file. DO NOT EDIT!
+// Generated with "$0 $@"
+#ifndef __ASM_OFFSETS_H
+#define __ASM_OFFSETS_H
+EOF
+sed -ne "/^->/{s:->#\(.*\):/* \1 */:; \
+ s:^->\([^ ]*\) [\$\#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
+ s:->::; p;}" < "$INFILE" >> "$OUTFILE"
+cat >> "$OUTFILE" <<EOF
+#endif // asm-offsets.h
+EOF