18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/* -----------------------------------------------------------------------
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci *   Copyright 2009 Intel Corporation; author H. Peter Anvin
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * ----------------------------------------------------------------------- */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/*
98c2ecf20Sopenharmony_ci * Simple helper function for initializing a register set.
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * Note that this sets EFLAGS_CF in the input register set; this
128c2ecf20Sopenharmony_ci * makes it easier to catch functions which do nothing but don't
138c2ecf20Sopenharmony_ci * explicitly set CF.
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include "boot.h"
178c2ecf20Sopenharmony_ci#include "string.h"
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_civoid initregs(struct biosregs *reg)
208c2ecf20Sopenharmony_ci{
218c2ecf20Sopenharmony_ci	memset(reg, 0, sizeof(*reg));
228c2ecf20Sopenharmony_ci	reg->eflags |= X86_EFLAGS_CF;
238c2ecf20Sopenharmony_ci	reg->ds = ds();
248c2ecf20Sopenharmony_ci	reg->es = ds();
258c2ecf20Sopenharmony_ci	reg->fs = fs();
268c2ecf20Sopenharmony_ci	reg->gs = gs();
278c2ecf20Sopenharmony_ci}
28