]> git.buserror.net Git - polintos/scott/priv.git/commitdiff
Random stuff.
authorScott Wood <scott@buserror.net>
Fri, 22 Apr 2011 03:37:54 +0000 (22:37 -0500)
committerScott Wood <scott@buserror.net>
Fri, 22 Apr 2011 03:37:54 +0000 (22:37 -0500)
Random stuff lying around uncommitted from when I last worked on this a
couple years ago.  It's not in a good state, but the commit before it
probably wasn't either.

Signed-off-by: Scott Wood <scott@buserror.net>
14 files changed:
doc/abi/x86
doc/orb/parameter-info-block
idlcomp/BUGS
idlcomp/idlc.h
idlcomp/idlparse.y
idlcomp/input.cc
idlcomp/main.cc
include/c/std/string.h
kernel/arch/x86/descriptors.cc
kernel/arch/x86/entry.S
kernel/arch/x86/misc.cc
kernel/include/kern/orb.h
kernel/orb/invoke.cc
lib/c/freestanding/string.c

index 7a11bd11a47a813b1a6962e25d1953da52ff9563..a095a79e4125886983eb8e6e2e919b28b965a404 100644 (file)
@@ -13,15 +13,16 @@ Out-of-Process Method Invocation:
            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.
       
@@ -31,9 +32,9 @@ Out-of-Process Method Invocation:
       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
index c4f176848cadb92e480df4ec2aaf912436350c7b..7c9b3d83df7b238ffb524e3e177f520fe5ca3f15 100644 (file)
@@ -24,9 +24,7 @@ Parameter Info Block (PIB)
       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
@@ -38,8 +36,7 @@ Parameter Info Block (PIB)
       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
 
index fc1be9d16c384cf907a4933614c86b21413308ff..8a8090c726fa8d2a22f48dae3036e43aa5615cb0 100644 (file)
@@ -2,3 +2,5 @@ IDLC does not check whether the contents of a bitfield or enum fit
 within the specified size.
 
 IDLC does not check for loops in the inheritance chain.
+
+oldptr not underscored
index 414d14a7a08d9b2cd1c7719a09e9bc22aa828001..56dfefea45e543e6b29657f24257bf7faf14e654 100644 (file)
@@ -30,6 +30,7 @@
 #include <list>
 #include <map>
 #include <vector>
+#include <cstring>
 
 #include "compileddef.h"
 
@@ -824,9 +825,9 @@ protected:
        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) :
index a6f30e9235181e570a955ab5f80179d77d236446..23bd8fd2101c36db38b5573f96afae99255755e0 100644 (file)
@@ -421,15 +421,14 @@ param:
        }                       
 ;
 
-more_params:
-       /* empty */
-|      ',' param_list
+param_list_nonempty:
+       param
+|      param_list_nonempty ',' param
 ;
 
 param_list:
        /* empty */
-|      param more_params
-;
+|      param_list_nonempty
 
 method:
        ident '(' {
index 1ef953d2be2cc95f7461aa8dd739b4fc8399ff2c..80a5f876edbedc7cecd26dba13e0573706db2618 100644 (file)
@@ -271,7 +271,7 @@ StrList::StrList(const String *input, char delimeter)
        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;
                
index a02453cad2a8f9b3de8b18f4f4f89a7db7c76df2..00c2151b89ced4d7c71101129e9156cb186179aa 100644 (file)
@@ -349,7 +349,7 @@ static void longopt(const char *s, const char *arg)
        } 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")) {
@@ -361,7 +361,7 @@ static void longopt(const char *s, const char *arg)
 }
 
 static int global_argc;
-static const char **global_argv;
+static char **global_argv;
 static int got_dashdash;
 
 static void process_args(void)
@@ -372,7 +372,7 @@ 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]) {
@@ -719,7 +719,7 @@ void language_output()
        autorelease_pool.clean();
 }
 
-int run_idlc(int argc, const char **argv)
+int run_idlc(int argc, char **argv)
 {
        global_argc = argc;
        global_argv = argv;
@@ -783,7 +783,7 @@ int run_idlc(int argc, const char **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();
index 6c2f4c9becdec0dfa6c69f3e2919caa3cb1e5c83..e50633c277fee3121c1b1dc309cdda54070a3818 100644 (file)
@@ -18,7 +18,7 @@ extern "C" {
        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);
index 35e11f974e14dc8e8f21fe3b9091e83b4764f78d..172e4e42bfbeb25c2032bf9e4b3689c10c868028 100644 (file)
@@ -183,7 +183,7 @@ static void set_int_gate(int num, void *addrptr, bool ints_off = false,
 
 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 {
@@ -203,6 +203,8 @@ namespace Priv {
                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);
index 8d4ede48ad2309d117979c0533b7095ca29ff99b..8308fb7330cb32ce2530fbad7028392cab8b3b77 100644 (file)
@@ -321,6 +321,38 @@ x86_int99_entry:
        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
@@ -430,6 +462,16 @@ x86_shared_int99:
        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)
index 3e0091a9aeb08c10e0986e719a05a695c4950e35..a458a563cbb4b83eaeb4ff41e6da41808eea8351 100644 (file)
@@ -253,11 +253,13 @@ namespace Priv {
                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;
@@ -298,3 +300,15 @@ extern "C" void x86_return_from_method(Arch::Priv::OrbRegs *regs)
        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;
+}
index f9654341589af29f27fb95ff5de3c62b54e2af76..22664ec2d006dac80c92d67ce6dae7a24939c4e5 100644 (file)
@@ -49,17 +49,9 @@ namespace ORB {
                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 {
@@ -70,19 +62,15 @@ namespace ORB {
                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
        
index ced7ad8469db3508d6cbf4706d4f6a46e59b3c96..abfe23792d231e5ed1f49693bee8c47aba4ed502 100644 (file)
@@ -57,7 +57,7 @@ namespace ORB {
        {
                // 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)
index 45eb2463284af43fd33ffe4f043e999dd0069537..77c13ef698b79e970cc9b131522b9afa50e9d01a 100644 (file)
@@ -153,9 +153,9 @@ int strcmp(const char *s1, const char *s2)
        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++;