ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
September 2007
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
19 participants
589 discussions
Start a n
N
ew thread
[arty] 28758: Adding misc ppc tools.
by arty@svn.reactos.org
Author: arty Date: Sun Sep 2 13:11:10 2007 New Revision: 28758 URL:
http://svn.reactos.org/svn/reactos?rev=28758&view=rev
Log: Adding misc ppc tools. Added: trunk/reactos/tools/ppc.lost+found/ trunk/reactos/tools/ppc.lost+found/bootcd (with props) trunk/reactos/tools/ppc.lost+found/hfsmap.lst trunk/reactos/tools/ppc.lost+found/link-freeldr (with props) trunk/reactos/tools/ppc.lost+found/ofboot.b trunk/reactos/tools/ppc.lost+found/pmake (with props) Added: trunk/reactos/tools/ppc.lost+found/bootcd URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/ppc.lost%2Bfound/boo…
============================================================================== --- trunk/reactos/tools/ppc.lost+found/bootcd (added) +++ trunk/reactos/tools/ppc.lost+found/bootcd Sun Sep 2 13:11:10 2007 @@ -1,0 +1,21 @@ +#!/bin/sh +# +# Create an iso that can be booted under qemu. +# For now, this is just to make ofwldr available to qemu. A disk image will +# still be required yet. +# + +CD=output-ppc/ppcboot +I=$CD/install +TOOLS=tools/ppc.lost+found + +$TOOLS/link-freeldr + +mkdir -p $I +cp freeldr.elf $I/yaboot +cp `dirname $0`/ofboot.b $I + +mkisofs -chrp-boot -U -part -hfs -T -r -l -J -A "ReactOS" -sysid PPC \ + -V "ReactOS" -volset 1 -volset-size 1 -volset-seqno 1 \ + -hfs-volid "ReactOS" -hfs-bless $I -map $TOOLS/hfsmap.lst \ + -no-desktop -allow-multidot -o ppcboot.iso $CD Propchange: trunk/reactos/tools/ppc.lost+found/bootcd ------------------------------------------------------------------------------ svn:executable = * Added: trunk/reactos/tools/ppc.lost+found/hfsmap.lst URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/ppc.lost%2Bfound/hfs…
============================================================================== --- trunk/reactos/tools/ppc.lost+found/hfsmap.lst (added) +++ trunk/reactos/tools/ppc.lost+found/hfsmap.lst Sun Sep 2 13:11:10 2007 @@ -1,0 +1,12 @@ +# ext. xlate creator type comment +.hqx Ascii 'BnHx' 'TEXT' "BinHex file" +.sit Raw 'SIT!' 'SITD' "StuffIT Expander" +.mov Raw 'TVOD' 'MooV' "QuickTime Movie" +.deb Raw 'Debn' 'bina' "Debian package" +.bin Raw 'ddsk' 'DDim' "Floppy or ramdisk image" +.img Raw 'ddsk' 'DDim' "Floppy or ramdisk image" +.b Raw 'UNIX' 'tbxi' "bootstrap" +yaboot Raw 'UNIX' 'boot' "bootstrap" +vmlinux Raw 'UNIX' 'boot' "bootstrap" +.conf Raw 'UNIX' 'conf' "bootstrap" +* Ascii '????' '????' "Text file" Added: trunk/reactos/tools/ppc.lost+found/link-freeldr URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/ppc.lost%2Bfound/lin…
============================================================================== --- trunk/reactos/tools/ppc.lost+found/link-freeldr (added) +++ trunk/reactos/tools/ppc.lost+found/link-freeldr Sun Sep 2 13:11:10 2007 @@ -1,0 +1,74 @@ +#!/bin/sh -v + +export PATH=$PATH:/usr/local/pkg/reactos-powerpc/bin +make -C lib/mmu +powerpc-unknown-linux-gnu-ld \ + -g -nostartfiles -nostdlib -N -Ttext=0xe00000 \ + -o freeldr.elf \ + obj-ppc/boot/freeldr/freeldr/arch/powerpc/boot.o \ + obj-ppc/boot/freeldr/freeldr/arch/powerpc/ofw_util.o \ + obj-ppc/boot/freeldr/freeldr/arch/powerpc/ofw_calls.o \ + obj-ppc/boot/freeldr/freeldr/cache/blocklist.o \ + obj-ppc/boot/freeldr/freeldr/cache/cache.o \ + obj-ppc/boot/freeldr/freeldr/comm/rs232.o \ + obj-ppc/boot/freeldr/freeldr/disk/disk.o \ + obj-ppc/boot/freeldr/freeldr/disk/partition.o \ + obj-ppc/boot/freeldr/freeldr/fs/ext2.o \ + obj-ppc/boot/freeldr/freeldr/fs/fat.o \ + obj-ppc/boot/freeldr/freeldr/fs/fs.o \ + obj-ppc/boot/freeldr/freeldr/fs/fsrec.o \ + obj-ppc/boot/freeldr/freeldr/fs/iso.o \ + obj-ppc/boot/freeldr/freeldr/fs/ntfs.o \ + obj-ppc/boot/freeldr/freeldr/inifile/ini_init.o \ + obj-ppc/boot/freeldr/freeldr/inifile/inifile.o \ + obj-ppc/boot/freeldr/freeldr/inifile/parse.o \ + obj-ppc/boot/freeldr/freeldr/math/libgcc2.o \ + obj-ppc/boot/freeldr/freeldr/mm/meminit.o \ + obj-ppc/boot/freeldr/freeldr/mm/mm.o \ + obj-ppc/boot/freeldr/freeldr/reactos/registry.o \ + obj-ppc/boot/freeldr/freeldr/reactos/binhive.o \ + obj-ppc/boot/freeldr/freeldr/reactos/arcname.o \ + obj-ppc/boot/freeldr/freeldr/reactos/reactos.o \ + obj-ppc/boot/freeldr/freeldr/rtl/list.o \ + obj-ppc/boot/freeldr/freeldr/rtl/libsupp.o \ + obj-ppc/boot/freeldr/freeldr/ui/gui.o \ + obj-ppc/boot/freeldr/freeldr/ui/tui.o \ + obj-ppc/boot/freeldr/freeldr/ui/tuimenu.o \ + obj-ppc/boot/freeldr/freeldr/ui/ui.o \ + obj-ppc/boot/freeldr/freeldr/video/bank.o \ + obj-ppc/boot/freeldr/freeldr/video/fade.o \ + obj-ppc/boot/freeldr/freeldr/video/palette.o \ + obj-ppc/boot/freeldr/freeldr/video/pixel.o \ + obj-ppc/boot/freeldr/freeldr/video/video.o \ + obj-ppc/boot/freeldr/freeldr/freeldr.o \ + obj-ppc/boot/freeldr/freeldr/debug.o \ + obj-ppc/boot/freeldr/freeldr/version.o \ + obj-ppc/boot/freeldr/freeldr/cmdline.o \ + obj-ppc/boot/freeldr/freeldr/machine.o \ + obj-ppc/boot/freeldr/freeldr/windows/conversion.o \ + obj-ppc/boot/freeldr/freeldr/windows/peloader.o \ + obj-ppc/boot/freeldr/freeldr/windows/winldr.o \ + obj-ppc/boot/freeldr/freeldr/windows/wlmemory.o \ + obj-ppc/boot/freeldr/freeldr/windows/wlregistry.o \ + obj-ppc/boot/freeldr/freeldr/arch/powerpc/mach.o \ + obj-ppc/boot/freeldr/freeldr/arch/powerpc/ofw.o \ + obj-ppc/boot/freeldr/freeldr/arch/powerpc/mboot.o \ + obj-ppc/boot/freeldr/freeldr/arch/powerpc/loader.o \ + obj-ppc/boot/freeldr/freeldr/arch/powerpc/prep.o \ + obj-ppc/boot/freeldr/freeldr/arch/powerpc/prep_ide.o \ + obj-ppc/boot/freeldr/freeldr/arch/powerpc/prep_pci.o \ + obj-ppc/boot/freeldr/freeldr/arch/powerpc/prep_vga.o \ + obj-ppc/boot/freeldr/freeldr/bootmgr.o \ + obj-ppc/boot/freeldr/freeldr/drivemap.o \ + obj-ppc/boot/freeldr/freeldr/miscboot.o \ + obj-ppc/boot/freeldr/freeldr/options.o \ + obj-ppc/boot/freeldr/freeldr/linuxboot.o \ + obj-ppc/boot/freeldr/freeldr/oslist.o \ + obj-ppc/boot/freeldr/freeldr/custom.o \ + obj-ppc/lib/rossym/rossym.a \ + obj-ppc/lib/cmlib/cmlib.a \ + obj-ppc/lib/string/string.a \ + obj-ppc/lib/rtl/rtl.a \ + obj-ppc/lib/mmu/libmmu.a \ + obj-ppc/lib/mmu/libmmu_code.a \ + /usr/local/pkg/reactos-powerpc/lib/libgcc.a Propchange: trunk/reactos/tools/ppc.lost+found/link-freeldr ------------------------------------------------------------------------------ svn:executable = * Added: trunk/reactos/tools/ppc.lost+found/ofboot.b URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/ppc.lost%2Bfound/ofb…
============================================================================== --- trunk/reactos/tools/ppc.lost+found/ofboot.b (added) +++ trunk/reactos/tools/ppc.lost+found/ofboot.b Sun Sep 2 13:11:10 2007 @@ -1,0 +1,64 @@ +<CHRP-BOOT> +<COMPATIBLE> +MacRISC MacRISC3 MacRISC4 +</COMPATIBLE> +<DESCRIPTION> +GNU/Linux PPC bootloader +</DESCRIPTION> +<BOOT-SCRIPT> +" screen" output +load-base release-load-area +boot cd:,\install\yaboot +</BOOT-SCRIPT> +<OS-BADGE-ICONS> +1010 +000000000000F8FEACF6000000000000 +0000000000F5FFFFFEFEF50000000000 +00000000002BFAFEFAFCF70000000000 +0000000000F65D5857812B0000000000 +0000000000F5350B2F88560000000000 +0000000000F6335708F8FE0000000000 +00000000005600F600F5FD8100000000 +00000000F9F8000000F5FAFFF8000000 +000000008100F5F50000F6FEFE000000 +000000F8F700F500F50000FCFFF70000 +00000088F70000F50000F5FCFF2B0000 +0000002F582A00F5000008ADE02C0000 +00090B0A35A62B0000002D3B350A0000 +000A0A0B0B3BF60000505E0B0A0B0A00 +002E350B0B2F87FAFCF45F0B2E090000 +00000007335FF82BF72B575907000000 +000000000000ACFFFF81000000000000 +000000000081FFFFFFFF810000000000 +0000000000FBFFFFFFFFAC0000000000 +000000000081DFDFDFFFFB0000000000 +000000000081DD5F83FFFD0000000000 +000000000081DDDF5EACFF0000000000 +0000000000FDF981F981FFFF00000000 +00000000FFACF9F9F981FFFFAC000000 +00000000FFF98181F9F981FFFF000000 +000000ACACF981F981F9F9FFFFAC0000 +000000FFACF9F981F9F981FFFFFB0000 +00000083DFFBF981F9F95EFFFFFC0000 +005F5F5FDDFFFBF9F9F983DDDD5F0000 +005F5F5F5FDD81F9F9E7DF5F5F5F5F00 +0083DD5F5F83FFFFFFFFDF5F835F0000 +000000FBDDDFACFBACFBDFDFFB000000 +000000000000FFFFFFFF000000000000 +0000000000FFFFFFFFFFFF0000000000 +0000000000FFFFFFFFFFFF0000000000 +0000000000FFFFFFFFFFFF0000000000 +0000000000FFFFFFFFFFFF0000000000 +0000000000FFFFFFFFFFFF0000000000 +0000000000FFFFFFFFFFFFFF00000000 +00000000FFFFFFFFFFFFFFFFFF000000 +00000000FFFFFFFFFFFFFFFFFF000000 +000000FFFFFFFFFFFFFFFFFFFFFF0000 +000000FFFFFFFFFFFFFFFFFFFFFF0000 +000000FFFFFFFFFFFFFFFFFFFFFF0000 +00FFFFFFFFFFFFFFFFFFFFFFFFFF0000 +00FFFFFFFFFFFFFFFFFFFFFFFFFFFF00 +00FFFFFFFFFFFFFFFFFFFFFFFFFF0000 +000000FFFFFFFFFFFFFFFFFFFF000000 +</OS-BADGE-ICONS> +</CHRP-BOOT> Added: trunk/reactos/tools/ppc.lost+found/pmake URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/ppc.lost%2Bfound/pma…
============================================================================== --- trunk/reactos/tools/ppc.lost+found/pmake (added) +++ trunk/reactos/tools/ppc.lost+found/pmake Sun Sep 2 13:11:10 2007 @@ -1,0 +1,14 @@ +#!/bin/sh + +export PATH=$PATH:/usr/local/pkg/reactos-powerpc/bin +make \ + ARCH=powerpc \ + HOST=mingw32-linux \ + PREFIX=reactos-powerpc \ + ROS_INTERMEDIATE=obj-ppc \ + ROS_OUTPUT=output-ppc \ + ROS_PREFIX=reactos-powerpc \ + ROS_INSTALL=rosppc \ + ROS_AUTOMAKE=makefile.ppc \ + ROS_RBUILDFLAGS=-rReactOS-ppc.rbuild \ + $* Propchange: trunk/reactos/tools/ppc.lost+found/pmake ------------------------------------------------------------------------------ svn:executable = *
17 years, 3 months
1
0
0
0
[arty] 28757: Add interface generator for open firmware calls.
by arty@svn.reactos.org
Author: arty Date: Sun Sep 2 13:02:12 2007 New Revision: 28757 URL:
http://svn.reactos.org/svn/reactos?rev=28757&view=rev
Log: Add interface generator for open firmware calls. Added: trunk/reactos/tools/ofw_interface/ trunk/reactos/tools/ofw_interface/calls.ofw trunk/reactos/tools/ofw_interface/ofw_interface.cpp trunk/reactos/tools/ofw_interface/ofw_interface.mak Modified: trunk/reactos/tools/tools.mak Added: trunk/reactos/tools/ofw_interface/calls.ofw URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/ofw_interface/calls.…
============================================================================== --- trunk/reactos/tools/ofw_interface/calls.ofw (added) +++ trunk/reactos/tools/ofw_interface/calls.ofw Sun Sep 2 13:02:12 2007 @@ -1,0 +1,25 @@ +# Function Args Returns Types +# Real OFW functions to proxy +finddevice 1 1 char* int +open 1 1 char* int +getprop 4 1 int char* char*:arg3 int int +write 3 1 int char*:arg2 int int +read 3 1 int char*:arg2 int int +exit 0 0 +child 1 1 int int +peer 1 1 int int +parent 1 1 int int +seek 3 1 int int int int +# MMU methods +# claim (virt size align -- base) +claim 3 1 int int int int +# claim-mem (size align -- base) +claim-mem 2 1 int int int +# release (virt size --) +release 2 0 int int +package-to-path 3 1 int char*:arg2 int int +# Declare the call-method BE function ++call-method 0 0 +# MMU Methods +@phys2virt!translate 4 1 int int int int&0 int +@virt2phys!translate 2 1 int int&1 int Added: trunk/reactos/tools/ofw_interface/ofw_interface.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/ofw_interface/ofw_in…
============================================================================== --- trunk/reactos/tools/ofw_interface/ofw_interface.cpp (added) +++ trunk/reactos/tools/ofw_interface/ofw_interface.cpp Sun Sep 2 13:02:12 2007 @@ -1,0 +1,316 @@ +#include <stdio.h> +#include <iostream> +#include <fstream> +#include <sstream> +#include <string> +#include <vector> + +class ofw_wrappers { +public: + int base, ctindex, method_ctindex; + std::string functions; + std::string names; + std::string calltable; + std::string le_stubs; + std::string of_call; +}; + +class vartype { +public: + vartype( const std::string &typestr ) { + size_t amp = typestr.find('&'); + size_t col = typestr.find(':'); + if( amp != std::string::npos ) { + if( col > amp && col != std::string::npos ) + lit_value = typestr.substr(amp+1,col-amp+1); + else lit_value = typestr.substr(amp+1); + } + if( col != std::string::npos ) { + if( amp > col && amp != std::string::npos ) + len = typestr.substr(col+1,amp-col+1); + else len = typestr.substr(col+1); + } + + if( amp != std::string::npos && amp < col ) col = amp; + if( col == std::string::npos ) col = typestr.size(); + c_type = typestr.substr(0,col); + } + + vartype( const vartype &other ) + : c_type(other.c_type), + len(other.len), + lit_value(other.lit_value) { + } + + vartype &operator = ( const vartype &other ) { + c_type = other.c_type; + len = other.len; + lit_value = other.lit_value; + return *this; + } + + std::string c_type; + std::string len; + std::string lit_value; +}; + +std::string uppercase( const std::string &toucase ) { + std::vector<char> ucase_work(toucase.size()); + for( size_t i = 0; i < toucase.size(); i++ ) { + ucase_work[i] = toupper(toucase[i]); + } + return std::string(&ucase_work[0], toucase.size()); +} + +std::string clip_eol( std::string in, const std::string &eol_marks ) { + size_t found; + for( size_t i = 0; i < eol_marks.size(); i++ ) { + found = in.find( eol_marks[i] ); + if( found != std::string::npos ) + in = in.substr( 0, found ); + } + return in; +} + +int round_up( int x, int factor ) { + return (x + (factor - 1)) & ~(factor - 1); +} + +void populate_definition( ofw_wrappers &wrapper, const std::string &line ) { + std::istringstream iss(line); + bool make_function = true, method_call = false, make_stub = true, comma; + std::string name, nametext, argtype, rettype; + std::vector<vartype> argtypes; + int args, rets, i, local_offset, total_stack, userarg_start = 0; + size_t f; + std::ostringstream function, ct_csource, le_stub, of_call; + + iss >> name >> args >> rets; + + if( !name.size() ) return; + + if( (f = name.find('!')) != std::string::npos ) { + nametext = name.substr(f+1); + name = name.substr(0,f); + } + if( name[0] == '-' ) { + name = name.substr(1); + make_function = false; + } + if( name[0] == '+' ) { + name = name.substr(1); + make_stub = false; + } + if( name[0] == '@' ) { + name = name.substr(1); + method_call = true; + make_function = false; + } + + if( !nametext.size() ) nametext = name; + + for( i = 1; i < (int)name.size(); i++ ) + if( name[i] == '-' ) name[i] = '_'; + + if( nametext == "call-method" ) + wrapper.method_ctindex = wrapper.ctindex; + + for( i = 0; i < args; i++ ) { + iss >> argtype; + argtypes.push_back(vartype(argtype)); + } + + if( method_call ) { + userarg_start = 1; + args += 2; + } + + iss >> rettype; + if( !rettype.size() ) rettype = "void"; + + local_offset = (3 + rets + args) * 4; + total_stack = round_up(12 + local_offset, 16); + + function << "asm_ofw_" << name << ":\n" + << "\t/* Reserve stack space */\n" + << "\tsubi %r1,%r1," << total_stack << "\n" + << "\t/* Store r8, r9, lr */\n" + << "\tstw %r8," << (local_offset + 0) << "(%r1)\n" + << "\tstw %r9," << (local_offset + 4) << "(%r1)\n" + << "\tmflr %r8\n" + << "\tstw %r8," << (local_offset + 8) << "(%r1)\n" + << "\t/* Get read name */\n" + << "\tlis %r8," << name << "_ofw_name@ha\n" + << "\taddi %r9,%r8," << name << "_ofw_name@l\n" + << "\tstw %r9,0(%r1)\n" + << "\t/* " << args << " arguments and " << rets << " return */\n" + << "\tli %r9," << args << "\n" + << "\tstw %r9,4(%r1)\n" + << "\tli %r9," << rets << "\n" + << "\tstw %r9,8(%r1)\n"; + + for( int i = 0; i < args; i++ ) + function << "\tstw %r" << (i+3) << "," << (4 * (i + 3)) << "(%r1)\n"; + + function << "\t/* Load up the call address */\n" + << "\tlis %r10,ofw_call_addr@ha\n" + << "\tlwz %r9,ofw_call_addr@l(%r10)\n" + << "\tmtlr %r9\n" + << "\t/* Set argument */\n" + << "\tmr %r3,%r1\n" + << "\t/* Fire */\n" + << "\tblrl\n" + << "\tlwz %r3," << (local_offset - 4) << "(%r1)\n" + << "\t/* Restore registers */\n" + << "\tlwz %r8," << (local_offset + 8) << "(%r1)\n" + << "\tmtlr %r8\n" + << "\tlwz %r9," << (local_offset + 4) << "(%r1)\n" + << "\tlwz %r8," << (local_offset + 0) << "(%r1)\n" + << "\t/* Return */\n" + << "\taddi %r1,%r1," << total_stack << "\n" + << "\tblr\n"; + + if( method_call ) { + argtypes.insert(argtypes.begin(),vartype("int")); + argtypes.insert(argtypes.begin(),vartype("char*")); + } + + le_stub << rettype << " ofw_" << name << "("; + + comma = false; + for( i = userarg_start; i < args; i++ ) { + if( !argtypes[i].lit_value.size() ) { + if( !comma ) comma = true; else le_stub << ","; + le_stub << argtypes[i].c_type << " arg" << i; + } + } + le_stub << ")"; + of_call << le_stub.str() << ";\n"; + + le_stub << " {\n"; + if( rettype != "void" ) + le_stub << "\t" << rettype << " ret;\n"; + + if( method_call ) { + le_stub << "\tchar arg0[" + << round_up(nametext.size()+1,8) + << "] = \"" << nametext << "\";\n"; + } + + for( i = 0; i < args; i++ ) { + if( argtypes[i].lit_value.size() ) { + le_stub << "\t" << argtypes[i].c_type << " arg" << i << " = " + << argtypes[i].lit_value << ";\n"; + } + } + + le_stub << "\t"; + if( rettype != "void" ) le_stub << "ret = (" << rettype << ")"; + + le_stub << "ofproxy(" << + (method_call ? (wrapper.method_ctindex * 4) : (wrapper.ctindex * 4)); + + for( i = 0; i < 6; i++ ) { + if( i < args ) le_stub << ",(void *)arg" << i; + else le_stub << ",NULL"; + } + + le_stub << ");\n"; + + if( rettype != "void" ) + le_stub << "\treturn ret;\n"; + + le_stub << "}\n"; + + if( make_function ) wrapper.functions += function.str(); + if( make_stub ) { + wrapper.le_stubs += le_stub.str(); + wrapper.of_call += of_call.str(); + } + if( !method_call ) { + wrapper.names += name + "_ofw_name:\n\t.asciz \"" + nametext + "\"\n"; + wrapper.calltable += std::string("\t.long asm_ofw_") + name + "\n"; + wrapper.ctindex++; + } +} + +int main( int argc, char **argv ) { + int status = 0; + std::ifstream in; + std::ofstream out, outcsource, outcheader; + std::string line; + const char *eol_marks = "#\r\n"; + ofw_wrappers wrappers; + + wrappers.base = 0xe00000; + wrappers.ctindex = 0; + + if( argc < 5 ) { + fprintf( stderr, "%s [interface.ofw] [ofw.s] [le_stub.c] [le_stub.h]\n", argv[0] ); + return 1; + } + + in.open( argv[1] ); + if( !in ) { + fprintf( stderr, "can't open %s\n", argv[1] ); + status = 1; + goto error; + } + + out.open( argv[2] ); + if( !out ) { + fprintf( stderr, "can't open %s\n", argv[2] ); + status = 1; + goto error; + } + + outcsource.open( argv[3] ); + if( !outcsource ) { + fprintf( stderr, "can't open %s\n", argv[3] ); + status = 1; + goto error; + } + + outcheader.open( argv[4] ); + if( !outcheader ) { + fprintf( stderr, "can't open %s\n", argv[4] ); + status = 1; + goto error; + } + + while( std::getline( in, line ) ) { + line = clip_eol( line, eol_marks ); + if( line.size() ) populate_definition( wrappers, line ); + } + + out << "/* AUTOMATICALLY GENERATED BY ofw_interface */\n" + << "\t.section .text\n" + << "\t.align 4\n" + << "\t.globl _start\n" + << "\t.globl ofw_functions\n" + << "\t.globl ofw_call_addr\n" + << "ofw_call_addr:\n" + << "\t.long 0\n" + << "\n/* Function Wrappers */\n\n" + << wrappers.functions + << "\n/* Function Names */\n\n" + << wrappers.names + << "\n/* Function Call Table for Freeldr */\n\n" + << "\t.align 4\n" + << "ofw_functions:\n" + << wrappers.calltable + << "\n/* End */\n"; + + outcsource << "/* AUTOMATICALLY GENERATED BY ofw_interface */\n" + << "#include \"of.h\"\n" + << wrappers.le_stubs; + + outcheader << "/* AUTOMATICALLY GENERATE BY ofw_interface */\n" + << "#ifndef _OFW_CALLS_H\n" + << "#define _OFW_CALLS_H\n" + << wrappers.of_call + << "#endif/*_OFW_CALLS_H*/\n"; + +error: + return status; +} Added: trunk/reactos/tools/ofw_interface/ofw_interface.mak URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/ofw_interface/ofw_in…
============================================================================== --- trunk/reactos/tools/ofw_interface/ofw_interface.mak (added) +++ trunk/reactos/tools/ofw_interface/ofw_interface.mak Sun Sep 2 13:02:12 2007 @@ -1,0 +1,63 @@ +OFW_INTERFACE_BASE = $(TOOLS_BASE_)ofw_interface +OFW_INTERFACE_BASE_ = $(OFW_INTERFACE_BASE)$(SEP) +OFW_INTERFACE_INT = $(INTERMEDIATE_)$(OFW_INTERFACE_BASE) +OFW_INTERFACE_INT_ = $(OFW_INTERFACE_INT)$(SEP) +OFW_INTERFACE_OUT = $(OUTPUT_)$(OFW_INTERFACE_BASE) +OFW_INTERFACE_OUT_ = $(OFW_INTERFACE_OUT)$(SEP) + +OFW_INTERFACE_OUTPUT = boot/freeldr/freeldr/arch/powerpc/ofw_calls.s +OFW_INTERFACE_SOURCE = boot/freeldr/freeldr/arch/powerpc/ofw.c +OFW_INTERFACE_HEADER = boot/freeldr/freeldr/include/of_call.h +OFW_INTERFACE_INPUT = $(OFW_INTERFACE_BASE_)calls.ofw +OFW_INTERFACE_SERVICE_FILES = \ + $(OFW_INTERFACE_OUTPUT) \ + $(OFW_INTERFACE_SOURCE) \ + $(OFW_INTERFACE_HEADER) + +$(OFW_INTERFACE_INT): | $(TOOLS_INT) + $(ECHO_MKDIR) + ${mkdir} $@ + +ifneq ($(INTERMEDIATE),$(OUTPUT)) +$(OFW_INTERFACE_OUT): | $(TOOLS_OUT) + $(ECHO_MKDIR) + ${mkdir} $@ +endif + +OFW_INTERFACE_TARGET = \ + $(EXEPREFIX)$(OFW_INTERFACE_OUT_)ofw_interface$(EXEPOSTFIX) + +OFW_INTERFACE_SOURCES = $(addprefix $(OFW_INTERFACE_BASE_), \ + ofw_interface.cpp \ + ) + +OFW_INTERFACE_OBJECTS = \ + $(addprefix $(INTERMEDIATE_), $(OFW_INTERFACE_SOURCES:.cpp=.o)) + +OFW_INTERFACE_HOST_CFLAGS = $(TOOLS_CFLAGS) + +OFW_INTERFACE_HOST_LFLAGS = $(TOOLS_LFLAGS) + +$(OFW_INTERFACE_TARGET): $(OFW_INTERFACE_OBJECTS) | $(OFW_INTERFACE_OUT) + $(ECHO_LD) + ${host_gpp} $(OFW_INTERFACE_OBJECTS) $(OFW_INTERFACE_HOST_LFLAGS) -o $@ + +$(OFW_INTERFACE_INT_)ofw_interface.o: $(OFW_INTERFACE_BASE_)ofw_interface.cpp | $(OFW_INTERFACE_INT) + $(ECHO_CC) + ${host_gpp} $(OFW_INTERFACE_HOST_CFLAGS) -c $< -o $@ + +$(OFW_INTERFACE_SERVICE_FILES): $(OFW_INTERFACE_TARGET) $(OFW_INTERFACE_INPUT) + $(ECHO_OFW) + $(Q)$(OFW_INTERFACE_TARGET) \ + $(OFW_INTERFACE_INPUT) \ + $(OFW_INTERFACE_OUTPUT) \ + $(OFW_INTERFACE_SOURCE) \ + $(OFW_INTERFACE_HEADER) + +.PHONY: ofw_interface +ofw_interface: $(OFW_INTERFACE_TARGET) + +.PHONY: ofw_interface_clean +ofw_interface_clean: + -@$(rm) $(OFW_INTERFACE_TARGET) $(OFW_INTERFACE_OBJECTS) 2>$(NUL) +clean: ofw_interface_clean Modified: trunk/reactos/tools/tools.mak URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/tools.mak?rev=28757&…
============================================================================== --- trunk/reactos/tools/tools.mak (original) +++ trunk/reactos/tools/tools.mak Sun Sep 2 13:02:12 2007 @@ -47,6 +47,7 @@ include tools/cdmake/cdmake.mak include tools/dbgprint/dbgprint.mak include tools/gendib/gendib.mak +include tools/ofw_interface/ofw_interface.mak include tools/mkhive/mkhive.mak include tools/nci/nci.mak include tools/pefixup.mak
17 years, 3 months
1
0
0
0
[jimtabor] 28756: Working Dc_Attr support, tested and it worked. Will plugin the rest later.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Sun Sep 2 11:59:12 2007 New Revision: 28756 URL:
http://svn.reactos.org/svn/reactos?rev=28756&view=rev
Log: Working Dc_Attr support, tested and it worked. Will plugin the rest later. Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h trunk/reactos/subsystems/win32/win32k/objects/dcutil.c Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/dc.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/dc.h Sun Sep 2 11:59:12 2007 @@ -145,6 +145,7 @@ VOID FASTCALL DC_InitDC(HDC DCToInit); HDC FASTCALL DC_FindOpenDC(PUNICODE_STRING Driver); VOID FASTCALL DC_FreeDC(HDC DCToFree); +VOID FASTCALL DC_FreeDcAttr(HDC); BOOL INTERNAL_CALL DC_Cleanup(PVOID ObjectBody); HDC FASTCALL DC_GetNextDC (PDC pDC); VOID FASTCALL DC_SetNextDC (PDC pDC, HDC hNextDC); @@ -154,6 +155,10 @@ BOOL FASTCALL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest); BOOL FASTCALL DCU_UpdateUserXForms(PDC, ULONG); +BOOL FASTCALL DCU_SyncDcAttrtoUser(PDC, FLONG); +BOOL FASTCALL DCU_SynchDcAttrtoUser(HDC, FLONG); +BOOL FASTCALL DCU_SyncDcAttrtoW32k(PDC, FLONG); +BOOL FASTCALL DCU_SynchDcAttrtoW32k(HDC, FLONG); VOID FASTCALL IntGetViewportExtEx(PDC dc, LPSIZE pt); VOID FASTCALL IntGetViewportOrgEx(PDC dc, LPPOINT pt); Modified: trunk/reactos/subsystems/win32/win32k/objects/dcutil.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dcutil.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dcutil.c Sun Sep 2 11:59:12 2007 @@ -3,6 +3,121 @@ #define NDEBUG #include <debug.h> + +static +VOID +CopytoUserDcAttr(PDC dc, PDC_ATTR Dc_Attr, FLONG Dirty) +{ + + Dc_Attr->hpen = dc->Dc_Attr.hpen; + Dc_Attr->hbrush = dc->Dc_Attr.hbrush; + Dc_Attr->hColorSpace = dc->Dc_Attr.hColorSpace; + Dc_Attr->hlfntNew = dc->Dc_Attr.hlfntNew; + + Dc_Attr->jROP2 = dc->Dc_Attr.jROP2; + Dc_Attr->jFillMode = dc->Dc_Attr.jFillMode; + Dc_Attr->jStretchBltMode = dc->Dc_Attr.jStretchBltMode; + Dc_Attr->lRelAbs = dc->Dc_Attr.lRelAbs; + Dc_Attr->jBkMode = dc->Dc_Attr.jBkMode; + + Dc_Attr->crBackgroundClr = dc->Dc_Attr.crBackgroundClr; + Dc_Attr->ulBackgroundClr = dc->Dc_Attr.ulBackgroundClr; + Dc_Attr->crForegroundClr = dc->Dc_Attr.crForegroundClr; + Dc_Attr->ulForegroundClr = dc->Dc_Attr.ulForegroundClr; + + Dc_Attr->ulBrushClr = dc->Dc_Attr.ulBrushClr; + Dc_Attr->crBrushClr = dc->Dc_Attr.crBrushClr; + + Dc_Attr->ulPenClr = dc->Dc_Attr.ulPenClr; + Dc_Attr->crPenClr = dc->Dc_Attr.crPenClr; + + Dc_Attr->ptlBrushOrigin.x = dc->Dc_Attr.ptlBrushOrigin.x; + Dc_Attr->ptlBrushOrigin.y = dc->Dc_Attr.ptlBrushOrigin.y; + + Dc_Attr->lTextAlign = dc->Dc_Attr.lTextAlign; + Dc_Attr->lTextExtra = dc->Dc_Attr.lTextExtra; + Dc_Attr->cBreak = dc->Dc_Attr.cBreak; + Dc_Attr->lBreakExtra = dc->Dc_Attr.lBreakExtra; + Dc_Attr->iMapMode = dc->Dc_Attr.iMapMode; + Dc_Attr->iGraphicsMode = dc->Dc_Attr.iGraphicsMode; + + Dc_Attr->ptlCurrent.x = dc->Dc_Attr.ptlCurrent.x; + Dc_Attr->ptlCurrent.y = dc->Dc_Attr.ptlCurrent.y; + Dc_Attr->ptlWindowOrg.x = dc->Dc_Attr.ptlWindowOrg.x; + Dc_Attr->ptlWindowOrg.y = dc->Dc_Attr.ptlWindowOrg.y; + Dc_Attr->szlWindowExt.cx = dc->Dc_Attr.szlWindowExt.cx; + Dc_Attr->szlWindowExt.cy = dc->Dc_Attr.szlWindowExt.cy; + Dc_Attr->ptlViewportOrg.x = dc->Dc_Attr.ptlViewportOrg.x; + Dc_Attr->ptlViewportOrg.y = dc->Dc_Attr.ptlViewportOrg.y; + Dc_Attr->szlViewportExt.cx = dc->Dc_Attr.szlViewportExt.cx; + Dc_Attr->szlViewportExt.cy = dc->Dc_Attr.szlViewportExt.cy; + + Dc_Attr->ulDirty_ = 0; // Force to Zero! +} + +static +VOID +CopyFromUserDcAttr(PDC dc, PDC_ATTR Dc_Attr, FLONG Dirty) +{ + if ( (Dirty & DIRTY_FILL) || (Dc_Attr->ulDirty_ & DIRTY_FILL)) + { + dc->Dc_Attr.ulBrushClr = Dc_Attr->ulBrushClr; + dc->Dc_Attr.crBrushClr = Dc_Attr->crBrushClr; + Dc_Attr->ulDirty_ &= ~DIRTY_FILL; + } + if ( Dirty & DIRTY_LINE || (Dc_Attr->ulDirty_ & DIRTY_LINE)) + { + dc->Dc_Attr.ulPenClr = Dc_Attr->ulPenClr; + dc->Dc_Attr.crPenClr = Dc_Attr->crPenClr; + Dc_Attr->ulDirty_ &= ~DIRTY_LINE; + } +} + +static +BOOL +ReadWriteVMDcAttr(PDC dc, FLONG Dirty, BOOL Write) +{ + BOOL Ret = FALSE; + KeEnterCriticalRegion(); + { + INT Index = GDI_HANDLE_GET_INDEX((HGDIOBJ)dc->hSelf); + PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index]; + HANDLE ProcessId = (HANDLE)(((ULONG_PTR)(Entry->ProcessId)) & 0x0000ffff); + DC_ATTR lDc_AttrData; + + if(Entry->UserData) + { + NTSTATUS Status = ZwReadVirtualMemory ( ProcessId, + &(Entry->UserData), + &lDc_AttrData, + sizeof(DC_ATTR), + NULL ); + if (Write) + { + if (NT_SUCCESS(Status)) CopytoUserDcAttr(dc, &lDc_AttrData, Dirty); + Ret = TRUE; + } + else + { + if (NT_SUCCESS(Status)) CopyFromUserDcAttr(dc, &lDc_AttrData, Dirty); + Ret = TRUE; + } + if (Write) + Status = ZwWriteVirtualMemory ( ProcessId, + &(Entry->UserData), + &lDc_AttrData, + sizeof(DC_ATTR), + NULL ); + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + Ret = FALSE; + } + } + } + KeLeaveCriticalRegion(); + return Ret; +} BOOL @@ -41,12 +156,103 @@ { SetLastNtError(Status); return FALSE; - } + } } #endif return TRUE; } +BOOL +FASTCALL +DCU_SyncDcAttrtoUser(PDC dc, FLONG Dirty) +{ + BOOL TryHarder = FALSE; + PDC_ATTR Dc_Attr = dc->pDc_Attr; + if (!Dirty) return FALSE; + if (!Dc_Attr) return FALSE; + else + { + NTSTATUS Status = STATUS_SUCCESS; + _SEH_TRY + { + ProbeForWrite(Dc_Attr, + sizeof(DC_ATTR), + 1); + CopytoUserDcAttr( dc, Dc_Attr, Dirty); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + if(!NT_SUCCESS(Status)) + { + TryHarder = TRUE; + } + if (TryHarder) + { + return ReadWriteVMDcAttr( dc, Dirty, TRUE); + } + } + return TRUE; +} + +BOOL +FASTCALL +DCU_SynchDcAttrtoUser(HDC hDC, FLONG Dirty) +{ + PDC pDC = DC_LockDc ( hDC ); + BOOL Ret = DCU_SyncDcAttrtoUser(pDC, Dirty); + DC_UnlockDc( pDC ); + return Ret; +} + +BOOL +FASTCALL +DCU_SyncDcAttrtoW32k(PDC dc, FLONG Dirty) +{ + BOOL TryHarder = FALSE; + PDC_ATTR Dc_Attr = dc->pDc_Attr; + if (!Dirty) return FALSE; + if (!Dc_Attr) return FALSE; + else + { + NTSTATUS Status = STATUS_SUCCESS; + _SEH_TRY + { + ProbeForRead(Dc_Attr, + sizeof(DC_ATTR), + 1); + CopyFromUserDcAttr( dc, Dc_Attr, Dirty); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + if(!NT_SUCCESS(Status)) + { + TryHarder = TRUE; + } + if (TryHarder) + { + return ReadWriteVMDcAttr( dc, Dirty, FALSE); + } + } + return TRUE; +} + +BOOL +FASTCALL +DCU_SynchDcAttrtoW32k(HDC hDC, FLONG Dirty) +{ + PDC pDC = DC_LockDc ( hDC ); + BOOL Ret = DCU_SyncDcAttrtoW32k(pDC, Dirty); + DC_UnlockDc( pDC ); + return Ret; +} + + VOID APIENTRY
17 years, 3 months
1
0
0
0
[jimtabor] 28755: Fix BootCD!!!!! Watch your commit GL! LOL!
by jimtabor@svn.reactos.org
Author: jimtabor Date: Sun Sep 2 09:31:00 2007 New Revision: 28755 URL:
http://svn.reactos.org/svn/reactos?rev=28755&view=rev
Log: Fix BootCD!!!!! Watch your commit GL! LOL! Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubs…
============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/stubs.c (original) +++ trunk/reactos/dll/win32/gdi32/misc/stubs.c Sun Sep 2 09:31:00 2007 @@ -2737,7 +2737,7 @@ DWORD dwRop) { /* FIXME some part need be done in user mode */ - return PatBlt( hdc, nXLeft, nYLeft, nWidth, nHeight, dwRop); + return NtGdiPatBlt( hdc, nXLeft, nYLeft, nWidth, nHeight, dwRop); } BOOL
17 years, 3 months
1
0
0
0
[tkreuzer] 28754: Revert wars! ; -) I talked with GL, he agrees, it is correct.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Sep 2 03:11:16 2007 New Revision: 28754 URL:
http://svn.reactos.org/svn/reactos?rev=28754&view=rev
Log: Revert wars! ;-) I talked with GL, he agrees, it is correct. Modified: trunk/reactos/dll/win32/gdi32/objects/font.c Modified: trunk/reactos/dll/win32/gdi32/objects/font.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/fo…
============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/font.c (original) +++ trunk/reactos/dll/win32/gdi32/objects/font.c Sun Sep 2 03:11:16 2007 @@ -1091,17 +1091,13 @@ STDCALL AddFontResourceExW ( LPCWSTR lpszFilename, DWORD fl, PVOID pvReserved ) { - int retVal = 0; - - if (fl & (FR_PRIVATE | FR_NOT_ENUM)) - { - retVal = GdiAddFontResourceW(lpszFilename, fl,0); - } - else + if (fl & ~(FR_PRIVATE | FR_NOT_ENUM)) { SetLastError( ERROR_INVALID_PARAMETER ); - } - return retVal; + return 0; + } + + return GdiAddFontResourceW(lpszFilename, fl,0); } @@ -1114,26 +1110,24 @@ { NTSTATUS Status; PWSTR FilenameW; - int rc = 0; - - if (!(fl & (FR_PRIVATE | FR_NOT_ENUM))) + int rc; + + if (fl & ~(FR_PRIVATE | FR_NOT_ENUM)) { SetLastError( ERROR_INVALID_PARAMETER ); - } - else - { - Status = HEAP_strdupA2W ( &FilenameW, lpszFilename ); - if ( !NT_SUCCESS (Status) ) - { - SetLastError (RtlNtStatusToDosError(Status)); - } - else - { - rc = GdiAddFontResourceW ( FilenameW, fl, 0 ); - HEAP_free ( FilenameW ); - } - } - return rc; + return 0; + } + + Status = HEAP_strdupA2W ( &FilenameW, lpszFilename ); + if ( !NT_SUCCESS (Status) ) + { + SetLastError (RtlNtStatusToDosError(Status)); + return 0; + } + + rc = GdiAddFontResourceW ( FilenameW, fl, 0 ); + HEAP_free ( FilenameW ); + return rc; }
17 years, 3 months
1
0
0
0
[tkreuzer] 28753: - Add test for AddFontResourceEx showing that the function accepts 0 as flags. - remove header inclusion in test files
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Sep 2 02:06:05 2007 New Revision: 28753 URL:
http://svn.reactos.org/svn/reactos?rev=28753&view=rev
Log: - Add test for AddFontResourceEx showing that the function accepts 0 as flags. - remove header inclusion in test files Added: trunk/rostests/apitests/gdi32api/tests/AddFontResourceEx.c Modified: trunk/rostests/apitests/gdi32api/testlist.c trunk/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c trunk/rostests/apitests/gdi32api/tests/CreateFont.c trunk/rostests/apitests/gdi32api/tests/CreatePen.c trunk/rostests/apitests/gdi32api/tests/CreateRectRgn.c trunk/rostests/apitests/gdi32api/tests/ExtCreatePen.c trunk/rostests/apitests/gdi32api/tests/GetClipRgn.c trunk/rostests/apitests/gdi32api/tests/GetObject.c trunk/rostests/apitests/gdi32api/tests/GetStockObject.c trunk/rostests/apitests/gdi32api/tests/SelectObject.c trunk/rostests/apitests/gdi32api/tests/SetDCPenColor.c trunk/rostests/apitests/gdi32api/tests/SetSysColors.c Modified: trunk/rostests/apitests/gdi32api/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/testlis…
============================================================================== --- trunk/rostests/apitests/gdi32api/testlist.c (original) +++ trunk/rostests/apitests/gdi32api/testlist.c Sun Sep 2 02:06:05 2007 @@ -4,6 +4,7 @@ #include "gdi32api.h" /* include the tests */ +#include "tests/AddFontResourceEx.c" #include "tests/CreateCompatibleDC.c" #include "tests/CreateFont.c" #include "tests/CreatePen.c" @@ -20,6 +21,7 @@ /* The List of tests */ TESTENTRY TestList[] = { + { L"AddFontResourceEx", Test_AddFontResourceEx }, { L"CreateCompatibleDC", Test_CreateCompatibleDC }, { L"CreateFont", Test_CreateFont }, { L"CreatePen", Test_CreatePen }, Added: trunk/rostests/apitests/gdi32api/tests/AddFontResourceEx.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/A…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/AddFontResourceEx.c (added) +++ trunk/rostests/apitests/gdi32api/tests/AddFontResourceEx.c Sun Sep 2 02:06:05 2007 @@ -1,0 +1,19 @@ + +INT +Test_AddFontResourceEx(PTESTINFO pti) +{ + WCHAR szFileName[MAX_PATH]; + GetEnvironmentVariableW(L"systemroot", szFileName, MAX_PATH); + + wcscat(szFileName, L"\\Fonts\\cour.ttf"); + + SetLastError(ERROR_SUCCESS); + TEST(AddFontResourceExW(szFileName, 0, 0) != 0); + TEST(GetLastError() == ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + TEST(AddFontResourceExW(szFileName, 256, 0) == 0); + TEST(GetLastError() == ERROR_INVALID_PARAMETER); + + return APISTATUS_NORMAL; +} Modified: trunk/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/C…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c (original) +++ trunk/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c Sun Sep 2 02:06:05 2007 @@ -1,5 +1,3 @@ -#include "../gdi32api.h" - INT Test_CreateCompatibleDC(PTESTINFO pti) { Modified: trunk/rostests/apitests/gdi32api/tests/CreateFont.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/C…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/CreateFont.c (original) +++ trunk/rostests/apitests/gdi32api/tests/CreateFont.c Sun Sep 2 02:06:05 2007 @@ -1,5 +1,3 @@ -#include "../gdi32api.h" - #define INVALIDFONT "ThisFontDoesNotExist" INT Modified: trunk/rostests/apitests/gdi32api/tests/CreatePen.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/C…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/CreatePen.c (original) +++ trunk/rostests/apitests/gdi32api/tests/CreatePen.c Sun Sep 2 02:06:05 2007 @@ -1,5 +1,3 @@ -#include "../gdi32api.h" - INT Test_CreatePen(PTESTINFO pti) { Modified: trunk/rostests/apitests/gdi32api/tests/CreateRectRgn.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/C…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/CreateRectRgn.c (original) +++ trunk/rostests/apitests/gdi32api/tests/CreateRectRgn.c Sun Sep 2 02:06:05 2007 @@ -1,5 +1,3 @@ -#include "../gdi32api.h" - INT Test_CreateRectRgn(PTESTINFO pti) { Modified: trunk/rostests/apitests/gdi32api/tests/ExtCreatePen.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/E…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/ExtCreatePen.c (original) +++ trunk/rostests/apitests/gdi32api/tests/ExtCreatePen.c Sun Sep 2 02:06:05 2007 @@ -1,5 +1,3 @@ -#include "../gdi32api.h" - INT Test_ExtCreatePen(PTESTINFO pti) { Modified: trunk/rostests/apitests/gdi32api/tests/GetClipRgn.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/G…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/GetClipRgn.c (original) +++ trunk/rostests/apitests/gdi32api/tests/GetClipRgn.c Sun Sep 2 02:06:05 2007 @@ -1,5 +1,3 @@ -#include "../gdi32api.h" - INT Test_GetClipRgn(PTESTINFO pti) { Modified: trunk/rostests/apitests/gdi32api/tests/GetObject.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/G…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/GetObject.c (original) +++ trunk/rostests/apitests/gdi32api/tests/GetObject.c Sun Sep 2 02:06:05 2007 @@ -1,5 +1,3 @@ -#include "../gdi32api.h" - static INT Test_General(PTESTINFO pti) { Modified: trunk/rostests/apitests/gdi32api/tests/GetStockObject.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/G…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/GetStockObject.c (original) +++ trunk/rostests/apitests/gdi32api/tests/GetStockObject.c Sun Sep 2 02:06:05 2007 @@ -1,5 +1,3 @@ -#include "../gdi32api.h" - INT Test_GetStockObject(PTESTINFO pti) { Modified: trunk/rostests/apitests/gdi32api/tests/SelectObject.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/S…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/SelectObject.c (original) +++ trunk/rostests/apitests/gdi32api/tests/SelectObject.c Sun Sep 2 02:06:05 2007 @@ -1,5 +1,3 @@ -#include "../gdi32api.h" - INT Test_SelectObject(PTESTINFO pti) { Modified: trunk/rostests/apitests/gdi32api/tests/SetDCPenColor.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/S…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/SetDCPenColor.c (original) +++ trunk/rostests/apitests/gdi32api/tests/SetDCPenColor.c Sun Sep 2 02:06:05 2007 @@ -1,5 +1,3 @@ -#include "../gdi32api.h" - INT Test_SetDCPenColor(PTESTINFO pti) { Modified: trunk/rostests/apitests/gdi32api/tests/SetSysColors.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/S…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/SetSysColors.c (original) +++ trunk/rostests/apitests/gdi32api/tests/SetSysColors.c Sun Sep 2 02:06:05 2007 @@ -1,5 +1,3 @@ -#include "../gdi32api.h" - #define NUM_SYSCOLORS 31 INT
17 years, 3 months
1
0
0
0
[greatlrd] 28752: add PatBlt, PolyPatBlt to user mode redirect PATHOBJ_bEnum@8 to NtGdiPATHOBJ_bEnum@8, PATHOBJ_bEnumClipLines@12 to NtGdiPATHOBJ_bEnumClipLines@12, PATHOBJ_vEnumStart@4 to NtGdiPATHOBJ_vEnumStart@4, PATHOBJ_vEnumStartClipLines@16 to NtGdiPATHOBJ_vEnumStartClipLines@16, PATHOBJ_vGetBounds@8 to NtGdiPATHOBJ_vGetBounds@8 update the good api list
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sun Sep 2 01:36:44 2007 New Revision: 28752 URL:
http://svn.reactos.org/svn/reactos?rev=28752&view=rev
Log: add PatBlt, PolyPatBlt to user mode redirect PATHOBJ_bEnum@8 to NtGdiPATHOBJ_bEnum@8, PATHOBJ_bEnumClipLines@12 to NtGdiPATHOBJ_bEnumClipLines@12, PATHOBJ_vEnumStart@4 to NtGdiPATHOBJ_vEnumStart@4, PATHOBJ_vEnumStartClipLines@16 to NtGdiPATHOBJ_vEnumStartClipLines@16, PATHOBJ_vGetBounds@8 to NtGdiPATHOBJ_vGetBounds@8 update the good api list Modified: trunk/reactos/dll/win32/gdi32/gdi32.def trunk/reactos/dll/win32/gdi32/good api.def trunk/reactos/dll/win32/gdi32/misc/stubs.c Modified: trunk/reactos/dll/win32/gdi32/gdi32.def URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/gdi32.def?…
============================================================================== --- trunk/reactos/dll/win32/gdi32/gdi32.def (original) +++ trunk/reactos/dll/win32/gdi32/gdi32.def Sun Sep 2 01:36:44 2007 @@ -416,8 +416,26 @@ OffsetRgn@12 OffsetViewportOrgEx@16 OffsetWindowOrgEx@16 - - +PATHOBJ_bEnum@8=NtGdiPATHOBJ_bEnum@8 +PATHOBJ_bEnumClipLines@12=NtGdiPATHOBJ_bEnumClipLines@12 +PATHOBJ_vEnumStart@4=NtGdiPATHOBJ_vEnumStart@4 +PATHOBJ_vEnumStartClipLines@16=NtGdiPATHOBJ_vEnumStartClipLines@16 +PATHOBJ_vGetBounds@8=NtGdiPATHOBJ_vGetBounds@8 +PaintRgn@8 +PatBlt@24 +PathToRegion@4 +Pie@36 +PlayEnhMetaFile@12 +PlayEnhMetaFileRecord@16 +PlayMetaFile@8 +PlayMetaFileRecord@16 +PlgBlt@40 +PolyBezier@12 +PolyBezierTo@12 +PolyDraw@16 +PolyPatBlt@20 +PolyPolygon@16 +PolyPolyline@16 @@ -494,26 +512,6 @@ GetGlyphIndicesA@20 GetTextExtentExPointWPri@28 GetTextExtentPoint32A@16 -PaintRgn@8 -PatBlt@24=NtGdiPatBlt@24 -PATHOBJ_bEnum@8 -PATHOBJ_bEnumClipLines@12 -PATHOBJ_vEnumStart@4 -PATHOBJ_vEnumStartClipLines@16 -PATHOBJ_vGetBounds@8 -PolyPatBlt@20=NtGdiPolyPatBlt@20 -PathToRegion@4 -Pie@36 -PlayEnhMetaFile@12 -PlayEnhMetaFileRecord@16 -PlayMetaFile@8 -PlayMetaFileRecord@16 -PlgBlt@40 -PolyBezier@12 -PolyBezierTo@12 -PolyDraw@16 -PolyPolygon@16 -PolyPolyline@16 PolyTextOutA@12 PolyTextOutW@12 Polygon@12 Modified: trunk/reactos/dll/win32/gdi32/good api.def URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/good%20api…
============================================================================== --- trunk/reactos/dll/win32/gdi32/good api.def (original) +++ trunk/reactos/dll/win32/gdi32/good api.def Sun Sep 2 01:36:44 2007 @@ -155,6 +155,11 @@ GetWorldTransform@8 HT_Get8BPPFormatPalette@16 HT_Get8BPPMaskPalette@24 +PATHOBJ_bEnum@8 +PATHOBJ_bEnumClipLines@12 +PATHOBJ_vEnumStart@4 +PATHOBJ_vEnumStartClipLines@16 +PATHOBJ_vGetBounds@8 Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubs…
============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/stubs.c (original) +++ trunk/reactos/dll/win32/gdi32/misc/stubs.c Sun Sep 2 01:36:44 2007 @@ -2196,57 +2196,6 @@ } -/* - * @unimplemented - */ -BOOL STDCALL -PATHOBJ_bEnum(PATHOBJ *ppo,PATHDATA *ppd) -{ - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - -/* - * @unimplemented - */ -BOOL STDCALL -PATHOBJ_bEnumClipLines(PATHOBJ *ppo,ULONG cb,CLIPLINE *pcl) -{ - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - -/* - * @unimplemented - */ -VOID STDCALL -PATHOBJ_vEnumStart(PATHOBJ *ppo) -{ - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); -} - -/* - * @unimplemented - */ -VOID STDCALL -PATHOBJ_vEnumStartClipLines(PATHOBJ *ppo,CLIPOBJ *pco,SURFOBJ *pso,LINEATTRS *pla) -{ - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); -} - -/* - * @unimplemented - */ -VOID STDCALL -PATHOBJ_vGetBounds(PATHOBJ *ppo,PRECTFX prectfx) -{ - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); -} /* * @unimplemented @@ -2775,15 +2724,39 @@ * when it calls to NtGdiExtEscape from NamedEscape */ return NtGdiExtEscape(NULL,pDriver,wcslen(pDriver),iEsc,cjIn,pjIn,cjOut,pjOut); - -} - - - - - - - - - - +} + + +BOOL +STDCALL +PatBlt(HDC hdc, + int nXLeft, + int nYLeft, + int nWidth, + int nHeight, + DWORD dwRop) +{ + /* FIXME some part need be done in user mode */ + return PatBlt( hdc, nXLeft, nYLeft, nWidth, nHeight, dwRop); +} + +BOOL +STDCALL +PolyPatBlt(IN HDC hdc, + IN DWORD rop4, + IN PPOLYPATBLT pPoly, + IN DWORD Count, + IN DWORD Mode) +{ + /* FIXME some part need be done in user mode */ + return NtGdiPolyPatBlt(hdc, rop4, pPoly,Count,Mode); +} + + + + + + + + +
17 years, 3 months
1
0
0
0
[fireball] 28751: - Finish the memory map code, so it now actually creates a real memory map, with all reserved, unusable pages marked - Add a memory type enum and use it in memory descriptors - Improvements in KiRosFrldrLpbToNtLpb() (separate the code into different functions, bugfixes)
by fireball@svn.reactos.org
Author: fireball Date: Sun Sep 2 00:54:02 2007 New Revision: 28751 URL:
http://svn.reactos.org/svn/reactos?rev=28751&view=rev
Log: - Finish the memory map code, so it now actually creates a real memory map, with all reserved, unusable pages marked - Add a memory type enum and use it in memory descriptors - Improvements in KiRosFrldrLpbToNtLpb() (separate the code into different functions, bugfixes) Modified: trunk/reactos/include/reactos/arc/arc.h trunk/reactos/ntoskrnl/ke/freeldr.c (contents, props changed) trunk/reactos/ntoskrnl/mm/mminit.c Modified: trunk/reactos/include/reactos/arc/arc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/arc/arc.h?…
============================================================================== --- trunk/reactos/include/reactos/arc/arc.h (original) +++ trunk/reactos/include/reactos/arc/arc.h Sun Sep 2 00:54:02 2007 @@ -86,6 +86,27 @@ LoaderMaximum } TYPE_OF_MEMORY; +typedef enum _MEMORY_TYPE +{ + MemoryExceptionBlock, + MemorySystemBlock, + MemoryFree, + MemoryBad, + MemoryLoadedProgram, + MemoryFirmwareTemporary, + MemoryFirmwarePermanent, + MemoryFreeContiguous, + MemorySpecialMemory, + MemoryMaximum +} MEMORY_TYPE; + +typedef struct _MEMORY_DESCRIPTOR +{ + MEMORY_TYPE MemoryType; + ULONG BasePage; + ULONG PageCount; +} MEMORY_DESCRIPTOR, *PMEMORY_DESCRIPTOR; + typedef struct _MEMORY_ALLOCATION_DESCRIPTOR { LIST_ENTRY ListEntry; Modified: trunk/reactos/ntoskrnl/ke/freeldr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/freeldr.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/ke/freeldr.c (original) +++ trunk/reactos/ntoskrnl/ke/freeldr.c Sun Sep 2 00:54:02 2007 @@ -11,6 +11,12 @@ #include <ntoskrnl.h> #define NDEBUG #include <debug.h> + +typedef struct _BIOS_MEMORY_DESCRIPTOR +{ + ULONG BlockBase; + ULONG BlockSize; +} BIOS_MEMORY_DESCRIPTOR, *PBIOS_MEMORY_DESCRIPTOR; /* GLOBALS *******************************************************************/ @@ -39,7 +45,7 @@ CHAR BldrNtHalPath[64]; // 0x025C CHAR BldrNtBootPath[64]; // 0x029C LDR_DATA_TABLE_ENTRY BldrModules[64]; // 0x02DC -MEMORY_ALLOCATION_DESCRIPTOR BldrMemoryDescriptors[64]; // 0x14DC +MEMORY_ALLOCATION_DESCRIPTOR BldrMemoryDescriptors[60]; // 0x14DC WCHAR BldrModuleStrings[64][260]; // 0x19DC WCHAR BldrModuleStringsFull[64][260]; // 0x9BDC NLS_DATA_BLOCK BldrNlsDataBlock; // 0x11DDC @@ -49,6 +55,14 @@ ARC_DISK_SIGNATURE BldrDiskInfo[32]; // 0x1413C // 0x1443C +/* BIOS Memory Map */ +BIOS_MEMORY_DESCRIPTOR BiosMemoryDescriptors[16] = {{0}}; +PBIOS_MEMORY_DESCRIPTOR BiosMemoryDescriptorList = BiosMemoryDescriptors; + +/* ARC Memory Map */ +ULONG NumberDescriptors = 0; +MEMORY_DESCRIPTOR MDArray[60] = {{0}}; + /* FUNCTIONS *****************************************************************/ PMEMORY_ALLOCATION_DESCRIPTOR @@ -56,8 +70,794 @@ KiRosGetMdFromArray(VOID) { /* Return the next MD from the list, but make sure we don't overflow */ - if (BldrCurrentMd > 64) KEBUGCHECK(0); + if (BldrCurrentMd > 60) KEBUGCHECK(0); return &BldrMemoryDescriptors[BldrCurrentMd++]; +} + +VOID +NTAPI +KiRosAddBiosBlock(ULONG Address, + ULONG Size) +{ + PBIOS_MEMORY_DESCRIPTOR BiosBlock = BiosMemoryDescriptorList; + + /* Loop our BIOS Memory Descriptor List */ + while (BiosBlock->BlockSize > 0) + { + /* Check if we've found a matching head block */ + if (Address + Size == BiosBlock->BlockBase) + { + /* Simply enlarge and rebase it */ + BiosBlock->BlockBase = Address; + BiosBlock->BlockSize += Size; + break; + } + + /* Check if we've found a matching tail block */ + if (Address == (BiosBlock->BlockBase + BiosBlock->BlockSize)) + { + /* Simply enlarge it */ + BiosBlock->BlockSize += Size; + break; + } + + /* Nothing suitable found, try the next block */ + BiosBlock++; + } + + /* No usable blocks found, found a free block instead */ + if (!BiosBlock->BlockSize) + { + /* Write our data */ + BiosBlock->BlockBase = Address; + BiosBlock->BlockSize = Size; + + /* Create a new block and mark it as the end of the array */ + BiosBlock++; + BiosBlock->BlockBase = BiosBlock->BlockSize = 0L; + } +} + +VOID +NTAPI +KiRosBuildBiosMemoryMap(VOID) +{ + ULONG j; + ULONG BlockBegin, BlockEnd; + + /* Loop the BIOS Memory Map */ + for (j = 0; j < KeMemoryMapRangeCount; j++) + { + /* Get the start and end addresses */ + BlockBegin = KeMemoryMap[j].BaseAddrLow; + BlockEnd = KeMemoryMap[j].BaseAddrLow + KeMemoryMap[j].LengthLow - 1; + + /* Make sure this isn't a > 4GB descriptor */ + if (!KeMemoryMap[j].BaseAddrHigh) + { + /* Make sure we don't overflow */ + if (BlockEnd < BlockBegin) BlockEnd = 0xFFFFFFFF; + + /* Check if this is free memory */ + if (KeMemoryMap[j].Type == 1) + { + /* Add it to our BIOS descriptors */ + KiRosAddBiosBlock(BlockBegin, BlockEnd - BlockBegin + 1); + } + } + } +} + +NTSTATUS +NTAPI +KiRosAllocateArcDescriptor(IN ULONG PageBegin, + IN ULONG PageEnd, + IN MEMORY_TYPE MemoryType) +{ + ULONG i; + + /* Loop all our descriptors */ + for (i = 0; i < NumberDescriptors; i++) + { + /* Attempt to fing a free block that describes our region */ + if ((MDArray[i].MemoryType == MemoryFree) && + (MDArray[i].BasePage <= PageBegin) && + (MDArray[i].BasePage + MDArray[i].PageCount > PageBegin) && + (MDArray[i].BasePage + MDArray[i].PageCount >= PageEnd)) + { + /* Found one! */ + break; + } + } + + /* Check if we found no free blocks, and fail if so */ + if (i == NumberDescriptors) return ENOMEM; + + /* Check if the block has our base address */ + if (MDArray[i].BasePage == PageBegin) + { + /* Check if it also has our ending address */ + if ((MDArray[i].BasePage + MDArray[i].PageCount) == PageEnd) + { + /* Then convert this region into our new memory type */ + MDArray[i].MemoryType = MemoryType; + } + else + { + /* Otherwise, make sure we have enough descriptors */ + if (NumberDescriptors == 60) return ENOMEM; + + /* Cut this descriptor short */ + MDArray[i].BasePage = PageEnd; + MDArray[i].PageCount -= (PageEnd - PageBegin); + + /* And allocate a new descriptor for our memory range */ + MDArray[NumberDescriptors].BasePage = PageBegin; + MDArray[NumberDescriptors].PageCount = PageEnd - PageBegin; + MDArray[NumberDescriptors].MemoryType = MemoryType; + NumberDescriptors++; + } + } + else if ((MDArray[i].BasePage + MDArray[i].PageCount) == PageEnd) + { + /* This block has our end address, make sure we have a free block */ + if (NumberDescriptors == 60) return ENOMEM; + + /* Rebase this descriptor */ + MDArray[i].PageCount = PageBegin - MDArray[i].BasePage; + + /* And allocate a new descriptor for our memory range */ + MDArray[NumberDescriptors].BasePage = PageBegin; + MDArray[NumberDescriptors].PageCount = PageEnd - PageBegin; + MDArray[NumberDescriptors].MemoryType = MemoryType; + NumberDescriptors++; + } + else + { + /* We'll need two descriptors, make sure they're available */ + if ((NumberDescriptors + 1) >= 60) return ENOMEM; + + /* Allocate a free memory descriptor for what follows us */ + MDArray[NumberDescriptors].BasePage = PageEnd; + MDArray[NumberDescriptors].PageCount = MDArray[i].PageCount - + (PageEnd - MDArray[i].BasePage); + MDArray[NumberDescriptors].MemoryType = MemoryFree; + NumberDescriptors++; + + /* Cut down the current free descriptor */ + MDArray[i].PageCount = PageBegin - MDArray[i].BasePage; + + /* Allocate a new memory descriptor for our memory range */ + MDArray[NumberDescriptors].BasePage = PageBegin; + MDArray[NumberDescriptors].PageCount = PageEnd - PageBegin; + MDArray[NumberDescriptors].MemoryType = MemoryType; + NumberDescriptors++; + } + + /* Everything went well */ + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +KiRosConfigureArcDescriptor(IN ULONG PageBegin, + IN ULONG PageEnd, + IN TYPE_OF_MEMORY MemoryType) +{ + ULONG i; + ULONG BlockBegin, BlockEnd; + MEMORY_TYPE BlockType; + BOOLEAN Combined = FALSE; + + /* If this descriptor seems bogus, just return */ + if (PageEnd <= PageBegin) return STATUS_SUCCESS; + + /* Loop every ARC descriptor, trying to find one we can modify */ + for (i = 0; i < NumberDescriptors; i++) + { + /* Get its settings */ + BlockBegin = MDArray[i].BasePage; + BlockEnd = MDArray[i].BasePage + MDArray[i].PageCount; + BlockType = MDArray[i].MemoryType; + + /* Check if we can fit inside this block */ + if (BlockBegin < PageBegin) + { + /* Check if we are larger then it */ + if ((BlockEnd > PageBegin) && (BlockEnd <= PageEnd)) + { + /* Make it end where we start */ + BlockEnd = PageBegin; + } + + /* Check if it ends after we do */ + if (BlockEnd > PageEnd) + { + /* Make sure we can allocate a descriptor */ + if (NumberDescriptors == 60) return ENOMEM; + + /* Create a descriptor for whatever memory we're not part of */ + MDArray[NumberDescriptors].MemoryType = BlockType; + MDArray[NumberDescriptors].BasePage = PageEnd; + MDArray[NumberDescriptors].PageCount = BlockEnd - PageEnd; + NumberDescriptors++; + + /* The next block ending is now where we begin */ + BlockEnd = PageBegin; + } + } + else + { + /* Check if the blog begins inside our range */ + if (BlockBegin < PageEnd) + { + /* Check if it ends before we do */ + if (BlockEnd < PageEnd) + { + /* Then make it disappear */ + BlockEnd = BlockBegin; + } + else + { + /* Otherwise make it start where we end */ + BlockBegin = PageEnd; + } + } + } + + /* Check if the block matches us, and we haven't tried combining yet */ + if ((BlockType == MemoryType) && !(Combined)) + { + /* Check if it starts where we end */ + if (BlockBegin == PageEnd) + { + /* Make it start with us, and combine us */ + BlockBegin = PageBegin; + Combined = TRUE; + } + else if (BlockEnd == PageBegin) + { + /* Otherwise, it ends where we begin, combine its ending */ + BlockEnd = PageEnd; + Combined = TRUE; + } + } + + /* Check the original block data matches with what we came up with */ + if ((MDArray[i].BasePage == BlockBegin) && + (MDArray[i].PageCount == BlockEnd - BlockBegin)) + { + /* Then skip it */ + continue; + } + + /* Otherwise, set our new settings for this block */ + MDArray[i].BasePage = BlockBegin; + MDArray[i].PageCount = BlockEnd - BlockBegin; + + /* Check if we are killing the block */ + if (BlockBegin == BlockEnd) + { + /* Delete this block and restart the loop properly */ + NumberDescriptors--; + if (i < NumberDescriptors) MDArray[i] = MDArray[NumberDescriptors]; + i--; + } + } + + /* If we got here without combining, we need to allocate a new block */ + if (!(Combined) && (MemoryType < LoaderMaximum)) + { + /* Make sure there's enough descriptors */ + if (NumberDescriptors == 60) return ENOMEM; + + /* Allocate a new block with our data */ + MDArray[NumberDescriptors].MemoryType = MemoryType; + MDArray[NumberDescriptors].BasePage = PageBegin; + MDArray[NumberDescriptors].PageCount = PageEnd - PageBegin; + NumberDescriptors++; + } + + /* Changes complete, return success */ + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +KiRosBuildOsMemoryMap(VOID) +{ + PBIOS_MEMORY_DESCRIPTOR MdBlock; + ULONG BlockStart, BlockEnd, BiasedStart, BiasedEnd, PageStart, PageEnd; + NTSTATUS Status = STATUS_SUCCESS; + ULONG BiosPage = 0xA0; + + /* Loop the BIOS Memory Descriptor List */ + MdBlock = BiosMemoryDescriptorList; + while (MdBlock->BlockSize) + { + /* Get the statrt and end addresses */ + BlockStart = MdBlock->BlockBase; + BlockEnd = BlockStart + MdBlock->BlockSize - 1; + + /* Align them to page boundaries */ + BiasedStart = BlockStart & (PAGE_SIZE - 1); + if (BiasedStart) BlockStart = BlockStart + PAGE_SIZE - BiasedStart; + BiasedEnd = (BlockEnd + 1) & (ULONG)(PAGE_SIZE - 1); + if (BiasedEnd) BlockEnd -= BiasedEnd; + + /* Get the actual page numbers */ + PageStart = BlockStart >> PAGE_SHIFT; + PageEnd = (BlockEnd + 1) >> PAGE_SHIFT; + + /* If we're starting at page 0, then put the BIOS page at the end */ + if (!PageStart) BiosPage = PageEnd; + + /* Check if we did any alignment */ + if (BiasedStart) + { + /* Mark that region as reserved */ + Status = KiRosConfigureArcDescriptor(PageStart - 1, + PageStart, + MemorySpecialMemory); + if (Status != STATUS_SUCCESS) break; + } + + /* Check if we did any alignment */ + if (BiasedEnd) + { + /* Mark that region as reserved */ + Status = KiRosConfigureArcDescriptor(PageEnd - 1, + PageEnd, + MemorySpecialMemory); + if (Status != STATUS_SUCCESS) break; + + /* If the bios page was the last page, use the next one instead */ + if (BiosPage == PageEnd) BiosPage += 1; + } + + /* Check if the page is below the 16MB Memory hole */ + if (PageEnd <= 0xFC0) + { + /* It is, mark the memory a free */ + Status = KiRosConfigureArcDescriptor(PageStart, + PageEnd, + LoaderFree); + } + else if (PageStart >= 0x1000) + { + /* It's over 16MB, so that memory gets marked as reserve */ + Status = KiRosConfigureArcDescriptor(PageStart, + PageEnd, + LoaderReserve); + } + else + { + /* Check if it starts below the memory hole */ + if (PageStart < 0xFC0) + { + /* Mark that part as free */ + Status = KiRosConfigureArcDescriptor(PageStart, + 0xFC0, + MemoryFree); + if (Status != STATUS_SUCCESS) break; + + /* And update the page start for the code below */ + PageStart = 0xFC0; + } + + /* Any code in the memory hole region ends up as reserve */ + Status = KiRosConfigureArcDescriptor(PageStart, + PageEnd, + LoaderReserve); + } + + /* If we failed, break out, otherwise, go to the next BIOS block */ + if (Status != STATUS_SUCCESS) break; + MdBlock++; + } + + /* If anything failed until now, return error code */ + if (Status != STATUS_SUCCESS) return Status; + + /* Set the top 16MB region as reserved */ + Status = KiRosConfigureArcDescriptor(0xFC0, 0x1000, MemorySpecialMemory); + if (Status != STATUS_SUCCESS) return Status; + + /* Setup the BIOS region as reserved */ + KiRosConfigureArcDescriptor(0xA0, 0x100, LoaderMaximum); + KiRosConfigureArcDescriptor(BiosPage, 0x100, MemoryFirmwarePermanent); + + /* Build an entry for the IVT */ + Status = KiRosAllocateArcDescriptor(0, 1, MemoryFirmwarePermanent); + if (Status != STATUS_SUCCESS) return Status; + + /* Build an entry for the KPCR (which we put in page 1) */ + Status = KiRosAllocateArcDescriptor(1, 2, LoaderMemoryData); + if (Status != STATUS_SUCCESS) return Status; + + /* Build an entry for the PDE and return the status */ + Status = KiRosAllocateArcDescriptor(KeRosLoaderBlock-> + PageDirectoryStart >> PAGE_SHIFT, + KeRosLoaderBlock-> + PageDirectoryEnd >> PAGE_SHIFT, + LoaderMemoryData); + return Status; +} + +VOID +NTAPI +KiRosBuildReservedMemoryMap(VOID) +{ + ULONG j; + ULONG BlockBegin, BlockEnd, BiasedPage; + + /* Loop the BIOS Memory Map */ + for (j = 0; j < KeMemoryMapRangeCount; j++) + { + /* Get the start and end addresses */ + BlockBegin = KeMemoryMap[j].BaseAddrLow; + BlockEnd = BlockBegin + KeMemoryMap[j].LengthLow - 1; + + /* Make sure it wasn't a > 4GB descriptor */ + if (!KeMemoryMap[j].BaseAddrHigh) + { + /* Make sure it doesn't overflow */ + if (BlockEnd < BlockBegin) BlockEnd = 0xFFFFFFFF; + + /* Check if this was free memory */ + if (KeMemoryMap[j].Type == 1) + { + /* Get the page-aligned addresses */ + BiasedPage = BlockBegin & (PAGE_SIZE - 1); + BlockBegin >>= PAGE_SHIFT; + if (BiasedPage) BlockBegin++; + BlockEnd = (BlockEnd >> PAGE_SHIFT) + 1; + + /* Check if the block is within the 16MB memory hole */ + if ((BlockBegin < 0xFC0) && (BlockEnd >= 0xFC0)) + { + /* Don't allow it to cross this boundary */ + BlockBegin = 0xFC0; + } + + /* Check if the boundary is across 16MB */ + if ((BlockEnd > 0xFFF) && (BlockBegin <= 0xFFF)) + { + /* Don't let it cross */ + BlockEnd = 0xFFF; + } + + /* Check if the block describes the memory hole */ + if ((BlockBegin >= 0xFC0) && (BlockEnd <= 0xFFF)) + { + /* Set this region as temporary */ + KiRosConfigureArcDescriptor(BlockBegin, + BlockEnd, + MemoryFirmwareTemporary); + } + } + else + { + /* Get the page-aligned addresses */ + BlockBegin >>= PAGE_SHIFT; + BiasedPage = (BlockEnd + 1) & (PAGE_SIZE - 1); + BlockEnd >>= PAGE_SHIFT; + if (BiasedPage) BlockEnd++; + + /* Set this memory as reserved */ + KiRosConfigureArcDescriptor(BlockBegin, + BlockEnd + 1, + MemorySpecialMemory); + } + } + } +} + +VOID +NTAPI +KiRosInsertNtDescriptor(IN PMEMORY_ALLOCATION_DESCRIPTOR NewDescriptor) +{ + PLIST_ENTRY ListHead, PreviousEntry, NextEntry; + PMEMORY_ALLOCATION_DESCRIPTOR Descriptor = NULL, NextDescriptor = NULL; + + /* Loop the memory descriptor list */ + ListHead = &KeLoaderBlock->MemoryDescriptorListHead; + PreviousEntry = ListHead; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + /* Get the current descriptor and check if it's below ours */ + NextDescriptor = CONTAINING_RECORD(NextEntry, + MEMORY_ALLOCATION_DESCRIPTOR, + ListEntry); + if (NewDescriptor->BasePage < NextDescriptor->BasePage) break; + + /* It isn't, save the previous entry and descriptor, and try again */ + PreviousEntry = NextEntry; + Descriptor = NextDescriptor; + NextEntry = NextEntry->Flink; + } + + /* So we found the right spot to insert. Is this free memory? */ + if (NewDescriptor->MemoryType != LoaderFree) + { + /* It isn't, so insert us before the last descriptor */ + InsertHeadList(PreviousEntry, &NewDescriptor->ListEntry); + } + else + { + /* We're free memory. Check if the entry we found is also free memory */ + if ((PreviousEntry != ListHead) && + ((Descriptor->MemoryType == LoaderFree) || + (Descriptor->MemoryType == LoaderReserve)) && + ((Descriptor->BasePage + Descriptor->PageCount) == + NewDescriptor->BasePage)) + { + /* It's free memory, and we're right after it. Enlarge that block */ + Descriptor->PageCount += NewDescriptor->PageCount; + NewDescriptor = Descriptor; + } + else + { + /* Our range scan't be combined, so just insert us separately */ + InsertHeadList(PreviousEntry, &NewDescriptor->ListEntry); + } + + /* Check if we merged with an existing free memory block */ + if ((NextEntry != ListHead) && + ((NextDescriptor->MemoryType == LoaderFree) || + (NextDescriptor->MemoryType == LoaderReserve)) && + ((NewDescriptor->BasePage + NewDescriptor->PageCount) == + NextDescriptor->BasePage)) + { + /* Update our own block */ + NewDescriptor->PageCount += NextDescriptor->PageCount; + + /* Remove the next block */ + RemoveEntryList(&NextDescriptor->ListEntry); + } + } +} + +NTSTATUS +NTAPI +KiRosBuildNtDescriptor(IN PMEMORY_ALLOCATION_DESCRIPTOR MemoryDescriptor, + IN MEMORY_TYPE MemoryType, + IN ULONG BasePage, + IN ULONG PageCount) +{ + PMEMORY_ALLOCATION_DESCRIPTOR Descriptor, NextDescriptor = NULL; + LONG Delta; + TYPE_OF_MEMORY CurrentType; + BOOLEAN UseNext; + + /* Check how many pages we'll be consuming */ + Delta = BasePage - MemoryDescriptor->BasePage; + if (!(Delta) && (PageCount == MemoryDescriptor->PageCount)) + { + /* We can simply convert the current descriptor into our new type */ + MemoryDescriptor->MemoryType = MemoryType; + } + else + { + /* Get the current memory type of the descriptor, and reserve it */ + CurrentType = MemoryDescriptor->MemoryType; + MemoryDescriptor->MemoryType = LoaderSpecialMemory; + + /* Check if we'll need another descriptor for what's left of memory */ + UseNext = ((BasePage != MemoryDescriptor->BasePage) && + (Delta + PageCount != MemoryDescriptor->PageCount)); + + /* Get a descriptor */ + Descriptor = KiRosGetMdFromArray(); + if (!Descriptor) return STATUS_INSUFFICIENT_RESOURCES; + + /* Check if we are using another descriptor */ + if (UseNext) + { + /* Allocate that one too */ + NextDescriptor = KiRosGetMdFromArray(); + if (!NextDescriptor) return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Build the descriptor we got */ + Descriptor->MemoryType = MemoryType; + Descriptor->BasePage = BasePage; + Descriptor->PageCount = PageCount; + + /* Check if we're starting at the same place as the old one */ + if (BasePage == MemoryDescriptor->BasePage) + { + /* Simply decrease the old descriptor and rebase it */ + MemoryDescriptor->BasePage += PageCount; + MemoryDescriptor->PageCount -= PageCount; + MemoryDescriptor->MemoryType = CurrentType; + } + else if (Delta + PageCount == MemoryDescriptor->PageCount) + { + /* We finish where the old one did, shorten it */ + MemoryDescriptor->PageCount -= PageCount; + MemoryDescriptor->MemoryType = CurrentType; + } + else + { + /* We're inside the current block, mark our free region */ + NextDescriptor->MemoryType = LoaderFree; + NextDescriptor->BasePage = BasePage + PageCount; + NextDescriptor->PageCount = MemoryDescriptor->PageCount - + (PageCount + Delta); + + /* And cut down the current descriptor */ + MemoryDescriptor->PageCount = Delta; + MemoryDescriptor->MemoryType = CurrentType; + + /* Finally, insert our new free descriptor into the list */ + KiRosInsertNtDescriptor(NextDescriptor); + } + + /* Insert the descriptor we allocated */ + KiRosInsertNtDescriptor(Descriptor); + } + + /* Return success */ + return STATUS_SUCCESS; +} + +PMEMORY_ALLOCATION_DESCRIPTOR +NTAPI +KiRosFindNtDescriptor(IN ULONG BasePage) +{ + PMEMORY_ALLOCATION_DESCRIPTOR MdBlock = NULL; + PLIST_ENTRY NextEntry, ListHead; + + /* Scan the memory descriptor list */ + ListHead = &KeLoaderBlock->MemoryDescriptorListHead; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + /* Get the current descriptor */ + MdBlock = CONTAINING_RECORD(NextEntry, + MEMORY_ALLOCATION_DESCRIPTOR, + ListEntry); + + /* Check if it can contain our memory range */ + if ((MdBlock->BasePage <= BasePage) && + (MdBlock->BasePage + MdBlock->PageCount > BasePage)) + { + /* It can, break out */ + break; + } + + /* Go to the next descriptor */ + NextEntry = NextEntry->Flink; + } + + /* Return the descriptor we found, if any */ + return MdBlock; +} + +NTSTATUS +NTAPI +KiRosAllocateNtDescriptor(IN TYPE_OF_MEMORY MemoryType, + IN ULONG BasePage, + IN ULONG PageCount, + IN ULONG Alignment, + OUT PULONG ReturnedBase) +{ + PMEMORY_ALLOCATION_DESCRIPTOR MdBlock; + ULONG AlignedBase, AlignedLimit; + PMEMORY_ALLOCATION_DESCRIPTOR ActiveMdBlock; + ULONG ActiveAlignedBase = 0; + PLIST_ENTRY NextEntry, ListHead; + + /* If no information was given, make some assumptions */ + if (!Alignment) Alignment = 1; + if (!PageCount) PageCount = 1; + + /* Start looking for a matching descvriptor */ + do + { + /* Calculate the limit of the range */ + AlignedLimit = PageCount + BasePage; + + /* Find a descriptor that already contains our base address */ + MdBlock = KiRosFindNtDescriptor(BasePage); + if (MdBlock) + { + /* If it contains our limit as well, break out early */ + if ((MdBlock->PageCount + MdBlock->BasePage) > AlignedLimit) break; + } + + /* Loop the memory list */ + ActiveMdBlock = NULL; + ListHead = &KeLoaderBlock->MemoryDescriptorListHead; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + /* Get the current descriptors */ + MdBlock = CONTAINING_RECORD(NextEntry, + MEMORY_ALLOCATION_DESCRIPTOR, + ListEntry); + + /* Align the base address and our limit */ + AlignedBase = (MdBlock->BasePage + (Alignment - 1)) &~ Alignment; + AlignedLimit = MdBlock->PageCount - + AlignedBase + + MdBlock->BasePage; + + /* Check if this is a free block that can satisfy us */ + if ((MdBlock->MemoryType == LoaderFree) && + (AlignedLimit <= MdBlock->PageCount) && + (PageCount <= AlignedLimit)) + { + /* It is, stop searching */ + ActiveMdBlock = MdBlock; + ActiveAlignedBase = AlignedBase; + break; + } + + /* Try the next block */ + NextEntry = NextEntry->Flink; + } + + /* See if we came up with an adequate block */ + if (ActiveMdBlock) + { + /* Generate a descriptor in it */ + *ReturnedBase = AlignedBase; + return KiRosBuildNtDescriptor(ActiveMdBlock, + MemoryType, + ActiveAlignedBase, + PageCount); + } + } while (TRUE); + + /* We found a matching block, generate a descriptor with it */ + *ReturnedBase = BasePage; + return KiRosBuildNtDescriptor(MdBlock, MemoryType, BasePage, PageCount); +} + +NTSTATUS +NTAPI +KiRosBuildArcMemoryList(VOID) +{ + PMEMORY_ALLOCATION_DESCRIPTOR Descriptor; + MEMORY_DESCRIPTOR *Memory; + ULONG i; + + /* Loop all BIOS Memory Descriptors */ + for (i = 0; i < NumberDescriptors; i++) + { + /* Get the current descriptor */ + Memory = &MDArray[i]; + + /* Allocate an NT Memory Descriptor */ + Descriptor = KiRosGetMdFromArray(); + if (!Descriptor) return ENOMEM; + + /* Copy the memory type */ + Descriptor->MemoryType = Memory->MemoryType; + if (Memory->MemoryType == MemoryFreeContiguous) + { + /* Convert this to free */ + Descriptor->MemoryType = LoaderFree; + } + else if (Memory->MemoryType == MemorySpecialMemory) + { + /* Convert this to special memory */ + Descriptor->MemoryType = LoaderSpecialMemory; + } + + /* Copy the range data */ + Descriptor->BasePage = Memory->BasePage; + Descriptor->PageCount = Memory->PageCount; + + /* Insert the descriptor */ + if (Descriptor->PageCount) KiRosInsertNtDescriptor(Descriptor); + } + + /* All went well */ + return STATUS_SUCCESS; } VOID @@ -67,7 +867,6 @@ { PLOADER_PARAMETER_BLOCK LoaderBlock; PLDR_DATA_TABLE_ENTRY LdrEntry; - PMEMORY_ALLOCATION_DESCRIPTOR MdEntry; PLOADER_MODULE RosEntry; ULONG i, j, ModSize; PVOID ModStart; @@ -79,15 +878,16 @@ WCHAR PathToDrivers[] = L"\\SystemRoot\\System32\\drivers\\"; WCHAR PathToSystem32[] = L"\\SystemRoot\\System32\\"; CHAR DriverNameLow[256]; + ULONG Base; /* First get some kernel-loader globals */ AcpiTableDetected = (RosLoaderBlock->Flags & MB_FLAGS_ACPI_TABLE) ? TRUE : FALSE; - MmFreeLdrMemHigher = RosLoaderBlock->MemHigher; - MmFreeLdrPageDirectoryEnd = RosLoaderBlock->PageDirectoryEnd; + MmFreeLdrMemHigher = RosLoaderBlock->MemHigher; + MmFreeLdrPageDirectoryEnd = RosLoaderBlock->PageDirectoryEnd; if (!MmFreeLdrPageDirectoryEnd) MmFreeLdrPageDirectoryEnd = 0x40000; /* Set the NT Loader block and initialize it */ - *NtLoaderBlock = LoaderBlock = &BldrLoaderBlock; + *NtLoaderBlock = KeLoaderBlock = LoaderBlock = &BldrLoaderBlock; RtlZeroMemory(LoaderBlock, sizeof(LOADER_PARAMETER_BLOCK)); /* Set the NLS Data block */ @@ -105,63 +905,17 @@ InitializeListHead(&LoaderBlock->BootDriverListHead); InitializeListHead(&LoaderBlock->ArcDiskInformation->DiskSignatureListHead); - /* Create one large blob of free memory */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderFree; - MdEntry->BasePage = 0; - MdEntry->PageCount = MmFreeLdrMemHigher / 4; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, &MdEntry->ListEntry); - - /* - * FIXME: Instead of just "inserting" MDs into the list, - * we need to make then be "consumed" from the Free Descriptor. - * This will happen soon (and also ensure a sorted list). - */ - - /* Loop the BIOS Memory Map */ - for (j = 0; j < KeMemoryMapRangeCount; j++) - { - /* Check if this is a reserved entry */ - if (KeMemoryMap[j].Type == 2) - { - /* It is, build an entry for it */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderSpecialMemory; - MdEntry->BasePage = KeMemoryMap[j].BaseAddrLow >> PAGE_SHIFT; - MdEntry->PageCount = (KeMemoryMap[j].LengthLow + PAGE_SIZE - 1) >> PAGE_SHIFT; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, - &MdEntry->ListEntry); - } - } - - /* Page 0 is reserved: build an entry for it */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderFirmwarePermanent; - MdEntry->BasePage = 0; - MdEntry->PageCount = 1; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, &MdEntry->ListEntry); - - /* Build an entry for the KPCR (which we put in page 1) */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderMemoryData; - MdEntry->BasePage = 1; - MdEntry->PageCount = 1; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, &MdEntry->ListEntry); - - /* Build an entry for the PDE */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderMemoryData; - MdEntry->BasePage = (ULONG_PTR)MmGetPageDirectory() >> PAGE_SHIFT; - MdEntry->PageCount = (MmFreeLdrPageDirectoryEnd - - (ULONG_PTR)MmGetPageDirectory()) / PAGE_SIZE; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, &MdEntry->ListEntry); - - /* Mark Video ROM as reserved */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderFirmwarePermanent; - MdEntry->BasePage = 0xA0000 >> PAGE_SHIFT; - MdEntry->PageCount = (0xE8000 - 0xA0000) / PAGE_SIZE; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, &MdEntry->ListEntry); + /* Build the free memory map, which uses BIOS Descriptors */ + KiRosBuildBiosMemoryMap(); + + /* Build entries for ReactOS memory ranges, which uses ARC Descriptors */ + KiRosBuildOsMemoryMap(); + + /* Build entries for the reserved map, which uses ARC Descriptors */ + KiRosBuildReservedMemoryMap(); + + /* Now convert the BIOS and ARC Descriptors into NT Memory Descirptors */ + KiRosBuildArcMemoryList(); /* Loop boot driver list */ for (i = 0; i < RosLoaderBlock->ModsCount; i++) @@ -180,12 +934,12 @@ LoaderBlock->NlsData->AnsiCodePageData = ModStart; /* Create an MD for it */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderNlsData; - MdEntry->BasePage = ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> PAGE_SHIFT; - MdEntry->PageCount = (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, - &MdEntry->ListEntry); + KiRosAllocateNtDescriptor(LoaderNlsData, + ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> + PAGE_SHIFT, + (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, + 0, + &Base); continue; } else if (!_stricmp(DriverName, "oem.nls")) @@ -195,12 +949,12 @@ LoaderBlock->NlsData->OemCodePageData = ModStart; /* Create an MD for it */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderNlsData; - MdEntry->BasePage = ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> PAGE_SHIFT; - MdEntry->PageCount = (ModSize + PAGE_SIZE - 1) >> PAGE_SHIFT; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, - &MdEntry->ListEntry); + KiRosAllocateNtDescriptor(LoaderNlsData, + ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> + PAGE_SHIFT, + (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, + 0, + &Base); continue; } else if (!_stricmp(DriverName, "casemap.nls")) @@ -210,12 +964,12 @@ LoaderBlock->NlsData->UnicodeCodePageData = ModStart; /* Create an MD for it */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderNlsData; - MdEntry->BasePage = ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> PAGE_SHIFT; - MdEntry->PageCount = (ModSize + PAGE_SIZE - 1) >> PAGE_SHIFT; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, - &MdEntry->ListEntry); + KiRosAllocateNtDescriptor(LoaderNlsData, + ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> + PAGE_SHIFT, + (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, + 0, + &Base); continue; } @@ -232,12 +986,12 @@ LoaderBlock->SetupLdrBlock = NULL; /* Create an MD for it */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderRegistryData; - MdEntry->BasePage = ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> PAGE_SHIFT; - MdEntry->PageCount = (ModSize + PAGE_SIZE - 1) >> PAGE_SHIFT; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, - &MdEntry->ListEntry); + KiRosAllocateNtDescriptor(LoaderRegistryData, + ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> + PAGE_SHIFT, + (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, + 0, + &Base); continue; } @@ -246,13 +1000,11 @@ !(_stricmp(DriverName, "hardware.hiv"))) { /* Create an MD for it */ - ModStart = RVA(ModStart, KSEG0_BASE); - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderRegistryData; - MdEntry->BasePage = ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> PAGE_SHIFT; - MdEntry->PageCount = (ModSize + PAGE_SIZE - 1) >> PAGE_SHIFT; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, - &MdEntry->ListEntry); + KiRosAllocateNtDescriptor(LoaderRegistryData, + (ULONG_PTR)ModStart >> PAGE_SHIFT, + (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, + 0, + &Base); continue; } @@ -260,32 +1012,32 @@ if (!(_stricmp(DriverName, "ntoskrnl.exe"))) { /* Create an MD for it */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderSystemCode; - MdEntry->BasePage = ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> PAGE_SHIFT; - MdEntry->PageCount = (ModSize + PAGE_SIZE - 1) >> PAGE_SHIFT; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, - &MdEntry->ListEntry); + KiRosAllocateNtDescriptor(LoaderSystemCode, + ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> + PAGE_SHIFT, + (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, + 0, + &Base); } else if (!(_stricmp(DriverName, "hal.dll"))) { /* Create an MD for the HAL */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderHalCode; - MdEntry->BasePage = ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> PAGE_SHIFT; - MdEntry->PageCount = (ModSize + PAGE_SIZE - 1) >> PAGE_SHIFT; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, - &MdEntry->ListEntry); + KiRosAllocateNtDescriptor(LoaderHalCode, + ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> + PAGE_SHIFT, + (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, + 0, + &Base); } else { /* Create an MD for any driver */ - MdEntry = KiRosGetMdFromArray(); - MdEntry->MemoryType = LoaderBootDriver; - MdEntry->BasePage = ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> PAGE_SHIFT; - MdEntry->PageCount = (ModSize + PAGE_SIZE - 1) >> PAGE_SHIFT; - InsertTailList(&LoaderBlock->MemoryDescriptorListHead, - &MdEntry->ListEntry); + KiRosAllocateNtDescriptor(LoaderBootDriver, + ((ULONG_PTR)ModStart &~ KSEG0_BASE) >> + PAGE_SHIFT, + (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, + 0, + &Base); } /* Lowercase the drivername so we can check its extension later */ @@ -361,7 +1113,9 @@ /* Save the number of pages the kernel images take */ LoaderBlock->Extension->LoaderPagesSpanned = - MmFreeLdrLastKrnlPhysAddr - MmFreeLdrFirstKrnlPhysAddr; + PAGE_ROUND_UP(KeRosLoaderBlock-> + ModsAddr[KeRosLoaderBlock->ModsCount - 1].ModEnd) - + KeRosLoaderBlock->ModsAddr[0].ModStart; LoaderBlock->Extension->LoaderPagesSpanned /= PAGE_SIZE; /* Now setup the setup block if we have one */ @@ -452,16 +1206,15 @@ /* Save pointer to ROS Block */ KeRosLoaderBlock = LoaderBlock; - - /* Save memory manager data */ MmFreeLdrLastKernelAddress = PAGE_ROUND_UP(KeRosLoaderBlock-> ModsAddr[KeRosLoaderBlock-> ModsCount - 1]. - ModEnd); + ModEnd); MmFreeLdrFirstKrnlPhysAddr = KeRosLoaderBlock->ModsAddr[0].ModStart - KSEG0_BASE; MmFreeLdrLastKrnlPhysAddr = MmFreeLdrLastKernelAddress - KSEG0_BASE; + /* Save memory manager data */ KeMemoryMapRangeCount = 0; if (LoaderBlock->Flags & MB_FLAGS_MMAP_INFO) { Propchange: trunk/reactos/ntoskrnl/ke/freeldr.c ------------------------------------------------------------------------------ --- svn:needs-lock (original) +++ svn:needs-lock (removed) @@ -1,1 +1,0 @@ -* Modified: trunk/reactos/ntoskrnl/mm/mminit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/mm/mminit.c (original) +++ trunk/reactos/ntoskrnl/mm/mminit.c Sun Sep 2 00:54:02 2007 @@ -326,7 +326,8 @@ "MemoryData ", // not used "NlsData ", // used "SpecialMemory ", // == Bad - "BBTMemory " // == Bad + "BBTMemory ", + "LoaderReserve "// == Bad }; VOID
17 years, 3 months
1
0
0
0
[greatlrd] 28750: revert 28748 that change are incorrect, it shall only check if the bits are set or not, if no flag are set we shall fail, if one flag are set we shall doing the call.
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sun Sep 2 00:25:50 2007 New Revision: 28750 URL:
http://svn.reactos.org/svn/reactos?rev=28750&view=rev
Log: revert 28748 that change are incorrect, it shall only check if the bits are set or not, if no flag are set we shall fail, if one flag are set we shall doing the call. Modified: trunk/reactos/dll/win32/gdi32/objects/font.c Modified: trunk/reactos/dll/win32/gdi32/objects/font.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/fo…
============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/font.c (original) +++ trunk/reactos/dll/win32/gdi32/objects/font.c Sun Sep 2 00:25:50 2007 @@ -1091,13 +1091,17 @@ STDCALL AddFontResourceExW ( LPCWSTR lpszFilename, DWORD fl, PVOID pvReserved ) { - if (fl & ~(FR_PRIVATE | FR_NOT_ENUM)) + int retVal = 0; + + if (fl & (FR_PRIVATE | FR_NOT_ENUM)) + { + retVal = GdiAddFontResourceW(lpszFilename, fl,0); + } + else { SetLastError( ERROR_INVALID_PARAMETER ); - return 0; - } - - return GdiAddFontResourceW(lpszFilename, fl,0); + } + return retVal; } @@ -1110,24 +1114,26 @@ { NTSTATUS Status; PWSTR FilenameW; - int rc; - - if (fl & ~(FR_PRIVATE | FR_NOT_ENUM)) + int rc = 0; + + if (!(fl & (FR_PRIVATE | FR_NOT_ENUM))) { SetLastError( ERROR_INVALID_PARAMETER ); - return 0; - } - - Status = HEAP_strdupA2W ( &FilenameW, lpszFilename ); - if ( !NT_SUCCESS (Status) ) - { - SetLastError (RtlNtStatusToDosError(Status)); - return 0; - } - - rc = GdiAddFontResourceW ( FilenameW, fl, 0 ); - HEAP_free ( FilenameW ); - return rc; + } + else + { + Status = HEAP_strdupA2W ( &FilenameW, lpszFilename ); + if ( !NT_SUCCESS (Status) ) + { + SetLastError (RtlNtStatusToDosError(Status)); + } + else + { + rc = GdiAddFontResourceW ( FilenameW, fl, 0 ); + HEAP_free ( FilenameW ); + } + } + return rc; }
17 years, 3 months
1
0
0
0
[cwittich] 28749: set eol-style:native
by cwittich@svn.reactos.org
Author: cwittich Date: Sat Sep 1 23:53:06 2007 New Revision: 28749 URL:
http://svn.reactos.org/svn/reactos?rev=28749&view=rev
Log: set eol-style:native Modified: trunk/reactos/dll/win32/stdole2.tlb/std_ole_v2.idl (props changed) trunk/reactos/dll/win32/stdole2.tlb/stdole2.tlb.spec (props changed) Propchange: trunk/reactos/dll/win32/stdole2.tlb/std_ole_v2.idl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/dll/win32/stdole2.tlb/stdole2.tlb.spec ------------------------------------------------------------------------------ svn:eol-style = native
17 years, 3 months
1
0
0
0
← Newer
1
...
54
55
56
57
58
59
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Results per page:
10
25
50
100
200