build: add a "user" arch to allow the kernel to run as a program on the host machine
This commit is contained in:
15
arch/user/include/socks/machine/cpu.h
Normal file
15
arch/user/include/socks/machine/cpu.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef SOCKS_USER_CPU_H_
|
||||
#define SOCKS_USER_CPU_H_
|
||||
|
||||
typedef struct ml_cpu_block {
|
||||
int cpu_reserved;
|
||||
} ml_cpu_block;
|
||||
|
||||
extern int ml_init_bootcpu(void);
|
||||
|
||||
extern int ml_cpu_block_init(ml_cpu_block *p);
|
||||
extern int ml_cpu_block_use(ml_cpu_block *p);
|
||||
|
||||
extern void ml_halt_cpu(void);
|
||||
|
||||
#endif
|
||||
14
arch/user/include/socks/machine/hwlock.h
Normal file
14
arch/user/include/socks/machine/hwlock.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef SOCKS_USER_HWLOCK_H_
|
||||
#define SOCKS_USER_HWLOCK_H_
|
||||
|
||||
#define ML_HWLOCK_INIT (0)
|
||||
|
||||
typedef int ml_hwlock_t;
|
||||
|
||||
extern void ml_hwlock_lock(ml_hwlock_t *lck);
|
||||
extern void ml_hwlock_unlock(ml_hwlock_t *lck);
|
||||
|
||||
extern void ml_hwlock_lock_irqsave(ml_hwlock_t *lck, unsigned long *flags);
|
||||
extern void ml_hwlock_unlock_irqrestore(ml_hwlock_t *lck, unsigned long flags);
|
||||
|
||||
#endif
|
||||
8
arch/user/include/socks/machine/init.h
Normal file
8
arch/user/include/socks/machine/init.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef SOCKS_X86_64_INIT_H_
|
||||
#define SOCKS_X86_64_INIT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern int ml_init(uintptr_t arg);
|
||||
|
||||
#endif
|
||||
5
arch/user/include/socks/machine/irq.h
Normal file
5
arch/user/include/socks/machine/irq.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#ifndef SOCKS_X86_64_IRQ_H_
|
||||
#define SOCKS_X86_64_IRQ_H_
|
||||
|
||||
|
||||
#endif
|
||||
9
arch/user/include/socks/machine/pmap.h
Normal file
9
arch/user/include/socks/machine/pmap.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef SOCKS_X86_64_PMAP_H_
|
||||
#define SOCKS_X86_64_PMAP_H_
|
||||
|
||||
#include <arch/paging.h>
|
||||
|
||||
typedef pml4t_ptr_t ml_pmap_t;
|
||||
typedef uint64_t ml_pfn_t;
|
||||
|
||||
#endif
|
||||
26
arch/user/include/socks/machine/vm.h
Normal file
26
arch/user/include/socks/machine/vm.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef SOCKS_USER_VM_H_
|
||||
#define SOCKS_USER_VM_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern uintptr_t __pagemap_base(void);
|
||||
extern uintptr_t __pagemap_limit(void);
|
||||
|
||||
/* kernel higher-half base virtual address. */
|
||||
#define VM_KERNEL_VOFFSET (__pagemap_base())
|
||||
|
||||
/* direct page-mapping region.
|
||||
NOTE that these are the maximum bounds of this region.
|
||||
the actual size depends on the amount of physical
|
||||
memory present. */
|
||||
#define VM_PAGEMAP_BASE (__pagemap_base())
|
||||
#define VM_PAGEMAP_LIMIT (__pagemap_limit())
|
||||
|
||||
#define VM_PAGE_SIZE 0x1000
|
||||
#define VM_PAGE_MASK (VM_PAGE_SIZE-1)
|
||||
#define VM_PAGE_SHIFT 12
|
||||
|
||||
#define VM_PAGE_MIN_ORDER VM_PAGE_4K
|
||||
#define VM_PAGE_MAX_ORDER VM_PAGE_8M
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user