libgrub_cmd.c revision fda6624021ffe01adf1af44f72ae4fb3ba65c1e8
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This file contains all the functions that implement the following
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * GRUB commands:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * kernel, kernel$, module, module$, findroot, bootfs
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Return 0 on success, errno on failure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* __i386 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RESET_MODULE(barg) ((barg)->gb_module[0] = 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const char cpuid_dev[] = "/dev/cpu/self/cpuid";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Return 1 if the system supports 64-bit mode, 0 if it doesn't,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or -1 on failure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pread(fd, &cpuid_regs, sizeof (cpuid_regs), 0x80000001) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = ((CPUID_AMD_EDX_LM & cpuid_regs.cp_edx) != 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* __i386 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Expand $ISAIDR
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if !defined(__i386)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* __i386 */
#if defined(__i386)
var[0] = 0;
static size_t
var[0] = 0;
int ret = 0;
if (ret == 0)
return (ret);
int ret;
const char *zfn;
if (ret != 0)
return (EG_ROOTNOTSUPP);
return (EG_INVALIDLINE);
return (E2BIG);
return (E2BIG);
int ret;
return (E2BIG);
return (EINVAL);
return (ret);
return (ret);
int ret;
return (E2BIG);
(isadir))
return (EINVAL);
return (ret);
const char *sign;
const char *pos;
++sign;
return (EG_FINDROOTFMT);
++pos;
return (EG_FINDROOTFMT);
++pos;
return (EG_FINDROOTFMT);
return (E2BIG);
char *gfs_devp;
return (EG_NOTZFS);
return (E2BIG);
return (EG_OPENZFS);