162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 262306a36Sopenharmony_ci/* ----------------------------------------------------------------------- 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Copyright 2009 Intel Corporation; author H. Peter Anvin 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * ----------------------------------------------------------------------- */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci/* 962306a36Sopenharmony_ci * Simple helper function for initializing a register set. 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * Note that this sets EFLAGS_CF in the input register set; this 1262306a36Sopenharmony_ci * makes it easier to catch functions which do nothing but don't 1362306a36Sopenharmony_ci * explicitly set CF. 1462306a36Sopenharmony_ci */ 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#include "boot.h" 1762306a36Sopenharmony_ci#include "string.h" 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_civoid initregs(struct biosregs *reg) 2062306a36Sopenharmony_ci{ 2162306a36Sopenharmony_ci memset(reg, 0, sizeof(*reg)); 2262306a36Sopenharmony_ci reg->eflags |= X86_EFLAGS_CF; 2362306a36Sopenharmony_ci reg->ds = ds(); 2462306a36Sopenharmony_ci reg->es = ds(); 2562306a36Sopenharmony_ci reg->fs = fs(); 2662306a36Sopenharmony_ci reg->gs = gs(); 2762306a36Sopenharmony_ci} 28