38c19fb2f19d749834de8dd2db5b1677d7cfc88b
[cacao.git] / src / native / vm / VMSecurityManager.c
1 /* nat/SecurityManager.c - java/lang/SecurityManager
2
3    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
4    R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
5    M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
6    P. Tomsich, J. Wenninger
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Roman Obermaiser
28
29    Changes: Joseph Wenninger
30
31    $Id: VMSecurityManager.c 951 2004-03-11 17:30:03Z jowenn $
32
33 */
34
35
36 #include "jni.h"
37 #include "builtin.h"
38 #include "native.h"
39 #include "tables.h"
40 #include "toolbox/loging.h"
41 #include "java_lang_ClassLoader.h"
42
43 #ifdef _ALPHA_
44 /*
45  * Class:     java/lang/SecurityManager
46  * Method:    currentClassLoader
47  * Signature: ()Ljava/lang/ClassLoader;
48  */
49 JNIEXPORT java_lang_ClassLoader* JNICALL Java_java_lang_VMSecurityManager_currentClassLoader(JNIEnv *env, jclass clazz)
50 {
51         log_text("Java_java_lang_VMSecurityManager_currentClassLoader");
52         init_systemclassloader();
53
54         return SystemClassLoader;
55 }
56 #endif
57
58 #ifdef _ALPHA_
59 /*THIS IS IN ASMPART NOW*/
60 /*
61  * Class:     java/lang/SecurityManager
62  * Method:    getClassContext
63  * Signature: ()[Ljava/lang/Class;
64  */
65 JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMSecurityManager_getClassContext(JNIEnv *env, jclass clazz)
66 {
67   log_text("Java_java_lang_VMSecurityManager_getClassContext  called");
68
69   /* XXX should use vftbl directly */
70   return (java_objectarray *) builtin_newarray(0, class_array_of(class_java_lang_Class)->vftbl);
71 }
72 #endif
73
74 java_objectarray* temporaryGetClassContextHelper(methodinfo *m) {
75         if (!m) {
76                 log_text("BUILTIN");
77                 return 0;
78         }
79         if (!(m->name)) log_text("method or block has no name");
80         else
81         utf_display(m->name);
82         printf("--");  
83         if (!(m->class)) log_text("method or block has no class");
84         else
85         utf_display(m->class->name);
86         printf("\n");  
87 #if 0
88   log_text("temporaryGetClassContextHelper called");
89   if (adr==0) log_text("NO REAL METHOD");
90   else {
91         
92         struct methodinfo *m=(struct methodinfo*)(*(adr-1));
93         if (!(m->name)) log_text("method or block has no name");
94         else
95         utf_display(m->name);
96         if (!(m->class)) log_text("method or block has no class");
97         else
98         utf_display(m->class->name);
99         printf("\nFrame size:%ld\n",(long)(*(adr-2)));
100         adr=adr-5;
101         printf("saveint:%ld\n",(long)(*adr));
102         printf("saveflt:%ld\n",(long)(*(adr-1)));
103   }
104   log_text("temporaryGetClassContextHelper leaving");
105   return (java_objectarray *) builtin_newarray(0, class_array_of(class_java_lang_Class)->vftbl);        
106 #endif
107 }
108
109 java_objectarray* temporaryGetClassContextHelper2() {
110   log_text("temporaryGetClassContextHelper2 called");
111   return (java_objectarray *) builtin_newarray(0, class_array_of(class_java_lang_Class)->vftbl);        
112 }
113
114 /*
115  * These are local overrides for various environment variables in Emacs.
116  * Please do not remove this and leave it at the end of the file, where
117  * Emacs will automagically detect them.
118  * ---------------------------------------------------------------------
119  * Local variables:
120  * mode: c
121  * indent-tabs-mode: t
122  * c-basic-offset: 4
123  * tab-width: 4
124  * End:
125  */