Cleanup: Disable LWIP and address compiler warnings

This commit is contained in:
Ali Mashtizadeh 2019-07-31 17:30:50 -04:00
parent 506c559dad
commit 04b709f3b3
10 changed files with 47 additions and 40 deletions

View File

@ -21,7 +21,7 @@ opts.AddVariables(
("WITH_GPROF", "Include gprof profiling (0 or 1).", "0"), ("WITH_GPROF", "Include gprof profiling (0 or 1).", "0"),
("PREFIX", "Installation target directory.", "#pxelinux"), ("PREFIX", "Installation target directory.", "#pxelinux"),
("ARCH", "Target Architecture", "amd64"), ("ARCH", "Target Architecture", "amd64"),
("BOOTDISK", "Build boot disk (0 or 1)", "0"), ("BOOTDISK", "Build boot disk (0 or 1)", "1"),
("BOOTDISK_SIZE", "Boot disk size", "128") ("BOOTDISK_SIZE", "Boot disk size", "128")
) )
@ -165,12 +165,12 @@ env["CRTEND"] = [ "#build/lib/libc/crtn.o" ]
CopyTree('build/include', 'include', env) CopyTree('build/include', 'include', env)
CopyTree('build/include/sys', 'sys/include', env) CopyTree('build/include/sys', 'sys/include', env)
CopyTree('build/include/machine', 'sys/' + env['ARCH'] + '/include', env) CopyTree('build/include/machine', 'sys/' + env['ARCH'] + '/include', env)
CopyTree('build/include/', 'lib/liblwip/src/include', env) #CopyTree('build/include/', 'lib/liblwip/src/include', env)
# Build Targets # Build Targets
SConscript('sys/SConscript', variant_dir='build/sys') SConscript('sys/SConscript', variant_dir='build/sys')
SConscript('lib/libc/SConscript', variant_dir='build/lib/libc') SConscript('lib/libc/SConscript', variant_dir='build/lib/libc')
SConscript('lib/liblwip/SConscript', variant_dir='build/lib/liblwip') #SConscript('lib/liblwip/SConscript', variant_dir='build/lib/liblwip')
SConscript('bin/ethdump/SConscript', variant_dir='build/bin/ethdump') SConscript('bin/ethdump/SConscript', variant_dir='build/bin/ethdump')
SConscript('bin/ethinject/SConscript', variant_dir='build/bin/ethinject') SConscript('bin/ethinject/SConscript', variant_dir='build/bin/ethinject')
SConscript('bin/shell/SConscript', variant_dir='build/bin/shell') SConscript('bin/shell/SConscript', variant_dir='build/bin/shell')
@ -203,7 +203,7 @@ if env["BOOTDISK"] == "1":
Depends(bootdisk, "#build/sbin/init/init") Depends(bootdisk, "#build/sbin/init/init")
Depends(bootdisk, "#build/sbin/sysctl/sysctl") Depends(bootdisk, "#build/sbin/sysctl/sysctl")
Depends(bootdisk, "#build/sys/castor") Depends(bootdisk, "#build/sys/castor")
Depends(bootdisk, "#build/tests/lwiptest") #Depends(bootdisk, "#build/tests/lwiptest")
Depends(bootdisk, "#build/tests/pthreadtest") Depends(bootdisk, "#build/tests/pthreadtest")
Depends(bootdisk, "#build/tests/threadtest") Depends(bootdisk, "#build/tests/threadtest")
env.Alias('bootdisk', '#build/bootdisk.img') env.Alias('bootdisk', '#build/bootdisk.img')

View File

@ -100,17 +100,22 @@ handle_argv(int argc, char *argv[], char **env)
void void
_start(char **ap) _start(char **ap)
{ {
int argc; int status;
char **argv; int argc = 0;
char **env; char **argv = NULL;
char **env = NULL;
//argc = *(long *)(void *)ap; //argc = *(long *)(void *)ap;
//argv = ap + 1; //argv = ap + 1;
//env = ap + 2 + argc; //env = ap + 2 + argc;
//handle_argv(argc, argv, env); handle_argv(argc, argv, env);
//handle_static_init(argc, argv, env); handle_static_init(argc, argv, env);
exit(main(argc, argv)); status = main(argc, argv);
finalizer();
exit(status);
} }

View File

@ -4,6 +4,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include <syscall.h> #include <syscall.h>
@ -94,11 +95,15 @@ fclose(FILE *fh)
int int
feof(FILE *fh) feof(FILE *fh)
{ {
errno = ENOSYS;
return -1;
} }
int int
fflush(FILE *fh) fflush(FILE *fh)
{ {
errno = ENOSYS;
return -1;
} }
size_t size_t

View File

@ -15,7 +15,6 @@ DIR /
FILE sysctl build/sbin/sysctl/sysctl FILE sysctl build/sbin/sysctl/sysctl
END END
DIR tests DIR tests
FILE lwiptest build/tests/lwiptest
FILE pthreadtest build/tests/pthreadtest FILE pthreadtest build/tests/pthreadtest
FILE threadtest build/tests/threadtest FILE threadtest build/tests/threadtest
END END

View File

@ -10,12 +10,12 @@ main(int argc, const char *argv[])
status = OSSpawn("/bin/shell"); status = OSSpawn("/bin/shell");
if (status > 100) { if (status > 100) {
printf("init: Could not spawn shell %016llx\n", status); printf("init: Could not spawn shell %016lx\n", status);
} }
while (1) { while (1) {
status = OSWait(0); status = OSWait(0);
printf("init: Zombie process exited (%016llx)\n", status); printf("init: Zombie process exited (%016lx)\n", status);
} }
} }

View File

@ -30,7 +30,6 @@ int
main(int argc, const char *argv[]) main(int argc, const char *argv[])
{ {
int i; int i;
uint64_t status;
printf("%d\n", argc); printf("%d\n", argc);
if (true) { if (true) {
@ -59,7 +58,7 @@ main(int argc, const char *argv[])
break; break;
case SYSCTL_TYPE_INT: case SYSCTL_TYPE_INT:
OSSysCtl(SYSCTLTable[i].path, &scInt, NULL); OSSysCtl(SYSCTLTable[i].path, &scInt, NULL);
printf("%s: %lld\n", SYSCTLTable[i].path, scInt.value); printf("%s: %ld\n", SYSCTLTable[i].path, scInt.value);
break; break;
case SYSCTL_TYPE_BOOL: case SYSCTL_TYPE_BOOL:
OSSysCtl(SYSCTLTable[i].path, &scBool, NULL); OSSysCtl(SYSCTLTable[i].path, &scBool, NULL);

View File

@ -412,7 +412,7 @@ PMap_Dump(AS *space)
continue; continue;
kprintf("Level 3: %016llx:%016llx\n", kprintf("Level 3: %016llx:%016llx\n",
AddrFromIJKL(i, j, k, l), AddrFromIJKL(i, j, k, 0),
(uint64_t)pte3); (uint64_t)pte3);
if ((pte3 & PTE_PS) == 0) { if ((pte3 & PTE_PS) == 0) {
@ -423,12 +423,9 @@ PMap_Dump(AS *space)
AddrFromIJKL(i, j, k, l), AddrFromIJKL(i, j, k, l),
(uint64_t)pte4); (uint64_t)pte4);
} }
l = 0;
} }
} }
k = 0;
} }
j = 0;
} }
return; return;

View File

@ -62,6 +62,11 @@ void E1000_Configure(PCIDevice dev);
#define E1000_REG_MTABASE 0x5200 #define E1000_REG_MTABASE 0x5200
// EEPROM Offsets
#define NVM_MAC_ADDR 0x0000
#define NVM_DEVICE_ID 0x000D
#define NVM_VENDOR_ID 0x000E
// Control Flags // Control Flags
#define CTRL_SLU (1 << 6) #define CTRL_SLU (1 << 6)
@ -184,12 +189,6 @@ E1000_Init(uint32_t bus, uint32_t slot, uint32_t func)
} }
} }
static inline uint16_t
MMIO_Read16(E1000Dev *dev, uint64_t addr)
{
return *(uint16_t volatile *)(dev->mmiobase + addr);
}
static inline uint32_t static inline uint32_t
MMIO_Read32(E1000Dev *dev, uint64_t addr) MMIO_Read32(E1000Dev *dev, uint64_t addr)
{ {
@ -479,6 +478,9 @@ E1000_Configure(PCIDevice dev)
IRQ_Register(dev.irq, &ethDev->irqHandle); IRQ_Register(dev.irq, &ethDev->irqHandle);
kprintf("E1000: MAC XX:XX:XX:XX:XX:XX\n"); kprintf("E1000: MAC XX:XX:XX:XX:XX:XX\n");
for (int i = 0; i < 3; i++) {
E1000_EEPROM_Read(ethDev, NVM_MAC_ADDR + 2*i);
}
// Device lock // Device lock
Spinlock_Init(&ethDev->lock, "E1000 Spinlock", SPINLOCK_TYPE_NORMAL); Spinlock_Init(&ethDev->lock, "E1000 Spinlock", SPINLOCK_TYPE_NORMAL);

View File

@ -5,12 +5,12 @@
typedef signed char int8_t; typedef signed char int8_t;
typedef signed short int16_t; typedef signed short int16_t;
typedef signed int int32_t; typedef signed int int32_t;
typedef signed long long int64_t; typedef signed long int64_t;
typedef unsigned char uint8_t; typedef unsigned char uint8_t;
typedef unsigned short uint16_t; typedef unsigned short uint16_t;
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
typedef unsigned long long uint64_t; typedef unsigned long uint64_t;
typedef int64_t intptr_t; typedef int64_t intptr_t;
typedef uint64_t uintptr_t; typedef uint64_t uintptr_t;

View File

@ -21,17 +21,17 @@ pthreadtest_src.append(["pthreadtest.c"])
pthreadtest_src.append(env["CRTEND"]) pthreadtest_src.append(env["CRTEND"])
test_env.Program("pthreadtest", pthreadtest_src) test_env.Program("pthreadtest", pthreadtest_src)
test_netenv = env.Clone() #test_netenv = env.Clone()
#
test_netenv.Append(LINKFLAGS = ['-nostdlib']) #test_netenv.Append(LINKFLAGS = ['-nostdlib'])
test_netenv.Append(CPPFLAGS = ['-fno-builtin', '-nostdinc']) #test_netenv.Append(CPPFLAGS = ['-fno-builtin', '-nostdinc'])
test_netenv.Append(CPPPATH = ['#build/include', '#build/include/ipv4']) #test_netenv.Append(CPPPATH = ['#build/include', '#build/include/ipv4'])
test_netenv.Append(LIBPATH = ['#build/lib/libc', '#build/lib/liblwip'], #test_netenv.Append(LIBPATH = ['#build/lib/libc', '#build/lib/liblwip'],
LIBS = ['lwip', 'c']) # LIBS = ['lwip', 'c'])
#
lwiptest_src = [] #lwiptest_src = []
lwiptest_src.append(env["CRTBEGIN"]) #lwiptest_src.append(env["CRTBEGIN"])
lwiptest_src.append(["lwiptest.c"]) #lwiptest_src.append(["lwiptest.c"])
lwiptest_src.append(env["CRTEND"]) #lwiptest_src.append(env["CRTEND"])
test_netenv.Program("lwiptest", lwiptest_src) #test_netenv.Program("lwiptest", lwiptest_src)