1/* $NetBSD: libi386.h,v 1.53 2024/06/29 13:46:40 rin Exp $ */ 2 3/* 4 * Copyright (c) 1996 5 * Matthias Drochner. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * 27 */ 28 29#ifndef __I386_STAND_LIBI386_H__ 30#define __I386_STAND_LIBI386_H__ 31 32typedef unsigned long physaddr_t; 33 34/* this is in startup code */ 35void vpbcopy(const void *, void *, size_t); 36void pvbcopy(const void *, void *, size_t); 37void pbzero(void *, size_t); 38physaddr_t vtophys(void *); 39 40ssize_t pread(int, void *, size_t); 41void startprog(physaddr_t, uint32_t, uint32_t *, physaddr_t); 42void multiboot(physaddr_t, physaddr_t, physaddr_t, uint32_t); 43 44int exec_netbsd(const char *, physaddr_t, int, int, void (*)(void)); 45int exec_multiboot(const char *, char *); 46 47void delay(int); 48int getbasemem(void); 49int getextmemx(void); 50int getextmem1(void); 51int biosvideomode(void); 52#ifdef CONSERVATIVE_MEMDETECT 53#define getextmem() getextmem1() 54#else 55#define getextmem() getextmemx() 56#endif 57void reboot(void); 58void gateA20(void); 59 60void clear_pc_screen(void); 61void initio(int); 62#define CONSDEV_PC 0 63#define CONSDEV_COM0 1 64#define CONSDEV_COM1 2 65#define CONSDEV_COM2 3 66#define CONSDEV_COM3 4 67#define CONSDEV_COM0KBD 5 68#define CONSDEV_COM1KBD 6 69#define CONSDEV_COM2KBD 7 70#define CONSDEV_COM3KBD 8 71#define CONSDEV_AUTO (-1) 72int iskey(int); 73char awaitkey(int, int); 74void wait_sec(int); 75 76/* multiboot */ 77struct multiboot_package; 78struct multiboot_package_priv; 79 80struct multiboot_package { 81 int mbp_version; 82 struct multiboot_header *mbp_header; 83 const char *mbp_file; 84 char *mbp_args; 85 u_long mbp_basemem; 86 u_long mbp_extmem; 87 u_long mbp_loadaddr; 88 u_long *mbp_marks; 89 struct multiboot_package_priv*mbp_priv; 90 struct multiboot_package*(*mbp_probe)(const char *); 91 int (*mbp_exec)(struct multiboot_package *); 92 void (*mbp_cleanup)(struct multiboot_package *); 93}; 94 95struct multiboot_package *probe_multiboot1(const char *); 96struct multiboot_package *probe_multiboot2(const char *); 97 98/* this is in "user code"! */ 99int parsebootfile(const char *, char **, char **, int *, int *, const char **); 100 101#ifdef XMS 102physaddr_t ppbcopy(physaddr_t, physaddr_t, int); 103int checkxms(void); 104physaddr_t xmsalloc(int); 105#endif 106 107/* parseutils.c */ 108char *gettrailer(char *); 109int parseopts(const char *, int *); 110int parseboot(char *, char **, int *); 111 112/* menuutils.c */ 113struct bootblk_command { 114 const char *c_name; 115 void (*c_fn)(char *); 116}; 117void bootmenu(void); 118void docommand(char *); 119 120/* in "user code": */ 121void command_help(char *); 122extern const struct bootblk_command commands[]; 123 124/* asm bios/dos calls */ 125__compactcall int biosdisk_extread(int, void *); 126int biosdisk_read(int, int, int, int, int, void *); 127__compactcall int biosdisk_reset(int); 128 129__compactcall int biosgetrtc(u_long *); 130int biosgetsystime(void); 131int comgetc(int); 132void cominit(int); 133__compactcall int computc(int, int); 134int comstatus(int); 135int congetc(void); 136int conisshift(void); 137int coniskey(void); 138__compactcall void conputc(int); 139void conclr(void); 140 141int getextmem2(int *); 142__compactcall int getextmemps2(void *); 143int getmementry(int *, int *); 144 145__compactcall int biosdisk_int13ext(int); 146__compactcall int biosdisk_getinfo(int); 147struct biosdisk_extinfo; 148__compactcall int biosdisk_getextinfo(int, struct biosdisk_extinfo *); 149int get_harddrives(void); 150void biosdisk_probe(void); 151 152void module_add(char *); 153void splash_add(char *); 154void rnd_add(char *); 155void fs_add(char *); 156void userconf_add(char *); 157void module_add_split(const char *, uint8_t); 158 159struct btinfo_framebuffer; 160void framebuffer_configure(struct btinfo_framebuffer *); 161 162void ksyms_addr_set(void *, void *, void *); 163 164#endif /* __I386_STAND_LIBI386_H__ */ 165