From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Date: Mon, 18 Jun 2018 16:45:36 +0200 Subject: [U-Boot] [PATCH v8 12/30] sandbox: Try to start the RAM buffer at a particular address In-Reply-To: <20180618140835.195901-13-sjg@chromium.org> References: <20180618140835.195901-1-sjg@chromium.org> <20180618140835.195901-13-sjg@chromium.org> Message-ID: <094edfc9-e485-d577-d4fb-6cf1bccd49ec@suse.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 06/18/2018 04:08 PM, Simon Glass wrote: > Use a starting address of 256MB which should be available. This helps to > make sandbox RAM buffers pointers more recognisable. > > Signed-off-by: Simon Glass Nak, this has a non-0 chance of failing, in case something else is already mapped at that address. You don't want to have your CI blow up 1% of the time due to this. Alex > --- > > Changes in v8: None > Changes in v7: None > Changes in v6: None > Changes in v5: None > Changes in v4: None > Changes in v3: None > Changes in v2: None > > arch/sandbox/cpu/os.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c > index a1a982af2d..1553aa687d 100644 > --- a/arch/sandbox/cpu/os.c > +++ b/arch/sandbox/cpu/os.c > @@ -145,7 +145,12 @@ void *os_malloc(size_t length) > struct os_mem_hdr *hdr; > int page_size = getpagesize(); > > - hdr = mmap(NULL, length + page_size, > + /* > + * Use an address that is hopefully available to us so that pointers > + * to this memory are fairly obvious. If we end up with a different > + * address, that's fine too. > + */ > + hdr = mmap((void *)0x10000000, length + page_size, > PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); > if (hdr == MAP_FAILED) > return NULL;