19762338dSopenharmony_ci/* 29762338dSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 39762338dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 49762338dSopenharmony_ci * you may not use this file except in compliance with the License. 59762338dSopenharmony_ci * You may obtain a copy of the License at 69762338dSopenharmony_ci * 79762338dSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 89762338dSopenharmony_ci * 99762338dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 109762338dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 119762338dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 129762338dSopenharmony_ci * See the License for the specific language governing permissions and 139762338dSopenharmony_ci * limitations under the License. 149762338dSopenharmony_ci */ 159762338dSopenharmony_ci 169762338dSopenharmony_ci#ifndef KERNEL_CONSTANTS_H 179762338dSopenharmony_ci#define KERNEL_CONSTANTS_H 189762338dSopenharmony_ci 199762338dSopenharmony_ci#include <unistd.h> 209762338dSopenharmony_ci 219762338dSopenharmony_ci/** 229762338dSopenharmony_ci * ================ DAC and Caps ================ 239762338dSopenharmony_ci */ 249762338dSopenharmony_ciconst uid_t SHELL_UID = 2; 259762338dSopenharmony_ciconst uid_t SHELL_GID = 2; 269762338dSopenharmony_ci 279762338dSopenharmony_ci 289762338dSopenharmony_ci/** 299762338dSopenharmony_ci * ================ Process Manager ================ 309762338dSopenharmony_ci */ 319762338dSopenharmony_ci#define MAX_PROCESS_GROUPS 255 // max number of groups a process can have 329762338dSopenharmony_ci#define MAX_PROCESS_NUMBER 63 // max allowd process [0,63] 339762338dSopenharmony_ci#define MAX_TASK_NUMBER 128 // max allowd task(process+thread) 349762338dSopenharmony_ci 359762338dSopenharmony_ci#define INIT_PROCESS_ID 1 // pid of init 369762338dSopenharmony_ci#define KERNEL_PROCESS_ID 2 // pid of KProcess 379762338dSopenharmony_ci 389762338dSopenharmony_ci#define HIGHEST_USER_PROCESS_PRIORITY 10 399762338dSopenharmony_ci#define LOWEST_USER_PROCESS_PRIORITY 31 409762338dSopenharmony_ci#define HIGHEST_USER_THREAD_PRIORITY 0 419762338dSopenharmony_ci#define LOWEST_USER_THREAD_PRIORITY 31 429762338dSopenharmony_ci 439762338dSopenharmony_ci#define DEFAULT_SHELL_PROCESS_PRIORITY 15 449762338dSopenharmony_ci#define DEFAULT_INIT_PROCESS_PRIORITY 28 459762338dSopenharmony_ci#define DEFAULT_KERNEL_PROCESS_PRIORITY 0 469762338dSopenharmony_ci#define DEFAULT_THREAD_PRIORITY 25 479762338dSopenharmony_ci#define DEFAULT_RR_SCHED_INTERVAL 5000000 // defalult sched interval of RR, in ms 489762338dSopenharmony_ci 499762338dSopenharmony_ci/** 509762338dSopenharmony_ci * ================ Memory Manager ================ 519762338dSopenharmony_ci */ 529762338dSopenharmony_citypedef unsigned long addr_t; 539762338dSopenharmony_ci 549762338dSopenharmony_ci#define USER_ASPACE_BASE ((addr_t)0x01000000UL) 559762338dSopenharmony_ci#define USER_ASPACE_TOP_MAX ((addr_t)0x3FFFFFFFUL) 569762338dSopenharmony_ci#define USER_ASPACE_SIZE ((addr_t)(USER_ASPACE_TOP_MAX - USER_ASPACE_BASE)) 579762338dSopenharmony_ci#define USER_HEAP_BASE ((addr_t)(USER_ASPACE_TOP_MAX >> 2)) 589762338dSopenharmony_ci#define USER_MAP_BASE ((addr_t)(USER_ASPACE_TOP_MAX >> 1)) 599762338dSopenharmony_ci#define USER_MAP_SIZE ((addr_t)(USER_ASPACE_SIZE >> 3)) 609762338dSopenharmony_ci 619762338dSopenharmony_ci#ifndef PAGE_SIZE 629762338dSopenharmony_ci#define PAGE_SIZE 0x1000U 639762338dSopenharmony_ci#endif 649762338dSopenharmony_ci#define PAGE_MASK (~(PAGE_SIZE - 1)) 659762338dSopenharmony_ci#define PAGE_SHIFT 12 669762338dSopenharmony_ci 679762338dSopenharmony_ci 689762338dSopenharmony_ci/** 699762338dSopenharmony_ci * ================ IPC ================ 709762338dSopenharmony_ci */ 719762338dSopenharmony_ciconst int MAX_SIGNAL_NUMBER = 64; // max number of allowed signal, [1,64] 729762338dSopenharmony_ciconst int MAX_PIPE_BUFFER = 4096; // max size of a pipe buffer 739762338dSopenharmony_ciconst int MAX_PIPE_NUMBER = 32; // max pipe number 749762338dSopenharmony_ci 759762338dSopenharmony_ciconst int MAX_MQ_NUMBER = 256; // max mqueue number 769762338dSopenharmony_ciconst int MAX_MQ_NAME_LEN = 2560; // max mqueue name length 779762338dSopenharmony_ciconst int MAX_MQ_MSG_SIZE = 65530; // max mqueue message size 789762338dSopenharmony_ci 799762338dSopenharmony_ci 809762338dSopenharmony_ci/** 819762338dSopenharmony_ci * ================ FS ================ 829762338dSopenharmony_ci */ 839762338dSopenharmony_ciconst int MAX_PATH_SIZE = 256; // max size of path string 849762338dSopenharmony_ci 859762338dSopenharmony_ci/** 869762338dSopenharmony_ci * ================ SYSTEM ================ 879762338dSopenharmony_ci */ 889762338dSopenharmony_ci#define SYSINFO_SYSNAME "Linux" // sys name from 'uname' 899762338dSopenharmony_ci 909762338dSopenharmony_ci/** 919762338dSopenharmony_ci * ================ XTS ================ 929762338dSopenharmony_ci */ 939762338dSopenharmony_ci#define RES_DIR_KERNEL "/test_root/kernel/" // top dir of test resource of kernel 949762338dSopenharmony_ci#define WRITABLE_TEST_DIR "/storage/" // writable dir for test file 959762338dSopenharmony_ci 969762338dSopenharmony_ci#endif 97