X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fparse.c;h=f8a0dd123fd32c53a96ea7f19ab9bfa4a8cd987d;hb=3a5eefac8a65dfd36729031f0a9b9dd8c022b7f2;hp=bd5cc924c89b8a1ba5e27dabb2a0978660271304;hpb=503a50f07740b52908f630b0492cf56556f1a792;p=sbcl.git diff --git a/src/runtime/parse.c b/src/runtime/parse.c index bd5cc92..f8a0dd1 100644 --- a/src/runtime/parse.c +++ b/src/runtime/parse.c @@ -15,8 +15,8 @@ #include #include -#include "runtime.h" #include "sbcl.h" +#include "runtime.h" #if defined(LISP_FEATURE_SB_LDB) @@ -27,8 +27,15 @@ #include "interrupt.h" #include "lispregs.h" #include "monitor.h" +#include "validate.h" #include "arch.h" #include "search.h" +#include "thread.h" + +#include "genesis/simple-fun.h" +#include "genesis/fdefn.h" +#include "genesis/symbol.h" +#include "genesis/static-symbols.h" static void skip_ws(char **ptr) { @@ -243,26 +250,23 @@ static boolean lookup_symbol(char *name, lispobj *result) /* Search static space. */ headerptr = (lispobj *)STATIC_SPACE_START; count = - (lispobj *)SymbolValue(STATIC_SPACE_FREE_POINTER) - - (lispobj *)STATIC_SPACE_START; + (lispobj *)SymbolValue(STATIC_SPACE_FREE_POINTER,0) - + (lispobj *)STATIC_SPACE_START; if (search_for_symbol(name, &headerptr, &count)) { - *result = (lispobj)headerptr | OTHER_POINTER_LOWTAG; + *result = make_lispobj(headerptr,OTHER_POINTER_LOWTAG); return 1; } /* Search dynamic space. */ - headerptr = (lispobj *)DYNAMIC_SPACE_START; -#if !defined(__i386__) - count = - dynamic_space_free_pointer - - (lispobj *)DYNAMIC_SPACE_START; +#ifndef LISP_FEATURE_GENCGC + headerptr = (lispobj *)current_dynamic_space; + count = dynamic_space_free_pointer - headerptr; #else - count = - (lispobj *)SymbolValue(ALLOCATION_POINTER) - - (lispobj *)DYNAMIC_SPACE_START; + headerptr = (lispobj *)DYNAMIC_SPACE_START; + count = ((lispobj *)SymbolValue(ALLOCATION_POINTER,0)) - headerptr; #endif if (search_for_symbol(name, &headerptr, &count)) { - *result = (lispobj)headerptr | OTHER_POINTER_LOWTAG; + *result = make_lispobj(headerptr, OTHER_POINTER_LOWTAG); return 1; } @@ -273,35 +277,36 @@ static int parse_regnum(char *s) { if ((s[1] == 'R') || (s[1] == 'r')) { - int regnum; + int regnum; - if (s[2] == '\0') - return -1; + if (s[2] == '\0') + return -1; - /* skip the $R part and call atoi on the number */ - regnum = atoi(s + 2); - if ((regnum >= 0) && (regnum < NREGS)) - return regnum; - else - return -1; + /* skip the $R part and call atoi on the number */ + regnum = atoi(s + 2); + if ((regnum >= 0) && (regnum < NREGS)) + return regnum; + else + return -1; } else { - int i; + int i; - for (i = 0; i < NREGS ; i++) - if (strcasecmp(s + 1, lisp_register_names[i]) == 0) -#ifdef __i386__ - return i*2; + for (i = 0; i < NREGS ; i++) + if (strcasecmp(s + 1, lisp_register_names[i]) == 0) +#ifdef LISP_FEATURE_X86 + return i*2; #else - return i; + return i; #endif - - return -1; + + return -1; } } lispobj parse_lispobj(ptr) char **ptr; { + struct thread *thread=arch_os_get_current_thread(); char *token = parse_token(ptr); long pointer; lispobj result; @@ -310,28 +315,28 @@ char **ptr; printf("expected an object\n"); throw_to_monitor(); } else if (token[0] == '$') { - if (isalpha(token[1])) { - int free; - int regnum; - os_context_t *context; + if (isalpha(token[1])) { + int free; + int regnum; + os_context_t *context; - free = SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX)>>2; + free = SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX,thread)>>2; - if (free == 0) { - printf("Variable ``%s'' is not valid -- there is no current interrupt context.\n", token); - throw_to_monitor(); - } + if (free == 0) { + printf("Variable ``%s'' is not valid -- there is no current interrupt context.\n", token); + throw_to_monitor(); + } - context = lisp_interrupt_contexts[free - 1]; + context = thread->interrupt_contexts[free - 1]; - regnum = parse_regnum(token); - if (regnum < 0) { - printf("bogus register: ``%s''\n", token); - throw_to_monitor(); - } + regnum = parse_regnum(token); + if (regnum < 0) { + printf("bogus register: ``%s''\n", token); + throw_to_monitor(); + } - result = *os_context_register_addr(context, regnum); - } else if (!lookup_variable(token+1, &result)) { + result = *os_context_register_addr(context, regnum); + } else if (!lookup_variable(token+1, &result)) { printf("unknown variable: ``%s''\n", token); throw_to_monitor(); }