Subject: Re: i386 boot code assembler problem
To: =?ISO-8859-2?Q?Jarom=EDr?= =?ISO-8859-2?Q?_Dole=E8ek?= <dolecek@ics.muni.cz>
From: Jaromír Doleček <dolecek@ics.muni.cz>
List: port-i386
Date: 05/17/2000 22:09:34
--ELM958594174-2344-0_
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: 8bit
Okay, this time with the mentioned file ....
Jaromir
Jaromír Doleček wrote:
> Hi,
> can anyone help me with this ? What I need is:
> call int 0x15, function 0xc0
> this call returns some info on es:bx, I need to pass the info
> into provided buffer
>
> I've copied code from
> sys/arch/i386/stand/lib/bios_disk.S:biosread() and hacked it to
> shape I _think_ it should do this, but it apparently doesn't.
> The call itself succeeds, but the passed buffer is not modified
> (the contents of the memory it points to stays the same).
> Is there any obvious error in attached code ?
>
> The routine is called like
>
> {
> struct ps2_sys_config *cfg;
> int err;
>
> cfg = alloc(sizeof(struct ps2_sys_config));
> err = biosmca(cfg);
> ...
> }
>
> Thanks for any help/hints :)
>
> Jaromir
> --
> Jaromir Dolecek <jdolecek@NetBSD.org> http://www.ics.muni.cz/~dolecek/
> @@@@ Wanna a real operating system ? Go and get NetBSD, damn! @@@@
>
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.ics.muni.cz/~dolecek/
@@@@ Wanna a real operating system ? Go and get NetBSD, damn! @@@@
--ELM958594174-2344-0_
Content-Type: text/plain; charset=ISO-8859-1
Content-Disposition: attachment; filename=biosmca.S
Content-Description: /home/dolecek/tmp/syssrc/sys/arch/i386/stand/lib/biosmca.S
Content-Transfer-Encoding: 7bit
/* $NetBSD: bios_disk.S,v 1.7 1999/03/30 22:35:21 fvdl 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.
*/
/* extracted from netbsd:sys/arch/i386/boot/bios.S */
#include <machine/asm.h>
#define addr32 .byte 0x67
#define data32 .byte 0x66
/*
# BIOS call "INT 0x15 Function 0xc0" to read extended sys config info on PS/2
# Call with %es:%bx = segment:offset of buffer to place the info
# Return:
# %al = 0x0 on success; err code on failure
*/
ENTRY(biosmca)
pushl %ebp
movl %esp, %ebp
pushl %ebx
push %ecx
push %edx
push %esi
push %edi
movl 8(%ebp), %ebx # offset
# prot_to_real will set %es to BOOTSEG
call _C_LABEL(prot_to_real) # enter real mode
movb $0xc0, %ah # subfunction
int $0x15
setc %bl
data32
call _C_LABEL(real_to_prot) # back to protected mode
xorl %eax, %eax
movb %bl, %al # return value in %ax
pop %edi
pop %esi
pop %edx
pop %ecx
popl %ebx
popl %ebp
ret
--ELM958594174-2344-0_--