abortfixup.c revision 1.1
11.1Sreinoud/* $NetBSD: abortfixup.c,v 1.1 2002/03/16 20:37:49 reinoud Exp $ */
21.1Sreinoud
31.1Sreinoud/*-
41.1Sreinoud * Copyright (c) 2001 The NetBSD Foundation, Inc.
51.1Sreinoud * All rights reserved.
61.1Sreinoud *
71.1Sreinoud * Redistribution and use in source and binary forms, with or without
81.1Sreinoud * modification, are permitted provided that the following conditions
91.1Sreinoud * are met:
101.1Sreinoud * 1. Redistributions of source code must retain the above copyright
111.1Sreinoud *    notice, this list of conditions and the following disclaimer.
121.1Sreinoud * 2. Redistributions in binary form must reproduce the above copyright
131.1Sreinoud *    notice, this list of conditions and the following disclaimer in the
141.1Sreinoud *    documentation and/or other materials provided with the distribution.
151.1Sreinoud * 3. All advertising materials mentioning features or use of this software
161.1Sreinoud *    must display the following acknowledgement:
171.1Sreinoud *      This product includes software developed by the NetBSD
181.1Sreinoud *      Foundation, Inc. and its contributors.
191.1Sreinoud * 4. Neither the name of The NetBSD Foundation nor the names of its
201.1Sreinoud *    contributors may be used to endorse or promote products derived
211.1Sreinoud *    from this software without specific prior written permission.
221.1Sreinoud *
231.1Sreinoud * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
241.1Sreinoud * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
251.1Sreinoud * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
261.1Sreinoud * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
271.1Sreinoud * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
281.1Sreinoud * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
291.1Sreinoud * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
301.1Sreinoud * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
311.1Sreinoud * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
321.1Sreinoud * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
331.1Sreinoud * POSSIBILITY OF SUCH DAMAGE.
341.1Sreinoud *
351.1Sreinoud *
361.1Sreinoud * Trying out if an unhandled instruction pattern in the late abort fixup
371.1Sreinoud * generates a panic or sysfaults like it ought to do.
381.1Sreinoud */
391.1Sreinoud
401.1Sreinoud#include <sys/types.h>
411.1Sreinoud
421.1Sreinoud__RCSID("$NetBSD: abortfixup.c,v 1.1 2002/03/16 20:37:49 reinoud Exp $");
431.1Sreinoud
441.1Sreinoud#include <signal.h>
451.1Sreinoud#include <stdio.h>
461.1Sreinoud#include <stdlib.h>
471.1Sreinoud#include <stdio.h>
481.1Sreinoud
491.1Sreinoud
501.1Sreinoudint main(void) {
511.1Sreinoud	printf("ARM 6/7 abort fixup panic regression test\n");
521.1Sreinoud	printf("    it should SEGV instead of panic!\n");
531.1Sreinoud
541.1Sreinoud	/*
551.1Sreinoud 	 * issue an instruction that for certain generates a page
561.1Sreinoud	 * fault but _can't_ be fixed up by late abort fixup
571.1Sreinoud	 * routines due to its structure.
581.1Sreinoud	 */
591.1Sreinoud
601.1Sreinoud	__asm __volatile ("
611.1Sreinoud		mvn r0, #0
621.1Sreinoud		mov r1, r0
631.1Sreinoud		str r0, [r0], r1, ror #10
641.1Sreinoud	");
651.1Sreinoud
661.1Sreinoud	/* Should not be reached if OK */
671.1Sreinoud	printf("!!! Regression test FAILED - no SEGV recieved\n");
681.1Sreinoud	return 1;
691.1Sreinoud};
701.1Sreinoud
71