mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix kernel compile warnings.
This commit is contained in:
parent
ed6d4f82bb
commit
49a66893b2
15 changed files with 46 additions and 19 deletions
|
@ -118,7 +118,7 @@ ATABus::~ATABus()
|
|||
|
||||
ATADrive* ATABus::Instatiate(unsigned driveid)
|
||||
{
|
||||
if ( 1 < driveid ) { errno = EINVAL; return false; }
|
||||
if ( 1 < driveid ) { errno = EINVAL; return NULL; }
|
||||
curdriveid = 0;
|
||||
|
||||
uint8_t drivemagic = 0xA0 | (driveid << 4);
|
||||
|
@ -132,12 +132,12 @@ ATADrive* ATABus::Instatiate(unsigned driveid)
|
|||
while ( true )
|
||||
{
|
||||
status = CPU::InPortB(iobase + STATUS);
|
||||
if ( !status || status == 0xFF ) { errno = ENODEV; return false; }
|
||||
if ( !status || status == 0xFF ) { errno = ENODEV; return NULL; }
|
||||
if ( !(status & STATUS_BUSY) ) { break; }
|
||||
}
|
||||
if ( CPU::InPortB(iobase + LBA_MID) || CPU::InPortB(iobase + LBA_MID) )
|
||||
{
|
||||
errno = ENODEV; return false; // ATAPI device not following spec.
|
||||
errno = ENODEV; return NULL; // ATAPI device not following spec.
|
||||
}
|
||||
while ( !(status & STATUS_DATAREADY) && !(status & STATUS_ERROR) )
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ ATADrive* ATABus::Instatiate(unsigned driveid)
|
|||
//Log::PrintF("Error status during identify\n");
|
||||
}
|
||||
errno = EIO;
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
ATADrive* drive = new ATADrive(this, driveid, iobase, altport);
|
||||
return drive;
|
||||
|
@ -198,13 +198,24 @@ ATADrive::ATADrive(ATABus* bus, unsigned driveid, uint16_t portoffset, uint16_t
|
|||
meta[i] = CPU::InPortW(iobase + DATA);
|
||||
}
|
||||
lba48 = meta[META_FLAGS] & FLAG_LBA48;
|
||||
numsectors = 0;
|
||||
if ( lba48 )
|
||||
{
|
||||
numsectors = *((uint64_t*) (meta + META_LBA48));
|
||||
numsectors = (uint64_t) meta[META_LBA48 + 0] << 0
|
||||
| (uint64_t) meta[META_LBA48 + 1] << 8
|
||||
| (uint64_t) meta[META_LBA48 + 2] << 16
|
||||
| (uint64_t) meta[META_LBA48 + 3] << 24
|
||||
| (uint64_t) meta[META_LBA48 + 4] << 32
|
||||
| (uint64_t) meta[META_LBA48 + 5] << 40
|
||||
| (uint64_t) meta[META_LBA48 + 6] << 48
|
||||
| (uint64_t) meta[META_LBA48 + 7] << 56;
|
||||
}
|
||||
else
|
||||
{
|
||||
numsectors = *((uint32_t*) (meta + META_LBA28));
|
||||
numsectors = meta[META_LBA28 + 0] << 0
|
||||
| meta[META_LBA28 + 1] << 8
|
||||
| meta[META_LBA28 + 2] << 16
|
||||
| meta[META_LBA28 + 3] << 24;
|
||||
}
|
||||
sectorsize = 512; // TODO: Detect this!
|
||||
Initialize();
|
||||
|
@ -275,7 +286,7 @@ bool ATADrive::ReadSector(off_t sector, uint8_t* dest)
|
|||
destword[i] = CPU::InPortW(iobase + DATA);
|
||||
}
|
||||
Wait400NSecs(iobase);
|
||||
uint8_t status = CPU::InPortB(iobase + STATUS);
|
||||
CPU::InPortB(iobase + STATUS);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,8 +88,7 @@ namespace Sortix
|
|||
memcpy(newlist, devices, sizeof(*devices) * numdevices);
|
||||
}
|
||||
|
||||
size_t numpadded = newlistlength-numdevices;
|
||||
for ( size_t i = numdevices; i < newlistlength; i++ )
|
||||
for ( int i = numdevices; i < newlistlength; i++ )
|
||||
newlist[i].dev = NULL,
|
||||
newlist[i].path = NULL,
|
||||
newlist[i].flags = 0;
|
||||
|
|
|
@ -140,6 +140,9 @@ namespace Sortix
|
|||
addr_t Construct64(Process* process, const void* file, size_t filelen)
|
||||
{
|
||||
#ifndef PLATFORM_X64
|
||||
(void) process;
|
||||
(void) file;
|
||||
(void) filelen;
|
||||
errno = ENOEXEC;
|
||||
return 0;
|
||||
#else
|
||||
|
|
|
@ -41,6 +41,7 @@ uint8_t* initrd;
|
|||
size_t initrdsize;
|
||||
const initrd_superblock_t* sb;
|
||||
|
||||
__attribute__((unused))
|
||||
static uint32_t HostModeToInitRD(mode_t mode)
|
||||
{
|
||||
uint32_t result = mode & 0777; // Lower 9 bits per POSIX and tradition.
|
||||
|
@ -55,6 +56,7 @@ static uint32_t HostModeToInitRD(mode_t mode)
|
|||
return result;
|
||||
}
|
||||
|
||||
__attribute__((unused))
|
||||
static mode_t InitRDModeToHost(uint32_t mode)
|
||||
{
|
||||
mode_t result = mode & 0777; // Lower 9 bits per POSIX and tradition.
|
||||
|
|
|
@ -145,7 +145,7 @@ namespace Sortix
|
|||
|
||||
// Check if the kbkey is outside the layout structure (not printable).
|
||||
size_t numchars = sizeof(LAYOUT_US) / 4UL / sizeof(uint32_t);
|
||||
if ( numchars < abskbkey ) { return 0; }
|
||||
if ( numchars < (size_t) abskbkey ) { return 0; }
|
||||
|
||||
return LAYOUT_US[index];
|
||||
}
|
||||
|
|
|
@ -122,6 +122,8 @@ static size_t TextTermHeight(void* user)
|
|||
|
||||
extern "C" void KernelInit(unsigned long magic, multiboot_info_t* bootinfo)
|
||||
{
|
||||
(void) magic;
|
||||
|
||||
// Initialize system calls.
|
||||
Syscall::Init();
|
||||
|
||||
|
@ -179,7 +181,7 @@ extern "C" void KernelInit(unsigned long magic, multiboot_info_t* bootinfo)
|
|||
"multiboot compliant?");
|
||||
}
|
||||
|
||||
addr_t initrd = NULL;
|
||||
addr_t initrd = 0;
|
||||
size_t initrdsize = 0;
|
||||
|
||||
uint32_t* modules = (uint32_t*) (addr_t) bootinfo->mods_addr;
|
||||
|
|
|
@ -45,6 +45,7 @@ extern "C" void kthread_exit(void* /*param*/)
|
|||
{
|
||||
Worker::Schedule(kthread_do_kill_thread, CurrentThread());
|
||||
Scheduler::ExitThread();
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
struct kthread_cond_elem
|
||||
|
|
|
@ -94,12 +94,14 @@ namespace Sortix
|
|||
if ( ENABLE_CALLTRACE ) { PanicCalltrace(); }
|
||||
}
|
||||
|
||||
__attribute__((noreturn))
|
||||
void PanicHalt()
|
||||
{
|
||||
#ifdef JSSORTIX
|
||||
JSSortix::Exit();
|
||||
#endif
|
||||
HaltKernel();
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
extern "C" void Panic(const char* Error)
|
||||
|
|
|
@ -510,6 +510,7 @@ namespace Sortix
|
|||
int envc, const char* const* envp,
|
||||
CPU::InterruptRegisters* regs)
|
||||
{
|
||||
(void) programname;
|
||||
assert(CurrentProcess() == this);
|
||||
|
||||
addr_t entry = ELF::Construct(CurrentProcess(), program, programsize);
|
||||
|
@ -568,6 +569,8 @@ namespace Sortix
|
|||
|
||||
DevBuffer* OpenProgramImage(const char* progname, const char* wd, const char* path)
|
||||
{
|
||||
(void) wd;
|
||||
(void) path;
|
||||
char* abs = Directory::MakeAbsolute("/", progname);
|
||||
if ( !abs ) { errno = ENOMEM; return NULL; }
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace Sortix
|
|||
int c;
|
||||
while ( (c=UART::TryPopChar()) != -1 )
|
||||
{
|
||||
#warning Support for hooking the serial input up against the keyboard API have broken
|
||||
// TODO: Support for hooking the serial input up against the keyboard API have broken
|
||||
#if 0
|
||||
// TODO: This is no longer compatible with the keyboard API, so
|
||||
// it has been commented out. Besides, JSSortix isn't really
|
||||
|
@ -140,7 +140,7 @@ namespace Sortix
|
|||
|
||||
size_t Print(void* /*user*/, const char* string, size_t stringlen)
|
||||
{
|
||||
#warning Echoing to the VGA terminal is broken
|
||||
// TODO: Echoing to the VGA terminal is broken
|
||||
#if 0
|
||||
if ( ECHO_TO_VGA ) { VGATerminal::Print(NULL, string, stringlen); }
|
||||
#endif
|
||||
|
|
|
@ -45,7 +45,6 @@ char* Clone(const char* Input)
|
|||
|
||||
char* Substring(const char* src, size_t offset, size_t length)
|
||||
{
|
||||
size_t srclen = strlen(src);
|
||||
char* dest = new char[length + 1];
|
||||
if ( !dest ) { return NULL; }
|
||||
memcpy(dest, src + offset, length * sizeof(char));
|
||||
|
|
|
@ -149,7 +149,7 @@ namespace Sortix
|
|||
Page::Lock();
|
||||
|
||||
// In case any pages wasn't cleaned at this point.
|
||||
#warning Page::Put calls may internally Page::Get and then reusing pages we are not done with just yet
|
||||
// TODO: Page::Put calls may internally Page::Get and then reusing pages we are not done with just yet
|
||||
RecursiveFreeUserspacePages(TOPPMLLEVEL, 0);
|
||||
|
||||
// Switch to the address space from when the world was originally
|
||||
|
|
|
@ -136,6 +136,7 @@ namespace Sortix
|
|||
tss_entry.cs = 0x08 | 0x3;
|
||||
tss_entry.ss = tss_entry.ds = tss_entry.es = tss_entry.fs = tss_entry.gs = 0x10 | 0x3;
|
||||
#elif defined(PLATFORM_X64)
|
||||
(void) ss0;
|
||||
tss_entry.stack0 = stack0;
|
||||
#endif
|
||||
}
|
||||
|
@ -143,8 +144,12 @@ namespace Sortix
|
|||
void SetKernelStack(addr_t stacklower, size_t stacksize, addr_t stackhigher)
|
||||
{
|
||||
#ifdef PLATFORM_X86
|
||||
(void) stacklower;
|
||||
(void) stacksize;
|
||||
tss_entry.esp0 = (uint32_t) stackhigher;
|
||||
#elif defined(PLATFORM_X64)
|
||||
(void) stacklower;
|
||||
(void) stacksize;
|
||||
tss_entry.stack0 = (uint64_t) stackhigher;
|
||||
#else
|
||||
#warning "TSS is not yet supported on this arch!"
|
||||
|
|
|
@ -136,8 +136,8 @@ namespace Sortix
|
|||
|
||||
// Give all the physical memory to the physical memory allocator
|
||||
// but make sure not to give it things we already use.
|
||||
addr_t regionstart = mmap->addr;
|
||||
addr_t regionend = mmap->addr + mmap->len;
|
||||
addr_t regionstart = base;
|
||||
addr_t regionend = base + length;
|
||||
addr_t processed = regionstart;
|
||||
while ( processed < regionend )
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Sortix
|
|||
{
|
||||
PML* const BOOTPML2 = (PML* const) 0x11000UL;
|
||||
PML* const BOOTPML1 = (PML* const) 0x12000UL;
|
||||
PML* const FORKPML1 = (PML* const) 0x13000UL;
|
||||
//PML* const FORKPML1 = (PML* const) 0x13000UL;
|
||||
PML* const IDENPML1 = (PML* const) 0x14000UL;
|
||||
|
||||
// Initialize the memory structures with zeroes.
|
||||
|
@ -139,7 +139,7 @@ namespace Sortix
|
|||
Page::Lock();
|
||||
|
||||
// In case any pages wasn't cleaned at this point.
|
||||
#warning Page::Put calls may internally Page::Get and then reusing pages we are not done with just yet
|
||||
// TODO: Page::Put calls may internally Page::Get and then reusing pages we are not done with just yet
|
||||
RecursiveFreeUserspacePages(TOPPMLLEVEL, 0);
|
||||
|
||||
// Switch to the address space from when the world was originally
|
||||
|
|
Loading…
Reference in a new issue