X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fparse.c;h=beedc2972e949ab1998a2129fc268dc690b2d8b1;hb=dd54f9e004a0a83d1328e94648f48dcc27e0be5b;hp=f8a0dd123fd32c53a96ea7f19ab9bfa4a8cd987d;hpb=79cc569a97e444389350ea3f5b1017374fe16bec;p=sbcl.git diff --git a/src/runtime/parse.c b/src/runtime/parse.c index f8a0dd1..beedc29 100644 --- a/src/runtime/parse.c +++ b/src/runtime/parse.c @@ -12,6 +12,7 @@ */ #include +#include #include #include @@ -31,6 +32,7 @@ #include "arch.h" #include "search.h" #include "thread.h" +#include "pseudo-atomic.h" #include "genesis/simple-fun.h" #include "genesis/fdefn.h" @@ -213,29 +215,30 @@ char *parse_addr(ptr) char **ptr; { char *token = parse_token(ptr); - long result; + lispobj result; if (token == NULL) { printf("expected an address\n"); throw_to_monitor(); } else if (token[0] == '$') { - if (!lookup_variable(token+1, (lispobj *)&result)) { + if (!lookup_variable(token+1, &result)) { printf("unknown variable: ``%s''\n", token); throw_to_monitor(); } result &= ~7; } else { - if (!string_to_long(token, &result)) { + long value; + if (!string_to_long(token, &value)) { printf("invalid number: ``%s''\n", token); throw_to_monitor(); } - result &= ~3; + result = (value & ~3); } if (!is_valid_lisp_addr((os_vm_address_t)result)) { - printf("invalid Lisp-level address: 0x%lx\n", result); + printf("invalid Lisp-level address: %p\n", (void *)result); throw_to_monitor(); } @@ -258,13 +261,14 @@ static boolean lookup_symbol(char *name, lispobj *result) } /* Search dynamic space. */ -#ifndef LISP_FEATURE_GENCGC +#if defined(LISP_FEATURE_GENCGC) + headerptr = (lispobj *)DYNAMIC_SPACE_START; + count = (lispobj *)get_alloc_pointer() - headerptr; +#else headerptr = (lispobj *)current_dynamic_space; count = dynamic_space_free_pointer - headerptr; -#else - headerptr = (lispobj *)DYNAMIC_SPACE_START; - count = ((lispobj *)SymbolValue(ALLOCATION_POINTER,0)) - headerptr; #endif + if (search_for_symbol(name, &headerptr, &count)) { *result = make_lispobj(headerptr, OTHER_POINTER_LOWTAG); return 1; @@ -310,24 +314,25 @@ char **ptr; char *token = parse_token(ptr); long pointer; lispobj result; + long value; if (token == NULL) { printf("expected an object\n"); throw_to_monitor(); } else if (token[0] == '$') { if (isalpha(token[1])) { - int free; + int free_ici; int regnum; os_context_t *context; - free = SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX,thread)>>2; + free_ici = fixnum_value(SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX,thread)); - if (free == 0) { + if (free_ici == 0) { printf("Variable ``%s'' is not valid -- there is no current interrupt context.\n", token); throw_to_monitor(); } - context = thread->interrupt_contexts[free - 1]; + context = thread->interrupt_contexts[free_ici - 1]; regnum = parse_regnum(token); if (regnum < 0) { @@ -355,8 +360,8 @@ char **ptr; throw_to_monitor(); } } - else if (string_to_long(token, (long *)&result)) - ; + else if (string_to_long(token, &value)) + result = value; else if (lookup_symbol(token, &result)) ; else {