mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
Remove VBE from kernel headers.
This commit is contained in:
parent
2bd8e2ab0b
commit
f74e3d6b20
13 changed files with 73 additions and 130 deletions
Binary file not shown.
|
@ -26,7 +26,6 @@ class CKConfig
|
|||
CDoc *add_dev;
|
||||
U8 *debug_distro_file, *debug_distro_start;
|
||||
U8 *home_dir;
|
||||
U16 screen_width, screen_height;
|
||||
Bool opts[CONFIG_OPTIONS_NUM];
|
||||
U8 mem_init_val, heap_init_val, var_init_val, boot_drive_let, mount_ide_auto_hd_let, mount_ide_auto_cd_let;
|
||||
};
|
||||
|
@ -168,29 +167,10 @@ U0 KConfigOptions(CKConfig *c)
|
|||
|
||||
CKConfig *KConfigNew()
|
||||
{
|
||||
I64 resolution_num;
|
||||
CKConfig *c = CAlloc(sizeof(CKConfig));
|
||||
|
||||
c->add_dev = KConfigAddDev(c);
|
||||
c->home_dir = StrNew("::/Home");
|
||||
|
||||
VideoRep(FALSE);
|
||||
resolution_num = I64Get("Enter list number of desired resolution, "
|
||||
"or desired width. ($$PURPLE$$<ENTER>$$FG$$ for auto maximum): ",, 1);
|
||||
if (resolution_num <= VBE_MODES_NUM)
|
||||
{
|
||||
// c->screen_width = sys_vbe_modes[resolution_num - 1].width;
|
||||
// c->screen_height = sys_vbe_modes[resolution_num - 1].height;
|
||||
c->screen_width = 1024;
|
||||
c->screen_height = 768;
|
||||
}
|
||||
else
|
||||
{
|
||||
// c->screen_width = resolution_num;
|
||||
c->screen_width = 1024;
|
||||
c->screen_height = I64Get("Enter Height: ",, 0);
|
||||
c->screen_height = 768;
|
||||
}
|
||||
|
||||
c->disk_cache_size_exp = StrGet("\nDisk Cache Size in Bytes, gets rounded-up funny, "
|
||||
"($$PURPLE$$<ENTER>$$FG$$ will use default.):",
|
||||
|
|
|
@ -64,17 +64,6 @@ U0 SysGlobalsInit()
|
|||
QueueInit(&dev.pci_head);
|
||||
dev.mem64_ptr = mem_mapped_space;
|
||||
|
||||
if (sys_boot_src.u8[0] != BOOT_SRC_RAM)
|
||||
{//framebuffer pointer is already linear
|
||||
// Seg2Linear(&sys_vbe_info.video_modes);
|
||||
// Seg2Linear(&sys_vbe_info.oem);
|
||||
// Seg2Linear(&sys_vbe_info.vendor);
|
||||
// Seg2Linear(&sys_vbe_info.product_name);
|
||||
// Seg2Linear(&sys_vbe_info.product_revision);
|
||||
/// Seg2Linear(SYS_FONT_PTR);
|
||||
// sys_vbe_info.software_revision = Bcd2Binary(sys_vbe_info.software_revision);
|
||||
}
|
||||
|
||||
debug.fun_seg_cache = CAlloc(FUN_SEG_CACHE_SIZE * sizeof(CFunSegCache));
|
||||
debug.int_fault_code = IntFaultHandlersNew;
|
||||
}
|
||||
|
|
|
@ -50,11 +50,6 @@ GDT_TR: DU8 MP_PROCESSORS_NUM * 16 DUP(0);
|
|||
GDT_TR_RING3: DU8 MP_PROCESSORS_NUM * 16 DUP(0);
|
||||
#assert $$ - SYS_GDT == sizeof(CGDT)
|
||||
|
||||
SYS_VBE_INFO:: DU8 sizeof(CVBEInfo) DUP(0);
|
||||
SYS_VBE_MODES:: DU8 sizeof(CVBEModeShort) * VBE_MODES_NUM DUP(0);
|
||||
SYS_VBE_FINAL_MODE:: DU8 sizeof(CVBEMode) DUP(0);
|
||||
SYS_VBE_FINAL_MODE_NUM::DU16 0; //mode number of final mode set
|
||||
|
||||
SYS_FRAMEBUFFER_ADDR:: DU64 0;
|
||||
SYS_FRAMEBUFFER_WIDTH:: DU64 0;
|
||||
SYS_FRAMEBUFFER_HEIGHT:: DU64 0;
|
||||
|
@ -68,12 +63,11 @@ SYS_SMBIOS_ENTRY:: DU64 0;
|
|||
TEMP_VBE_MODE: DU8 sizeof(CVBEMode) DUP(0);
|
||||
MAX_VBE_MODE: DU8 sizeof(CVBEModeShort) DUP(0);
|
||||
MAX_SCREEN_HEIGHT: DU16 0;
|
||||
VBE_INFO: DU8 sizeof(CVBEInfo) DUP(0);
|
||||
VBE_MODES: DU8 sizeof(CVBEModeShort) * VBE_MODES_NUM DUP(0);
|
||||
VBE_FINAL_MODE: DU8 sizeof(CVBEMode) DUP(0);
|
||||
VBE_FINAL_MODE_NUM: DU16 0; //mode number of final mode set
|
||||
|
||||
#exe
|
||||
{
|
||||
StreamPrint("SCREEN_WIDTH: DU16 %d;"
|
||||
"SCREEN_HEIGHT: DU16 %d;", kernel_config->screen_width, kernel_config->screen_height);
|
||||
};
|
||||
|
||||
//************************************
|
||||
CORE0_16BIT_INIT::
|
||||
|
@ -91,10 +85,10 @@ GET_IP: POP BX
|
|||
MOV AX, CS
|
||||
ADD AX, BX
|
||||
PUSH AX
|
||||
PUSH U16 @@04
|
||||
PUSH U16 @@05
|
||||
RETF
|
||||
|
||||
@@04: STI
|
||||
@@05: STI
|
||||
MOV AX, CS
|
||||
MOV DS, AX
|
||||
MOV U32 [SYS_RUN_LEVEL], RLF_16BIT
|
||||
|
@ -107,15 +101,15 @@ GET_IP: POP BX
|
|||
|
||||
//Get VBE implementation information
|
||||
MOV AX, 0x4F00
|
||||
MOV DI, SYS_VBE_INFO
|
||||
MOV DI, VBE_INFO
|
||||
MOV CVBEInfo.signature[DI], 'VBE2' //set to 'VBE2' to use VBE 2.0 functionality
|
||||
INT 0x10
|
||||
POP ES
|
||||
CMP AX, 0x004F
|
||||
JE @@05
|
||||
JE @@10
|
||||
JMP $$ //Freeze system if VBE not supported
|
||||
|
||||
@@05:
|
||||
@@10:
|
||||
|
||||
/*Loop variables:
|
||||
DI <- Temporary storage for mode information
|
||||
|
@ -125,16 +119,16 @@ GET_IP: POP BX
|
|||
SI <- Offset for video modes list
|
||||
*/
|
||||
//Obtain segment:offset of list of potential video modes
|
||||
MOV AX, SYS_VBE_INFO
|
||||
MOV AX, VBE_INFO
|
||||
MOV SI, CVBEInfo.video_modes[AX]
|
||||
MOV GS, CVBEInfo.video_modes+2[AX]
|
||||
MOV DI, TEMP_VBE_MODE
|
||||
MOV DX, SYS_VBE_MODES
|
||||
MOV DX, VBE_MODES
|
||||
|
||||
@@06: //Loop through all the mode numbers
|
||||
@@15: //Loop through all the mode numbers
|
||||
MOV AX, GS:[SI]
|
||||
CMP AX, 0xFFFF //FFFF signifies the end of the list
|
||||
JE @@08
|
||||
JE @@25
|
||||
|
||||
ADD SI, 2 //Increment pointer to read next U16 mode
|
||||
|
||||
|
@ -148,81 +142,75 @@ GET_IP: POP BX
|
|||
INT 0x10
|
||||
POP ES
|
||||
CMP AX, 0x004F
|
||||
JNE @@06 //if call to get mode information failed
|
||||
JNE @@15 //if call to get mode information failed
|
||||
|
||||
//filter everything but 32-bit color
|
||||
MOV AL, CVBEMode.bpp[DI]
|
||||
CMP AL, 32
|
||||
JNE @@06
|
||||
JNE @@15
|
||||
|
||||
//Check if the mode is actually supported
|
||||
MOV AX, CVBEMode.attributes[DI]
|
||||
AND AX, 0x91 //bit 0 = supported, bit 4 = graphics mode, bit 7 = linear framebuffer
|
||||
CMP AX, 0x91
|
||||
JNE @@06
|
||||
JNE @@15
|
||||
|
||||
//Only want memory model of packed pixel or direct color (RGB)
|
||||
// MOV AX, CVBEMode.memory_model[DI]
|
||||
// CMP AX, 4
|
||||
// JNE @@06
|
||||
// CMP AX, 6
|
||||
// JNE @@06
|
||||
//Copy information about this mode into an element of the mode array
|
||||
MOV BX, CVBEMode.height[DI]
|
||||
MOV CVBEModeShort.height[DX], BX
|
||||
CMP BX, [MAX_SCREEN_HEIGHT]
|
||||
JL @@07
|
||||
MOV AX, CVBEMode.memory_model[DI]
|
||||
CMP AX, 4
|
||||
JE @@18
|
||||
CMP AX, 6
|
||||
JNE @@15
|
||||
|
||||
MOV [MAX_SCREEN_HEIGHT], BX
|
||||
MOV [MAX_VBE_MODE], CX
|
||||
//Copy information about this mode into AX and BX
|
||||
@@18: MOV BX, CVBEMode.height[DI]
|
||||
@@20: MOV AX, CVBEMode.width[DI]
|
||||
|
||||
@@07: MOV AX, CVBEMode.width[DI]
|
||||
MOV CVBEModeShort.width[DX], AX
|
||||
// MOV EAX, CVBEMode.max_pixel_clock[DI]
|
||||
// MOV CVBEModeShort.max_pixel_clock[DX], EAX
|
||||
|
||||
MOV CVBEModeShort.mode_num[DX], CX
|
||||
ADD DX, sizeof(CVBEModeShort) //next array element
|
||||
|
||||
//Check if width and height match
|
||||
CMP AX, [SCREEN_WIDTH]
|
||||
JNE @@06
|
||||
CMP BX, [SCREEN_HEIGHT]
|
||||
JNE @@06
|
||||
//Check if width and height match standard 1024x768
|
||||
CMP AX, 1024
|
||||
JNE @@15
|
||||
CMP BX, 768
|
||||
JNE @@15
|
||||
|
||||
//If we've made it here we have our mode
|
||||
MOV [SYS_VBE_FINAL_MODE_NUM], CX
|
||||
JMP @@06
|
||||
MOV [VBE_FINAL_MODE_NUM], CX
|
||||
JMP @@15
|
||||
|
||||
@@08: //End of loop
|
||||
//If there isn't a valid mode set by user through kernel config, set the mode with the biggest height.
|
||||
MOV AX, [SYS_VBE_FINAL_MODE_NUM]
|
||||
CMP AX, 0
|
||||
JNE @@09
|
||||
MOV CX, [MAX_VBE_MODE]
|
||||
MOV [SYS_VBE_FINAL_MODE_NUM], CX
|
||||
@@25: //End of loop
|
||||
|
||||
@@09: PUSH ES
|
||||
@@30: PUSH ES
|
||||
PUSH DS
|
||||
POP ES
|
||||
//Get mode infomration for the mode we want
|
||||
MOV DI, SYS_VBE_FINAL_MODE
|
||||
MOV CX, [SYS_VBE_FINAL_MODE_NUM]
|
||||
MOV DI, VBE_FINAL_MODE
|
||||
MOV CX, [VBE_FINAL_MODE_NUM]
|
||||
MOV AX, 0x4F01
|
||||
INT 0x10
|
||||
POP ES
|
||||
CMP AX, 0x004F
|
||||
JNE @@10 //if called failed
|
||||
JNE @@35 //if called failed
|
||||
|
||||
//Set the mode; call takes mode number in BX
|
||||
MOV AX, 0x4F02
|
||||
MOV BX, CX
|
||||
INT 0x10
|
||||
CMP AX, 0x004F
|
||||
JNE @@10
|
||||
JNE @@35
|
||||
|
||||
//Give mode information to kernel
|
||||
MOV EAX, CVBEMode.framebuffer[DI]
|
||||
MOV U32 [SYS_FRAMEBUFFER_ADDR], EAX
|
||||
MOV AX, CVBEMode.height[DI]
|
||||
MOV U16 [SYS_FRAMEBUFFER_HEIGHT], AX
|
||||
MOV AX, CVBEMode.width[DI]
|
||||
MOV U16 [SYS_FRAMEBUFFER_WIDTH], AX
|
||||
MOV AX, CVBEMode.pitch[DI]
|
||||
MOV U16 [SYS_FRAMEBUFFER_PITCH], AX
|
||||
MOV AX, CVBEMode.bpp[DI]
|
||||
MOV U16 [SYS_FRAMEBUFFER_BPP], AX
|
||||
|
||||
BTS U32 [SYS_RUN_LEVEL], RLf_VESA
|
||||
@@10:
|
||||
@@35:
|
||||
|
||||
//Get E801 memory map.
|
||||
//Output: AX = Memory between 1MiB and 16MiB in KiB (max 0x3C00 == 15 MiB)
|
||||
|
@ -231,10 +219,10 @@ GET_IP: POP BX
|
|||
XOR DX, DX
|
||||
MOV AX, 0xE801
|
||||
INT 0x15
|
||||
JCXZ @@12 //if CX and DX are zero, use AX and BX instead.
|
||||
JCXZ @@40 //if CX and DX are zero, use AX and BX instead.
|
||||
MOV AX, CX
|
||||
MOV BX, DX
|
||||
@@12: MOV U16 [MEM_E801], AX
|
||||
@@40: MOV U16 [MEM_E801], AX
|
||||
MOV U16 [MEM_E801+2], BX
|
||||
|
||||
//Get E820 memory map.
|
||||
|
@ -243,21 +231,21 @@ GET_IP: POP BX
|
|||
PUSH DS
|
||||
POP ES
|
||||
MOV DI, MEM_E820
|
||||
@@15: PUSH CX
|
||||
@@45: PUSH CX
|
||||
MOV EAX, 0xE820
|
||||
MOV ECX, sizeof(CMemE820)
|
||||
MOV EDX, 'PAMS'
|
||||
INT 0x15
|
||||
JC @@20
|
||||
JC @@50
|
||||
CMP EAX, 'PAMS'
|
||||
JNE @@20
|
||||
JNE @@50
|
||||
TEST EBX, EBX
|
||||
JZ @@20
|
||||
JZ @@50
|
||||
ADD DI, sizeof(CMemE820)
|
||||
POP CX
|
||||
LOOP @@15
|
||||
LOOP @@45
|
||||
SUB SP, 2
|
||||
@@20: ADD SP, 2 //if called failed we want to nullify the PUSHed CX value.
|
||||
@@50: ADD SP, 2 //if called failed we want to nullify the PUSHed CX value.
|
||||
|
||||
//Find how much space to map, start with E801 limit.
|
||||
XOR EAX, EAX
|
||||
|
@ -268,24 +256,24 @@ GET_IP: POP BX
|
|||
|
||||
//Find max of E820 to set mapped space.
|
||||
MOV SI, MEM_E820
|
||||
@@25: MOV CL, CMemE820.type[SI]
|
||||
@@55: MOV CL, CMemE820.type[SI]
|
||||
TEST CL, CL
|
||||
JZ @@35
|
||||
JZ @@65
|
||||
MOV EBX, CMemE820.base [SI]
|
||||
MOV ECX, CMemE820.base+4[SI]
|
||||
ADD EBX, CMemE820.len [SI]
|
||||
ADC ECX, CMemE820.len+4 [SI]
|
||||
SUB EBX, EAX
|
||||
SBB ECX, EDX
|
||||
JC @@30
|
||||
JC @@60
|
||||
MOV EAX, CMemE820.base [SI]
|
||||
MOV EDX, CMemE820.base+4[SI]
|
||||
ADD EAX, CMemE820.len [SI]
|
||||
ADC EDX, CMemE820.len+4 [SI]
|
||||
@@30: ADD SI, sizeof(CMemE820)
|
||||
JMP @@25
|
||||
@@60: ADD SI, sizeof(CMemE820)
|
||||
JMP @@55
|
||||
|
||||
@@35: MOV [MEM_PHYSICAL_SPACE], EAX
|
||||
@@65: MOV [MEM_PHYSICAL_SPACE], EAX
|
||||
MOV [MEM_PHYSICAL_SPACE+4], EDX
|
||||
|
||||
//Get PCI Bus Info
|
||||
|
@ -294,11 +282,11 @@ GET_IP: POP BX
|
|||
MOV AX, 0xB101
|
||||
INT 0x1A
|
||||
CMP DX, 'PC'
|
||||
JNE @@40
|
||||
JNE @@70
|
||||
MOV CH, 0
|
||||
INC CX
|
||||
MOV U16 [SYS_PCI_BUSES], CX
|
||||
@@40:
|
||||
@@70:
|
||||
CLI
|
||||
//Enable A20
|
||||
IN AL, 0x92
|
||||
|
|
|
@ -564,10 +564,6 @@ class CKernel
|
|||
U16 sys_pci_buses;
|
||||
;$$ = ($$ + 15) & -16;
|
||||
CGDT sys_gdt;
|
||||
CVBEInfo sys_vbe_info;
|
||||
CVBEModeShort sys_vbe_modes[VBE_MODES_NUM];
|
||||
CVBEMode sys_vbe_mode;
|
||||
U16 sys_vbe_mode_num;
|
||||
U64 sys_framebuffer_addr;
|
||||
U64 sys_framebuffer_width;
|
||||
U64 sys_framebuffer_height;
|
||||
|
|
|
@ -243,12 +243,6 @@ public _intern IC_FS CTask *Fs(); //FS segment register points to the current $L
|
|||
#help_file "::/Doc/TimeCycles"
|
||||
public _intern IC_RDTSC I64 TSCGet(); //Get time stamp counter.
|
||||
|
||||
#help_index "Graphics/VBE"
|
||||
public _extern SYS_VBE_INFO CVBEInfo sys_vbe_info;
|
||||
public _extern SYS_VBE_FINAL_MODE CVBEMode sys_vbe_mode;
|
||||
_extern SYS_VBE_FINAL_MODE_NUM U16 sys_vbe_mode_num;
|
||||
_extern SYS_VBE_MODES CVBEModeShort sys_vbe_modes[VBE_MODES_NUM];
|
||||
|
||||
#help_index "Graphics/Framebuffer"
|
||||
public _extern SYS_FRAMEBUFFER_ADDR U8 *sys_framebuffer_addr;
|
||||
public _extern SYS_FRAMEBUFFER_WIDTH U64 sys_framebuffer_width;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Custom DoDistro file that generates an AUTO.ISO.
|
||||
// Used by host OS to create a full Distro ISO synced with GitHub repo.
|
||||
|
||||
#define STD_DISTRO_DVD_CONFIG "TB\nScale2Mem(2048,0x40000)\nT\n\n1024\n768\n\n\n"
|
||||
#define STD_DISTRO_DVD_CONFIG "TB\nScale2Mem(2048,0x40000)\nT\n\n\n\n"
|
||||
|
||||
U0 MakeMyISO(U8 *_out_iso_filename)
|
||||
{//Does everything with current drive.
|
||||
|
|
|
@ -19,7 +19,7 @@ U0 Auto()
|
|||
}
|
||||
|
||||
BootMHDIns('C');
|
||||
in_str = MStrPrint("Sleep(700);In(\"CC\\n%d\\n\\n1024\\n768\\n\\n\\n\");", ata_port);
|
||||
in_str = MStrPrint("Sleep(700);In(\"CC\\n%d\\n\\n\\n\\n\");", ata_port);
|
||||
OnceDrive('C', in_str);
|
||||
Free(in_str);
|
||||
// in_str = MStrPrint("BootHDIns;OnceFlush;Once(\"#include \\\"/Misc/Auto/AutoFullDistro1\\\";;Auto;\");Reboot;");
|
||||
|
|
|
@ -20,7 +20,7 @@ U0 Auto()
|
|||
|
||||
// BootMHDIns('C');
|
||||
// in_str = MStrPrint("Sleep(700);In(\"CC\\n%d\\n\\n1024\\n768\\n\\n\\n\");", ata_port);
|
||||
in_str = MStrPrint("CC\n%d\n\n1024\n768\n\n\n", ata_port);
|
||||
in_str = MStrPrint("CC\n%d\n\n\n\n", ata_port);
|
||||
Sleep(700);
|
||||
In(in_str);
|
||||
// OnceDrive('C', in_str);
|
||||
|
|
|
@ -20,7 +20,7 @@ U0 Auto()
|
|||
|
||||
// BootMHDIns('C');
|
||||
// in_str = MStrPrint("Sleep(700);In(\"CC\\n%d\\n\\n1024\\n768\\n\\n\\n\");", ata_port);
|
||||
in_str = MStrPrint("CC\n%d\n\n1024\n768\n\n\n", ata_port);
|
||||
in_str = MStrPrint("CC\n%d\n\n\n\n", ata_port);
|
||||
Sleep(700);
|
||||
In(in_str);
|
||||
// OnceDrive('C', in_str);
|
||||
|
|
|
@ -41,7 +41,7 @@ U0 VMInstallDrive(CTask *task, U8 drv_let, I64 ata_port, I64 atapi_port)
|
|||
XTalkWait(task, "C\n%d\n", ata_port);
|
||||
if (atapi_port > -1)
|
||||
XTalkWait(task, "T%d\n", atapi_port);
|
||||
XTalkWait(task, "\n1024\n768\n\n\n"); //Exit Drives, set Screen Resolution, skip Disk Cache and Options
|
||||
XTalkWait(task, "\n\n\n"); //Exit Drives, set Screen Resolution, skip Disk Cache and Options
|
||||
}
|
||||
|
||||
U0 VMInstallWiz()
|
||||
|
|
|
@ -2,7 +2,7 @@ public I64 VideoRep(Bool full=TRUE)
|
|||
{//List available VBE modes as indicated by the BIOS. Show current mode;
|
||||
I64 i, mode_count = 0;
|
||||
CVBEModeShort *mode;
|
||||
|
||||
/*
|
||||
if (full)
|
||||
{
|
||||
"\nVBE Version %X.%X\n\n", sys_vbe_info.version.u8[1], sys_vbe_info.version.u8[0];
|
||||
|
@ -61,6 +61,6 @@ public I64 VideoRep(Bool full=TRUE)
|
|||
mode_count++;
|
||||
}
|
||||
}
|
||||
return mode_count;
|
||||
*/ return mode_count;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,10 +126,6 @@ struct CKernel {
|
|||
} __attribute__((packed)) sys_gdt_ptr;
|
||||
uint16_t sys_pci_buses;
|
||||
struct CGDT sys_gdt __attribute__((aligned(16)));
|
||||
struct CVBEInfo sys_vbe_info;
|
||||
struct CVBEModeShort sys_vbe_modes[VBE_MODES_NUM];
|
||||
struct CVBEMode sys_vbe_mode;
|
||||
uint16_t sys_vbe_mode_num;
|
||||
uint64_t sys_framebuffer_addr;
|
||||
uint64_t sys_framebuffer_width;
|
||||
uint64_t sys_framebuffer_height;
|
||||
|
|
Loading…
Reference in a new issue