Home | History | Annotate | Line # | Download | only in libsa
      1 /*	$NetBSD: fdsub.S,v 1.2 2024/01/07 07:58:34 isaki Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2001 MINOURA Makoto.
      5  * 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 #include <machine/asm.h>
     29 #include "iocscall.h"
     30 
     31 /*
     32  * int fd_check_fmt(drive, head, minmax)
     33  *	int drive;		(0-3)
     34  *	int head;		(0-1)
     35  *	struct fdfmt *minmax;	(results are stored)
     36  *	return value:	0 on success, or negative
     37  */
     38 
     39 	.text
     40 ENTRY_NOPROFILE(fd_check_format)
     41 ||	movl	%sp@(4),%d1
     42 ||	andil	#3,%d1
     43 ||	orib	#0x90,%d1
     44 ||	lslw	#8,%d1
     45 ||	movql	#0,%d2
     46 ||	IOCS(__B_DRVCHK)
     47 ||	btst.b	#1,%d0
     48 ||	beq	fail
     49 ||	IOCS(__B_RECALI)
     50 
     51 	moveml	%sp@(4),%d0-%d1
     52 	andil	#1,%d1
     53 	andil	#3,%d0
     54 	lslw	#2,%d1
     55 	orw	%d1,%d0
     56 	jbsr	check_fd_format
     57 
     58 	tstl	%d1
     59 	beq	fail1
     60 
     61 	moval	%sp@(12),%a0
     62 	moveml	%d0-%d1,%a0@
     63 
     64 	movl	#0,%d0
     65 	rts
     66 
     67 ||fail:
     68 ||	movl	#-6,%d0
     69 ||	rts
     70 fail1:
     71 	movl	#-5,%d0
     72 
     73 #define BOOT_ERROR(a)	movl	#0,%d1;	\
     74 			rts
     75 
     76 #include "chkfmt.s"
     77