Skip to content

Commit 0630f9a

Browse files
committed
Merge branch 'main' of https://github.com/nanoframework/nf-interpreter into networkfusion/ci-improvements
2 parents 03f66e2 + 79cb491 commit 0630f9a

File tree

13 files changed

+345
-341
lines changed

13 files changed

+345
-341
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
# ignore any content inside the Interop assemblies folder
1515
InteropAssemblies/*
16+
!InteropAssemblies/CLR_IncludedAPI.h.in
1617
!InteropAssemblies/CLR_RT_InteropAssembliesTable.cpp.in
1718
!InteropAssemblies/README.md
1819

.typo-ci.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

CMake/Modules/FindNF_NativeAssemblies.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ macro(PerformSettingsForApiEntry apiNamespace)
118118
# list this option
119119
list(APPEND apiListing "${apiNamespace}")
120120

121+
# append to list of defines for Interop Assemblies include file
122+
set(CLR_RT_NativeAssemblyPreprocessorDefines "${CLR_RT_NativeAssemblyPreprocessorDefines}\n#define API_${apiNamespaceWithoutDots}")
123+
121124
# append to list of declaration for Interop Assemblies table
122125
list(APPEND CLR_RT_NativeAssemblyDataList "extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_${apiNamespaceWithoutDots};")
123126

@@ -470,10 +473,14 @@ string(REPLACE ";" "\n " CLR_RT_NativeAssemblyDataTableEntries "${CLR_RT_Nati
470473
list(LENGTH CLR_RT_NativeAssemblyDataTableEntriesList CLR_RT_NativeAssembliesCount)
471474

472475

476+
# configure header file with Interop Assemblies defines and...
477+
configure_file("${CMAKE_SOURCE_DIR}/InteropAssemblies/CLR_IncludedAPI.h.in"
478+
"${CMAKE_CURRENT_BINARY_DIR}/CLR_IncludedAPI.h" @ONLY)
479+
473480
# configure code file with Interop Assemblies table and...
474481
configure_file("${CMAKE_SOURCE_DIR}/InteropAssemblies/CLR_RT_InteropAssembliesTable.cpp.in"
475482
"${CMAKE_CURRENT_BINARY_DIR}/CLR_RT_InteropAssembliesTable.cpp" @ONLY)
476-
# ... now add Interop Assemblies table to ChibiOS nanoCLR sources list
483+
# ... now add Interop Assemblies table to nanoCLR sources list
477484
list(APPEND NF_NativeAssemblies_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/CLR_RT_InteropAssembliesTable.cpp")
478485

479486
# create a .csv file with native assembly versions in the output directory
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// See LICENSE file in the project root for full license information.
4+
//
5+
6+
//////////////////////////////////////////////////////////////////////////////
7+
// This file was automatically generated by a tool. //
8+
// Any changes you make here will be overwritten when it's generated again. //
9+
//////////////////////////////////////////////////////////////////////////////
10+
11+
#ifndef _CLR_INCLUDEDAPI_H_
12+
#define _CLR_INCLUDEDAPI_H_
13+
@CLR_RT_NativeAssemblyPreprocessorDefines@
14+
15+
#endif // _CLR_INCLUDEDAPI_H_

InteropAssemblies/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

2-
This folder contains the configuration file for the Assemblies Table collection.
2+
This folder contains a template for a header with preprocessor defines and
3+
for the configuration file for the Assemblies Table collection.
34

4-
It's a placeholder for the Interop assemblies source files.
5-
The source files for each Interop assembly should be placed in it's own folder.
5+
The latter is a placeholder for the Interop assemblies source files.
6+
The source files for each Interop assembly should be placed in its own folder.
67
Anything inside this folder is ignored by an exception pattern in .gitignore file.

azure-pipelines.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,12 @@ trigger:
1313
- .clang-format
1414
- .github_changelog_generator
1515
- .gitignore
16-
- .typo-ci.yml
1716
- build.ps1
1817
- CHANGELOG.md
19-
- CMakeSettings.json
20-
- CMakeSettings.SAMPLE.json
2118
- LICENSE.md
2219
- nf.props
2320
- nfcore.vssettings
24-
- README.md
25-
- README.zh-cn.md
21+
- README*.md
2622
- RunCmd.bat
2723
- startocd.bat
2824
- .github/*

install-scripts/install-cmake.ps1

Lines changed: 242 additions & 189 deletions
Large diffs are not rendered by default.

nfcore.vssettings

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/CLR/CorLib/corlib_native_System_Guid.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,31 @@
33
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
44
// See LICENSE file in the project root for full license information.
55
//
6-
#include "CorLib.h"
7-
8-
//
9-
// Generate a new GUID
10-
//
11-
// Based on the version 4 GUID (random)
12-
// http://guid.one/guid/make
136

7+
#include "CorLib.h"
148

15-
HRESULT Library_corlib_native_System_Guid::GenerateNewGuid___STATIC__SZARRAY_U1( CLR_RT_StackFrame& stack )
9+
HRESULT Library_corlib_native_System_Guid::GenerateNewGuid___STATIC__SZARRAY_U1(CLR_RT_StackFrame &stack)
1610
{
1711
NANOCLR_HEADER();
1812

19-
CLR_RT_Random rand;
20-
CLR_UINT8* buf;
21-
CLR_RT_HeapBlock& top = stack.PushValueAndClear();
22-
13+
CLR_RT_Random rand;
14+
CLR_UINT8 *buf;
15+
CLR_RT_HeapBlock &top = stack.PushValueAndClear();
16+
2317
// Create a array of 16 bytes on top of stack to return
24-
NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( top, 16, g_CLR_RT_WellKnownTypes.m_UInt8 ));
18+
NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(top, 16, g_CLR_RT_WellKnownTypes.m_UInt8));
2519
buf = top.DereferenceArray()->GetFirstElement();
2620

2721
rand.Initialize();
28-
rand.NextBytes(buf, 16); // fill with random numbers
2922

30-
buf[7] = (buf[7] & 0x0f) | 0x40; // Set verion
31-
buf[9] = (buf[7] & 0x3f) | 0x80; // Set variant
32-
23+
// Generate 16 random bytes for the GUID
24+
rand.NextBytes(buf, 16);
25+
26+
// Set the version (version 4, bits 12-15 of time_hi_and_version)
27+
buf[7] = (buf[7] & 0x0F) | 0x40;
28+
29+
// Set the variant (the two most significant bits of clock_seq_hi_and_reserved must be 10)
30+
buf[8] = (buf[8] & 0x3F) | 0x80;
31+
3332
NANOCLR_NOCLEANUP();
3433
}

src/CLR/Debugger/Debugger.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Copyright (c) .NET Foundation and Contributors
33
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
44
// See LICENSE file in the project root for full license information.
@@ -998,12 +998,12 @@ bool CLR_DBG_Debugger::Monitor_WriteMemory(WP_Message *msg)
998998
{
999999
NATIVE_PROFILE_CLR_DEBUGGER();
10001000

1001-
CLR_DBG_Commands_Monitor_WriteMemory *cmd = (CLR_DBG_Commands_Monitor_WriteMemory *)msg->m_payload;
1002-
CLR_DBG_Commands_Monitor_WriteMemory_Reply cmdReply;
1001+
auto *cmd = (CLR_DBG_Commands_Monitor_WriteMemory *)msg->m_payload;
1002+
CLR_DBG_Commands_Monitor_WriteMemory_Reply errorCode = AccessMemoryErrorCode_NoError;
10031003

1004-
g_CLR_DBG_Debugger->AccessMemory(cmd->address, cmd->length, cmd->data, AccessMemory_Write, &cmdReply);
1004+
g_CLR_DBG_Debugger->AccessMemory(cmd->address, cmd->length, cmd->data, AccessMemory_Write, &errorCode);
10051005

1006-
WP_ReplyToCommand(msg, true, false, &cmdReply, sizeof(cmdReply));
1006+
WP_ReplyToCommand(msg, true, false, &errorCode, sizeof(errorCode));
10071007

10081008
return true;
10091009
}
@@ -1012,14 +1012,13 @@ bool CLR_DBG_Debugger::Monitor_CheckMemory(WP_Message *msg)
10121012
{
10131013
NATIVE_PROFILE_CLR_DEBUGGER();
10141014

1015-
CLR_DBG_Commands_Monitor_CheckMemory *cmd = (CLR_DBG_Commands_Monitor_CheckMemory *)msg->m_payload;
1016-
CLR_DBG_Commands_Monitor_CheckMemory_Reply cmdReply;
1017-
uint32_t errorCode;
1015+
auto *cmd = (CLR_DBG_Commands_Monitor_CheckMemory *)msg->m_payload;
1016+
CLR_DBG_Commands_Monitor_CheckMemory_Reply errorCode = AccessMemoryErrorCode_NoError;
10181017

10191018
g_CLR_DBG_Debugger
1020-
->AccessMemory(cmd->address, cmd->length, (unsigned char *)&cmdReply, AccessMemory_Check, &errorCode);
1019+
->AccessMemory(cmd->address, cmd->length, (unsigned char *)&errorCode, AccessMemory_Check, &errorCode);
10211020

1022-
WP_ReplyToCommand(msg, errorCode == AccessMemoryErrorCode_NoError, false, &cmdReply, sizeof(cmdReply));
1021+
WP_ReplyToCommand(msg, errorCode == AccessMemoryErrorCode_NoError, false, &errorCode, sizeof(errorCode));
10231022

10241023
return true;
10251024
}
@@ -1028,12 +1027,12 @@ bool CLR_DBG_Debugger::Monitor_EraseMemory(WP_Message *msg)
10281027
{
10291028
NATIVE_PROFILE_CLR_DEBUGGER();
10301029

1031-
CLR_DBG_Commands_Monitor_EraseMemory *cmd = (CLR_DBG_Commands_Monitor_EraseMemory *)msg->m_payload;
1032-
CLR_DBG_Commands_Monitor_EraseMemory_Reply cmdReply;
1030+
auto *cmd = (CLR_DBG_Commands_Monitor_EraseMemory *)msg->m_payload;
1031+
CLR_DBG_Commands_Monitor_EraseMemory_Reply errorCode = AccessMemoryErrorCode_NoError;
10331032

1034-
g_CLR_DBG_Debugger->AccessMemory(cmd->address, cmd->length, NULL, AccessMemory_Erase, &cmdReply);
1033+
g_CLR_DBG_Debugger->AccessMemory(cmd->address, cmd->length, NULL, AccessMemory_Erase, &errorCode);
10351034

1036-
WP_ReplyToCommand(msg, true, false, &cmdReply, sizeof(cmdReply));
1035+
WP_ReplyToCommand(msg, true, false, &errorCode, sizeof(errorCode));
10371036

10381037
return true;
10391038
}

0 commit comments

Comments
 (0)