From f48184bbdc430516eb0b9331c401b0edc2abb4b0 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 29 Mar 2018 15:56:34 +0100 Subject: [PATCH] cpu.h: add __packed --- Kernel/cpu-6502/cpu.h | 2 ++ Kernel/cpu-65c816/cpu.h | 2 ++ Kernel/cpu-68000/cpu.h | 2 ++ Kernel/cpu-6809/cpu.h | 1 + Kernel/cpu-68hc11/cpu.h | 2 ++ Kernel/cpu-8086/cpu.h | 1 + Kernel/cpu-msp430x/cpu.h | 1 + Kernel/cpu-z80/cpu.h | 5 +++++ 8 files changed, 16 insertions(+) diff --git a/Kernel/cpu-6502/cpu.h b/Kernel/cpu-6502/cpu.h index aa104865..5aa5f383 100644 --- a/Kernel/cpu-6502/cpu.h +++ b/Kernel/cpu-6502/cpu.h @@ -69,3 +69,5 @@ typedef union { /* this structure is endian dependent */ /* CC65 is bright enough to partly optimise this but not fully so do it by hand */ #define HIBYTE32(x) (((uint8_t *)&(x))[3]) + +#define __packed diff --git a/Kernel/cpu-65c816/cpu.h b/Kernel/cpu-65c816/cpu.h index c370fb33..2a3c4a30 100644 --- a/Kernel/cpu-65c816/cpu.h +++ b/Kernel/cpu-65c816/cpu.h @@ -76,3 +76,5 @@ typedef union { /* this structure is endian dependent */ /* cc65 really wants structs used repeatedly to be marked register */ #define regptr register + +#define __packed diff --git a/Kernel/cpu-68000/cpu.h b/Kernel/cpu-68000/cpu.h index ef06b66e..99346082 100644 --- a/Kernel/cpu-68000/cpu.h +++ b/Kernel/cpu-68000/cpu.h @@ -77,3 +77,5 @@ register struct u_data *udata_ptr asm ("a5"); #define CONFIG_STACKSIZE 1024 #define CPUTYPE CPUTYPE_68000 + +#define __packed __attribute__((packed)) diff --git a/Kernel/cpu-6809/cpu.h b/Kernel/cpu-6809/cpu.h index c9a0285a..0ba8e112 100644 --- a/Kernel/cpu-6809/cpu.h +++ b/Kernel/cpu-6809/cpu.h @@ -71,3 +71,4 @@ typedef union { /* this structure is endian dependent */ #define BIG_ENDIAN #define CPUTYPE CPUTYPE_6809 +#define __packed __attribute__((packed)) diff --git a/Kernel/cpu-68hc11/cpu.h b/Kernel/cpu-68hc11/cpu.h index 47f022d3..6faac2b5 100644 --- a/Kernel/cpu-68hc11/cpu.h +++ b/Kernel/cpu-68hc11/cpu.h @@ -68,3 +68,5 @@ typedef union { /* this structure is endian dependent */ #define BIG_ENDIAN #define CPUTYPE CPUTYPE_68HC11 + +#define __packed __attribute__((packed)) diff --git a/Kernel/cpu-8086/cpu.h b/Kernel/cpu-8086/cpu.h index df32872a..ce2ae6c1 100644 --- a/Kernel/cpu-8086/cpu.h +++ b/Kernel/cpu-8086/cpu.h @@ -94,3 +94,4 @@ static inline uint8_t inb(uint16_t port) } #define CPUTYPE CPUTYPE_8086 +#define __packed __attribute__((packed)) diff --git a/Kernel/cpu-msp430x/cpu.h b/Kernel/cpu-msp430x/cpu.h index e6aae65f..03037c32 100644 --- a/Kernel/cpu-msp430x/cpu.h +++ b/Kernel/cpu-msp430x/cpu.h @@ -119,3 +119,4 @@ typedef union { /* this structure is endian dependent */ #define no_cache_udata() #define CPUTYPE CPUTYPE_MSP340X +#define __packed __attribute__((packed)) diff --git a/Kernel/cpu-z80/cpu.h b/Kernel/cpu-z80/cpu.h index cb5583cc..3c8de8e0 100644 --- a/Kernel/cpu-z80/cpu.h +++ b/Kernel/cpu-z80/cpu.h @@ -87,3 +87,8 @@ typedef union { /* this structure is endian dependent */ /* Deal with SDCC code gen issue */ #define HIBYTE32(x) (((uint8_t *)&(x))[3]) + +/* SDCC does not support attribute(packed) but then it also doesn't insert + padding either */ + +#define __packed \ No newline at end of file -- 2.34.1