From 5d16441307c1a86d793661b344a3ae5d77325211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 30 Jan 2006 16:32:47 +0000 Subject: [PATCH] Now usually ignores the length of the data segment as well. It now works fine on my P4 system as well :-) But since the BIOS area is not identity mapped, it might work on fewer systems than it does in BeOS R5. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16154 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/arch/x86/apm.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/arch/x86/apm.cpp b/src/system/kernel/arch/x86/apm.cpp index 6bbe03eb50..bd5b27b1b0 100644 --- a/src/system/kernel/arch/x86/apm.cpp +++ b/src/system/kernel/arch/x86/apm.cpp @@ -259,7 +259,10 @@ apm_init(kernel_args *args) // TODO: test if APM segments really are in the BIOS ROM area (especially the // data segment) - // setup APM GDTs + // Setup APM GDTs + + // We ignore their length, and just set their segments to 64 kB which + // shouldn't cause any headaches set_segment_descriptor(&gGDT[APM_CODE32_SEGMENT >> 3], gBiosBase + (info.code32_segment_base << 4) - 0xe0000, 0xffff, @@ -272,13 +275,17 @@ apm_init(kernel_args *args) if ((info.data_segment_base << 4) < 0xe0000) { // use the BIOS data segment as data segment for APM + + if (info.data_segment_length == 0) + info.data_segment_length = B_PAGE_SIZE - info.data_segment_base; + set_segment_descriptor(&gGDT[APM_DATA_SEGMENT >> 3], (addr_t)gDmaAddress + (info.data_segment_base << 4), info.data_segment_length, DT_DATA_WRITEABLE, DPL_KERNEL); } else { // use the BIOS area as data segment set_segment_descriptor(&gGDT[APM_DATA_SEGMENT >> 3], - gBiosBase + (info.data_segment_base << 4) - 0xe0000, info.data_segment_length, + gBiosBase + (info.data_segment_base << 4) - 0xe0000, 0xffff, DT_DATA_WRITEABLE, DPL_KERNEL); }