cpu.h revision 1.11
11.11Spooka/*	$NetBSD: cpu.h,v 1.11 2009/10/15 01:50:08 pooka Exp $	*/
21.1Spooka
31.1Spooka/*
41.1Spooka * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
51.1Spooka *
61.1Spooka * Development of this software was supported by Google Summer of Code.
71.1Spooka *
81.1Spooka * Redistribution and use in source and binary forms, with or without
91.1Spooka * modification, are permitted provided that the following conditions
101.1Spooka * are met:
111.1Spooka * 1. Redistributions of source code must retain the above copyright
121.1Spooka *    notice, this list of conditions and the following disclaimer.
131.1Spooka * 2. Redistributions in binary form must reproduce the above copyright
141.1Spooka *    notice, this list of conditions and the following disclaimer in the
151.1Spooka *    documentation and/or other materials provided with the distribution.
161.1Spooka *
171.1Spooka * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
181.1Spooka * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
191.1Spooka * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
201.1Spooka * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
211.1Spooka * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221.1Spooka * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
231.1Spooka * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241.1Spooka * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251.1Spooka * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261.1Spooka * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271.1Spooka * SUCH DAMAGE.
281.1Spooka */
291.1Spooka
301.1Spooka#ifndef _SYS_RUMP_CPU_H_
311.1Spooka#define _SYS_RUMP_CPU_H_
321.1Spooka
331.8Spooka#ifndef _LOCORE
341.8Spooka
351.1Spooka#include <sys/cpu_data.h>
361.5Spooka#include <machine/pcb.h>
371.1Spooka
381.1Spookastruct cpu_info {
391.4Spooka	struct cpu_data ci_data;
401.2Spooka	cpuid_t ci_cpuid;
411.4Spooka
421.4Spooka/*
431.4Spooka * XXX: horrible workaround for vax lock.h.
441.4Spooka * I eventually want to nuke rump include/machine, so don't waste
451.4Spooka * energy fighting with this.
461.4Spooka */
471.4Spooka#ifdef __vax__
481.4Spooka	int ci_ipimsgs;
491.4Spooka#define IPI_SEND_CNCHAR 0
501.4Spooka#define IPI_DDB 0
511.4Spooka#endif /* __vax__ */
521.9Spooka
531.9Spooka/*
541.9Spooka * More stinky hacks, this time for powerpc.  Will go away eventually.
551.9Spooka */
561.9Spooka#ifdef __powerpc__
571.9Spooka	struct cache_info {
581.9Spooka		int dcache_size;
591.9Spooka		int dcache_line_size;
601.9Spooka		int icache_size;
611.9Spooka		int icache_line_size;
621.9Spooka	} ci_ci;
631.9Spooka#endif /* __powerpc */
641.1Spooka};
651.1Spooka
661.4Spooka/* more dirty rotten vax kludges */
671.4Spooka#ifdef __vax__
681.4Spookastatic __inline void cpu_handle_ipi(void) {}
691.4Spooka#endif /* __vax__ */
701.4Spooka
711.9Spooka#ifdef __powerpc__
721.9Spookavoid __syncicache(void *, size_t);
731.9Spooka#endif
741.9Spooka
751.3Spookastruct lwp *rump_get_curlwp(void); /* XXX */
761.3Spooka#define curlwp rump_get_curlwp()
771.3Spooka
781.11Spooka#define curcpu() (curlwp->l_cpu)
791.11Spooka#define cpu_number() 0 /* XXX: not good enuf */
801.11Spooka
811.8Spooka#endif /* !_LOCORE */
821.8Spooka
831.1Spooka#endif /* _SYS_RUMP_CPU_H_ */
84