function will search for an exception handling function
that covers the calling address. If none is found,
it will assume that it is a language without exception
- handling, an5Ad return the exception to the caller in eax.
+ handling, and return the exception to the caller in eax.
edx: length of exception segment, if any
ecx: may be clobbered
Callee:
- eax: pointer to PIB
- edx: pointer to caller information struct, or NULL if not
- requested
- esp: NULL.
+ eax: object ID
+ edx: segment zero size
+ ecx: total size
+ ebx: method ID
+ esp, ebp, esi, edi: NULL.
Jump to 0x7fff0080 to return.
ebx, ecx, esi, edi, ebp, esp: may be clobbered
Other system calls:
- eax, edx, ecx: syscall arguments.
+ eax, edx, ecx: syscall arguments.
- Call 0x7fff0000 + 0x80 * syscallnum
+ Call 0x7fff0000 + 0x80 * syscallnum
- eax: return value
- edx, ecx: may be clobbered
+ eax: return value
+ edx, ecx: may be clobbered
This is like buffer_size, but for Copy segments.
objlist_ptr pointer Pointer to the object list
- newobj_ptr pointer Pointer to the new object list.
objlist_len 32-bit Length of the object list, in IDs
- newobj_len 32-bit Length of the new object list, in entries.
The object list is a special segment that contains object IDs
rather than arbitrary data. Each object ID will be translated
Objects which live in this address space have the high bit
clear; remote objects have the high bit set. When sending an
object reference that has not been exposed to the kernel
- before, its interface hash (SHA-1 of interface GUIDs) should
- exist in the newobj list.
+ before, the new_object() syscall must first be called.
num_segments 32-bit Number of data segments
within the specified size.
IDLC does not check for loops in the inheritance chain.
+
+oldptr not underscored
#include <list>
#include <map>
#include <vector>
+#include <cstring>
#include "compileddef.h"
CompiledDefHeader hdr;
// sym is the symbol from which to get the path/name, and
- // dir is true if it should be "name/.self" rather than
+ // is_dir is true if it should be "name/.self" rather than
// "name".
- void output_self(const char *dir, Symbol *sym, bool dir);
+ void output_self(const char *dir, Symbol *sym, bool is_dir);
public:
Def(const char *self, int self_len, CompiledDefHeader::Type type) :
}
;
-more_params:
- /* empty */
-| ',' param_list
+param_list_nonempty:
+ param
+| param_list_nonempty ',' param
;
param_list:
/* empty */
-| param more_params
-;
+| param_list_nonempty
method:
ident '(' {
const char *cur = input->c_str();
do {
- char *next = strchr(cur, delimeter);
+ const char *next = strchr(cur, delimeter);
String *s = new String();
s->token = TOK_IDENT;
} else if (!strcmp(s, "show-targets")) {
printf("Supported target architectures:\n");
for (int i = 1; i <= max_target; i++)
- printf(" %s\n", targets[i].name);
+ printf(" %s\n", targets[i].name);
printf("\n");
exit(0);
} else if (!strcmp(s, "server")) {
}
static int global_argc;
-static const char **global_argv;
+static char **global_argv;
static int got_dashdash;
static void process_args(void)
for (i = 1; i < global_argc; i++) {
if (global_argv[i][0] == '-' && global_argv[i][1] && !got_dashdash) {
- const char *opt = global_argv[i];
+ char *opt = global_argv[i];
if (opt[1] == '-') {
if (!opt[2]) {
autorelease_pool.clean();
}
-int run_idlc(int argc, const char **argv)
+int run_idlc(int argc, char **argv)
{
global_argc = argc;
global_argv = argv;
return 0;
}
-int main(int argc, const char **argv)
+int main(int argc, char **argv)
{
int ret = run_idlc(argc, argv);
autorelease_pool.clean();
char *strcat(char *dest, const char *src);
char *strncat(char *dest, const char *src, size_t len);
int strcmp(const char *s1, const char *s2);
- int strncmp(const char *s1, const char *s2, int n);
+ int strncmp(const char *s1, const char *s2, size_t n);
#ifdef __cplusplus
char *strchr(char *s, int c);
extern int x86_diverr, x86_debug, x86_breakpoint;
extern int x86_gpf, x86_page_fault, x86_invalid_insn;
-extern int x86_int98_entry, x86_int99_entry;
+extern int x86_int98_entry, x86_int99_entry, x86_int9a_entry, x86_int9b_entry;
extern void *x86_irqs[256];
namespace Arch {
set_int_gate(14, &x86_page_fault, true);
set_int_gate(0x98, &x86_int98_entry, false, true);
set_int_gate(0x99, &x86_int99_entry, false, true);
+ set_int_gate(0x9a, &x86_int9a_entry, false, true);
+ set_int_gate(0x9b, &x86_int9b_entry, false, true);
for (int i = 0x20; i < 0x30; i++)
set_int_gate(i, x86_irqs[i], true);
movl $ROSHARED_PTR(x86_shared_int98_ret), (%esp)
iret
+ .global x86_int9a_entry
+x86_int9a_entry:
+ pushl %edx
+ pushl %eax
+ enterkernel %edx
+
+ pushl %esp
+ call x86_new_object
+ addl $4, %esp
+
+ exitkernel
+ popl %eax
+ xorl %ecx, %ecx
+ xorl %edx, %edx
+ iret
+
+ .global x86_int9b_entry
+x86_int9b_entry:
+ pushl %edx
+ pushl %eax
+ enterkernel %edx
+
+ pushl %esp
+ call x86_get_iface_hash
+ addl $4, %esp
+
+ exitkernel
+ popl %eax
+ xorl %ecx, %ecx
+ xorl %edx, %edx
+ iret
+
.global x86_irq
x86_irq:
pushvolatilesnoeax
int $0x99
ret
+ . = roshared + 0x100
+x86_shared_int9a:
+ int $0x9a
+ ret
+
+ . = roshared + 0x180
+x86_shared_int9b:
+ int $0x9b
+ ret
+
.global test_user_ptr
test_user_ptr:
.long ROSHARED_PTR(test_user)
union {
System::RunTime::ParamInfoBlock *pib;
uintptr_t exptr;
+ uintptr_t arg0;
};
union {
uintptr_t caller;
size_t exlen;
+ uintptr_t arg1;
};
ulong eip, cs, eflags, user_esp, user_ss;
assert(regs->cs & 3);
regs->user_esp = ORB::return_from_method(regs->exptr, regs->exlen);
}
+
+extern "C" void x86_new_object(Arch::Priv::OrbRegs *regs)
+{
+ assert(regs->cs & 3);
+ regs->arg0 = 0;
+}
+
+extern "C" void x86_get_iface_hash(Arch::Priv::OrbRegs *regs)
+{
+ assert(regs->cs & 3);
+ regs->arg0 = 0;
+}
CallFrame frames[0];
};
+ static const ID invalid_id = 0xffffffff;
struct ObjectHdr {
ID id;
-
- union {
- struct {
- u32 Valid:1;
- u32 Pointer:1;
- };
-
- u32 flags;
- };
};
struct Object : public ObjectHdr {
Object *object;
};
- union ObjTableEntry {
- ObjectHdr hdr;
- Object obj;
- ObjectPtr ptr;
- };
-
- typedef Util::RadixTree<ObjTableEntry, ID, 6> IDTable;
+ typedef Util::RadixTree<Object, ID, 6> LocalIDTable;
+ typedef Util::RadixTree<ObjectPtr, ID, 6> RemoteIDTable;
typedef Util::RBPtr<Object *, ObjectPtr *> IDRMap;
typedef Util::BitmapTree<ID> IDAlloc;
class IDSpace {
Lock::SpinLock lock; // For add/del only; not needed for lookup
- IDTable table; // Forward mapping of local IDs to object ptrs
+ LocalIDTable locals; // Objects that live in this address space
+ RemoteIDTable remotes; // Objects that live in other address spaces
IDRMap rmap; // Reverse mapping of remote object pointers to local IDs
IDAlloc alloc; // Bitmap for allocating IDs
{
// FIXME: refcounting
ObjTableEntry *ote = table.lookup(id);
- if (!ote || !ote->hdr.Valid)
+ if (!ote || ote->hdr.id == invalid_id)
return NULL;
if (ote->hdr.Pointer)
return (unsigned char)*s2 - (unsigned char)*s1;
}
-int strncmp(const char *s1, const char *s2, int n)
+int strncmp(const char *s1, const char *s2, size_t n)
{
- int i = 0;
+ size_t i = 0;
while (i < n && s1[i] && s2[i] && s1[i] == s2[i])
i++;