]> 4ch.mooo.com Git - 16.git/blob - src/lib/doslib/hw/llmem/llmem.h
added a bunch of things~ and midi stuff~
[16.git] / src / lib / doslib / hw / llmem / llmem.h
1
2 #include <stdio.h>
3 #include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
4 #include <stdlib.h>
5 #include <unistd.h>
6 #include <string.h>
7 #include <malloc.h>
8 #include <assert.h>
9 #include <fcntl.h>
10 #include <dos.h>
11
12 #include <hw/cpu/cpu.h>
13 #include <hw/dos/dos.h>
14
15 enum {
16         LLMEMCPY_PF_NONE=0,
17         LLMEMCPY_PF_386_4KB,            /* 386-compatible two-level 4KB pages */
18         LLMEMCPY_PF_PSE_4M,             /* Pentium PSE style one-level 4M pages */
19         LLMEMCPY_PF_PAE_2M,             /* Modern PAE 64-bit pages 2M each */
20         LLMEMCPY_PF_PSE_4M_VCPI,        /* PSE 4M pages, with one 4KB page for VCPI server compatibility */
21         LLMEMCPY_PF_PAE_2M_VCPI         /* PAE 2M pages, with two 4KB pages for VCPI compat, and one extra page */
22 };
23
24 extern unsigned char            llmem_probed;
25 extern unsigned char            llmem_meth_pse;
26 extern unsigned char            llmem_meth_pae;
27 extern unsigned char            llmem_available;
28 extern uint64_t                 llmem_phys_limit;
29 extern uint64_t                 llmem_pse_limit;
30 extern const char*              llmem_reason;
31
32 extern volatile void FAR*       llmemcpy_pagetables;
33 extern volatile void FAR*       llmemcpy_pagetables_raw;
34 extern size_t                   llmemcpy_pagetables_size;
35 extern unsigned char            llmemcpy_pagefmt;
36 #if TARGET_MSDOS == 16
37 extern uint32_t far*            llmemcpy_gdt;
38 extern uint16_t                 llmemcpy_gdtr[4];
39 extern uint16_t                 llmemcpy_idtr[4];
40 extern uint32_t                 llmemcpy_vcpi[0x20];
41 extern uint32_t                 llmemcpy_vcpi_return[2];
42 extern uint8_t                  llmemcpy_vcpi_tss[108];
43 #endif
44
45 /* returns 0xFFFFFFFFFFFFFFFF if unmappable */
46 #if TARGET_MSDOS == 16
47 uint64_t llmem_ptr2ofs(unsigned char far *ptr);
48 #else
49 uint64_t llmem_ptr2ofs(unsigned char *ptr);
50 #endif
51
52 int llmem_init();
53 void llmemcpy_free();
54 int llmemcpy_alloc(size_t len,unsigned char typ);
55 uint32_t llmem_virt_phys_recommended_copy_size();
56 size_t llmemcpy(uint64_t dst,uint64_t src,size_t len);
57