-asm_switchstackandcall:
- mov 4(%esp),%edx /* first argument *stack */
- sub $8,%edx /* allocate new stack */
-
- mov (%esp),%eax /* save return address on new stack */
- mov %eax,(%edx)
-
- mov %esp,4(%edx) /* save old stack pointer on new stack */
-
- mov 12(%esp),%eax /* third argument **stacktopsave */
- mov %esp,(%eax) /* save old stack pointer to variable */
-
- mov 8(%esp),%eax /* load function pointer */
- mov 16(%esp),%ecx /* fourth argument *p */
-
- mov %edx,%esp /* switch to new stack */
-
- sub $4,%esp
- mov %ecx,0(%esp) /* pass pointer */
- call *%eax /* and call function */
- add $4,%esp
-
- mov (%esp),%edx /* load return address */
- mov 4(%esp),%esp /* switch to old stack */
- mov %edx,(%esp)
- ret
-
-
-Java_java_lang_VMSecurityManager_currentClassLoader:
- lea builtin_asm_getclassloader,%eax
- push %eax /*store collector function pointer*/
- jmp getClassContext_begin
-Java_java_lang_VMSecurityManager_getClassContext:
- lea builtin_asm_createclasscontextarray,%eax
- push %eax /*store collector function pointer*/
-getClassContext_begin: /*start the real work*/
-
- mov %esp,%eax
- sub $4,%eax
- sub $68,%esp /*64 memory location without overwriting return adress and collector function adress*/
- mov %esp,%ebx /*end of allocated memory block for classpointers is the adress of the working data block +4 */
- push $0 /*%esp+32 was native*/
- push %eax /*%esp+24 blkbegin*/
- push %eax /*%esp+20 currentpos*/
- push %ebx /*%esp+16 blkend*/
-
- call builtin_asm_get_threadrootmethod
- push %eax /*%esp+12*/
- movl 104(%esp),%eax /*(stack contains: threadRootMethod,blkend,blkpos,blkbegin,was native, data(64kB),collector,ret,env,class,frame stack info of stub, we want the frame stack info of thestub*/
- movl %esp,%edx
- addl $116, %edx
- push %edx /*esp+8*/ /*position of return address of native stub*/
- call builtin_asm_get_stackframeinfo
- movl (%eax),%eax /*comment ??*/
- push 0(%eax) /*esp+4*/ /*address of frame info block*/
- movl 124(%esp),%edx
-
-/*DEBUG*/
-/* mov %esp,%eax
- addl $116,%eax
- push %eax
- call i386_native_stub_debug
- pop %eax*/
-
- push %edx /*esp+0*/ /*return adress out of native stub*/
- call findmethod /*find calling java method, this one is still to be skipped (==SecurityManager.getClassContext (or .currentClassLoader)*/
-
-/*DEBUGGING*/
-/* push %eax
- movl MethodPointer(%eax),%eax
- push %eax
- call temporaryGetClassContextHelper
- pop %eax
- call traverseStackInfo
- pop %eax
-*/
-
- movl 20(%esp),%edx
- movl MethodPointer(%eax),%ebx
- movl offclassmethodinfo(%ebx),%ecx
- movl %ecx,(%edx)
- subl $4,%edx
- movl %edx,20(%esp)
-
- mov 8(%esp),%ebx /*pos of return adress */
- add FrameSize(%eax),%ebx
- add $4,%ebx /*adress of new return adress (out of Securitymanager.*/
- mov %ebx,8(%esp)
- mov %eax,(%esp)
-
- /* by now we have skipped this method call*/
-
-getClassContext_next:
- movl 8(%esp),%eax
- movl (%eax),%eax
- movl %eax,(%esp) /*return adress*/
-
- call findmethod
-
- cmp $1,32(%esp)
- mov 8(%esp),%ebx
- add FrameSize(%eax),%ebx
- add $4,%ebx
- mov %ebx,8(%esp) /*store adress of next return adress*/
-getClassContext_nextRetStored:
-
- mov MethodPointer(%eax),%ecx /*get struct methodinfo*/
-
- cmp $0,%ecx
- je getClassContext_nativeCall
- /*save class pointer*/
- movl $0,32(%esp)
-getClassContext_saveClassPointer:
- movl 20(%esp),%ebx /*get temporary memory adress in stack*/
- movl offclassmethodinfo(%ecx),%edx /* get class pointer of method*/
- movl %edx,(%ebx) /*save */
- sub $4,%ebx /*calculate next position */
- movl %ebx,20(%esp) /* check if the new adress would overwrite our working data */
- cmp %ebx,16(%esp)
- je getClassContext_incStack
-getClassContext_checkLeave:
-
- cmp 12(%esp),%ecx /*check if we reached the toplevel method of our thread*/
- je getClassContext_leave /*yes ->leave*/
-
-/*DEBUGING*/
-/* mov %ecx,(%esp)
- call temporaryGetClassContextHelper
-*/
-
-
- jmp getClassContext_next /*continue*/
-
-
-getClassContext_nativeCall:
- movl $1,32(%esp)
- movl 4(%esp),%eax /*get top most element on stackframe help information stack*/
- movl 0(%eax),%ecx
- movl %ecx,4(%esp)
- addl $8,%eax
- movl (%eax),%ecx
- addl $4,%eax
- movl %eax,8(%esp)
-
- cmp $0,%ecx
- je getClassContext_checkLeave
- jmp getClassContext_saveClassPointer
-
-getClassContext_incStack:
- /*make another 64 in our temporary storage free and store the workingdata */
- movl %esp,%edx
- subl $40,%esp /*should be 32*/
- push 32(%edx)
- push 28(%edx)
- push 24(%edx)
- push 20(%edx)
- push 16(%edx)
- push 12(%edx)
- push 8(%edx)
- push 4(%edx)
- push 0(%edx)
- subl $64,16(%esp)
-
- jmp getClassContext_checkLeave /* continue */
-
-getClassContext_leave:
-/*DEBUGING*/
-/* mov %ecx,(%esp)
- call temporaryGetClassContextHelper*/
-
- /*call collector function with begin/end of temporary classarray*/
- push 24(%esp)
- push 24(%esp)
-
- movl 32(%esp),%eax
- add $4,%eax
- movl (%eax),%ebx
- call *%ebx
-
- /* free stack memory of this function*/
- mov 32(%esp),%esp
- add $8,%esp