xref: /linux/arch/x86/boot/regs.c (revision 2dbc0838bcf24ca59cabc3130cf3b1d6809cdcd4)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* -----------------------------------------------------------------------
3  *
4  *   Copyright 2009 Intel Corporation; author H. Peter Anvin
5  *
6  * ----------------------------------------------------------------------- */
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"
17 #include "string.h"
18 
19 void initregs(struct biosregs *reg)
20 {
21 	memset(reg, 0, sizeof(*reg));
22 	reg->eflags |= X86_EFLAGS_CF;
23 	reg->ds = ds();
24 	reg->es = ds();
25 	reg->fs = fs();
26 	reg->gs = gs();
27 }
28