Merge branch 'mipsel' into dev

master
Jiajie Chen 6 years ago
commit f410aef5bc

1
.gitignore vendored

@ -1,6 +1,7 @@
build
target
/kernel/src/arch/x86_64/interrupt/vector.asm
/kernel/src/arch/mipsel/boot/linker.ld
*.gen.s
*.dtb

@ -346,8 +346,9 @@ else ifeq ($(arch), aarch64)
@cargo xbuild $(build_args)
else ifeq ($(arch), mipsel)
@for file in context entry trap ; do \
$(hostcc) -E src/arch/$(arch)/boot/$${file}.S -o src/arch/$(arch)/boot/$${file}.gen.s ; \
$(hostcc) -Dboard_$(board) -E src/arch/$(arch)/boot/$${file}.S -o src/arch/$(arch)/boot/$${file}.gen.s ; \
done
$(hostcc) -Dboard_$(board) -E src/arch/$(arch)/boot/linker.ld.S -o src/arch/$(arch)/boot/linker.ld
@cargo xbuild $(build_args)
endif

@ -1,3 +1,3 @@
/// board specific constants
pub const MEMORY_END: usize = 0x8800_0000;
pub const KERNEL_HEAP_SIZE: usize = 0x0044_0000;
pub const MEMORY_END: usize = 0x8090_0000;
pub const KERNEL_HEAP_SIZE: usize = 0x003b_0000;

@ -9,7 +9,7 @@
chosen {
stdio = &uart2;
bootargs = "rust/sh";
bootargs = "sh";
};
aliases { };

@ -1,3 +1,3 @@
/// board specific constants
pub const MEMORY_END: usize = 0x8080_0000;
pub const KERNEL_HEAP_SIZE: usize = 0x0044_0000;
pub const KERNEL_HEAP_SIZE: usize = 0x0038_0000;

@ -9,7 +9,7 @@
chosen {
stdio = &uart;
bootargs = "";
bootargs = "sh";
};
aliases { };

@ -4,7 +4,11 @@
OUTPUT_ARCH(riscv)
ENTRY(_start)
#ifdef board_thinpad
BASE_ADDRESS = 0x80000000;
#else
BASE_ADDRESS = 0x80100000;
#endif
SECTIONS
{

@ -32,6 +32,12 @@ trap_from_kernel:
* k1 = old stack pointer
* sp = kernel stack */
#ifdef board_thinpad
#define TRAPFRAME_SIZE 304
#else
#define TRAPFRAME_SIZE 176
#endif
# align stack pointer
andi k0, sp, 0xf
beqz k0, sp_aligned
@ -39,12 +45,13 @@ trap_from_kernel:
la k0, 0xfffffff0
and k0, sp, k0
sw sp, -176(k0)
sw sp, -TRAPFRAME_SIZE(k0)
move sp, k0
sp_aligned:
# allocate 38 words for trapframe + 6 extra words
addiu sp, sp, -176
# allocate 38 / 70 words for trapframe + 6 extra words
addiu sp, sp, -TRAPFRAME_SIZE
# save general registers
sw ra, 160(sp)
@ -80,6 +87,42 @@ sp_aligned:
sw AT, 40(sp)
nop
#ifdef board_thinpad
# save floating point registers
swc1 $f0, 164(sp)
swc1 $f1, 168(sp)
swc1 $f2, 172(sp)
swc1 $f3, 176(sp)
swc1 $f4, 180(sp)
swc1 $f5, 184(sp)
swc1 $f6, 188(sp)
swc1 $f7, 192(sp)
swc1 $f8, 196(sp)
swc1 $f9, 200(sp)
swc1 $f10, 204(sp)
swc1 $f11, 208(sp)
swc1 $f12, 212(sp)
swc1 $f13, 216(sp)
swc1 $f14, 220(sp)
swc1 $f15, 224(sp)
swc1 $f16, 228(sp)
swc1 $f17, 232(sp)
swc1 $f18, 236(sp)
swc1 $f19, 240(sp)
swc1 $f20, 244(sp)
swc1 $f21, 248(sp)
swc1 $f22, 252(sp)
swc1 $f23, 256(sp)
swc1 $f24, 260(sp)
swc1 $f25, 264(sp)
swc1 $f26, 268(sp)
swc1 $f27, 272(sp)
swc1 $f28, 276(sp)
swc1 $f29, 280(sp)
swc1 $f30, 284(sp)
swc1 $f31, 288(sp)
#endif
# save hi/lo
mflo t1
sw t1, 36(sp)
@ -158,9 +201,45 @@ trap_return:
lw fp, 156(sp)
lw ra, 160(sp)
#ifdef board_thinpad
# restore floating point registers
lwc1 $f0, 164(sp)
lwc1 $f1, 168(sp)
lwc1 $f2, 172(sp)
lwc1 $f3, 176(sp)
lwc1 $f4, 180(sp)
lwc1 $f5, 184(sp)
lwc1 $f6, 188(sp)
lwc1 $f7, 192(sp)
lwc1 $f8, 196(sp)
lwc1 $f9, 200(sp)
lwc1 $f10, 204(sp)
lwc1 $f11, 208(sp)
lwc1 $f12, 212(sp)
lwc1 $f13, 216(sp)
lwc1 $f14, 220(sp)
lwc1 $f15, 224(sp)
lwc1 $f16, 228(sp)
lwc1 $f17, 232(sp)
lwc1 $f18, 236(sp)
lwc1 $f19, 240(sp)
lwc1 $f20, 244(sp)
lwc1 $f21, 248(sp)
lwc1 $f22, 252(sp)
lwc1 $f23, 256(sp)
lwc1 $f24, 260(sp)
lwc1 $f25, 264(sp)
lwc1 $f26, 268(sp)
lwc1 $f27, 272(sp)
lwc1 $f28, 276(sp)
lwc1 $f29, 280(sp)
lwc1 $f30, 284(sp)
lwc1 $f31, 288(sp)
#endif
# save kernel stack
lw k0, 0(sp)
addiu k1, sp, 176
addiu k1, sp, TRAPFRAME_SIZE
movn k1, k0, k0
la k0, _cur_kstack_ptr

@ -2,11 +2,16 @@
///
pub use super::board::consts::*;
pub const MEMORY_OFFSET: usize = 0x80000000;
pub const KERNEL_OFFSET: usize = 0x80100000;
pub const PHYSICAL_MEMORY_OFFSET: usize = 0x80000000;
pub const MEMORY_OFFSET: usize = 0x8000_0000;
pub const USER_STACK_OFFSET: usize = 0x70000000 - USER_STACK_SIZE;
#[cfg(feature = "board_thinpad")]
pub const KERNEL_OFFSET: usize = 0x8000_0000;
#[cfg(feature = "board_malta")]
pub const KERNEL_OFFSET: usize = 0x8010_0000;
pub const PHYSICAL_MEMORY_OFFSET: usize = 0x8000_0000;
pub const USER_STACK_OFFSET: usize = 0x7000_0000 - USER_STACK_SIZE;
pub const USER_STACK_SIZE: usize = 0x10000;
pub const MAX_DTB_SIZE: usize = 0x2000;

@ -52,6 +52,39 @@ pub struct TrapFrame {
pub sp: usize,
pub fp: usize,
pub ra: usize,
/// Floating-point registers (contains garbage if no FP support present)
pub f0: usize,
pub f1: usize,
pub f2: usize,
pub f3: usize,
pub f4: usize,
pub f5: usize,
pub f6: usize,
pub f7: usize,
pub f8: usize,
pub f9: usize,
pub f10: usize,
pub f11: usize,
pub f12: usize,
pub f13: usize,
pub f14: usize,
pub f15: usize,
pub f16: usize,
pub f17: usize,
pub f18: usize,
pub f19: usize,
pub f20: usize,
pub f21: usize,
pub f22: usize,
pub f23: usize,
pub f24: usize,
pub f25: usize,
pub f26: usize,
pub f27: usize,
pub f28: usize,
pub f29: usize,
pub f30: usize,
pub f31: usize,
/// Reserved
pub reserved: usize,
pub __padding: [usize; 2],

@ -68,12 +68,19 @@ impl SerialPort {
impl Write for SerialPort {
fn write_str(&mut self, s: &str) -> Result {
for c in s.bytes() {
if c == 127 {
self.putchar(8);
self.putchar(b' ');
self.putchar(8);
} else {
self.putchar(c);
match c {
127 => {
self.putchar(8);
self.putchar(b' ');
self.putchar(8);
},
b'\n' => {
self.putchar(b'\r');
self.putchar(b'\n');
},
c => {
self.putchar(c);
}
}
}
Ok(())

@ -59,12 +59,19 @@ impl SerialPort {
impl Write for SerialPort {
fn write_str(&mut self, s: &str) -> Result {
for c in s.bytes() {
if c == 127 {
self.putchar(8);
self.putchar(b' ');
self.putchar(8);
} else {
self.putchar(c);
match c {
127 => {
self.putchar(8);
self.putchar(b' ');
self.putchar(8);
},
b'\n' => {
self.putchar(b'\r');
self.putchar(b'\n');
},
c => {
self.putchar(c);
}
}
}
Ok(())

@ -68,12 +68,19 @@ impl SerialPort {
impl Write for SerialPort {
fn write_str(&mut self, s: &str) -> Result {
for c in s.bytes() {
if c == 127 {
self.putchar(8);
self.putchar(b' ');
self.putchar(8);
} else {
self.putchar(c);
match c {
127 => {
self.putchar(8);
self.putchar(b' ');
self.putchar(8);
},
b'\n' => {
self.putchar(b'\r');
self.putchar(b'\n');
},
c => {
self.putchar(c);
}
}
}
Ok(())

@ -289,7 +289,8 @@ impl Syscall<'_> {
),
SYS_GETRANDOM => {
self.sys_getrandom(args[0] as *mut u8, args[1] as usize, args[2] as u32)
}
},
SYS_RT_SIGQUEUEINFO => self.unimplemented("rt_sigqueueinfo", Ok(0)),
// custom
SYS_MAP_PCI_DEVICE => self.sys_map_pci_device(args[0], args[1]),

@ -7,7 +7,7 @@
"target-pointer-width": "32",
"target-c-int-width": "32",
"os": "none",
"features": "+mips32r2,+soft-float",
"features": "+mips32r2,+single-float",
"max-atomic-width": "32",
"linker": "rust-lld",
"linker-flavor": "ld.lld",

Loading…
Cancel
Save