static void sigterm(int sig)
{
    TraceExit("Signal %d received. Exiting...\n",sig);
}
NTSTATUS
RegistersCreate(
    _In_ WDFDEVICE Device,
    _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR  RegistersResource
    )
/*++

Routine Description:

    Helper function to map the memory resources to the HW registers.

Arguments:

    Device - Wdf device object corresponding to the FDO

    RegisterResource -  Raw resource for the memory

Return Value:

    Appropriate NTSTATUS value

--*/
{
    NTSTATUS Status;
    PREGISTERS_CONTEXT Context;
    WDF_OBJECT_ATTRIBUTES Attributes;

    TraceEntry();

    PAGED_CODE();

    WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&Attributes, REGISTERS_CONTEXT);

    Status = WdfObjectAllocateContext(Device, &Attributes, &Context);
    if (Status == STATUS_OBJECT_NAME_EXISTS) {
        //
        // In the case of a resource rebalance, the context allocated
        // previously still exists.
        //
        Status = STATUS_SUCCESS;
        RtlZeroMemory(Context, sizeof(*Context));
    }
    CHK_NT_MSG(Status, "Failed to allocate context for registers");

    Context->RegisterBase = MmMapIoSpaceEx(
                                RegistersResource->u.Memory.Start,
                                RegistersResource->u.Memory.Length,
                                PAGE_NOCACHE | PAGE_READWRITE);

    if (Context->RegisterBase == NULL) {
        Status = STATUS_INSUFFICIENT_RESOURCES;
        CHK_NT_MSG(Status, "MmMapIoSpaceEx failed");
    }

    Context->RegistersLength = RegistersResource->u.Memory.Length;

End:

    TraceExit();
    return Status;
}