-;; The absolute/indirect load instructions are non-generic loads
-;; designed to be used in socket filters. They come in several
-;; variants:
-;;
-;; LD{abs,ind}{w,h,b,dw}le for the little-endian ISA
-;; LD{abs,ind}[w,h,b,dw}be for the big-endian ISA
-
-(define-pmacro (dlsi x-basename x-suffix x-class x-size x-mode x-endian)
- (dni (.sym x-basename x-suffix x-endian)
- (.str x-basename x-suffix)
+;; The absolute load instructions are non-generic loads designed to be
+;; used in socket filters. They come in several variants:
+;;
+;; LDABS{w,h,b,dw}
+
+(define-pmacro (dlabs x-suffix x-size x-smode)
+ (dni (.sym "ldabs" x-suffix)
+ (.str "ldabs" x-suffix)
+ (all-isas)
+ (.str "ldabs" x-suffix " $imm32")
+ (+ imm32 (f-offset16 0) (f-regs 0)
+ OP_CLASS_LD OP_MODE_ABS (.sym OP_SIZE_ x-size))
+ (set x-smode
+ (reg x-smode h-gpr 0)
+ (mem x-smode
+ (add DI
+ (mem DI
+ (add DI
+ (reg DI h-gpr 6) ;; Pointer to struct sk_buff
+ (const DI 0))) ;; XXX offsetof
+ ;; (struct sk_buff, data) XXX but the offset
+ ;; depends on CONFIG_* options, so this should
+ ;; be configured in the simulator and driven by
+ ;; command-line options. Handle with a c-call.
+ imm32)))
+ ;; XXX this clobbers R1-R5
+ ()))
+
+(dlabs "w" W SI)
+(dlabs "h" H HI)
+(dlabs "b" B QI)
+(dlabs "dw" DW DI)
+
+;; The indirect load instructions are non-generic loads designed to be
+;; used in socket filters. They come in several variants:
+;;
+;; LDIND{w,h,b,dw}le for the little-endian ISA
+;; LDIND[w,h,b,dw}be for the big-endian ISA
+
+(define-pmacro (dlind x-suffix x-size x-endian x-smode)
+ (dni (.sym "ldind" x-suffix x-endian)
+ (.str "ldind" x-suffix)