VirtualBox

Changeset 106725 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Oct 27, 2024 9:02:31 PM (4 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
165608
Message:

VMM/IEM: Produce IEMAssemblyOffsets.h on win.arm64 using llvm-pdbutil/pretty and a sed script. jiraref:VBP-1253

Location:
trunk/src/VBox/VMM
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/Makefile.kmk

    r106533 r106725  
    693693        $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMAssemblyOffsets.h
    694694  $(call KB_FN_AUTO_CMD_DEPS,$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMAssemblyOffsets.h.ts)
    695   $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMAssemblyOffsets.h.ts \
    696   +| $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMAssemblyOffsets.h: \
    697                 $(VBoxVMM_0_OUTDIR)/VMMAll/IEMAllN8veRecompiler.o \
    698                 $(PATH_SUB_CURRENT)/dwarfdump-to-offsets.sed
     695  ifeq ($(KBUILD_TARGET),win)
     696   $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMAssemblyOffsets.h.ts \
     697   +| $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMAssemblyOffsets.h: \
     698                $(VBoxVMM_0_OUTDIR)/VMMAll/IEMAllN8veRecompiler-obj.pdb \
     699                $(PATH_SUB_CURRENT)/pdbutil-to-offsets.sed
     700        $(QUIET)$(call MSG_GENERATE,VBoxVMM,$@,IEMAllN8veRecompiler-obj.pdb)
     701        $(QUIET)$(RM) -f -- "$@" "[email protected]"
     702        $(QUIET)$(MKDIR) -p -- "$(dir $@)"
     703        $(call KB_FN_AUTO_CMD_DEPS_COMMANDS)
     704        $(QUIET)$(REDIRECT) -0 /dev/null -o "[email protected]" -- \
     705                $(TOOL_VCC143-CLANGXX_PREFIX2)pdbutil$(TOOL_VCC143-CLANGXX_SUFFIX2) \
     706                        pretty --with-name=VMCPU --with-name=IEMCPU "$<"
     707        $(QUIET)$(SED) -n -f "$(filter %.sed,$^)" --output "$@" "[email protected]"
     708        $(QUIET)$(RM) -f "[email protected]"
     709        $(QUIET)$(CP) -v -f --changed -- "$@" "$(basename $@)"
     710  else
     711   $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMAssemblyOffsets.h.ts \
     712   +| $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMAssemblyOffsets.h: \
     713                $(VBoxVMM_0_OUTDIR)/VMMAll/IEMAllN8veRecompiler.o \
     714                $(PATH_SUB_CURRENT)/dwarfdump-to-offsets.sed
    699715        $(QUIET)$(call MSG_GENERATE,VBoxVMM,$@,IEMAllN8veRecompiler.o)
    700716        $(QUIET)$(RM) -f -- "$@" "[email protected]"
     
    706722        $(QUIET)$(RM) -f "[email protected]"
    707723        $(QUIET)$(CP) -v -f --changed -- "$@" "$(basename $@)"
     724  endif
    708725
    709726  # Set up the dependencies.
    710   $(VBoxVMM_0_OUTDIR)/VMMAll/IEMAllN8veHlpA-arm64.o: $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMAssemblyOffsets.h
     727  $(VBoxVMM_0_OUTDIR)/VMMAll/IEMAllN8veHlpA-arm64.o:   $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMAssemblyOffsets.h
     728  $(VBoxVMM_0_OUTDIR)/VMMAll/IEMAllN8veHlpA-arm64.obj: $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMAssemblyOffsets.h
    711729 endif
    712730
  • trunk/src/VBox/VMM/pdbutil-to-offsets.sed

    r106717 r106725  
    33# For defining member offsets for selected struct so the ARM64 assembler can use them.
    44#
    5 # The script ASSUMES that the input is well filtered and the the output doesn't
    6 # change in any way that makes it difficult to match and edit.  The dwarfdump
    7 # utility assumed there, is the one from llvm that shippes with apple's command
    8 # line tools.
    9 #
    10 # These assumptions aren't ideal, however the two alternatives are:
    11 #   1. Build time program to print the offsets via RT_UOFFSETOF,
    12 #   2. Build time program parsing the dwarf info ourselves.
    13 #
    14 # The problem with the first option is that we have to get all the DEFS right
    15 # as well as the compiler options to ensure that we end up with the same
    16 # structure layout.  Doesn't led itself for cross building either (not all that
    17 # relevant for darwin, but it probably is for linux).
    18 #
    19 # The second option is potentially a lot of work as we don't have any IPRT
    20 # interface for browsing types found in debug info yet.  Once that is added, it
    21 # shouldn't be all that difficult.
     5# This script uses the 'pretty' command in the llvm-pdbutil.exe utility to do
     6# the dumping from IEMAllN8veRecompiler-obj.pdb.  The script ASSUMES a specific
     7# output format and indentation system to work.
    228#
    239
     
    4531
    4632#
    47 # This matches first level structure types, putting the name in the hold space for later use.
     33# The top-level VMCPU members.
    4834#
    49 # ASSUMES that the DW_AT_xxx listing follow on separate lines, one line per attribute
    50 # ASSUMES that there is a blank line after the DW_AT_xxx listing
    51 # ASSUMES that first level structures have exactly one space after the colon.
    52 #
    53 /^0x[[:xdigit:]][[:xdigit:]]*: DW_TAG_structure_type/,/^[[:space:]]*$/ {
    54     /DW_AT_name/ {
    55         s/^.*DW_AT_name[[:space:]]*[(]["]//
    56         s/["][)][[:space:]]*$//
    57         h
    58     }
    59     /DW_AT_data_member_location/p
     35/^  struct VMCPU .* {$/,/^  }$/ {
     36    s/^    data [+]\(0x[[:xdigit:]][[:xdigit:]]*\) .* \([a-zA-Z_][a-zA-Z0-9_]*\)$/\#define VMCPU_OFF_\2 \1/p
     37    s/^    data [+]\(0x[[:xdigit:]][[:xdigit:]]*\) .* \([a-zA-Z_][a-zA-Z0-9_]*\)\[[0-9][0-9]*]$/\#define VMCPU_OFF_\2 \1/p
    6038}
    6139
    62 
    63 
    6440#
    65 # This matches the first level of structure members.
     41# The top-level IEMCPU members.
    6642#
    67 # ASSUMES that the DW_AT_xxx listing follow on separate lines, one line per attribute
    68 # ASSUMES that there is a blank line after the DW_AT_xxx listing
    69 # ASSUMES that first level member have exactly three spaces after the colon.
    70 #
    71 /^0x[[:xdigit:]][[:xdigit:]]*:   DW_TAG_member/,/^[[:space:]]*$/ {
    72     /DW_AT_name/ {
    73         s/^.*DW_AT_name[[:space:]]*[(]["]/_OFF_/
    74         s/["][)][[:space:]]*$//
    75         x
    76         H
    77         x
    78         s/\(_OFF_.*\)[\n]\(.*\)$/#define \2\1 \\/
    79         p
    80     }
    81     /DW_AT_data_member_location/ {
    82         s/^[[:space:]]*DW_AT_data_member_location[[:space:]]*/                /
    83         p
    84     }
     43/^  struct IEMCPU .* {$/,/^  }$/ {
     44    s/^    data [+]\(0x[[:xdigit:]][[:xdigit:]]*\) .* \([a-zA-Z_][a-zA-Z0-9_]*\)$/\#define IEMCPU_OFF_\2 \1/p
     45    s/^    data [+]\(0x[[:xdigit:]][[:xdigit:]]*\) .* \([a-zA-Z_][a-zA-Z0-9_]*\)\[[0-9][0-9]*]$/\#define IEMCPU_OFF_\2 \1/p
    8546}
    8647
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette