makecontext.c revision 1.2
11.2Sscole/* $NetBSD: makecontext.c,v 1.2 2016/11/22 22:50:32 scole Exp $ */ 21.1Sscole 31.1Sscole/*- 41.1Sscole * Copyright (c) 2016 The NetBSD Foundation, Inc. 51.1Sscole * All rights reserved. 61.1Sscole * 71.1Sscole * Redistribution and use in source and binary forms, with or without 81.1Sscole * modification, are permitted provided that the following conditions 91.1Sscole * are met: 101.1Sscole * 1. Redistributions of source code must retain the above copyright 111.1Sscole * notice, this list of conditions and the following disclaimer. 121.1Sscole * 2. Redistributions in binary form must reproduce the above copyright 131.1Sscole * notice, this list of conditions and the following disclaimer in the 141.1Sscole * documentation and/or other materials provided with the distribution. 151.1Sscole * 161.1Sscole * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 171.1Sscole * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 181.1Sscole * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 191.1Sscole * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 201.1Sscole * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 211.1Sscole * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 221.1Sscole * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 231.1Sscole * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 241.1Sscole * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 251.1Sscole * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 261.1Sscole * POSSIBILITY OF SUCH DAMAGE. 271.1Sscole */ 281.1Sscole 291.1Sscole#include <inttypes.h> 301.1Sscole#include <stddef.h> 311.1Sscole#include <ucontext.h> 321.1Sscole#include "extern.h" 331.1Sscole 341.1Sscole#if __STDC__ 351.1Sscole#include <stdarg.h> 361.1Sscole#else 371.1Sscole#include <varargs.h> 381.1Sscole#endif 391.1Sscole 401.1Sscolevoid 411.1Sscolemakecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) 421.1Sscole{ 431.1Sscole /* XXX implement, halt in ski */ 441.2Sscole __asm __volatile("break.i 1"); 451.1Sscole} 46