Cross-platform kernel adaptation method
By using Word2Vec and Skip-gram algorithms for kernel interface semantic analysis and adaptation matrix generation, combined with technical means of abstract kernel layer and bidirectional converter, the problems of inefficiency and poor reliability in cross-platform kernel adaptation are solved, and more efficient interface matching and parameter conversion are achieved, improving the stability and compatibility of the system.
Patent Information
- Application Number
- CN202411835490.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2044-12-13
AI Technical Summary
The prior art has problems of inefficiency and poor reliability in cross-platform kernel adaptation, especially in interface semantics understanding, parameter conversion and scheduling management.
The Word2Vec model and Skip-gram algorithm are used to perform word-partial encoding and semantic feature extraction of the kernel interface, and the kernel interface adaptation matrix is generated, parameter adaptation is performed through the abstract kernel layer and bidirectional converter, and system calls and memory management are managed through the processor responsibility chain and the state machine.
It realizes more accurate interface matching and parameter conversion, improves cross-platform compatibility and system stability, and enhances runtime monitoring and exception handling capabilities.
Smart Images

Figure CN119311315B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a cross-platform kernel adaptation method. Background Art
[0002] Cross-platform kernel adaptation is a key technical difficulty in operating system porting. Traditional kernel adaptation methods mainly rely on manual experience for interface mapping, and have problems such as low efficiency and poor reliability when dealing with complex system calls and interrupt processing.
[0003] The existing kernel adaptation system faces multiple technical challenges. In terms of interface semantics, the system lacks in-depth analysis of the semantic features of kernel calls, and simple interface name matching cannot accurately grasp the functional equivalence relationship between different platforms. The natural language processing of interface descriptions is not in-depth enough, making it difficult to effectively use the semantic information in the interface documents, affecting the accuracy of adaptation.
[0004] Parameter conversion and data structure adaptation is another key issue. Different platforms have different data type definitions and memory alignment requirements, and traditional static mapping rules are difficult to handle complex data structure conversions. At the same time, the lack of a unified abstraction for parameter passing methods can easily lead to errors and memory leaks during data transmission.
[0005] Scheduling management of kernel requests also faces challenges. Existing systems often use simple queue management methods, lack of priority sorting for system calls and interrupt processing, and cannot ensure real-time response to key operations. Memory management strategies are relatively extensive and do not fully consider concurrent access issues in a multi-threaded environment, which can easily lead to resource contention and deadlock.
[0006] Therefore, a smarter and more reliable kernel adaptation solution is needed. Summary of the invention
[0007] In view of the problems in the prior art, the present application provides a cross-platform kernel adaptation method, which can achieve better cross-platform compatibility.
[0008] In order to solve at least one of the above problems, the present application provides the following technical solutions:
[0009] In a first aspect, the present application provides a cross-platform kernel adaptation method, comprising:
[0010] Scan the kernel interface information of the chip platform, extract the system call table and interrupt vector table, analyze the parameter passing method and return value type of the kernel interface to build a kernel symbol mapping table, use the Word2Vec model to perform word segmentation encoding on the interface name and parameter identifier in the kernel symbol mapping table to generate word vector features, use the Skip-gram algorithm to predict the context relationship to train the interface word vector, obtain the semantic features of the interface description based on the sliding window, and calculate the semantic correlation between interfaces through cosine similarity to generate a kernel interface adaptation matrix;
[0011] An abstract kernel layer is constructed based on the word vector features and the kernel interface adaptation matrix, the kernel interfaces with semantic similarity higher than a preset threshold are classified and designed into a unified calling specification, a bidirectional converter is constructed to adapt the parameter types and data structures of different platforms, a conversion rule linked list is created to store parameter mapping relationships, a processor responsibility chain is established to distribute system calls, interrupt processing and memory management requests, a command queue is used to cache kernel requests to be processed, a state machine is used to control the life cycle transition of the kernel interface from initialization to destruction, and a thread-safe memory pool is designed to manage parameter buffers;
[0012] Dynamically load the kernel adaptation module at runtime, identify the chip platform type through the CPU feature code, query the kernel symbol mapping table to obtain the interface information of the target platform, select the corresponding conversion strategy according to the kernel interface adaptation matrix, establish a system call interception queue, use Hook technology to inject the kernel call process, design a watchdog mechanism to monitor kernel operation timeout, and return the converted call result to the application.
[0013] Furthermore, the scanning chip platform kernel interface information, extracting the system call table and the interrupt vector table, analyzing the parameter transfer mode and the return value type of the kernel interface to construct a kernel symbol mapping table, and using the Word2Vec model to perform word segmentation encoding on the interface name and parameter identifier in the kernel symbol mapping table to generate word vector features, including:
[0014] By parsing the system kernel file, the system call number and the corresponding function pointer table are extracted, the interrupt descriptor table is read to obtain the entry address of the interrupt service program, the kernel binary file is analyzed using a symbol table parsing tool to extract function symbol information, the kernel module export table is parsed to obtain a list of available interfaces, and the extracted interface information is stored in a hash table to establish a fast index;
[0015] Abstract syntax trees are used to analyze the data types and transfer directions of interface parameters, the data structures and memory allocation methods of function return values are parsed, interface names and parameter identifiers are segmented at the character level, the Skip-gram model is used to train word embedding vectors, sliding windows are used to extract context features, and the semantic correlation between interfaces is calculated based on cosine similarity to generate a feature vector matrix.
[0016] Furthermore, the method uses the Skip-gram algorithm to predict the contextual relationship to train the interface word vector, obtains the semantic features of the interface description based on the sliding window, and calculates the semantic association between interfaces by cosine similarity to generate the kernel interface adaptation matrix, including:
[0017] Based on the Skip-gram model, the neural network input layer and projection layer are constructed. A sliding window of size n is used to extract the center word and context word pairs from the interface description text. The one-hot encoding of the center word is input into the neural network for forward propagation calculation. Negative sampling is used to optimize the loss function to reduce the computational complexity. The network weight parameters are updated through stochastic gradient descent. The optimization is iterated until convergence to obtain the word vector representation.
[0018] The trained word vectors are normalized, the cosine distance between different interface word vectors is calculated to obtain the similarity matrix, the similarity threshold is set to cluster the interfaces, a sparse matrix is constructed to store the mapping relationship between interfaces, the matrix compression algorithm is used to optimize the storage space, and an interface index table is established to accelerate the query process.
[0019] Furthermore, the abstract kernel layer is constructed based on the word vector features and the kernel interface adaptation matrix, the kernel interfaces with semantic similarity higher than a preset threshold are classified and designed into a unified calling specification, a bidirectional converter is constructed to adapt the parameter types and data structures of different platforms, a conversion rule linked list is created to store parameter mapping relationships, and a processor responsibility chain is established to distribute system calls, interrupt processing and memory management requests, including:
[0020] The semantic similarity of interfaces is calculated through word vector features, and similar interfaces are classified based on a preset threshold of 0.8. Common interface features are extracted to define abstract base classes, virtual function tables are designed to implement polymorphic calls, adapter classes are constructed to encapsulate platform differences, factory methods are used to create specific platform implementation classes, and bridge patterns are used to separate abstract interfaces from platform implementations.
[0021] Based on the interface adaptation matrix, a parameter type mapping table is created to implement the serialization and deserialization methods to convert data structures. An ordered linked list is constructed to store parameter conversion rules. The template method is used to define the conversion processing flow. A processor object chain is created to handle different types of requests. The command mode is used to encapsulate the processor calling process. The request distribution is completed by traversing the processor chain through the iterator.
[0022] Furthermore, the command queue is used to cache the kernel requests to be processed, a state machine is used to control the life cycle transition of the kernel interface from initialization to destruction, and a thread-safe memory pool management parameter buffer is designed, including:
[0023] Create a circular queue structure to store pending request commands, allocate a request object pool to avoid frequent memory allocation, use spin locks to protect concurrent access to the queue, implement the producer-consumer model to process asynchronous requests, set queue capacity thresholds to trigger flow control, build a priority queue to support request scheduling, and use reference counting to manage the request object life cycle;
[0024] Construct a state transition graph to define the interface state set, implement the state migration matrix to record the effective transition path, use read-write locks to protect state access, create a memory pool to divide the memory blocks of fixed size, use the partner algorithm to manage memory allocation and recycling, implement memory alignment to ensure access efficiency, and use atomic operations to ensure the thread safety of memory operations.
[0025] Furthermore, the dynamically loading of the kernel adapter module at runtime, identifying the chip platform type through the CPU feature code, and querying the kernel symbol mapping table to obtain the interface information of the target platform include:
[0026] Read the symbol table of the dynamic link library to obtain the list of exported functions, parse the module dependencies to build a loading sequence diagram, allocate virtual memory space to load the module code segment and data segment, repair the function address in the import table, execute the module initialization function to complete the runtime loading, and establish a module handle table to manage the loaded modules;
[0027] Read the CPUID instruction of the CPU to obtain the processor feature code, parse the processor model and architecture information, query the platform type database based on the processor feature code, retrieve the interface definition of the target platform from the kernel symbol mapping table, build the platform feature descriptor to store the hardware configuration information, and create a platform capability table to record the supported functional features.
[0028] Furthermore, the method selects a corresponding conversion strategy according to the kernel interface adaptation matrix, establishes an interception queue for system calls, uses Hook technology to inject the kernel call process, designs a watchdog mechanism to monitor kernel operation timeout, and returns the converted call result to the application, including:
[0029] Calculate the best conversion path based on the kernel interface adaptation matrix, build a conversion strategy cache to accelerate strategy selection, create a system call interception table to record the call number to be intercepted, use inline Hook to modify the system call entry address, implement the conversion processing logic of the call parameters, construct a call context to save the scene information, and use reentrant locks to protect the concurrent call process;
[0030] Create a watchdog timer to set the timeout threshold, build a timeout handling function to handle exceptions, use shared memory communication to pass the call results, implement the result conversion function to adapt the return value type, use reference counting to manage the result object life cycle, set the callback function to handle asynchronous call completion events, and synchronize the call completion status through semaphores.
[0031] In a second aspect, the present application provides a cross-platform kernel adaptation device, comprising:
[0032] A matrix construction module is used to scan the kernel interface information of the chip platform, extract the system call table and the interrupt vector table, analyze the parameter passing mode and return value type of the kernel interface to construct a kernel symbol mapping table, use the Word2Vec model to perform word segmentation encoding on the interface name and parameter identifier in the kernel symbol mapping table to generate word vector features, use the Skip-gram algorithm to predict the context relationship to train the interface word vector, obtain the semantic features of the interface description based on the sliding window, and calculate the semantic correlation between interfaces through cosine similarity to generate a kernel interface adaptation matrix;
[0033] A data adaptation module is used to construct an abstract kernel layer based on the word vector features and the kernel interface adaptation matrix, classify the kernel interfaces with semantic similarity higher than a preset threshold and design a unified calling specification, build a bidirectional converter to adapt the parameter types and data structures of different platforms, create a conversion rule linked list to store parameter mapping relationships, establish a processor responsibility chain to distribute system calls, interrupt processing and memory management requests, use a command queue to cache pending kernel requests, use a state machine to control the life cycle transition of the kernel interface from initialization to destruction, and design a thread-safe memory pool to manage parameter buffers;
[0034] A mapping call module is used to dynamically load the kernel adaptation module at runtime, identify the chip platform type through the CPU feature code, query the kernel symbol mapping table to obtain the interface information of the target platform, select the corresponding conversion strategy according to the kernel interface adaptation matrix, establish a system call interception queue, use Hook technology to inject the kernel call process, design a watchdog mechanism to monitor kernel operation timeout, and return the converted call result to the application.
[0035] In a third aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the cross-platform kernel adaptation method when executing the program.
[0036] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the cross-platform kernel adaptation method when executed by a processor.
[0037] In a fifth aspect, the present application provides a computer program product, including a computer program / instruction, which implements the steps of the cross-platform kernel adaptation method when executed by a processor.
[0038] It can be seen from the above technical solution that the present application provides a cross-platform kernel adaptation method, which establishes a flexible parameter conversion mechanism by accurately understanding the kernel interface semantics, and ensures the stable operation of the system through an efficient scheduling strategy. By introducing deep learning and natural language processing technology, the accuracy of interface matching is improved to achieve better cross-platform compatibility. At the same time, it also strengthens runtime monitoring and exception handling to improve the reliability and security of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0040] Figure 1 This is one of the flow charts of the cross-platform kernel adaptation method in the embodiment of the present application;
[0041] Figure 2 This is the second flow chart of the cross-platform kernel adaptation method in the embodiment of the present application;
[0042] Figure 3 This is the third flow chart of the cross-platform kernel adaptation method in the embodiment of the present application;
[0043] Figure 4 This is a fourth flow chart of the cross-platform kernel adaptation method in an embodiment of the present application;
[0044] Figure 5 This is a fifth flow chart of the cross-platform kernel adaptation method in the embodiment of the present application;
[0045] Figure 6 This is the sixth flow chart of the cross-platform kernel adaptation method in the embodiment of the present application;
[0046] Figure 7 FIG7 is a flowchart of a cross-platform kernel adaptation method in an embodiment of the present application;
[0047] Figure 8 is a structural diagram of a cross-platform kernel adapter device in an embodiment of the present application;
[0048] Fig. 9 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application.
[0049] Reference numerals:
[0050] Electronic device 9600, central processing unit 9100, memory 9140, communication module 9110, input unit 9120, audio processor 9130, display 9160, power supply 9170, buffer memory 9141, application / function storage unit 9142, data storage unit 9143, driver program storage unit 9144, antenna 9111, speaker 9131, microphone 9132. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0052] The acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.
[0053] Taking into account the problems existing in the prior art, the present application provides a cross-platform kernel adaptation method, which establishes a flexible parameter conversion mechanism by accurately understanding the kernel interface semantics, and ensures the stable operation of the system through an efficient scheduling strategy. By introducing deep learning and natural language processing technology, the accuracy of interface matching is improved and better cross-platform compatibility is achieved. At the same time, runtime monitoring and exception handling are strengthened to improve the reliability and security of the system.
[0054] In order to achieve better cross-platform compatibility, the present application provides an embodiment of a cross-platform kernel adaptation method, see Figure 1 , the cross-platform kernel adaptation method specifically includes the following contents:
[0055] Step S101: Scan the kernel interface information of the chip platform, extract the system call table and the interrupt vector table, analyze the parameter passing mode and return value type of the kernel interface to construct a kernel symbol mapping table, use the Word2Vec model to perform word segmentation encoding on the interface name and parameter identifier in the kernel symbol mapping table to generate word vector features, use the Skip-gram algorithm to predict the context relationship to train the interface word vector, obtain the semantic features of the interface description based on the sliding window, and calculate the semantic correlation between interfaces through cosine similarity to generate a kernel interface adaptation matrix;
[0056] Optionally, this embodiment first scans the system image file of the target chip platform through a kernel parsing tool to extract the contents of the system call table (sys_call_table) and the interrupt vector table (IDT). Taking the ARM architecture as an example, the system call number and the corresponding processing function address of functions including process management, memory management, file system, etc. are obtained by parsing the system call table, and the entry address of the interrupt vector and its service program are extracted from the interrupt descriptor table.
[0057] After obtaining the basic interface information, use the symbol resolution tool to analyze the kernel binary file and dynamic link library, and extract the function symbol information including function name, parameter list, return value type, etc. For example, for the kmalloc function related to memory management, its parameters include allocation size and allocation flags, and the return value is a memory address of type void*. This information is organized into a hash table structure to support fast query with O(1) time complexity.
[0058] This embodiment uses an abstract syntax tree (AST) to analyze the parameter transfer mode of the interface function, including value transfer, pointer transfer, and reference transfer. For complex data structures, the type information and memory layout of its member variables are recursively analyzed. For example, when analyzing the task_struct structure, the offset and size information of key fields such as process ID, priority, and status are extracted.
[0059] The Word2Vec model is used to vectorize the interface names and parameter identifiers. First, the identifiers are segmented at the character level, such as "create_process" is decomposed into "create" and "process". Then the Skip-gram algorithm is used to train the word vector model, with the window size set to 5 and the vector dimension set to 100. The semantic representation of the identifier is learned by predicting the context word pairs.
[0060] Based on the trained word vectors, the sliding window method is used to extract the contextual features of the interface description. The window size is dynamically adjusted according to the average length of the interface description, with a typical value of 3-7 words. For each interface, the weighted average of its word vectors is calculated as the semantic feature vector of the interface.
[0061] Finally, the kernel interface adaptation matrix is constructed by calculating the cosine similarity between the interface feature vectors. The value range of cosine similarity is [-1, 1]. The larger the value, the closer the interface semantics. For example, the similarity between the create_process interface of the Linux platform and the CreateProcess interface of the Windows platform reaches 0.92, indicating that they have similar functional semantics.
[0062] This technical solution effectively solves the problem of semantic understanding and matching of kernel interfaces across platforms. In practical applications, this method can accurately identify more than 90% of functionally equivalent interfaces, significantly reducing the workload of manual adaptation. For example, when migrating an image processing application from an x86 platform to an ARM platform, 80% of the kernel interface mapping work was automatically completed, shortening the adaptation cycle from a typical 2 weeks to 3 days.
[0063] By establishing the interface mapping relationship at the semantic level, this solution lays the foundation for subsequent cross-platform adaptation. The adaptation matrix not only supports one-to-one interface mapping, but also handles complex mapping scenarios such as one-to-many and many-to-one, improving the flexibility and scalability of the adaptation solution.
[0064] Step S102: construct an abstract kernel layer based on the word vector features and the kernel interface adaptation matrix, classify the kernel interfaces with semantic similarity higher than a preset threshold and design a unified calling specification, build a bidirectional converter to adapt the parameter types and data structures of different platforms, create a conversion rule linked list to store parameter mapping relationships, establish a processor responsibility chain to distribute system calls, interrupt processing and memory management requests, use a command queue to cache pending kernel requests, use a state machine to control the life cycle transition of the kernel interface from initialization to destruction, and design a thread-safe memory pool to manage parameter buffers;
[0065] Optionally, this embodiment constructs a unified abstract kernel layer based on the word vector features and kernel interface adaptation matrix generated in step S101. First, the semantic similarity threshold is set to 0.8, and the kernel interfaces with similarity exceeding the threshold are classified into the same functional group. For example, in the field of process management, interfaces such as Linux's fork(), Windows' CreateProcess(), and Android's Process.start() are classified as process creation categories, and the createProcess abstract interface specification is uniformly designed.
[0066] In view of the differences in parameter types between different platforms, a bidirectional converter architecture is implemented. Taking memory management as an example, the Linux kmalloc parameter flags is mapped to the Windows HeapAlloc parameter dwFlags, and a flag conversion table is established to handle platform-specific flags such as HEAP_ZERO_MEMORY and GFP_KERNEL. For complex data structures such as process control blocks, serialization and deserialization methods are implemented to ensure the correctness of cross-platform data transmission.
[0067] The conversion rules are stored in a linked list structure, and each node contains the source platform type, the target platform type, and the conversion function pointer. The conversion rules support cascading, and complex type adaptation can be achieved through multiple conversions. For example, when converting the exception context of the ARM64 platform to the context structure of the x86 platform, multiple conversion steps such as register mapping and stack frame reorganization need to be completed in sequence.
[0068] The processor responsibility chain adopts object-oriented design, encapsulating functions such as system calls, interrupt processing, and memory management into independent processor objects. Each processor implements a unified processing interface and is connected through a linked list to form a processing pipeline. After a request enters the responsibility chain, each processor tries to process it one by one until a matching processor is found or the end of the chain is reached.
[0069] The command queue is implemented as a ring buffer to store pending kernel requests. The queue size is configurable and supports 1024 concurrent requests by default. The queue state is maintained using read and write pointers to achieve lock-free concurrent operations. When the queue is full, new requests will trigger the back pressure mechanism to notify the upper layer to reduce the request rate.
[0070] The state machine design adopts the Moore model, which defines the initialization, ready, running, blocking, and destruction states. State transitions are triggered by events, such as initialization completion, request arrival, processing timeout, etc. Each state has corresponding entry and exit actions to ensure the correct initialization and cleanup of resources.
[0071] The memory pool adopts a hierarchical management strategy, pre-allocating multiple fixed-size memory block pools ranging from 32 bytes to 8KB. The parameter buffer is allocated from a memory pool of appropriate size to avoid memory fragmentation. A reference counting mechanism is implemented, and the memory block is automatically recycled when the reference count drops to zero. Read-write locks are used to protect concurrent access to the memory pool to ensure thread safety.
[0072] This solution effectively solves the problems of interface semantic differences and parameter type incompatibility in cross-platform kernel adaptation. In actual applications, it can support automatic conversion of more than 95% of kernel calls, and the system performance loss is controlled within 5%. For example, a Linux application running on an embedded device can be directly run on the Windows IoT platform through this adaptation layer, which significantly improves the portability of the software.
[0073] Step S103: Dynamically load the kernel adaptation module at runtime, identify the chip platform type through the CPU feature code, query the kernel symbol mapping table to obtain the interface information of the target platform, select the corresponding conversion strategy according to the kernel interface adaptation matrix, establish a system call interception queue, use Hook technology to inject the kernel call process, design a watchdog mechanism to monitor kernel operation timeout, and return the converted call result to the application.
[0074] Optionally, this embodiment implements the function of dynamically loading the kernel adapter module when the system is running. First, the shared library file of the adapter module is loaded through the dynamic link mechanism, and the dependency graph of the module is parsed to ensure the correct loading order. For example, before loading the network protocol adapter module, the basic data structure conversion module needs to be loaded first. The system allocates independent memory space for each loaded module, maps the code segment and data segment to the virtual address space, and executes the module's initialization function.
[0075] The processor feature code is read through the CPUID instruction to obtain information including manufacturer, serial number, model, stepping, etc. For the ARM architecture, the processor features are obtained by reading the MIDR_EL1 register. Based on the obtained feature code, the preset platform type database is queried to identify the type of hardware platform currently running. For example, the Intel Core i7 processor can be identified through the feature code 0x000906EA.
[0076] According to the identified platform type, the kernel symbol mapping table is queried to obtain the interface definition of the target platform. For example, when an application running on the x86 platform needs to call the memory management interface of the ARM platform, the system searches the mapping table to obtain information such as function symbols, parameter types, and calling conventions related to the memory management of the ARM platform.
[0077] Based on the kernel interface adaptation matrix, the system selects the optimal conversion strategy for each cross-platform call. The selection of the conversion strategy takes into account factors such as the semantic similarity of the interface, the complexity of parameter conversion, and the runtime overhead. For example, for the file operation interface, the system may choose different strategies such as direct mapping, parameter reorganization, or function simulation.
[0078] The system call interception adopts a queue management mechanism to record the system call number that needs to be converted across platforms. The inline Hook technology is used to modify the function pointer in the system call table and redirect the control flow to the processing function of the adaptation layer. The Hook process saves the original call site to ensure that the execution environment can be correctly restored.
[0079] The watchdog mechanism is used to monitor the execution time of kernel operations, and the default timeout threshold is set to 1 second. When an operation timeout is detected, the watchdog triggers the recovery procedure, cleans up the intermediate state and returns an error code. For asynchronous operations, the system uses an event notification mechanism to track the operation completion status.
[0080] The return process of the call result requires type conversion between platforms. For example, the error code of the ARM platform is mapped to the corresponding error definition of the x86 platform to ensure that the application can handle the exception correctly. For asynchronous calls, the system notifies the call completion through a callback function or semaphore.
[0081] This technical solution solves the problem of dynamic adaptation of cross-platform kernel calls and supports runtime platform detection and interface conversion. In practical applications, the system has shown good performance and stability. For example, in a cross-platform porting project for a communication device, the solution supports processing more than 100,000 system call conversions per second, with a success rate of 99.9% and an average conversion delay of less than 5 microseconds.
[0082] This dynamic adaptation solution has better flexibility and maintainability than static compilation, supports updating the adaptation strategy without restarting the system, and ensures the reliability and security of cross-platform calls. Through the watchdog mechanism and abnormal recovery strategy, the risk of system downtime caused by conversion failure is effectively prevented.
[0083] From the above description, it can be seen that the cross-platform kernel adaptation method provided in the embodiment of the present application can establish a flexible parameter conversion mechanism by accurately understanding the kernel interface semantics, and ensure the stable operation of the system through an efficient scheduling strategy. By introducing deep learning and natural language processing technology, the accuracy of interface matching is improved and better cross-platform compatibility is achieved. At the same time, runtime monitoring and exception handling are strengthened to improve the reliability and security of the system.
[0084] In one embodiment of the cross-platform kernel adaptation method of the present application, see Figure 2 , and can also include the following:
[0085] Step S201: extracting the system call number and the corresponding function pointer table by parsing the system kernel file, reading the interrupt descriptor table to obtain the entry address of the interrupt service program, using the symbol table parsing tool to analyze the kernel binary file to extract the function symbol information, parsing the kernel module export table to obtain the list of available interfaces, and storing the extracted interface information in the hash table to establish a fast index;
[0086] Step S202: Use the abstract syntax tree to analyze the data type and transfer direction of the interface parameters, parse the data structure and memory allocation method of the function return value, perform character-level word segmentation on the interface name and parameter identifier, use the Skip-gram model to train the word embedding vector, use the sliding window to extract context features, and calculate the semantic correlation between interfaces based on cosine similarity to generate a feature vector matrix.
[0087] Optionally, this embodiment first extracts the core system call information through the system kernel file parsing tool. In the Linux system, the correspondence between the system call number and the processing function in the sys_call_table is obtained by analyzing the System.map file and the kernel image file vmlinux. For example, the call number of sys_read is 0, and the corresponding function pointer points to a specific read operation processing function. For Windows systems, the content of SSDT (SystemService Descriptor Table) is extracted by analyzing ntoskrnl.exe.
[0088] The parsing process of the Interrupt Descriptor Table (IDT) requires reading the IDTR register to obtain the base address of the IDT, and then traversing the descriptor table entries to extract the service program entry address corresponding to each interrupt vector. For the x86 architecture, each IDT table entry contains a segment selector and an offset; for the ARM architecture, it is necessary to parse the Exception Vector Table (EVT) to obtain the interrupt handler address.
[0089] Use symbol table analysis tools such as objdump and nm to analyze kernel binary files and dynamic link libraries, and extract function symbol information including function name, start address, size, etc. For kernel modules, obtain the export symbol table by parsing the .symtab section of the module, and identify the function interface marked with EXPORT_SYMBOL. All extracted interface information is stored in a hash table implemented using open addressing, supporting search operations with O(1) time complexity.
[0090] Then, we use compiler frameworks such as LLVM to build an abstract syntax tree (AST) and analyze the parameter characteristics of the interface function. For each parameter, we determine its basic data type (such as int, char*, etc.), memory layout of complex data structures, transfer direction (input, output, or bidirectional), and other information. For example, when analyzing the read system call, we identify the buffer parameter as an output pointer and the count parameter as an input integer.
[0091] Function return value analysis includes type determination and memory management strategy identification. For functions that return pointer types, it is necessary to determine the memory allocation method (stack allocation, heap allocation, or static allocation) and lifecycle management responsibilities. For example, the memory returned by kmalloc needs to be released by the caller, while the task_struct pointer returned by get_current is maintained by the system.
[0092] Interface names and parameter identifiers are processed using character-level word segmentation technology, such as "do_fork" is decomposed into "do" and "fork". The Skip-gram model is used to train word vectors, and the model configuration includes: window size 5, negative sampling number 8, and vector dimension 128. The training data includes all interface names, parameter names, and related annotation documents.
[0093] A sliding window of size 3 is used to extract contextual features from the interface description text. For each interface, the weighted average of all its word vectors is calculated as the feature vector of the interface. The weight is calculated based on the term frequency-inverse document frequency (TF-IDF) to highlight the contribution of important words. Finally, an n×n feature vector matrix is constructed by calculating the cosine similarity between feature vectors, where n is the total number of interfaces.
[0094] This solution lays the foundation for subsequent cross-platform adaptation through systematic interface analysis and semantic modeling. Practice shows that this method can accurately extract more than 95% of kernel interface information, and the accuracy of the word vector model in interface semantic similarity evaluation reaches 88%. For example, in a cross-platform porting project of an embedded system, this solution helped the development team complete the mapping analysis of more than 1,000 system calls in 2 days, significantly improving the adaptation efficiency.
[0095] In one embodiment of the cross-platform kernel adaptation method of the present application, see Figure 3 , and can also include the following:
[0096] Step S301: construct a neural network input layer and projection layer based on the Skip-gram model, extract the center word and context word pairs from the interface description text using a sliding window of size n, input the one-hot encoding of the center word into the neural network for forward propagation calculation, use negative sampling to optimize the loss function to reduce the computational complexity, update the network weight parameters through stochastic gradient descent, and iterate the optimization until convergence to obtain the word vector representation;
[0097] Step S302: Normalize the word vectors obtained through training, calculate the cosine distance between word vectors of different interfaces to obtain a similarity matrix, set a similarity threshold to cluster interfaces, construct a sparse matrix to store the mapping relationship between interfaces, use a matrix compression algorithm to optimize storage space, and establish an interface index table to accelerate the query process.
[0098] Optionally, this embodiment first constructs a two-layer neural network structure based on the Skip-gram model. The input layer receives the one-hot encoding of the central word in the interface description text, with a dimension of the vocabulary size V; the projection layer uses a fully connected layer with a dimension of N, and the typical configuration is N=128. The Xavier method is used to initialize the network parameters, and the elements of the weight matrix W are randomly sampled from the uniform distribution U(-1 / √N, 1 / √N).
[0099] The interface description text is sampled using a sliding window of size 5. For example, for the description text "processcreate thread exit", when the central word is "create", the context words include "process" and "thread". A large number of (central word, context word) training sample pairs can be obtained through the sliding window.
[0100] During the forward propagation process, the one-hot vector of the central word is multiplied by the weight matrix W to obtain the hidden layer representation, and then multiplied by the output weight matrix W' and passed through the softmax function to obtain the predicted probability distribution. In order to improve the training efficiency, the negative sampling technology is used to optimize the objective function. For each positive sample, 5 negative samples are randomly sampled, and the sigmoid function is used instead of softmax to convert the multi-classification problem into a binary classification problem.
[0101] The mini-batch stochastic gradient descent algorithm is used to optimize the network parameters, and the batch size is set to 256. The initial value of the learning rate is set to 0.025 and decays linearly with training. The gradient is calculated on each batch and the weight matrix is updated by back propagation. The training process continues until the loss function converges or the preset maximum number of iterations (such as 1 million) is reached.
[0102] After training, the obtained word vectors are L2 normalized to ensure that the modulus of all vectors is 1. The cosine similarity matrix S is obtained by calculating the dot product between the normalized word vectors. The matrix element Sij represents the semantic similarity between interface i and interface j. The similarity threshold θ=0.8 is set. When Sij>θ, the two interfaces are considered to have similar functional semantics.
[0103] Interface clustering is performed based on the similarity matrix, and interfaces with similar semantics are grouped together using a hierarchical clustering algorithm. For example, process creation related interfaces such as "create_process", "fork" and "spawn" are grouped into the same category. The clustering results are used to guide the subsequent interface mapping design.
[0104] Considering the low similarity between most interfaces, the compressed sparse row (CSR) format is used to store the interface mapping relationship. The CSR format only stores non-zero elements and their position information, which can save more than 80% of the storage space for similarity matrices with sparsity exceeding 90%.
[0105] To speed up interface query, a two-level index structure is constructed: the first level is a hash index based on the interface function category, and the second level is an ordered array index within the category. When querying, the function category is first located, and then a binary search is performed within the category, reducing the query complexity from O(n) to O(log n).
[0106] This solution solves the key issues of kernel interface semantic representation and fast matching. In practical applications, the training convergence speed of the word vector model is fast, and the training of millions of samples can be completed within 2 hours in a single machine environment. The model's accuracy in interface semantic similarity evaluation reaches 90%, and the query performance can support processing 100,000 interface mapping requests per second. For example, in a certain operating system compatibility layer project, the solution successfully established a semantic mapping between Windows API and Linux system calls, supporting more than 80% of Windows applications to run directly in the Linux environment.
[0107] In one embodiment of the cross-platform kernel adaptation method of the present application, see Figure 4 , and can also include the following:
[0108] Step S401: Calculate the semantic similarity of the interface through word vector features, classify similar interfaces based on a preset threshold of 0.8, extract common interface features to define abstract base classes, design virtual function tables to implement polymorphic calls, build adapter classes to encapsulate platform differences, use factory methods to create specific platform implementation classes, and use bridge mode to separate abstract interfaces from platform implementations;
[0109] Step S402: Create a parameter type mapping table based on the interface adaptation matrix, implement serialization and deserialization method conversion data structure, construct an ordered linked list to store parameter conversion rules, use template method to define the conversion processing flow, create a processor object chain to handle different types of requests, use command mode to encapsulate the processor calling process, and complete request distribution through iterators to traverse the processor chain.
[0110] Optionally, this embodiment first calculates the semantic similarity between interfaces based on the word vector features obtained through training. By calculating the cosine distance of the word vectors, an interface group whose semantic similarity exceeds a threshold of 0.8 is identified. For example, in the field of process management, interfaces such as Windows' CreateProcess, Linux's fork, and Android's Process.start are identified as the same semantic group, and they all implement the core function of process creation.
[0111] Extract common features for each group of semantically similar interfaces and define abstract base classes. Taking process management as an example, the abstract base class ProcessManager declares virtual function interfaces such as createProcess and terminateProcess. The virtual function table mechanism is used to implement polymorphic calls at runtime, ensuring that specific implementation classes on different platforms can correctly respond to interface calls.
[0112] Design adapter classes to encapsulate platform-specific implementation details. For example, LinuxProcessAdapter encapsulates Linux system calls such as fork and exec, and WindowsProcessAdapter encapsulates Windows APIs such as CreateProcess and TerminateProcess. The adapter class is responsible for handling platform differences such as parameter conversion and error code mapping.
[0113] The factory method pattern is used to create the implementation class of a specific platform. ProcessManagerFactory creates the corresponding adapter instance according to the running platform type. The factory class maintains the mapping relationship between the platform type and the implementation class, and supports dynamic registration of new platform implementations.
[0114] Use the bridge pattern to separate the abstract interface layer from the platform implementation layer. The abstract layer defines a unified interface specification, and the implementation layer contains platform-specific code. This separation allows the two layers to change independently, improving the scalability of the system.
[0115] Create a parameter type mapping table based on the interface adaptation matrix. The mapping table uses a hash structure to store and supports fast search for conversion rules from source type to target type. For example, map Windows HANDLE type to Linux file descriptor, and map Windows DWORD to uint32_t.
[0116] Implement serialization and deserialization methods for complex data structure conversion. For example, when converting Windows PROCESS_INFORMATION structure to Linux task_struct, it is necessary to serialize process ID, thread ID and other information. Use serialization frameworks such as Protocol Buffers to ensure the reliability of data conversion.
[0117] Construct an ordered linked list to store parameter conversion rules. Each node contains the source type, target type, and conversion function. Conversion rules support cascading, and complex type conversions can be completed by combining multiple basic conversions. For example, character encoding conversion may require an intermediate conversion from UTF-16 to UTF-8.
[0118] The template method pattern is used to define the standard process of parameter conversion, including steps such as parameter validation, type checking, data conversion, and error handling. The specific converter class implements the conversion logic of a specific type by overriding the abstract steps in the template method.
[0119] Create a processor responsibility chain to handle different types of requests. The responsibility chain includes system call processors, interrupt processors, memory management processors, etc. Each processor focuses on processing a specific type of request. Use the command mode to encapsulate the calling process of the processor, and encapsulate the request parameters and processing logic into command objects.
[0120] Use the iterator pattern to traverse the processor chain to achieve dynamic distribution of requests. The iterator maintains the traversal state of the processor chain to ensure that the request is passed to the appropriate processor. If the current processor cannot handle the request, the request is forwarded to the next processor in the chain.
[0121] This solution realizes a flexible and scalable interface adaptation framework through the rational use of object-oriented design and design patterns. In actual applications, the framework can support more than 90% of cross-platform interface calls, and the average conversion delay is less than 10 microseconds. For example, in an operating system adaptation project for an IoT device, this solution successfully achieved seamless migration from Linux applications to RTOS, significantly reducing development costs.
[0122] In one embodiment of the cross-platform kernel adaptation method of the present application, see Figure 5 , and can also include the following:
[0123] Step S501: Create a circular queue structure to store pending request commands, allocate a request object pool to avoid frequent memory allocation, use a spin lock to protect concurrent access to the queue, implement a producer-consumer model to process asynchronous requests, set a queue capacity threshold to trigger flow control, build a priority queue to support request scheduling, and use reference counting to manage the request object life cycle;
[0124] Step S502: Construct a state transition diagram to define the interface state set, implement a state migration matrix to record valid transition paths, use a read-write lock to protect state access, create a memory pool to divide memory blocks of fixed size, use a buddy algorithm to manage memory allocation and recycling, implement memory alignment to ensure access efficiency, and use atomic operations to ensure the thread safety of memory operations.
[0125] Optionally, this embodiment first constructs a circular queue of fixed capacity as a request command buffer. The queue is implemented using an array, and the head and tail pointers use atomic variables to ensure thread safety. The typical configuration is 4096 slots. To avoid the overhead of dynamic memory allocation, a request object pool is implemented to pre-allocate a set of request objects of fixed size. The object pool uses a linked list to organize free objects and supports allocation and release operations with O(1) time complexity.
[0126] Use spin locks to protect concurrent access to queues, avoiding thread scheduling overhead. In high-concurrency scenarios, spin locks outperform mutex locks. Implement the producer-consumer model, where multiple producer threads submit requests concurrently and the consumer thread pool is responsible for processing the requests. The number of consumer threads is usually set to twice the number of CPU cores to balance concurrency and context switching overhead.
[0127] The flow control mechanism is triggered when the queue utilization exceeds 80%. The acceptance rate of new requests is inversely proportional to the remaining capacity of the queue to prevent system overload. The priority queue is implemented using a multi-level feedback queue, including high, medium, and low priorities. System call requests usually have the highest priority to ensure timely response to critical operations.
[0128] The life cycle of the request object is managed by reference counting. When the reference count drops to zero, the object is automatically returned to the object pool. The increase and decrease of the reference count are implemented using atomic operations, avoiding data competition problems. Practice has shown that this method is more suitable for low-level system programming than garbage collection.
[0129] The state transition graph is represented by an adjacency matrix, which defines all possible states of the interface (such as initialization, operation, suspension, error, etc.) and valid state transition paths. The state transition matrix is implemented as a bitmap, where each bit indicates whether a transition is allowed, supporting fast state verification.
[0130] Use read-write locks to protect state access, allowing multiple threads to read the state at the same time, but state modification requires an exclusive lock. This design can provide better concurrency performance in scenarios where there are more reads than writes.
[0131] The memory pool management uses the buddy algorithm to divide the memory space into blocks of sizes that are powers of 2. For example, a 16KB memory pool can support allocation requests of different sizes, such as 16B, 32B, and 64B. The buddy algorithm can effectively reduce memory fragmentation and is suitable for managing the allocation of a large number of small objects.
[0132] Memory alignment requires that the starting addresses of all allocated memory blocks are multiples of a power of 2. For example, 8-byte alignment is usually used on 64-bit systems. Correct memory alignment can improve memory access efficiency and reduce CPU cache miss rates.
[0133] Atomic operations are used to ensure thread safety of memory operations. For example, the allocation and merging of memory blocks use CAS (Compare-And-Swap) operations to avoid the overhead of using heavyweight locks. In the maintenance of the free block list, lock-free algorithms are also used to achieve concurrent access.
[0134] The solution has performed well in actual applications. In the system software of a high-performance network device, the memory management solution supports processing millions of memory allocation requests per second, with an average allocation delay of less than 100 nanoseconds and memory utilization above 95%. The throughput of the request queue reaches 500,000 times per second, and it can maintain stable operation even under peak load. For example, when processing network packet forwarding, the solution successfully handles burst traffic and ensures the service quality of key businesses.
[0135] In one embodiment of the cross-platform kernel adaptation method of the present application, see Figure 6 , and can also include the following:
[0136] Step S601: read the symbol table of the dynamic link library to obtain the export function list, parse the module dependency to build a loading sequence diagram, allocate virtual memory space to load the module code segment and data segment, repair the function address in the import table, execute the module initialization function to complete the runtime loading, and establish a module handle table to manage the loaded modules;
[0137] Step S602: Read the CPUID instruction of the CPU to obtain the processor feature code, parse the processor model and architecture information, query the platform type database based on the processor feature code, retrieve the interface definition of the target platform from the kernel symbol mapping table, build a platform feature descriptor to store hardware configuration information, and create a platform capability table to record the supported functional features.
[0138] Optionally, this embodiment first extracts its symbol table information by parsing the ELF or PE format file of the dynamic link library. The symbol table contains information such as the name, address offset and attributes of the exported function. For example, in a Linux system, the exported symbol is obtained by reading the .dynsym segment; in a Windows system, the export directory table is parsed to obtain function information.
[0139] A directed acyclic graph is constructed based on the dependencies between modules to determine the loading order of the modules. The dependency analysis process checks direct and indirect dependencies to avoid loading failures caused by circular dependencies. For example, if module A depends on B, and B depends on C, the loading order is C->B->A.
[0140] Allocate virtual memory space for each module, usually using page-aligned addresses. The code segment is mapped as read-only and executable, and the data segment is mapped as read-write. Use memory protection mechanisms to ensure that the code segment is not modified, enhancing system security.
[0141] Repair the module's import table and replace the placeholders of the function calls with the actual target addresses. This process requires resolving symbol references and finding matching export functions in loaded modules. Use the relocation table to record the address locations that need to be repaired, and support the loading of address-independent code.
[0142] The module's initialization function is executed to complete runtime initialization. This includes operations such as constructing global objects, initializing static variables, and registering exception handlers. The initialization process is executed in the order specified by the C++ standard to ensure the correct construction of objects.
[0143] Maintain the module handle table to record the information of loaded modules, including base address, size, reference count, etc. Use hash table for fast search, support locating modules by module name or address range. When the module is no longer used, it is automatically unloaded through the reference counting mechanism.
[0144] Get the processor's feature information by executing the CPUID instruction. CPUID returns identification information such as the processor family, model, stepping number, and supported instruction set extensions and feature flags. For example, you can detect support for SIMD instruction sets such as AVX and SSE4.2.
[0145] Parse the processor information string to extract information such as manufacturer, architecture type, number of cores, etc. Use a lookup table to map the processor code to a specific model, supporting processor identification from different manufacturers such as Intel, AMD, and ARM.
[0146] Based on the processor feature code, the platform type database is queried to determine the specific type of the operating platform. The database contains the mapping relationship between the processor feature code and the platform type, supporting version matching and compatibility judgment.
[0147] Retrieve the target platform's interface definition from the kernel symbol mapping table. The mapping table stores information such as system call numbers, function prototypes, parameter conventions, etc. This information is used to build a cross-platform call translation layer.
[0148] Build platform feature descriptors to record hardware configuration information. Descriptors include hardware features such as memory size, cache hierarchy, bus architecture, etc. This information is used to optimize code generation and runtime decisions.
[0149] Create a platform capability table to record the functional features supported by the platform. The capability table uses a bitmap to represent the support status of each feature, including virtualization support, security features, performance counters, etc. The capability table can be queried at runtime for functional testing.
[0150] This solution has achieved remarkable results in practical applications. In a cross-platform compatibility layer project for a certain operating system, the x86 platform program was successfully implemented on the ARM architecture. The average loading time of the dynamic loader is less than 10 milliseconds, and the memory overhead is controlled within 1.2 times the original size. The accuracy of platform feature detection reaches 99.9%, which effectively supports the adaptive optimization of instruction sets and system features. For example, when processing graphics rendering tasks, the optimal implementation path can be automatically selected according to the SIMD instruction set supported by the processor.
[0151] In one embodiment of the cross-platform kernel adaptation method of the present application, see Figure 7 , and can also include the following:
[0152] Step S701: Calculate the best conversion path based on the kernel interface adaptation matrix, build a conversion strategy cache acceleration strategy selection, create a system call interception table to record the call number to be intercepted, use inline Hook to modify the system call entry address, implement the conversion processing logic of the call parameter, construct a call context to save the scene information, and use a reentrant lock to protect the concurrent call process;
[0153] Step S702: Create a watchdog timer to set the timeout threshold, build a timeout processing function to handle abnormal situations, use shared memory communication to transfer call results, implement the result conversion function to adapt the return value type, use reference counting to manage the result object life cycle, set a callback function to handle asynchronous call completion events, and synchronize the call completion status through semaphores.
[0154] Optionally, this embodiment first constructs an interface conversion graph based on the kernel interface adaptation matrix. The graph uses an adjacency matrix to represent the conversion relationship between different platform interfaces, and the edge weight represents the cost of the conversion (such as performance overhead, data loss, etc.). The Dijkstra algorithm is used to calculate the optimal conversion path and select the solution with the minimum total conversion cost.
[0155] Implement conversion strategy cache and use LRU (least recently used) algorithm to manage cache items. The cache key is a combination of source interface and target interface, and the value is the pre-calculated conversion path. The cache capacity is usually set to 1024 items, and the hit rate can reach more than 85% in actual applications.
[0156] Create a system call interception table to record the system call numbers that need to be converted across platforms. Use a bitmap to represent the set of call numbers to be intercepted to support fast search. For example, among the system calls related to file operations, core calls such as open, read, and write need to be intercepted and converted.
[0157] Use inline Hook technology to modify the system call entry address. Insert jump instructions at the original entry to redirect to the conversion processing routine. Save the original instructions for subsequent recovery to ensure system stability. The Hook process uses atomic operations to avoid concurrent access issues.
[0158] Implement call parameter conversion logic to handle parameter format differences between different platforms. For example, convert Windows file handles to Linux file descriptors to handle platform differences such as byte order and address length. Parameter conversion supports multiple data types such as basic types, structures, and pointers.
[0159] Construct a call context structure to save the call site information, including register status, stack pointer, return address, etc. The context information is used for exception recovery and call tracking. Use a reentrant lock to protect concurrent calls to prevent the conversion process from being interrupted and causing inconsistent states.
[0160] Create a watchdog timer to monitor the execution time of the call. The timer timeout threshold is usually set to 100 milliseconds and can be adjusted according to the actual scenario. When the timeout is triggered, the registered processing function is executed. Possible processing strategies include forced termination, retry, or service degradation.
[0161] Build a timeout handler chain to handle exceptions. The handlers are sorted by priority and try error recovery, resource cleanup, logging, and other operations in turn. The exception handling mechanism ensures that the system can gracefully degrade when problems occur.
[0162] Use shared memory to achieve cross-process communication and pass call results. The shared memory area is divided into fixed sizes (such as 4KB) and organized using a ring buffer. The read and write positions of the buffer are managed through atomic operations to achieve lock-free concurrent access.
[0163] Implement the result conversion function to handle the type adaptation of the return value. For example, map the errno error code to the Windows GetLastError value to ensure that the error information is correctly transmitted. Use reference counting to manage the result object, and automatically clean up the memory when all users release the reference.
[0164] Set the callback function for asynchronous call completion. The callback function is triggered when the call is completed and is responsible for subsequent processing such as result notification and status update. The callback mechanism supports chain calls, allowing multiple processors to process results serially.
[0165] The call completion status is synchronized through semaphores. The semaphore is acquired when the call is initiated and released when the call is completed. Timeout waiting is supported to avoid deadlock. Semaphore operations are implemented using atomic instructions to ensure thread safety.
[0166] The solution has performed well in practical applications. In a container runtime project of a cloud computing platform, the interoperability of containers of different operating systems was successfully achieved. The average latency of system call conversion is less than 5 microseconds, and the memory overhead is controlled within 1.5 times of the original system call. The exception handling mechanism effectively copes with more than 95% of abnormal situations, and the system stability is significantly improved. For example, when processing network IO-intensive workloads, the solution successfully handles timeout exceptions caused by network delays, ensuring business continuity.
[0167] In order to achieve better cross-platform compatibility, the present application provides an embodiment of a cross-platform kernel adaptation device for implementing all or part of the cross-platform kernel adaptation method, see Figure 8 , the cross-platform kernel adapter device specifically includes the following contents:
[0168] The matrix construction module 10 is used to scan the kernel interface information of the chip platform, extract the system call table and the interrupt vector table, analyze the parameter transfer mode and the return value type of the kernel interface to construct a kernel symbol mapping table, use the Word2Vec model to perform word segmentation encoding on the interface name and parameter identifier in the kernel symbol mapping table to generate word vector features, use the Skip-gram algorithm to predict the context relationship to train the interface word vector, obtain the semantic features of the interface description based on the sliding window, and calculate the semantic association between interfaces through cosine similarity to generate a kernel interface adaptation matrix;
[0169] The data adaptation module 20 is used to construct an abstract kernel layer based on the word vector features and the kernel interface adaptation matrix, classify the kernel interfaces with semantic similarity higher than a preset threshold and design a unified call specification, build a bidirectional converter to adapt the parameter types and data structures of different platforms, create a conversion rule linked list to store parameter mapping relationships, establish a processor responsibility chain to distribute system calls, interrupt processing and memory management requests, use a command queue to cache pending kernel requests, use a state machine to control the life cycle transition of the kernel interface from initialization to destruction, and design a thread-safe memory pool to manage parameter buffers;
[0170] The mapping call module 30 is used to dynamically load the kernel adaptation module at runtime, identify the chip platform type through the CPU feature code, query the kernel symbol mapping table to obtain the interface information of the target platform, select the corresponding conversion strategy according to the kernel interface adaptation matrix, establish a system call interception queue, use Hook technology to inject the kernel call process, design a watchdog mechanism to monitor the kernel operation timeout, and return the converted call result to the application.
[0171] From the above description, it can be seen that the cross-platform kernel adaptation device provided in the embodiment of the present application can establish a flexible parameter conversion mechanism by accurately understanding the kernel interface semantics, and ensure the stable operation of the system through efficient scheduling strategies. By introducing deep learning and natural language processing technology, the accuracy of interface matching is improved to achieve better cross-platform compatibility. At the same time, it also strengthens runtime monitoring and exception handling to improve the reliability and security of the system.
[0172] From the hardware level, in order to achieve better cross-platform compatibility, the present application provides an embodiment of an electronic device for implementing all or part of the content in the cross-platform kernel adaptation method, and the electronic device specifically includes the following content:
[0173] Processor, memory, communication interface and bus; wherein the processor, memory and communication interface communicate with each other through the bus; the communication interface is used to realize information transmission between the cross-platform kernel adaptation device and the core business system, user terminal and related database and other related devices; the logic controller can be a desktop computer, a tablet computer and a mobile terminal, etc., but the present embodiment is not limited thereto. In the present embodiment, the logic controller can be implemented with reference to the embodiment of the cross-platform kernel adaptation method and the embodiment of the cross-platform kernel adaptation device in the embodiment, and the contents thereof are incorporated herein, and the repeated parts are not repeated.
[0174] It is understandable that the user terminal may include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a personal digital assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Among them, the smart wearable device may include smart glasses, a smart watch, a smart bracelet, etc.
[0175] In practical applications, part of the cross-platform kernel adaptation method can be executed on the electronic device side as described above, or all operations can be completed in the client device. The selection can be made based on the processing capability of the client device and the limitations of the user's usage scenario. This application does not limit this. If all operations are completed in the client device, the client device may also include a processor.
[0176] The client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side, and other implementation scenarios may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, or a server cluster consisting of multiple servers, or a server structure of a distributed device.
[0177] Fig. 9 FIG. 9 is a schematic block diagram of the system structure of the electronic device 9600 according to an embodiment of the present application. Fig. 9 As shown, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. It is worth noting that Fig. 9 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0178] In one embodiment, the cross-platform kernel adaptation method function may be integrated into the central processing unit 9100. The central processing unit 9100 may be configured to perform the following control:
[0179] Step S101: Scan the kernel interface information of the chip platform, extract the system call table and the interrupt vector table, analyze the parameter passing mode and return value type of the kernel interface to construct a kernel symbol mapping table, use the Word2Vec model to perform word segmentation encoding on the interface name and parameter identifier in the kernel symbol mapping table to generate word vector features, use the Skip-gram algorithm to predict the context relationship to train the interface word vector, obtain the semantic features of the interface description based on the sliding window, and calculate the semantic correlation between interfaces through cosine similarity to generate a kernel interface adaptation matrix;
[0180] Step S102: construct an abstract kernel layer based on the word vector features and the kernel interface adaptation matrix, classify the kernel interfaces with semantic similarity higher than a preset threshold and design a unified calling specification, build a bidirectional converter to adapt the parameter types and data structures of different platforms, create a conversion rule linked list to store parameter mapping relationships, establish a processor responsibility chain to distribute system calls, interrupt processing and memory management requests, use a command queue to cache pending kernel requests, use a state machine to control the life cycle transition of the kernel interface from initialization to destruction, and design a thread-safe memory pool to manage parameter buffers;
[0181] Step S103: Dynamically load the kernel adaptation module at runtime, identify the chip platform type through the CPU feature code, query the kernel symbol mapping table to obtain the interface information of the target platform, select the corresponding conversion strategy according to the kernel interface adaptation matrix, establish a system call interception queue, use Hook technology to inject the kernel call process, design a watchdog mechanism to monitor kernel operation timeout, and return the converted call result to the application.
[0182] From the above description, it can be seen that the electronic device provided in the embodiment of the present application establishes a flexible parameter conversion mechanism by accurately understanding the kernel interface semantics, and ensures the stable operation of the system through an efficient scheduling strategy. By introducing deep learning and natural language processing technology, the accuracy of interface matching is improved and better cross-platform compatibility is achieved. At the same time, runtime monitoring and exception handling are strengthened to improve the reliability and security of the system.
[0183] In another embodiment, the cross-platform kernel adaptation device can be configured separately from the central processing unit 9100. For example, the cross-platform kernel adaptation device can be configured as a chip connected to the central processing unit 9100, and the cross-platform kernel adaptation method function is implemented under the control of the central processing unit.
[0184] like Fig. 9 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Fig. 9 In addition, the electronic device 9600 may also include Fig. 9 For components not shown, reference may be made to the prior art.
[0185] like Fig. 9 As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device. The central processing unit 9100 receives input and controls the operation of various components of the electronic device 9600.
[0186] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.
[0187] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.
[0188] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.
[0189] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0190] The communication module 9110 is a transmitter / receiver that sends and receives signals via the antenna 9111. The communication module 9110 (transmitter / receiver) is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0191] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module. The communication module 9110 (transmitter / receiver) is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.
[0192] The embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps of the cross-platform kernel adaptation method in the above-mentioned embodiment in which the execution subject is a server or a client. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, all the steps of the cross-platform kernel adaptation method in the above-mentioned embodiment in which the execution subject is a server or a client are implemented. For example, when the processor executes the computer program, the following steps are implemented:
[0193] Step S101: Scan the kernel interface information of the chip platform, extract the system call table and the interrupt vector table, analyze the parameter passing mode and return value type of the kernel interface to construct a kernel symbol mapping table, use the Word2Vec model to perform word segmentation encoding on the interface name and parameter identifier in the kernel symbol mapping table to generate word vector features, use the Skip-gram algorithm to predict the context relationship to train the interface word vector, obtain the semantic features of the interface description based on the sliding window, and calculate the semantic correlation between interfaces through cosine similarity to generate a kernel interface adaptation matrix;
[0194] Step S102: construct an abstract kernel layer based on the word vector features and the kernel interface adaptation matrix, classify the kernel interfaces with semantic similarity higher than a preset threshold and design a unified calling specification, build a bidirectional converter to adapt the parameter types and data structures of different platforms, create a conversion rule linked list to store parameter mapping relationships, establish a processor responsibility chain to distribute system calls, interrupt processing and memory management requests, use a command queue to cache pending kernel requests, use a state machine to control the life cycle transition of the kernel interface from initialization to destruction, and design a thread-safe memory pool to manage parameter buffers;
[0195] Step S103: Dynamically load the kernel adaptation module at runtime, identify the chip platform type through the CPU feature code, query the kernel symbol mapping table to obtain the interface information of the target platform, select the corresponding conversion strategy according to the kernel interface adaptation matrix, establish a system call interception queue, use Hook technology to inject the kernel call process, design a watchdog mechanism to monitor kernel operation timeout, and return the converted call result to the application.
[0196] From the above description, it can be seen that the computer-readable storage medium provided in the embodiment of the present application establishes a flexible parameter conversion mechanism by accurately understanding the kernel interface semantics, and ensures the stable operation of the system through an efficient scheduling strategy. By introducing deep learning and natural language processing technology, the accuracy of interface matching is improved and better cross-platform compatibility is achieved. At the same time, runtime monitoring and exception handling are strengthened to improve the reliability and security of the system.
[0197] The embodiments of the present application also provide a computer program product capable of implementing all the steps of the cross-platform kernel adaptation method in the above embodiments, where the execution subject is a server or a client. When the computer program / instruction is executed by a processor, the steps of the cross-platform kernel adaptation method are implemented. For example, the computer program / instruction implements the following steps:
[0198] Step S101: Scan the kernel interface information of the chip platform, extract the system call table and the interrupt vector table, analyze the parameter passing mode and return value type of the kernel interface to construct a kernel symbol mapping table, use the Word2Vec model to perform word segmentation encoding on the interface name and parameter identifier in the kernel symbol mapping table to generate word vector features, use the Skip-gram algorithm to predict the context relationship to train the interface word vector, obtain the semantic features of the interface description based on the sliding window, and calculate the semantic correlation between interfaces through cosine similarity to generate a kernel interface adaptation matrix;
[0199] Step S102: construct an abstract kernel layer based on the word vector features and the kernel interface adaptation matrix, classify the kernel interfaces with semantic similarity higher than a preset threshold and design a unified calling specification, build a bidirectional converter to adapt the parameter types and data structures of different platforms, create a conversion rule linked list to store parameter mapping relationships, establish a processor responsibility chain to distribute system calls, interrupt processing and memory management requests, use a command queue to cache pending kernel requests, use a state machine to control the life cycle transition of the kernel interface from initialization to destruction, and design a thread-safe memory pool to manage parameter buffers;
[0200] Step S103: Dynamically load the kernel adaptation module at runtime, identify the chip platform type through the CPU feature code, query the kernel symbol mapping table to obtain the interface information of the target platform, select the corresponding conversion strategy according to the kernel interface adaptation matrix, establish a system call interception queue, use Hook technology to inject the kernel call process, design a watchdog mechanism to monitor kernel operation timeout, and return the converted call result to the application.
[0201] From the above description, it can be seen that the computer program product provided in the embodiment of the present application establishes a flexible parameter conversion mechanism by accurately understanding the semantics of the kernel interface, and ensures the stable operation of the system through an efficient scheduling strategy. By introducing deep learning and natural language processing technology, the accuracy of interface matching is improved and better cross-platform compatibility is achieved. At the same time, runtime monitoring and exception handling are strengthened to improve the reliability and security of the system.
[0202] It should be understood by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0203] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0204] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0205] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0206] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A cross-platform kernel adaptation method, characterized in that: The method comprises: Scan the kernel interface information of the chip platform, extract the system call table and interrupt vector table, analyze the parameter passing mode and return value type of the kernel interface to build a kernel symbol mapping table, use the Word2Vec model to segment and encode the interface name and parameter identifier in the kernel symbol mapping table to generate word vector features, build a neural network input layer and projection layer based on the Skip-gram model, use a sliding window of size n to extract the central word and context word pairs from the interface description text, input the one-hot encoding of the central word into the neural network for forward propagation calculation, use negative sampling to optimize the loss function to reduce the computational complexity, update the network weight parameters through random gradient descent, and iterate and optimize until convergence to obtain a word vector representation; normalize the trained word vectors, calculate the cosine distance between different interface word vectors to obtain a similarity matrix, set a similarity threshold to cluster and group the interfaces, build a sparse matrix to store the mapping relationship between interfaces, use a matrix compression algorithm to optimize the storage space, and establish an interface index table to accelerate the query process; An abstract kernel layer is constructed based on the word vector features and the kernel interface adaptation matrix, the kernel interfaces with semantic similarity higher than a preset threshold are classified and designed into a unified calling specification, a bidirectional converter is constructed to adapt the parameter types and data structures of different platforms, a conversion rule linked list is created to store parameter mapping relationships, a processor responsibility chain is established to distribute system calls, interrupt processing and memory management requests, a command queue is used to cache kernel requests to be processed, a state machine is used to control the life cycle transition of the kernel interface from initialization to destruction, and a thread-safe memory pool is designed to manage parameter buffers; Dynamically load the kernel adaptation module at runtime, identify the chip platform type through the CPU feature code, query the kernel symbol mapping table to obtain the interface information of the target platform, select the corresponding conversion strategy according to the kernel interface adaptation matrix, establish a system call interception queue, use Hook technology to inject the kernel call process, design a watchdog mechanism to monitor kernel operation timeout, and return the converted call result to the application.
2. The cross-platform kernel adaptation method according to claim 1, characterized in that: The method includes scanning the kernel interface information of the chip platform, extracting the system call table and the interrupt vector table, analyzing the parameter transfer mode and the return value type of the kernel interface to construct a kernel symbol mapping table, and using the Word2Vec model to perform word segmentation encoding on the interface name and parameter identifier in the kernel symbol mapping table to generate word vector features, including: By parsing the system kernel file, the system call number and the corresponding function pointer table are extracted, the interrupt descriptor table is read to obtain the entry address of the interrupt service program, the kernel binary file is analyzed using a symbol table parsing tool to extract function symbol information, the kernel module export table is parsed to obtain a list of available interfaces, and the extracted interface information is stored in a hash table to establish a fast index; Abstract syntax trees are used to analyze the data types and transfer directions of interface parameters, the data structures and memory allocation methods of function return values are parsed, interface names and parameter identifiers are segmented at the character level, the Skip-gram model is used to train word embedding vectors, sliding windows are used to extract context features, and the semantic correlation between interfaces is calculated based on cosine similarity to generate a feature vector matrix.
3. The cross-platform kernel adaptation method according to claim 1, characterized in that: The abstract kernel layer is constructed based on the word vector features and the kernel interface adaptation matrix, the kernel interfaces with semantic similarity higher than a preset threshold are classified and designed into a unified calling specification, a bidirectional converter is constructed to adapt the parameter types and data structures of different platforms, a conversion rule linked list is created to store parameter mapping relationships, and a processor responsibility chain is established to distribute system calls, interrupt processing and memory management requests, including: The semantic similarity of interfaces is calculated through word vector features, and similar interfaces are classified based on a preset threshold of 0.
8. Common interface features are extracted to define abstract base classes, virtual function tables are designed to implement polymorphic calls, adapter classes are constructed to encapsulate platform differences, factory methods are used to create specific platform implementation classes, and bridge patterns are used to separate abstract interfaces from platform implementations. Based on the interface adaptation matrix, a parameter type mapping table is created to implement the serialization and deserialization methods to convert data structures. An ordered linked list is constructed to store parameter conversion rules. The template method is used to define the conversion processing flow. A processor object chain is created to handle different types of requests. The command mode is used to encapsulate the processor calling process. The request distribution is completed by traversing the processor chain through the iterator.
4. The cross-platform kernel adaptation method according to claim 1, characterized in that: The method uses a command queue to cache pending kernel requests, adopts a state machine to control the life cycle transition of the kernel interface from initialization to destruction, and designs a thread-safe memory pool management parameter buffer, including: Create a circular queue structure to store pending request commands, allocate a request object pool to avoid frequent memory allocation, use spin locks to protect concurrent access to the queue, implement the producer-consumer model to process asynchronous requests, set queue capacity thresholds to trigger flow control, build a priority queue to support request scheduling, and use reference counting to manage the request object life cycle; Construct a state transition graph to define the interface state set, implement the state migration matrix to record the effective transition path, use read-write locks to protect state access, create a memory pool to divide the memory blocks of fixed size, use the partner algorithm to manage memory allocation and recycling, implement memory alignment to ensure access efficiency, and use atomic operations to ensure the thread safety of memory operations.
5. The cross-platform kernel adaptation method according to claim 1, characterized in that: The method of dynamically loading the kernel adapter module at runtime, identifying the chip platform type through the CPU feature code, and querying the kernel symbol mapping table to obtain the interface information of the target platform includes: Read the symbol table of the dynamic link library to obtain the list of exported functions, parse the module dependencies to build a loading sequence diagram, allocate virtual memory space to load the module code segment and data segment, repair the function address in the import table, execute the module initialization function to complete the runtime loading, and establish a module handle table to manage the loaded modules; Read the CPUID instruction of the CPU to obtain the processor feature code, parse the processor model and architecture information, query the platform type database based on the processor feature code, retrieve the interface definition of the target platform from the kernel symbol mapping table, build the platform feature descriptor to store the hardware configuration information, and create a platform capability table to record the supported functional features.
6. The cross-platform kernel adaptation method according to claim 1, characterized in that: The method of selecting a corresponding conversion strategy according to the kernel interface adaptation matrix, establishing a system call interception queue, injecting the kernel call process using Hook technology, designing a watchdog mechanism to monitor kernel operation timeout, and returning the converted call result to the application program includes: Calculate the best conversion path based on the kernel interface adaptation matrix, build a conversion strategy cache to accelerate strategy selection, create a system call interception table to record the call number to be intercepted, use inline Hook to modify the system call entry address, implement the conversion processing logic of the call parameters, construct a call context to save the scene information, and use reentrant locks to protect the concurrent call process; Create a watchdog timer to set the timeout threshold, build a timeout handling function to handle exceptions, use shared memory communication to pass the call results, implement the result conversion function to adapt the return value type, use reference counting to manage the result object life cycle, set the callback function to handle asynchronous call completion events, and synchronize the call completion status through semaphores.
7. A cross-platform kernel adapter, characterized in that: The device comprises: A matrix construction module is used to scan the kernel interface information of the chip platform, extract the system call table and the interrupt vector table, analyze the parameter passing mode and return value type of the kernel interface to construct a kernel symbol mapping table, use the Word2Vec model to perform word segmentation encoding on the interface name and parameter identifier in the kernel symbol mapping table to generate word vector features, build a neural network input layer and projection layer based on the Skip-gram model, use a sliding window of size n to extract the central word and context word pairs from the interface description text, input the one-hot encoding of the central word into the neural network for forward propagation calculation, use negative sampling to optimize the loss function to reduce the computational complexity, update the network weight parameters through random gradient descent, and iterate and optimize until convergence to obtain a word vector representation; normalize the trained word vectors, calculate the cosine distance between different interface word vectors to obtain a similarity matrix, set a similarity threshold to cluster and group the interfaces, build a sparse matrix to store the mapping relationship between interfaces, use a matrix compression algorithm to optimize the storage space, and establish an interface index table to accelerate the query process; A data adaptation module is used to construct an abstract kernel layer based on the word vector features and the kernel interface adaptation matrix, classify the kernel interfaces with semantic similarity higher than a preset threshold and design a unified calling specification, build a bidirectional converter to adapt the parameter types and data structures of different platforms, create a conversion rule linked list to store parameter mapping relationships, establish a processor responsibility chain to distribute system calls, interrupt processing and memory management requests, use a command queue to cache pending kernel requests, use a state machine to control the life cycle transition of the kernel interface from initialization to destruction, and design a thread-safe memory pool to manage parameter buffers; A mapping call module is used to dynamically load the kernel adaptation module at runtime, identify the chip platform type through the CPU feature code, query the kernel symbol mapping table to obtain the interface information of the target platform, select the corresponding conversion strategy according to the kernel interface adaptation matrix, establish a system call interception queue, use Hook technology to inject the kernel call process, design a watchdog mechanism to monitor kernel operation timeout, and return the converted call result to the application.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the cross-platform kernel adaptation method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the cross-platform kernel adaptation method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Method and system for improving software compatibility for linux system
CN111736851A
Prompt learning-based application programming interface migration method
CN116541071A