https://github.com/torvalds/linux
Raw File
Tip revision: e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62 authored by Linus Torvalds on 03 January 2021, 23:55:30 UTC
Linux 5.11-rc2
Tip revision: e71ba94
regs.c
// SPDX-License-Identifier: GPL-2.0-or-later
/* -----------------------------------------------------------------------
 *
 *   Copyright 2009 Intel Corporation; author H. Peter Anvin
 *
 * ----------------------------------------------------------------------- */

/*
 * Simple helper function for initializing a register set.
 *
 * Note that this sets EFLAGS_CF in the input register set; this
 * makes it easier to catch functions which do nothing but don't
 * explicitly set CF.
 */

#include "boot.h"
#include "string.h"

void initregs(struct biosregs *reg)
{
	memset(reg, 0, sizeof(*reg));
	reg->eflags |= X86_EFLAGS_CF;
	reg->ds = ds();
	reg->es = ds();
	reg->fs = fs();
	reg->gs = gs();
}
back to top