From d5f0d4ee233cfee12945b69ac622ebf6b883ad66 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 21 Jul 2015 21:35:28 +0100 Subject: [PATCH] cpu-68hc11: add cpu definition --- Kernel/cpu-68hc11/cpu.h | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Kernel/cpu-68hc11/cpu.h diff --git a/Kernel/cpu-68hc11/cpu.h b/Kernel/cpu-68hc11/cpu.h new file mode 100644 index 00000000..15328ae9 --- /dev/null +++ b/Kernel/cpu-68hc11/cpu.h @@ -0,0 +1,69 @@ +typedef unsigned long uint32_t; +typedef signed long int32_t; +typedef unsigned short uint16_t; +typedef signed short int16_t; +typedef unsigned char uint8_t; +typedef signed char int8_t; +typedef signed int size_t; + +typedef uint8_t irqflags_t; + +typedef int16_t arg_t; +typedef uint16_t uarg_t; /* Holds arguments */ +typedef uint16_t usize_t; /* Largest value passed by userspace */ +typedef int16_t susize_t; +typedef uint16_t uaddr_t; /* A user address must fit this */ +typedef uint16_t uptr_t; /* User pointer equivalent */ + +#define uputp uputw /* Copy user pointer type */ +#define ugetp ugetw /* between user and kernel */ + +extern void ei(void); +extern irqflags_t di(void); +extern void irqrestore(irqflags_t f); + +#define EMAGIC 0x7E /* Header of executable (JMP) */ +#define EMAGIC_2 0x20 /* BRA */ +/* Allow a minimum of 512 bytes gap between stack and top of allocations */ +#define brk_limit() (udata.u_syscall_sp - 512) + +extern void *memcpy(void *, const void *, size_t); +extern void *memset(void *, int, size_t); +extern size_t strlen(const char *); +extern uint16_t swab(uint16_t); + +/* 680x wins on this one! */ +#define ntohs(x) (x) +#define ntohl(x) (x) + +/* 68HC11 doesn't benefit from making a few key variables in + non-reentrant functions static - FIXME, evaluate this carefully esp + wrt zero page */ +#define staticfast auto + +/* User's structure for times() system call */ +typedef unsigned long clock_t; + +typedef struct { + uint32_t high; /* FIXME: check this matches long long */ + uint32_t low; +} time_t; + +typedef union { /* this structure is endian dependent */ + clock_t full; /* 32-bit count of ticks since boot */ + struct { + uint16_t high; + uint16_t low; /* 16-bit count of ticks since boot */ + } h; +} ticks_t; + + +#define cpu_to_le16(x) swab(x) +#define le16_to_cpu(x) swab(x) +#define cpu_to_le32(x) ((((uint32_t)cpu_to_le16((x) & 0xFFFF)) << 16) | \ + (uint32_t)cpu_to_le16((x) >> 16)) +#define le32_to_cpu(x) cpu_to_le32(x) + +/* Sane behaviour for unused parameters */ +#define used(x) + -- 2.34.1