Merge branch 'main' of github.com:betrusted-io/xous-core into main

This commit is contained in:
bunnie 2021-07-11 04:15:26 +08:00
commit 8007eabd54
6 changed files with 86 additions and 22 deletions

View file

@ -44,8 +44,8 @@ of wear leveling, however.
+ 2028_0000 | Reserved for backup bitstream |
+ 204F_FFFF | |
+-----------+----------------------------------------+
+ 2050_0000 | loader.bin - Xous loader |
+ 2050_FFFF | |
+ 2050_0000 | top 0x1000 is signature record |
+ 2050_FFFF | 0x2050_1000: loader.bin - Xous loader |
+-----------+----------------------------------------+
+ 2051_0000 | Font planes |
+ 2097_FFFF | |

View file

@ -74,15 +74,23 @@ namespace Antmicro.Renode.Peripherals.Video
{
for (int x = 0; x < Width; x++)
{
if (((newbuf[(x + y * 44 * 8) / 8] >> (x % 8)) & 1) > 0)
if ((devBoot) && (y == devBootLine) && ((x >> 1) & 2) != 0)
{
buffer[2 * (x + y * Width)] = 0xFF;
buffer[2 * (x + y * Width) + 1] = 0xFF;
buffer[2 * (x + y * Width)] = 0x00;
buffer[2 * (x + y * Width) + 1] = 0x00;
}
else
{
buffer[2 * (x + y * Width)] = 0x0;
buffer[2 * (x + y * Width) + 1] = 0x0;
if (((newbuf[(x + y * 44 * 8) / 8] >> (x % 8)) & 1) > 0)
{
buffer[2 * (x + y * Width)] = 0xFF;
buffer[2 * (x + y * Width) + 1] = 0xFF;
}
else
{
buffer[2 * (x + y * Width)] = 0x0;
buffer[2 * (x + y * Width) + 1] = 0x0;
}
}
}
}
@ -105,8 +113,13 @@ namespace Antmicro.Renode.Peripherals.Video
Registers.PRESCALER.Define(this)
.WithValueField(0, 32, valueProviderCallback: _ => { return 0; })
;
Registers.DEVBOOT.Define(this)
.WithFlag(0, name: "DEVBOOT", valueProviderCallback: _ => { return devBoot; }, changeCallback: (_, val) => { if (val) { devBoot = true; } })
;
}
private const int devBootLine = 12;
private bool devBoot = false;
private bool updateDirty = false;
private bool updateAll = false;
@ -119,6 +132,7 @@ namespace Antmicro.Renode.Peripherals.Video
COMMAND = 0x0,
BUSY = 0x04,
PRESCALER = 0x08,
DEVBOOT = 0x18,
}
}
}

View file

@ -90,7 +90,7 @@ mem_rom: Memory.MappedMemory @ sysbus 0x00000000
size: 0x00001000
mem_sram: Memory.MappedMemory @ sysbus 0x10000000
size: 0x00020000
size: 0x00004000
mem_vexriscv_debug: Memory.MappedMemory @ sysbus 0xefff0000
size: 0x00001000

View file

@ -3,7 +3,7 @@
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" >
<vendor>litex</vendor>
<name>SOC</name>
<description><![CDATA[Litex SoC 2021-06-25 18:26:55]]></description>
<description><![CDATA[Litex SoC 2021-07-05 15:58:37]]></description>
<addressUnitBits>8</addressUnitBits>
<width>32</width>
@ -1222,10 +1222,10 @@ register to disable individual events.]]></description>
<register>
<name>GIT_GITREV</name>
<description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev
``fce2f15c``, so this value is 4242731356, which should be enough to check out
``afcc1323``, so this value is 2949387043, which should be enough to check out
the exact git version used to build this firmware.]]></description>
<addressOffset>0x0014</addressOffset>
<resetValue>0xfce2f15c</resetValue>
<resetValue>0xafcc1323</resetValue>
<size>32</size>
<fields>
<field>
@ -1242,7 +1242,7 @@ the exact git version used to build this firmware.]]></description>
is ``1``, then the repository this was built from has one additional commit
beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description>
<addressOffset>0x0018</addressOffset>
<resetValue>0x21</resetValue>
<resetValue>0x2a</resetValue>
<size>32</size>
<fields>
<field>
@ -1487,10 +1487,26 @@ register to disable individual events.]]></description>
</field>
</fields>
</register>
<register>
<name>DEVBOOT</name>
<addressOffset>0x0018</addressOffset>
<resetValue>0x00</resetValue>
<size>32</size>
<fields>
<field>
<name>devboot</name>
<msb>0</msb>
<bitRange>[0:0]</bitRange>
<lsb>0</lsb>
<description><![CDATA[When set to ``1``, permanently add a strike-through on the top of the screen.
Cannot be cleared, except by a full reset.]]></description>
</field>
</fields>
</register>
</registers>
<addressBlock>
<offset>0</offset>
<size>0x18</size>
<size>0x1c</size>
<usage>registers</usage>
</addressBlock>
</peripheral>
@ -3451,7 +3467,7 @@ inject too fast.]]></description>
<name>SEED1</name>
<description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description>
<addressOffset>0x0000</addressOffset>
<resetValue>0x199653c4</resetValue>
<resetValue>0x6d48a16e</resetValue>
<size>32</size>
<fields>
<field>
@ -3466,7 +3482,7 @@ inject too fast.]]></description>
<name>SEED0</name>
<description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description>
<addressOffset>0x0004</addressOffset>
<resetValue>0x5a781786</resetValue>
<resetValue>0x71a7a0e3</resetValue>
<size>32</size>
<fields>
<field>
@ -3519,10 +3535,40 @@ inject too fast.]]></description>
</field>
</fields>
</register>
<register>
<name>LOCKADDR</name>
<description><![CDATA[address of the word to lock. Address locked on write, and cannot be undone.]]></description>
<addressOffset>0x0008</addressOffset>
<resetValue>0x00</resetValue>
<size>32</size>
<fields>
<field>
<name>lockaddr</name>
<msb>7</msb>
<bitRange>[7:0]</bitRange>
<lsb>0</lsb>
</field>
</fields>
</register>
<register>
<name>LOCKSTAT</name>
<description><![CDATA[If set, the requested address word is locked and will always return 0.]]></description>
<addressOffset>0x000c</addressOffset>
<resetValue>0x00</resetValue>
<size>32</size>
<fields>
<field>
<name>lockstat</name>
<msb>0</msb>
<bitRange>[0:0]</bitRange>
<lsb>0</lsb>
</field>
</fields>
</register>
</registers>
<addressBlock>
<offset>0</offset>
<size>0x8</size>
<size>0x10</size>
<usage>registers</usage>
</addressBlock>
</peripheral>
@ -6957,7 +7003,7 @@ of the PLL]]></description>
<memoryRegion>
<name>SRAM</name>
<baseAddress>0x10000000</baseAddress>
<size>0x00020000</size>
<size>0x00004000</size>
</memoryRegion>
<memoryRegion>
<name>VEXRISCV_DEBUG</name>

View file

@ -372,11 +372,15 @@ impl Process {
let pid = self.pid.get();
let thread = self.thread_mut(new_tid);
// println!("Setting up thread {}, pid {}", new_tid, pid);
let sp = setup.stack.as_ptr() as usize + setup.stack.len();
if sp <= 16 {
Err(xous_kernel::Error::BadAddress)?;
}
crate::arch::syscall::invoke(
thread,
pid == 1,
entrypoint,
setup.stack.as_ptr() as usize + setup.stack.len(),
(sp - 16) & !0xf,
EXIT_THREAD,
&[setup.arg1, setup.arg2, setup.arg3, setup.arg4],
);

View file

@ -224,7 +224,7 @@ impl MiniElf {
// The load offset is the end of this process. Shift it down by one page
// so we get the start of the first page.
let mut top = load_offset - PAGE_SIZE;
let stack_addr = USER_STACK_TOP - 4;
let stack_addr = USER_STACK_TOP - 16;
// Allocate a page to handle the top-level memory translation
let satp_address = allocator.alloc() as usize;
@ -411,13 +411,13 @@ impl ProgramDescription {
let pid_idx = (pid - 1) as usize;
let is_kernel = pid == 1;
let flag_defaults = FLG_R | FLG_W | if is_kernel { 0 } else { FLG_U };
let stack_addr = USER_STACK_TOP - 4;
let stack_addr = USER_STACK_TOP - 16;
if is_kernel {
assert!(self.text_offset as usize == KERNEL_LOAD_OFFSET);
assert!(((self.text_offset + self.text_size) as usize) < EXCEPTION_STACK_TOP);
assert!(
((self.data_offset + self.data_size + self.bss_size) as usize)
< EXCEPTION_STACK_TOP - 4
< EXCEPTION_STACK_TOP - 16
);
assert!(self.data_offset as usize >= KERNEL_LOAD_OFFSET);
} else {
@ -465,7 +465,7 @@ impl ProgramDescription {
allocator.map_page(
satp,
sp_page,
(EXCEPTION_STACK_TOP - 4 - PAGE_SIZE * i) & !(PAGE_SIZE - 1),
(EXCEPTION_STACK_TOP - 16 - PAGE_SIZE * i) & !(PAGE_SIZE - 1),
flag_defaults,
);
allocator.change_owner(pid as XousPid, sp_page);