*/
#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
-#include <signal.h>
-#include "runtime.h"
#include "sbcl.h"
+#if defined(LISP_FEATURE_WIN32) && defined(LISP_FEATURE_SB_THREAD)
+#include "pthreads_win32.h"
+#else
+#include <signal.h>
+#endif
+#include "runtime.h"
#if defined(LISP_FEATURE_SB_LDB)
#include "interrupt.h"
#include "lispregs.h"
#include "monitor.h"
+#include "validate.h"
#include "arch.h"
#include "search.h"
#include "thread.h"
+#include "pseudo-atomic.h"
#include "genesis/simple-fun.h"
#include "genesis/fdefn.h"
(*ptr)++;
}
-static boolean string_to_long(char *token, long *value)
+static boolean string_to_long(char *token, uword_t *value)
{
int base, digit;
- long num;
+ uword_t num;
char *ptr;
if (token == 0)
}
#endif
-long parse_number(ptr)
+uword_t parse_number(ptr)
char **ptr;
{
char *token = parse_token(ptr);
- long result;
+ uword_t result;
if (token == NULL) {
printf("expected a number\n");
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)) {
+ uword_t 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();
}
/* Search static space. */
headerptr = (lispobj *)STATIC_SPACE_START;
count =
- (lispobj *)SymbolValue(STATIC_SPACE_FREE_POINTER,0) -
- (lispobj *)STATIC_SPACE_START;
+ (lispobj *)SymbolValue(STATIC_SPACE_FREE_POINTER,0) -
+ (lispobj *)STATIC_SPACE_START;
if (search_for_symbol(name, &headerptr, &count)) {
*result = make_lispobj(headerptr,OTHER_POINTER_LOWTAG);
return 1;
}
/* Search dynamic space. */
+#if defined(LISP_FEATURE_GENCGC)
headerptr = (lispobj *)DYNAMIC_SPACE_START;
-#if !defined(__i386__)
- count =
- dynamic_space_free_pointer -
- (lispobj *)DYNAMIC_SPACE_START;
+ count = (lispobj *)get_alloc_pointer() - headerptr;
#else
- count =
- (lispobj *)SymbolValue(ALLOCATION_POINTER,0) -
- (lispobj *)DYNAMIC_SPACE_START;
+ headerptr = (lispobj *)current_dynamic_space;
+ count = dynamic_space_free_pointer - headerptr;
#endif
+
if (search_for_symbol(name, &headerptr, &count)) {
*result = make_lispobj(headerptr, OTHER_POINTER_LOWTAG);
return 1;
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;
}
}
{
struct thread *thread=arch_os_get_current_thread();
char *token = parse_token(ptr);
- long pointer;
+ uword_t pointer;
lispobj result;
+ uword_t value;
if (token == NULL) {
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_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) {
- printf("Variable ``%s'' is not valid -- there is no current interrupt context.\n", token);
- throw_to_monitor();
- }
+ 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) {
- 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();
}
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 {