1/* $NetBSD: ctrlsp.S,v 1.2 2008/04/28 20:23:39 martin Exp $ */ 2 3/*- 4 * Copyright (c) 1996 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Adam Glass. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32/* 33 * This is shared with stand/libsa 34 * XXX - can not include cpu.h there... 35 */ 36 37#include <machine/asm.h> 38#define FC_CONTROL 3 /* from cpu.h */ 39 40/* 41 * unsigned char get_control_byte (char *addr) 42 */ 43ENTRY(get_control_byte) 44 movc %sfc,%d1 | save sfc 45 moveq #FC_CONTROL,%d0 | sfc = FC_CONTROL 46 movec %d0,%sfc 47 movl %sp@(4),%a0 | src addr 48 moveq #0,%d0 | get byte 49 movsb %a0@,%d0 50 movc %d1,%sfc | restore sfc 51 rts 52 53/* 54 * unsigned int get_control_word (char *addr) 55 */ 56ENTRY(get_control_word) 57 movc %sfc,%d1 | save sfc 58 moveq #FC_CONTROL,%d0 | sfc = FC_CONTROL 59 movec %d0,%sfc 60 movl %sp@(4),%a0 | src addr 61 movsl %a0@,%d0 | get long 62 movc %d1,%sfc | restore sfc 63 rts 64 65/* 66 * void set_control_byte (char *addr, int value) 67 */ 68ENTRY(set_control_byte) 69 movc %dfc,%d1 | save dfc 70 moveq #FC_CONTROL,%d0 | dfc = FC_CONTROL 71 movc %d0,%dfc 72 movl %sp@(4),%a0 | addr 73 movl %sp@(8),%d0 | value 74 movsb %d0,%a0@ | set byte 75 movc %d1,%dfc | restore dfc 76 rts 77 78/* 79 * void set_control_word (char *addr, int value) 80 */ 81ENTRY(set_control_word) 82 movc %dfc,%d1 | save dfc 83 moveq #FC_CONTROL, %d0 | dfc = FC_CONTROL 84 movc %d0,%dfc 85 movl %sp@(4),%a0 | addr 86 movl %sp@(8),%d0 | value 87 movsl %d0,%a0@ | set long 88 movc %d1,%dfc | restore dfc 89 rts 90