Skip to content

Commit

Permalink
hvmloader: Use fastcall everywhere
Browse files Browse the repository at this point in the history
HVMLoader is a single freestanding 32bit program with no external
dependencies.  Use the fastcall calling convetion (up to 3 parameters in
registers) globally, which is more efficient than passing all parameters on
the stack.

Some bloat-o-meter highlights are:

  add/remove: 0/0 grow/shrink: 3/118 up/down: 8/-3004 (-2996)
  Function                                     old     new   delta
  ...
  hvmloader_acpi_build_tables                 1125     961    -164
  acpi_build_tables                           1277    1081    -196
  pci_setup                                   4756    4516    -240
  construct_secondary_tables                  1689    1447    -242

No functional change.

Signed-off-by: Andrew Cooper <[email protected]>
Reviewed-by: Jan Beulich <[email protected]>
  • Loading branch information
andyhhp committed Jul 24, 2024
1 parent 5795a0b commit b25b28e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tools/firmware/hvmloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ld-option = $(shell if $(LD) -v $(1) >/dev/null 2>&1; then echo y; else echo n;
# SMBIOS spec requires format mm/dd/yyyy
SMBIOS_REL_DATE ?= $(shell date +%m/%d/%Y)

CFLAGS += $(CFLAGS_xeninclude) -fno-pic
CFLAGS += $(CFLAGS_xeninclude) -fno-pic -mregparm=3

# We mustn't use tools-only public interfaces.
CFLAGS += -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__
Expand Down
2 changes: 1 addition & 1 deletion tools/firmware/hvmloader/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

static int ap_callin;

static void __attribute__((regparm(1))) cpu_setup(unsigned int cpu)
static void cpu_setup(unsigned int cpu)
{
printf(" - CPU%d ... ", cpu);
cacheattr_init();
Expand Down

0 comments on commit b25b28e

Please sign in to comment.