Merge branch 'master' of github.com:MTGos/kernel

This commit is contained in:
Morten Delenk 2017-12-09 19:39:15 +00:00
commit 79f6f3bcda
16 changed files with 30 additions and 23 deletions

View file

@ -18,7 +18,7 @@ include gmp.mk
include isl.mk
include cloog.mk
fetch: gawk.tar.xz gcc.tar.bz2 binutils.tar.bz2 mpc.tar.gz mpfr.tar.xz gmp.tar.xz isl.tar.xz cloog.tar.gz
fetch: gawk.tar.xz gcc.tar.xz binutils.tar.bz2 mpc.tar.gz mpfr.tar.xz gmp.tar.xz isl.tar.xz cloog.tar.gz
extract: gawk/ binutils/ gcc/mpc/ gcc/mpfr/ gcc/gmp/ gcc/isl/ gcc/cloog/

View file

@ -1,4 +1,4 @@
BINUTILS_VERSION=2.28
BINUTILS_VERSION=2.29.1
binutils.tar.bz2: binutils-$(BINUTILS_VERSION).tar.bz2
mv $^ $@

View file

@ -1,4 +1,4 @@
GAWK_VERSION=4.1.4
GAWK_VERSION=4.2.0
gawk.tar.xz: gawk-$(GAWK_VERSION).tar.xz
mv $^ $@

View file

@ -1,15 +1,15 @@
GCC_VERSION=7.1.0
GCC_MAJOR_VERSION=7.1.0
gcc.tar.bz2: gcc-$(GCC_VERSION).tar.bz2
GCC_VERSION=7.2.0
GCC_MAJOR_VERSION=7.2.0
gcc.tar.xz: gcc-$(GCC_VERSION).tar.xz
mv $^ $@
gcc-$(GCC_VERSION).tar.bz2:
gcc-$(GCC_VERSION).tar.xz:
wget https://ftp.gnu.org/gnu/gcc/gcc-$(GCC_MAJOR_VERSION)/$@
gcc/: gcc-$(GCC_VERSION)/
mv $^ $@
gcc-$(GCC_VERSION)/: gcc.tar.bz2
gcc-$(GCC_VERSION)/: gcc.tar.xz
tar -xf $^
gcc-patch:
@ -28,4 +28,5 @@ gcc-make: gcc-configure
$(MAKE) -C builddir all-target-libgcc
gcc-install: gcc-make
$(MAKE) -C builddir install-gcc install-target-libgcc
$(MAKE) -C builddir install-gcc
$(MAKE) -C builddir install-target-libgcc

View file

@ -1,4 +1,4 @@
MPFR_VERSION=3.1.5
MPFR_VERSION=3.1.6
mpfr.tar.xz: mpfr-$(MPFR_VERSION).tar.xz
mv $^ $@

View file

@ -64,6 +64,7 @@ buildtools/sighax-firm.sh &&
mv sighax.firm out/ &&
cp -v build/kernel/kernel out/arm11loaderhax.elf
cat > /dev/null << EOF
{
echo 2
echo 1
@ -75,3 +76,4 @@ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/arm-none-eabi.cmake .. &&
make -j$(nproc) &&
popd &&
cp -v build/kernel/kernel out/raspi2.elf
EOF

View file

@ -42,7 +42,10 @@ f.write("char font_data[] = {\n")
for i,c in enumerate(fontbytes):
if not i % 32:
f.write(" ")
if c < 0x80:
f.write(hex(c)+", ")
else:
f.write("(char)"+hex(127-c^0x7F)+", ")
if i % 32 == 31:
f.write("\n")
f.write("\n};\n")

View file

@ -30,8 +30,8 @@ LOAD_PROFILE(${ARCH} ${SYSTEM})
ADD_EXECUTABLE(kernel ${PLATFORM_SRCS} ${ISA_SRCS} ${GENERIC_SRCS})
SET(CMAKE_ASM-ATT_COMPILE_OBJECT
"<CMAKE_C_COMPILER> -g -x assembler-with-cpp -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_ASM_FLAGS} ${PLATFORM_ASM_FLAGS} -c -o <OBJECT> <SOURCE>")
SET(CMAKE_C_FLAGS "-g -w -Werror -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -std=c11 -ffreestanding -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_C_FLAGS} ${PLATFORM_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -w -Werror -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -ffreestanding -fno-rtti -fno-exceptions -std=gnu++17 -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_CXX_FLAGS} ${PLATFORM_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-g --all-warnings -Werror -Wno-error=reorder -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -std=c11 -ffreestanding -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_C_FLAGS} ${PLATFORM_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g --all-warnings -Werror -Wno-error=reorder -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -ffreestanding -fno-rtti -fno-exceptions -std=gnu++17 -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_CXX_FLAGS} ${PLATFORM_CXX_FLAGS}")
SET_TARGET_PROPERTIES(kernel PROPERTIES LINK_FLAGS
"-T ../../kernel/${PLATFORM_LAYOUT} -N ${ISA_LINKER_FLAGS} ${PLATFORM_LINKER_FLAGS} -nostdlib -nodefaultlibs -Wl,--gc-sections -ffreestanding")
TARGET_LINK_LIBRARIES(kernel gcc)

View file

@ -22,7 +22,7 @@ void print_regdump(cpu_state *state) {
(*out << " returnAddr: ").puti(state->returnAddr);
*out << "\n";
}
extern "C" void panic2(char *msg, cpu_state *state);
extern "C" void panic2(const char *msg, cpu_state *state);
extern "C" cpu_state *handleINT(int number, cpu_state *state) {
*out << "Interrupt";
out->puti(number);
@ -49,7 +49,7 @@ extern "C" cpu_state *handleINT(int number, cpu_state *state) {
}
return new_cpu;
}
extern "C" void panic2(char *msg, cpu_state *state) {
extern "C" void panic2(const char *msg, cpu_state *state) {
out->setColor(Color::RED);
*out << "KERNEL PANIC: " << msg << "\n";
print_regdump(state);

View file

@ -47,7 +47,7 @@ paging_context_x86::paging_context_x86(): paging_context() {
continue;
if(i == 1 || i == 2 || i == 3)
continue;
pagetbl *pagetbl_start = (pagetbl *)(0x800000 + i << 22);
pagetbl *pagetbl_start = (pagetbl *)(0x800000 + (i << 22));
for(int j=0;j<1024;j++) {
if(!pagetbl_start[j].active)
continue;
@ -147,7 +147,7 @@ paging_context_x86::~paging_context_x86() {
for(int i=256;i<1024;i++) {
if(!pd[i].active)
continue;
pagetbl *pt = (pagetbl*)(0xC00000+i<<12);
pagetbl *pt = (pagetbl*)(0xC00000+(i<<12));
for(int j=0;j<1024;j++) {
if(!pt[j].active)
continue;
@ -161,7 +161,7 @@ paging_context_x86::~paging_context_x86() {
for(int i=1;i<3;i++) {
if(!pd[i].active)
continue;
pagetbl *pt = (pagetbl*)(0xC00000+i<<12);
pagetbl *pt = (pagetbl*)(0xC00000+(i<<12));
for(int j=0;j<1024;j++) {
if(!pt[j].active)
continue;

View file

@ -16,7 +16,7 @@ auto I2C::getResult() -> bool {
waitBusy();
return buses[busID]->ctl & 0x10;
}
auto I2C::stop() -> bool {
auto I2C::stop() -> void {
buses[busID]->ctl = 0xC0;
waitBusy();
buses[busID]->ctl = 0xC5;

View file

@ -15,7 +15,7 @@ class I2C {
~I2C();
auto waitBusy() -> void; ///< Waits for the currently selected device to finish
auto getResult() -> bool; ///< Returns true when the device sent a ACK
auto stop() -> bool; ///< Stops the current transfer
auto stop() -> void; ///< Stops the current transfer
auto selectDev(int dev) -> bool; ///< Selects current I2C device
auto selectReg(int reg) -> bool; ///< Selects current register
auto write(uint8_t data) -> bool; ///< Sends 8 bits of data

View file

@ -51,7 +51,7 @@ auto getRTC(RTC_date *date) -> void {
date->years = bcdToVal(read(0x36));
}
auto setRTC(RTC_date *date) -> void {
auto valToBCD = [](unsigned char c) -> unsigned char { return (c % 10) + (c / 10) << 4; };
auto valToBCD = [](unsigned char c) -> unsigned char { return (c % 10) + ((c / 10) << 4); };
write(0x30, valToBCD(date->seconds));
write(0x31, valToBCD(date->minutes));
write(0x32, valToBCD(date->hours));

View file

@ -32,7 +32,7 @@ IRQ_IO::IRQ_IO() {
*((volatile uint32_t*)(0x17E01100+i))=~0;
}
uint32_t intid;
while((intid=*((volatile uint32_t*)0x17E00118))&1023!=1023) {
while(((intid=*((volatile uint32_t*)0x17E00118))&1023)!=1023) {
*((volatile uint32_t*)0x17E00110)=intid;
}
}

View file

@ -23,7 +23,7 @@ void setIDTEntry(int i, void *entry) {
#endif
}
void initIDT() {
void *start_vectors = (void *)&intr_stub_0;
char *start_vectors = (char *)&intr_stub_0;
for (int i = 0; i < 256; i++) setIDTEntry(i, start_vectors + 16 * i);
struct {
uint16_t size;

View file

@ -23,4 +23,5 @@ extern "C" int __cxa_guard_acquire(__guard *g) {
}
extern "C" int __cxa_guard_release(__guard *g) {
*(char *)g = 1;
return 0;
}