The Chaotic-Neutron

Cool

The Windows XP PC Boot Process

by on Dec.03, 2005, under Cool, Educational, Programming

  Power supply switched on. rarrow The power supply performs a self-test – When all voltages and current levels are acceptable, the supply indicates that the power is stable and sends the Power Good signal to the processor. The time from switch-on to Power Good is usually between .1 and .5 seconds.
  darrow    
  The microprocessor timer chip receives the Power Good signal. rarrow With the arrival of the Power Good signal the timer chip stops sending reset signals to the processor allowing the CPU to begin operations.
  darrow    
  The CPU starts executing the ROM BIOS code. rarrow The CPU loads the ROM BIOS starting at ROM memory address FFFF:0000 which is only 16 bytes from the top of ROM memory. As such it contains only a JMP (jump) instruction that points to the actual address of the ROM BIOS code.
  darrow    
  The ROM BIOS performs a basic test of central hardware to verify basic functionality. rarrow Any errors that occur at this point in the boot process will be reported by means of ‘beep-codes’ because the video subsystem has not yet been initialized.
  darrow    
  The BIOS searches for adapters that may need to load their own ROM BIOS routines. rarrow Video adapters provide the most common source of adapter ROM BIOS. The start-up BIOS routines scan memory addresses C000:0000 through C780:0000 to find video ROM. An error loading any adapter ROM generates an error such as:

XXXX ROM Error

where XXXX represents the segment address of the failed module.

  darrow    
  The ROM BIOS checks to see if this is a ‘cold-start’ or a ‘warm-start’ rarrow To determine whether this is a warm-start or a cold start the ROM BIOS startup routines check the value of two bytes located at memory location 0000:0472. Any value other than 1234h indicates that this is a cold-start.
  darrow    
  If this is a cold-start the ROM BIOS executes a full POST (Power On Self Test). If this is a warm-start the memory test portion of the POST is switched off. rarrow The POST can be broken down into three components:
The Video Test initializes the video adapter, tests the video card and video memory, and displays configuration information or any errors.
The BIOS Identification displays the BIOS version, manufacturer, and date. The Memory Test tests the memory chips and displays a running sum of installed memory.
  darrow   Errors the occur during the POST can be classified as either ‘fatal’ or ‘non-fatal’. A non-fatal error will typically display an error message on screen and allow the system to continue the boot process. A fatal error, on the other hand, stops the process of booting the computer and is generally signaled by a series of beep-codes.
  The BIOS locates and reads the configuration information stored in CMOS. rarrow CMOS (which stands for Complementary Metal-Oxide Semiconductor) is a small area of memory (64 bytes) which is maintained by the current of a small battery attached to the motherboard. Most importantly for the ROM BIOS startup routines CMOS indicates the order in which drives should be examined for an operating systems – floppy first, CD-Rom first, or fixed disk first.
Fixed Disk darrow    
  If the first bootable disk is a fixed disk the BIOS examines the very first sector of the disk for a Master Boot Record (MBR). For a floppy the BIOS looks for a Boot Record in the very first sector. rarrow On a fixed disk the Master Boot Record occupies the very first sector at cylinder 0, head 0, sector 1. It is 512 bytes in size. If this sector is found it is loaded into memory at address 0000:7C00 and tested for a valid signature. A valid signature would be the value 55AAh in the last two bytes. Lacking an MBR or a valid signature the boot process halts with an error message which might read:

NO ROM BASIC – SYSTEM HALTED

A Master Boot Record is made up of two parts – the partition table which describes the layout of the fixed disk and the partition loader code which includes instructions for continuing the boot process.

  darrow    
MBR With a valid MBR loaded into memory the BIOS transfers control of the boot process to the partition loader code that takes up most of the 512 bytes of the MBR. rarrow The process of installing multiple operating systems on a single PC usually involves replacing the original partition loader code with a Boot Loader program that allows the user to select the specific fixed disk to load in the next step of the process
  darrow    
Partition Table The partition loader (or Boot Loader) examines the partition table for a partition marked as active. The partition loader then searches the very first sector of that partition for a Boot Record. rarrow The Boot Record is also 512 bytes and contains a table that describes the characteristics of the partition (number of bytes per sectors, number of sectors per cluster, etc.) and also the jump code that locates the first of the operating system files (IO.SYS in DOS).
Operating System darrow    
Boot Record The active partition’s boot record is checked for a valid boot signature and if found the boot sector code is executed as a program. rarrow The loading of Windows XP is controlled by the file NTLDR which is a hidden, system file that resides in the root directory of the system partition. NTLDR will load XP in four stages:

1) Initial Boot Loader Phase
2) Operating System selection
3) Hardware Detection
4) Configuration Selection

  darrow    
NTLDR
Initial Phase
During the initial phase NTLDR switches the processor from real-mode to protected mode which places the processor in 32-bit memory mode and turns memory paging on. It then loads the appropriate mini-file system drivers to allow NTLDR to load files from a partition formatted with any of the files systems supported by XP. rarrow Windows XP supports partitions formatted with either the FAT-16, FAT-32, or NTFS file system.
  darrow    
NTLDR
OS Selection
BOOT.INI
If the file BOOT.INI is located in the root directory NTLDR will read it’s contents into
memory. If BOOT.INI contains entries for more than one operating system NTLDR will stop the boot sequence at this point, display a menu of choices, and wait for a specified period of time for the user to make a selection.
rarrow If the file BOOT.INI is not found in the root directory NTLDR will continue the boot
sequence and attempt to load XP from the first partition of the first disk, typically C:\.
  darrow    
F8 Assuming that the operating system being loaded is Windows NT, 2000, or XP pressing F8 at this stage of the boot sequence to display various boot options including “Safe Mode” and “Last Known Good Configuration” rarrow After each successful boot sequence XP makes a copy of the current combination of driver and system settings and stores it as the Last Known Good Configuration. This collection of settings can be used to boot the system subsequently if the installation of some new device has caused a boot failure.
  darrow    
NTLDR
Hardware Detection
If the selected operating system is XP, NTLDR will continue the boot process by locating and loading the DOS based NTDETECT.COM program to perform hardware detection. rarrow NTDETECT.COM collects a list of currently installed hardware components and returns this list for later inclusion in the registry under the HKEY_LOCAL_MACHINEHARDWARE key.
  darrow    
NTLDR
Configuration Selection
If this computer has
more than one defined Hardware Profile the NTLDR program will stop at
this point and display the Hardware Profiles/Configuration Recovery
menu.
rarrow Lacking more than one Hardware Profile NTLDR will skip this step and not display this menu.
  darrow    
Kernel Load After selecting a hardware configuration (if necessary) NTLDR begins loading the XP kernel (NTOSKRNL.EXE). rarrow During the loading of the kernel (but before it is initialized) NTLDR remains in control of the computer. The screen is cleared and a series of white rectangles progress across the bottom of the screen. NTLDR also loads the Hardware Abstraction Layer (HAL.DLL) at this time which will insulate the kernel from hardware. Both files are located in the \system32 directory.
  darrow    
NTLDR
Boot
Device Drivers
NTLDR now loads device drivers that are marked as boot devices. With the loading of these drivers NTLDR relinquishes control of the computer. rarrow Every driver has a registry subkey entry under HKEY_LOCAL_MACHINE
\SYSTEM\Services. Any driver that has a Start value of SERVICE_BOOT_START is considered a device to start at boot up. A period is printed to the screen for each loaded file (unless the /SOS switch is used in which case file names are printed.
  darrow    
Kernel Initialization NTOSKRNL goes through two phases in its boot process – phase 0 and phase 1. Phase 0 initializes just enough of the microkernel and Executive subsystems so that basic services required for the completion of initialization become available.. At this point, the system display a graphical screen with a status bar indicating load status. rarrow XP disables interrupts during phase 0 and enables them before phase 1. The HAL is called to prepare the interrupt controller; the Memory Manager, Object Manager, Security Reference Monitor, and Process Manager are initialized.

Phase 1 begins when the HAL is called to prepare the system to accept interrupts from devices. If more than one processor is present the additional processors are initialized at this point. All Executive subsystems are reinitialized in the following order:

1) Object Manager
2) Executive
3) Microkernel
4) Security Reference Monitor
5) Memory Manager
6) Cache Manager
7) LPCS
8) I/O Manager
9) Process Manager

  darrow    
I/O Manager The initialization of I/O Manager begins the process of loading all the systems driver files. Picking up where NTLDR left off, it first finishes the loading of boot
devices. Next it assembles a prioritized list of drivers and attempts to load each in turn.
rarrow The failure of a driver to load may prompt NT to reboot and try to start the system using the values stored in the Last Known Good Configuration.
  darrow    
SMSS The last task for phase 1 initialization of the kernel is to launch the Session Manager Subsystem (SMSS). SMSS is responsible for creating the user-mode environment that provides the visible interface to NT. rarrow SMSS runs in user-mode but unlike other user-mode applications SMSS is considered a trusted part of the operating system and is also a native application (it uses only core Executive functions). These two features allow SMSS to start the graphics subsystem and login processes.
  darrow    
win32k.sys SMSS loads the win32k.sys device driver which implements the Win32 graphics subsystem. rarrow Shortly after win32k.sys starts it switches the screen into graphics mode. The Services Subsystem now starts all services mark as Auto Start. Once all devices and services are started the boot is deemed successful and this configuration is saved as the Last Known Good Configuration.
  darrow    
Logon The XP boot process is not considered complete until a user has successfully logged onto the system. The process is begun by the WINLOGON.EXE file which is loaded as a service by the kernel and continued by the Local Security Authority (LSASS.EXE) which displays the logon dialog box. rarrow This dialog box appears at approximately the time that the Services Subsystem starts the network service.
2 Comments more...

Choosing good passwords

by on Dec.02, 2005, under Computers, Cool, Educational

A farewell mail from one of Apple’s security professionals. Derrick Donnelly, in his farewell mail, made these very interesting suggestions for choosing a good password.

My final words

Remember security starts at the keyboard in front of you:

A 6 character password has about fifty six billion (56,800,235,584) possibilities and the average computer (the G5 is even faster) can try all combinations (crack them) in 2.5 hours.

A 7 character password has about three and a half trillion (3,521,614,606,208) possibilities and a computer can try all combinations in about 1 week.

An 8 character password has about two hundred trillion (218,340,105,584,896) possibilities and a computer can try all its combinations in about a year.

A 9 character password would take about 70 years for a computer to try all combinations.

They say the chips coming in about a year could half these times! Now if you do not want to wait for next year’s chip, you can always put 2 computers in parallel and half the time. In theory you could put 365 computers in parallel and break 8 character passwords in just over a day (Virginia Tech just put 1100 G5s in parallel). Do you think hackers have friends?

Computers have a lot more time on their hands than we do and most of the bad guys don’t have jobs. The next person asking for your social security number could be just a few clicks away from your stock options.

If you just got a chill down your back or just got a little paranoid; good, my work is done.

Use an 8 character password (9 characters is better)… You would make this security professional very happy if you would change your passwords after you read this e-mail : )

You can learn more about choosing good Passwords. And hey, do follow them !

On a sidenote, I remember learning to code during the under grad years just for the thrill of cracking passwords. I can still feel how beautiful it was when i did manage to do it. Sheer bliss. I understood then, on why people take so much effort to hack into classified sites and just play around with files until they make one stupid mistake and get caught.

It is the sheer satisfaction of the EGO … The Ego Trail that keeps us going.

Comments Off : more...

Logic and math riddles

by on Oct.16, 2005, under Cool, Fun, Math, Trivia

Today on Slashdot, a message board challenge to assemble a catalog of favority math and logic riddles. Well not all of them are that great but they have some really interesting puzzles among the lot.
There is a king and there are his n prisoners. The king has a dungeon in his castle that is shaped like a circle, and has n cell doors around the perimeter, each leading to a separate, utterly sound proof room. When within the cells, the prisoners have absolutely no means of communicating with each other.

The king sits in his central room and the n prisoners are all locked in their sound proof cells. In the king’s central chamber is a table with a single chalice sitting atop it. Now, the king opens up a door to one of the prisoners’ rooms and lets him into the room, but always only one prisoner at a time! So he lets in just one of the prisoners, any one he chooses, and then asks him a question, “Since I first locked you and the other prisoners into your rooms, have all of you been in this room yet?” The prisoner only has two possible answers. “Yes,” or, “I’m not sure.” If any prisoner answers “yes” but is wrong, they all will be beheaded. If a prisoner answers “yes,” however, and is correct, all prisoners are granted full pardons and freed. After being asked that question and answering, the prisoner is then given an opportunity to turn the chalice upside down or right side up. If when he enters the room it is right side up, he can choose to leave it right side up or to turn it upside down, it’s his choice. The same thing goes for if it is upside down when he enters the room. He can either choose to turn it upright or to leave it upside down. After the prisoner manipulates the chalice (or not, by his choice), he is sent back to his own cell and securely locked in.

The king will call the prisoners in any order he pleases, and he can call and recall each prisoner as many times as he wants, as many times in a row as he wants. The only rule the king has to obey is that eventually he has to call every prisoner in an arbitrary number of times. So maybe he will call the first prisoner in a million times before ever calling in the second prisoner twice, we just don’t know. But eventually we may be certain that each prisoner will be called in ten times, or twenty times, or any number you choose.

Here’s one last monkey wrench to toss in the gears, though. The king is allowed to manipulate the cup himself, k times, out of the view of any of the prisoners. That means the king may turn an upright cup upside down or vice versa up to k times, as he chooses, without the prisoners knowing about it. This does not mean the king must manipulate the cup any number of times at all, only that he may.

via Slashdot and Boing Boing

Also, found this great resource of riddles over at UCB’s site from the slashdot post. Definitely worth checking out if you have an hour or two to spare on some good grey cell petrifying puzzles.

Update : While we are at solving puzzles, here is one more awesome question that i had worked on, a long time back. Dig this.

You have a port that you are reading numbers from. You know that there is one number that is generated in more than half of the cases. You keep reading numbers arbitrarily long until you are given a command to stop. When you stop you have to return the number that has occurred in more than half of the cases.

(Hint: you don’t have enough memory to store all the numbers)

Here’s the actual link.

Comments Off more...

4D Cube

by on Sep.17, 2005, under Cool, Fun, Math, Photography

A very interesting, perspective invoking picture of a 4D cube. Well ironically, its name is still a Cube in 4D.

Here’s a 4-D visualization of the cube in a raytraced Povray version of the picture.

A 4D visualization of a cube

A 4D visualization of a cube

” />
Check out this site for more interesting trivia, facts and pictures related to math !

2 Comments more...

Star Wars – ASCIIfied

by on Sep.14, 2005, under Cool, Fun, Movies

This is just frickin cool. I just saw Star Wars Episode IV in nothing but ASCII in a Telnet screen. OMFG. Some creative crazy nuts have turned the entire movie into ASCII art which is now available using Telnet. I absolutely have no clue, as to how the author managed to get so much time to get this movie done. Just plainly mind-blowing.

If you want to see it, open up the command line on your computer(Terminal on OS X, or “CMD” from the run option of your Windows PC) and type “telnet towel.blinkenlights.nl”. Hit enter a few times and sit back with some popcorn to enjoy the show.

Now to push it up a notch and if you are using IP V6, you get the entire movie in color too !

Here’s a sampler.




Good old ASCII never ceases to surprise !

PS : If you do not want to muck around with telnet, go over here to watch the same movie as a Java applet.

Comments Off more...

Premier League Photo of the Decade

by on Aug.20, 2005, under Cool, Photography

The photo is from the Premier League web site Ten Seasons Awards section.

It is such a great illustration of the empathy (if not outright identification) of the sports fan with the athlete, all the more evident in English soccer because of the unique proximity of the stands to the fields.

Disbelief all round as Owen fails to score(11 September 1999 - Liverpool v Man Utd)


I think I recognize Fowler, Owen and Heskey for Liverpool. After some search, i think the keeper is Massimo Taibi in his brief, who had a troubled cameo as Manchester United goalie.

How ironic would it be if he ended up in the photo of the decade …

1 Comment :, more...

A User’s Guide to Time Travel

by on Aug.05, 2005, under Cool, Links, Physics, Science

Whoopy doo. I almost have a Time Machine in my hands !

Now if only i can just create a blackhole and get a computer with a mega huge cpu power to solve a billion variables accurately, i will be done …

Now read on about “A User’s Guide to Time Travel” – All it takes is a grasp of theoretical physics, control of the space-time continuum, and maybe a ball of cosmic string.

A very interesting and captivating article about some of the theories and concepts you need to know before trying to even talk about time travel to anyone ! Definitely a nice lay-man’s intro to the subject …

Also, here is the author’s site. Dr. Michio Kaku is the co-founder of String Field Theory. If you have never had the chance to read anything on Field theory, then believe me, after the basic reading i’ve done, i’d salute him a 100 times ! He’s got a great site going on, full of technical information. A nice site if you like theoretical physics and many other scientific phenomena.

Update : Saw this article “Realistic Time Machine? New design could forgo exotic ingredient” and found it interesting and relevant to the topic. While all the suggested theories seem good, nothing can be commented about them until a practical model is developed.

Comments Off more...

Daniel Tammet : A genius unravelled

by on Aug.04, 2005, under Cool, People

I am not sure how many people have read about Daniel Tammet but i did not know about him until i saw the following “Ripley’s Believe it or Not” clip, few days back. Here is what it said :

Out of curiosity, i started searching more about this genius. And found a great article, more like an interview with him where he actually explains how he is able to do the things that he does.

An excerpt :

Daniel Tammet is talking. As he talks, he studies my shirt and counts the stitches. Ever since the age of three, when he suffered an epileptic fit, Tammet has been obsessed with counting. Now he is 26, and a mathematical genius who can figure out cube roots quicker than a calculator and recall pi to 22,514 decimal places. He also happens to be autistic, which is why he can’t drive a car, wire a plug, or tell right from left. He lives with extraordinary ability and disability.

I mean, the first look at the article amazed me because like the article says, no one has ever explained on how they are able to do calculations in the mind, fast or slow, because it is all intuitive and it just comes. He talks about seeing numbers as shapes, and calculations meld these shapes together to create new shapes that represent new numbers – that sounds fascinating; it would be great to be able to do that. There is no way you can associate words with what is happening inside your head. But this genius wonder, explains it all, in terms of patterns, colours and shapes. Beautiful !

Another excerpt :

“I do love numbers,” he says. “It isn’t only an intellectual or aloof thing that I do. I really feel that there is an emotional attachment, a caring for numbers. I think this is a human thing – in the same way that a poet humanises a river or a tree through metaphor, my world gives me a sense of numbers as personal. It sounds silly, but numbers are my friends.”

I can exactly understand what he says. Probably every coder can understand that perfectly too. The way you see the design in your head and you just code it without having to think again about variable names or the patterns or the abstraction. It just flows !

Maybe this is what the next evolution of man should look like. Humans, independent of machines, performing zillions of calculations per sec and able to communicate across continents with just the mind. That just might be the right time to throw away all your computers but until then, if you are not a born genius, code on …

There are some more links and views about Dan Tammet. Read on …

@ Wikipedia
@ Spear’s Grotto
@ Digital Antichrist
@ Past Peak
@ MultipleSclerosis
And here’s a good picture of him

Comments Off more...

Is Big beautiful ?

by on Jul.23, 2005, under Cool, Gadgets

Nope. Its not what you think unless you have an awesome digital camera in mind ! Hello and welcome to an intro of Phase One’s P45 39 megapixel digital camera. The highlight of the monster is that it can take pictures at a resolution of 39 Megapixels. And even better a feature is that it can take 60 fpm at such a resolution ! Imagine what the sports or wildlife photographers can whip out with this baby. But oh well, an image at such a resolution does come with 2 show-stoppers.
  • Each image taken at 39MP is atleast 117MB in size ! WoW ! You better start buying lots of extra memory cards if you are into this game :)
  • Expected price for this wonderful gadget is 30000 USD ! God. Now i have to flush my dream of buying 2 of these down the drain …

Here is a picture of the gorgeous machinery.

I was actually pretty happy with the camera(Nikon Coolpix 4800) i had, albeit for a short time. I could manage to take some clear shots, of some great landscapes, and undistorted pictures with a good zoom. But if the miniscule 4MP cam can churn out such good pictures, i can’t even begin to imagine how perfect the image from Phase One’s P45 39 megapixel will be …

via Engadget. Also checkout the Photography Blog.

2 Comments more...

Free .NET IDEs

by on May.21, 2004, under Cool, Links, Programming

There has been a lot of talk about how expensive our favorite IDE, VS.NET is right now. Charles assured in one of the replies to the post that the issue is being discussed internally and will be addressed soon. Cool ! Actually, i don’t know what stand to take on this issue. Is your productivity important or the one time benefit of buying VS.NET professional edition ? It really is very confusing …

Anyway, as our quest for a free .NET IDE continues, here’s one to quench that ! Check out Eclipse for .NET ! Infact, i think i picked up this link from one of the replies, but not sure though… Eclipse as most of you would have heard is an awesome product which was developed by IBM and then later opensourced. I have heard quite a lot from fellow Java devs that the IDE is powerful compared to IntelliJ‘s IDE. Well i’m not the judge in either case but i definitely think that the plugin will help all those cribbing for a good IDE with C# support.

Again, #develop as many of you already know, is a very flexible IDE completely written in C# which is opensource and freely available. There is rarely something extra needed apart from #develop and ASP.NET Webmatrix for developing WinForm and WebForm code in .NET. What more do you want ?

And apart from all that, for the most hardcore developer who doesn’t care for IDE features, there is one really cool app to write code in C#. Ofcourse it will not work at all for enterprise level apps but for smaller projects, definitely useful. Check out Textpad. FYI, its got syntax highlighting functionality for C# too .. Download the file here.

Code on …

I guess, this is a pretty decent list of free IDEs to work on .NET right now. I might have missed a lot of other ones here but these are the ones that stand out quite prominently, i should say :)

Update : Just found out that the Notepad2 free utility provided at Flo’s freeware site also supports syntax highlighting for C# ! And the best part is that the whole thing is customizable, just like Textpad’s syntax highlight feature :) Cool.

Comments Off more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

 

Archives

All entries, chronologically...