From 898a716b91de1f8f055a143964daedb661cbf393 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 31 Oct 2016 18:13:15 +0000 Subject: [PATCH] runtime: work around mor1kx ignoring low bits of reset address. Fixes #599. --- artiq/gateware/amp/kernel_cpu.py | 2 +- artiq/runtime.rs/src/kernel_proto.rs | 2 +- artiq/runtime.rs/src/rpc_queue.rs | 4 ++-- artiq/runtime/ksupport.ld | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/artiq/gateware/amp/kernel_cpu.py b/artiq/gateware/amp/kernel_cpu.py index 9ad73099a..6aca00d32 100644 --- a/artiq/gateware/amp/kernel_cpu.py +++ b/artiq/gateware/amp/kernel_cpu.py @@ -7,7 +7,7 @@ from misoc.integration.soc_core import mem_decoder class KernelCPU(Module): def __init__(self, platform, - exec_address=0x40800080, + exec_address=0x40800000, main_mem_origin=0x40000000, l2_size=8192): self._reset = CSRStorage(reset=1) diff --git a/artiq/runtime.rs/src/kernel_proto.rs b/artiq/runtime.rs/src/kernel_proto.rs index d98be19f8..afaf7c35e 100644 --- a/artiq/runtime.rs/src/kernel_proto.rs +++ b/artiq/runtime.rs/src/kernel_proto.rs @@ -3,7 +3,7 @@ use core::marker::PhantomData; use core::fmt; -pub const KERNELCPU_EXEC_ADDRESS: usize = 0x40800080; +pub const KERNELCPU_EXEC_ADDRESS: usize = 0x40800000; pub const KERNELCPU_PAYLOAD_ADDRESS: usize = 0x40840000; pub const KERNELCPU_LAST_ADDRESS: usize = 0x4fffffff; pub const KSUPPORT_HEADER_SIZE: usize = 0x80; diff --git a/artiq/runtime.rs/src/rpc_queue.rs b/artiq/runtime.rs/src/rpc_queue.rs index f0f89f144..35fbe0df2 100644 --- a/artiq/runtime.rs/src/rpc_queue.rs +++ b/artiq/runtime.rs/src/rpc_queue.rs @@ -8,7 +8,7 @@ const SEND_MAILBOX: *mut usize = (board::mem::MAILBOX_BASE + 4) as *mut usize; const RECV_MAILBOX: *mut usize = (board::mem::MAILBOX_BASE + 8) as *mut usize; const QUEUE_BEGIN: usize = 0x40400000; -const QUEUE_END: usize = 0x40800000; +const QUEUE_END: usize = 0x407fff80; const QUEUE_CHUNK: usize = 0x1000; pub unsafe fn init() { @@ -21,7 +21,7 @@ fn next(mut addr: usize) -> usize { debug_assert!(addr >= QUEUE_BEGIN && addr < QUEUE_END); addr += QUEUE_CHUNK; - if addr == QUEUE_END { addr = QUEUE_BEGIN } + if addr >= QUEUE_END { addr = QUEUE_BEGIN } addr } diff --git a/artiq/runtime/ksupport.ld b/artiq/runtime/ksupport.ld index 1e0ed5040..333db0739 100644 --- a/artiq/runtime/ksupport.ld +++ b/artiq/runtime/ksupport.ld @@ -13,7 +13,7 @@ INCLUDE generated/regions.ld * are also loaded. */ MEMORY { - ksupport (RWX) : ORIGIN = 0x40800080, LENGTH = 0x40000 + ksupport (RWX) : ORIGIN = 0x40800000, LENGTH = 0x40000 } /* Kernel stack is at the end of main RAM. */