First JEM version from Nevo <sakur.deagod@gmail.com>, very buggy
[jamvm-avr32-jem.git] / src / arch / avr32_jem.h
blobcde22b5e0375dc712591d4771a0b6dce8ac70c79
1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007
3 * Robert Lougher <rob@lougher.org.uk>.
5 * This file is part of JamVM.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2,
10 * or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef AVR32_JEM_H_
23 #define AVR32_JEM_H_
24 #ifdef JEM
26 #define JEM_TRAP_ENTRIES 25 //our own trap table entries,the first entry is a jump to the proper offset
27 //extern static const void* jem_trap_handlers_0_ENTRY[JEM_TRAP_ENTRIES];
29 extern char *trap_h;
31 #define __NR_java_settrap 282
32 /**
33 * Setup the real traps,the entries are actually loaded when entering
34 * the interpreter engine
36 #define PREPARE_JEM_TRAPS \
37 { \
38 char *trap_b; \
39 trap_b = mmap(0, 8192, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED | MAP_ANONYMOUS, 0, 0); \
40 if (!trap_b) \
41 exitVM(1); \
42 trap_h = (void *)(((unsigned long)trap_b + 4095) & ~4095); \
43 syscall(__NR_java_settrap, trap_h);\
47 /**
48 * Called when exit jam vm
49 * TODO:
51 #define DESTORY_JEM_TRAPS
54 #endif /*JEM*/
55 #endif /*AVR32_JEM_H_*/