regs.c 697 B

123456789101112131415161718192021222324252627
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /* -----------------------------------------------------------------------
  3. *
  4. * Copyright 2009 Intel Corporation; author H. Peter Anvin
  5. *
  6. * ----------------------------------------------------------------------- */
  7. /*
  8. * Simple helper function for initializing a register set.
  9. *
  10. * Note that this sets EFLAGS_CF in the input register set; this
  11. * makes it easier to catch functions which do nothing but don't
  12. * explicitly set CF.
  13. */
  14. #include "boot.h"
  15. #include "string.h"
  16. void initregs(struct biosregs *reg)
  17. {
  18. memset(reg, 0, sizeof(*reg));
  19. reg->eflags |= X86_EFLAGS_CF;
  20. reg->ds = ds();
  21. reg->es = ds();
  22. reg->fs = fs();
  23. reg->gs = gs();
  24. }