diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-03-31 23:08:38 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-03-31 23:08:38 +0000 |
commit | 679a3586471bb3cfdabf2368fd7e7db48dfa6135 (patch) | |
tree | 56ef6566211c1fad248edbff1015ceb3fc4cfc7e /sys/arch/i386/stand/libsa | |
parent | d56519762d6c1899f2baa3dbbc461af05cd168a6 (diff) |
missed additions to the last commit
and....
it compiles and runs ok on my machine.
*** TEST IT !!! ***
some pieces into MI libsa coming in a minute (if line won't drop ;)
Diffstat (limited to 'sys/arch/i386/stand/libsa')
-rw-r--r-- | sys/arch/i386/stand/libsa/biosmem.S | 97 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/exec_i386.S | 42 |
2 files changed, 139 insertions, 0 deletions
diff --git a/sys/arch/i386/stand/libsa/biosmem.S b/sys/arch/i386/stand/libsa/biosmem.S new file mode 100644 index 00000000000..a13f4cbf897 --- /dev/null +++ b/sys/arch/i386/stand/libsa/biosmem.S @@ -0,0 +1,97 @@ +/* $OpenBSD: biosmem.S,v 1.1 1997/03/31 23:08:36 mickey Exp $ */ + +/* + * Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 + * + * Mach Operating System + * Copyright (c) 1992, 1991 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ + +/* + Copyright 1988, 1989, 1990, 1991, 1992 + by Intel Corporation, Santa Clara, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appears in all +copies and that both the copyright notice and this permission notice +appear in supporting documentation, and that the name of Intel +not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. + +INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, +IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, +NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION +WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include <machine/asm.h> +#define data32 .byte 0x66 + +/* +# +# biosmem(i) : return the memory size in KB. i == 0 for conventional memory, +# i == 1 for extended memory +# BIOS call "INT 12H" to get conventional memory size +# BIOS call "INT 15H, AH=88H" to get extended memory size +# Both have the return value in AX. +# +*/ + +ENTRY(biosmem) + pushl %ebp + movl %esp, %ebp + pushl %esi + pushl %edi + + movl 8(%ebp), %edx + + call _C_LABEL(prot_to_real) # enter real mode + + testb %dl, %dl + jnz 1f + + int $0x12 + jmp 2f + +1: + movb $0x88, %ah + int $0x15 + +2: + movl %eax, %edx + + data32 + call _C_LABEL(real_to_prot) + + movl %edx, %eax + popl %edi + popl %esi + popl %ebp + ret diff --git a/sys/arch/i386/stand/libsa/exec_i386.S b/sys/arch/i386/stand/libsa/exec_i386.S new file mode 100644 index 00000000000..541a2db4ed3 --- /dev/null +++ b/sys/arch/i386/stand/libsa/exec_i386.S @@ -0,0 +1,42 @@ +/* $OpenBSD: exec_i386.S,v 1.2 1997/03/31 23:08:37 mickey Exp $ */ + +#include <machine/asm.h> + +/* + * machdep_start(phyaddr) + * start the program on protected mode where phyaddr is the entry point + */ + .globl _cnvmem, _extmem +ENTRY(machdep_start) + pushl %ebp + movl %esp, %ebp + + # get things we need into registers + movl 8(%ebp), %ecx # entry offset + movl 12(%ebp), %edi # howto + movl 16(%ebp), %edx # loadaddr + movl 24(%ebp), %esi # esym + + # make a new stack at 0:0x90000 (big segs) + movl $0x10, %eax + movw %ax, %ss + movl $0x90000, %eax + movl %eax, %esp + + # push some number of args onto the stack + pushl _cnvmem + pushl _extmem + pushl %esi # esym + pushl $0 # cyloff + pushl $0 # bootdev + pushl %edi # howto + pushl $0 # dummy 'return' address + + # push on our entry address + movl 0x8, %eax # segment + pushw %ax + andl $0xffffff, %ecx + pushl %ecx + + # convert the PC (and code seg) + lret |