/* vim: set filetype=c:
 *
 **************************************************************************
 *
 * Boot-ROM-Code to load an operating system across a TCP/IP network.
 *
 * Module:  base.h86
 * Purpose: Definitions for the base code
 * Entries: none
 *
 **************************************************************************
 *
 * Copyright (C) 2003-2007 Gero Kuhlmann <gero@gkminix.han.de>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: base.h86,v 1.5 2007/01/06 18:30:46 gkminix Exp $
 */

#ifndef KERNEL_BOOT_BASE_H86
#define KERNEL_BOOT_BASE_H86



/*
 **************************************************************************
 *
 * This file can only get included into target C source files
 */
#if defined(_ASSEMBLY_) || !defined(_TARGET_) || !defined(_BOOTROM_)
# error This file can only get included into target C source files
#endif



/*
 **************************************************************************
 *
 * We need some includes before we can include this file
 */
#include <common.h86>



/*
 **************************************************************************
 *
 * The checksum computation routine is in the kernel init file:
 */
static inline __u8 dochecksum(const __u8 *ptr, size_t len)
{
  __u16 d0, d1;
  __u8 ret;

  __asm__ __volatile__(
	"call dochecksum"
	: "=&S" (d0), "=&c" (d1), "=&a" (ret)
	: "0" (_NP(ptr)), "1" ((__u16)len)
	: "cc");
  return(ret);
}



/*
 **************************************************************************
 *
 * Misc. external functions:
 */

/* Execute a loaded boot image */
extern bool_t exec_image(short mode, __fptr exec, __fptr head, void *param);


/* Determine the base of free memory */
extern __u16 getfbm(void);


/* Set the base of free memory */
extern void setfbm(__u16 newfbm);


#endif

