From 010329f29da072e6a6a9c2e09286fbce0779bf0d Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Wed, 24 Aug 2022 16:15:10 -0700 Subject: [PATCH] Convert to NativeAligned4FromLAddr/LPage in macros defined in cell.h --- inc/cell.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/inc/cell.h b/inc/cell.h index 037580c..84b4670 100644 --- a/inc/cell.h +++ b/inc/cell.h @@ -22,6 +22,7 @@ */ /**********************************************************************/ +#include "adr68k.h" /* for NativeAligned4FromLPage, NativeAligned4FromLAddr */ #include "lispemul.h" /* for LispPTR, DLword */ /* CONS CELL (LISTP) definitions moved to lispemulater.h */ @@ -101,13 +102,13 @@ struct conspage { /* Following MACROs for Conspage */ /* lisp_ptr is LISP pointer, returns 68k ptr points struct conspage obj */ -#define Get_ConsPageBase(lisp_ptr) (struct conspage *)Addr68k_from_LPAGE(POINTER_PAGEBASE(lisp_ptr)) +#define Get_ConsPageBase(lisp_ptr) (struct conspage *)NativeAligned4FromLPage(POINTER_PAGEBASE(lisp_ptr)) #define GetNewCell_68k(conspage68k) \ (ConsCell *)(((DLword *)(conspage68k)) + (unsigned)((conspage68k)->next_cell)) /* page : LISP page */ -#define GetCONSCount(page) (((struct conspage *)Addr68k_from_LPAGE(page))->count) +#define GetCONSCount(page) (((struct conspage *)NativeAligned4FromLPage(page))->count) #ifndef BYTESWAP /* For chaining together free cons cells on a page */ @@ -402,10 +403,13 @@ struct cadr_cell { #endif /* Good only for new-style NEW-ATOMs */ -#define GetDEFCELLnew(index) (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_DEFN_OFFSET) -#define GetVALCELLnew(index) (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_VALUE_OFFSET) -#define GetPnameCellnew(index) (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_PNAME_OFFSET) -#define GetPropCellnew(index) (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_PLIST_OFFSET) +/* Note: the _OFFSET values are in units of DLword so need to be adjusted before doing pointer + * arithmetic since we now have native pointers to cells not DLwords + */ +#define GetDEFCELLnew(index) (NativeAligned4FromLAddr(index) + (NEWATOM_DEFN_OFFSET / DLWORDSPER_CELL)) +#define GetVALCELLnew(index) (NativeAligned4FromLAddr(index) + (NEWATOM_VALUE_OFFSET / DLWORDSPER_CELL)) +#define GetPnameCellnew(index) (NativeAligned4FromLAddr(index) + (NEWATOM_PNAME_OFFSET / DLWORDSPER_CELL)) +#define GetPropCellnew(index) (NativeAligned4FromLAddr(index) + (NEWATOM_PLIST_OFFSET / DLWORDSPER_CELL)) #endif /* BIGATOMS */