* routine expects "mbuf-like" argument, and it does not expect the mbuf to be
* authentic; it only cares about 3 fields.
*/
+#if defined(__LP64__)
#define M_NEXT 0
#define M_DATA 16 // 8-byte address, would be aligned to 8-byte boundary
#define M_LEN 24
+#else
+#define M_NEXT 0
+#define M_DATA 8
+#define M_LEN 12
+#endif
.globl _os_cpu_in_cksum_mbuf
.text
#define Wmlen w6
#define t x7
#define data x8
+#if defined(__LP64__)
+ #define ptr_m x0
+ #define ptr_data x8
+#else
+ #define ptr_m w0
+ #define ptr_data w8
+#endif
+
mov needs_swap, #0 // needs_swap = FALSE;
mov started_on_odd, #0 // started_on_odd = FALSE;
ldr Wmlen, [m, #M_LEN] // mlen = m->m_len;
cmp mlen, off
b.le 1f
- ldr data, [m, #M_DATA] // mtod(m, uint8_t *)
+ ldr ptr_data, [m, #M_DATA] // mtod(m, uint8_t *)
sub mlen, mlen, off // mlen -= off;
add data, data, off // data = mtod(m, uint8_t *) + off;
b L_post_initial_offset
mov x0, x3
ret lr
2:
- ldr m, [m, #M_NEXT]
+ ldr ptr_m, [m, #M_NEXT]
b 0b
L_loop: // for (; len > 0; m = m->m_next) {
*/
cbz m, Lin_cksum_whoops // if (m == NULL) return -1;
ldr Wmlen, [m, #M_LEN] // mlen = m->m_len;
- ldr data, [m, #M_DATA] // mtod(m, uint8_t *)
+ ldr ptr_data, [m, #M_DATA] // mtod(m, uint8_t *)
L_post_initial_offset:
/*
L_continue:
cmp len, #0
- ldr m, [m, #M_NEXT] // m = m->m_next
+ ldr ptr_m, [m, #M_NEXT] // m = m->m_next
b.gt L_loop
/*