From 4e67dd7cfc0752fb0c83f3a485545f9477614932 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 25 Jan 2015 15:57:44 +0000 Subject: [PATCH] z80/6502: final (hopefully) alternate magic bytes for relocatables --- Kernel/cpu-6502/cpu.h | 6 +++++- Kernel/cpu-z80/cpu.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Kernel/cpu-6502/cpu.h b/Kernel/cpu-6502/cpu.h index 66d9e413..3fb7892c 100644 --- a/Kernel/cpu-6502/cpu.h +++ b/Kernel/cpu-6502/cpu.h @@ -22,7 +22,11 @@ extern void * __fastcall__ memset(void *, int, size_t); extern size_t __fastcall__ strlen(const char *); #define EMAGIC 0x4C /* Header of executable (JMP) */ -#define EMAGIC_2 0x18 /* CLC BCC foo */ +#define EMAGIC_2 0x38 /* SEC BCS foo */ +/* We use SEC BCS not CLC BCC because CLC is 0x18 which is the Z80 JR header + so the two would be identical - not good! */ + + /* High byte is saved, low byte is a mystery so take worst case. Also allow a bit less as C stack is not return stack */ #define brk_limit() ((udata.u_syscall_sp | 0xFF) - 384) diff --git a/Kernel/cpu-z80/cpu.h b/Kernel/cpu-z80/cpu.h index d399e1f8..c2646ca2 100644 --- a/Kernel/cpu-z80/cpu.h +++ b/Kernel/cpu-z80/cpu.h @@ -19,6 +19,7 @@ extern void irqrestore(irqflags_t f); /* Z80 binaries start with a JP */ #define EMAGIC 0xc3 /* Header of executable */ +#define EMAGIC_2 0x18 /* JR */ /* Allow a minimum of 512 bytes gap between stack and top of allocations */ #define brk_limit() (udata.u_syscall_sp - 512) -- 2.34.1