blob: 55de6b3092b897892d025d98d978c3b290d36607 [file] [log] [blame]
Thomas Gleixnerd6910052019-05-22 09:51:29 +02001// SPDX-License-Identifier: GPL-2.0-or-later
H. Peter Anvin7a734e72009-04-01 18:08:28 -07002/* -----------------------------------------------------------------------
3 *
4 * Copyright 2009 Intel Corporation; author H. Peter Anvin
5 *
H. Peter Anvin7a734e72009-04-01 18:08:28 -07006 * ----------------------------------------------------------------------- */
7
8/*
9 * Simple helper function for initializing a register set.
10 *
11 * Note that this sets EFLAGS_CF in the input register set; this
12 * makes it easier to catch functions which do nothing but don't
13 * explicitly set CF.
14 */
15
16#include "boot.h"
Vivek Goyalc041b5a2014-03-18 15:26:37 -040017#include "string.h"
H. Peter Anvin7a734e72009-04-01 18:08:28 -070018
19void initregs(struct biosregs *reg)
20{
Jordan Borgner0e96f312018-10-28 12:58:28 +000021 memset(reg, 0, sizeof(*reg));
H. Peter Anvin7a734e72009-04-01 18:08:28 -070022 reg->eflags |= X86_EFLAGS_CF;
23 reg->ds = ds();
24 reg->es = ds();
25 reg->fs = fs();
26 reg->gs = gs();
27}