Skip to content

Commit

Permalink
Fix the heap and use of IPI
Browse files Browse the repository at this point in the history
  • Loading branch information
Meulengracht committed Nov 19, 2019
1 parent 8ae325f commit 6303c90
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 20 deletions.
1 change: 1 addition & 0 deletions kernel/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* - Implementation of the resource handle interface. This provides system-wide
* resource handles and maintience of resources.
*/

#define __MODULE "HNDL"
//#define __TRACE

Expand Down
6 changes: 4 additions & 2 deletions kernel/heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ MemoryCacheAllocate(

Index = slab_allocate_index(Cache, Slab);
assert(Index != -1);

if (!Slab->NumberOfFreeObjects) {
list_remove(&Cache->PartialSlabs, &Slab->Header);
list_append(&Cache->FullSlabs, &Slab->Header);
Expand All @@ -702,10 +703,10 @@ MemoryCacheAllocate(
list_append(&Cache->FullSlabs, &Slab->Header);
}
else {
Cache->NumberOfFreeObjects += (Cache->ObjectCount - 1);
list_append(&Cache->PartialSlabs, &Slab->Header);
smp_wmb();
Cache->NumberOfFreeObjects += (Cache->ObjectCount - 1);
}
smp_wmb();
}

Allocated = MEMORY_SLAB_ELEMENT(Cache, Slab, Index);
Expand Down Expand Up @@ -766,6 +767,7 @@ MemoryCacheFree(
// Handle debug flags
if (Cache->Flags & HEAP_DEBUG_USE_AFTER_FREE) {
memset(Object, MEMORY_OVERRUN_PATTERN, Cache->ObjectSize);
smp_wmb();
}

// Can we push to cpu cache?
Expand Down
2 changes: 1 addition & 1 deletion kernel/include/component/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ typedef struct TxuMessage {
void* Argument;
} TxuMessage_t;

#define TXU_MESSAGE_INIT(Msg, Fn, Arg) ELEMENT_INIT(&(Msg)->Header, 0, Msg); (Msg)->Handler = Fn; (Msg)->Argument = Arg
#define TXU_MESSAGE_INIT(Msg, Fn, Arg) ELEMENT_INIT(&Msg->Header, 0, Msg); Msg->Handler = Fn; Msg->Argument = Arg

typedef struct SystemCpuCore {
UUId_t Id;
Expand Down
3 changes: 3 additions & 0 deletions kernel/machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ InitializeMachine(
ERROR("Failed to initialize output for system.");
ArchProcessorHalt();
}

// Initialize all those who need the heap system in place
TxuMessageCacheInitialize();

// Build system topology by enumerating the SRAT table if present.
// If ACPI is not present or the SRAT is missing the system is running in UMA
Expand Down
3 changes: 2 additions & 1 deletion kernel/memoryspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ SynchronizeMemoryRegion(
// We can easily allocate this object on the stack as the stack is globally
// visible to all kernel code. This spares us allocation on heap
MemorySynchronizationObject_t Object = { { { 0 } } };
TxuMessage_t* Message = &Object.Header;
int NumberOfCores;

// Skip this entire step if there is no multiple cores active
Expand All @@ -96,7 +97,7 @@ SynchronizeMemoryRegion(
}
}

TXU_MESSAGE_INIT(&Object.Header, MemorySynchronizationHandler, &Object);
TXU_MESSAGE_INIT(Message, MemorySynchronizationHandler, &Object);
Object.Address = Address;
Object.Length = Length;
Object.CallsCompleted = 0;
Expand Down
14 changes: 7 additions & 7 deletions modules/storage/msd/msd.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,27 +136,27 @@ MsdDeviceCreate(
goto Error;
}

// Perform setup
if (MsdDeviceStart(Device) != OsSuccess) {
ERROR("Failed to initialize the device");
goto Error;
}

// Start out by initializing the contract
InitializeContract(&Device->Contract, Device->Base.Base.Id, 1,
ContractStorage, "MSD Storage Interface");

// Register contract before interrupt
if (RegisterContract(&Device->Contract) != OsSuccess) {
ERROR("Failed to register storage contract for device");
}

// Notify diskmanager
// Wait for the disk service to finish loading
if (WaitForFileService(1000) != OsSuccess) {
ERROR("[msd] disk ready but storage service did not start");
// TODO: what do
return Device;
}

if (RegisterStorage(Device->Base.Base.Id, __STORAGE_REMOVABLE) != OsSuccess) {
ERROR("Failed to register storage with storagemanager");
}

// Done
return Device;

Error:
Expand Down
6 changes: 3 additions & 3 deletions revision.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#ifndef _REVISION_H_
#define _REVISION_H_

#define BUILD_DATE "18 November 2019"
#define BUILD_TIME "14:04:42"
#define BUILD_DATE "19 November 2019"
#define BUILD_TIME "12:13:50"
#define BUILD_SYSTEM "clang"

#define REVISION_MAJOR 0
#define REVISION_MINOR 6
#define REVISION_BUILD 12887
#define REVISION_BUILD 12895

#endif //!_REVISION_H_
6 changes: 0 additions & 6 deletions services/filemanager/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ VfsIdentifierFree(
}
}

/* OnLoad
* The entry-point of a server, this is called
* as soon as the server is loaded in the system */
OsStatus_t
OnLoad(
_In_ char** ServicePathOut)
Expand All @@ -180,9 +177,6 @@ OnLoad(
return OsSuccess;
}

/* OnUnload
* This is called when the server is being unloaded
* and should free all resources allocated by the system */
OsStatus_t
OnUnload(void)
{
Expand Down

2 comments on commit 6303c90

@Meulengracht
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity ValiOS / i386 / Build Build 268 is now running

@Meulengracht
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity ValiOS / i386 / Build Build 268 outcome was SUCCESS
Summary: Running Build time: 00:02:46

Please sign in to comment.