77 lines
2.1 KiB
C++
77 lines
2.1 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
*
|
|
* The contents of this file are subject to the Netscape Public
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.mozilla.org/NPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
* implied. See the License for the specific language governing
|
|
* rights and limitations under the License.
|
|
*
|
|
* The Original Code is mozilla.org code.
|
|
*
|
|
* The Initial Developer of the Original Code is Netscape
|
|
* Communications Corporation. Portions created by Netscape are
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
* Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
*/
|
|
//
|
|
// x86SysCallsRuntime.cpp
|
|
//
|
|
// simon
|
|
|
|
#include "JavaObject.h"
|
|
#include "SysCallsRuntime.h"
|
|
|
|
extern void* sysInvokeNativeStubs[1024];
|
|
|
|
// Assembly glue macro
|
|
#if defined(_WIN32)
|
|
|
|
#define guardedSysCall(target, numArgWords) \
|
|
__declspec(naked) SYSCALL_FUNC(void) guarded##target() \
|
|
{ \
|
|
__asm \
|
|
{ \
|
|
__asm push OFFSET target \
|
|
__asm jmp [sysInvokeNativeStubs + 4 * numArgWords] \
|
|
} \
|
|
}
|
|
|
|
#else
|
|
//#error You need to make some inline assembly equivalent to the above
|
|
#define guardedSysCall(target, numArgWords)
|
|
#endif
|
|
|
|
extern "C" {
|
|
|
|
// Make Guard Stubs for the all SysCalls that can throw exceptions
|
|
// NB: SysThrow is already guarded
|
|
// form: guardedSysCall(actual destination, number of words for parameters)
|
|
guardedSysCall(sysCheckArrayStore, 2)
|
|
|
|
guardedSysCall(sysMonitorEnter, 1)
|
|
guardedSysCall(sysMonitorExit, 1)
|
|
|
|
guardedSysCall(sysNewNDArray, 2)
|
|
guardedSysCall(sysNew2DArray, 3)
|
|
guardedSysCall(sysNew3DArray, 4)
|
|
|
|
guardedSysCall(sysNew, 1)
|
|
|
|
guardedSysCall(sysNewByteArray, 1)
|
|
guardedSysCall(sysNewBooleanArray, 1)
|
|
guardedSysCall(sysNewShortArray, 1)
|
|
guardedSysCall(sysNewCharArray, 1)
|
|
guardedSysCall(sysNewIntArray, 1)
|
|
guardedSysCall(sysNewLongArray, 1)
|
|
guardedSysCall(sysNewFloatArray, 1)
|
|
guardedSysCall(sysNewDoubleArray, 1)
|
|
guardedSysCall(sysNewObjectArray, 2)
|
|
|
|
}
|