Digital Stronghold




October 7, 2009

Linus’ discussion about goto statements

As discussed by Linus Torvalds 6 years ago,

From: Linus Torvalds
Subject: Re: any chance of 2.6.0-test*?
Date: Sun, 12 Jan 2003 12:22:26 -0800 (PST)

On Sun, 12 Jan 2003, Rob Wilkens wrote:
>
> However, I have always been taught, and have always believed that
> “goto”s are inherently evil. They are the creators of spaghetti code

No, you’ve been brainwashed by CS people who thought that Niklaus Wirth
actually knew what he was talking about. He didn’t. He doesn’t have a
frigging clue.

> (you start reading through the code to understand it (months or years
> after its written), and suddenly you jump to somewhere totally
> unrelated, and then jump somewhere else backwards, and it all gets ugly
> quickly). This makes later debugging of code total hell.

Any if-statement is a goto. As are all structured loops.

And sometimes structure is good. When it’s good, you should use it.

And sometimes structure is _bad_, and gets into the way, and using a
“goto” is just much clearer.

(more…)

June 18, 2008

Sun Tech Days 2008 Day 2 - OpenSolaris 2008.5 Track

Sun admitted that Solaris’ late move to open source is a big mistake. They said that while they were busy making money, they were already losing the server market, Linux is taking over very fast.

Having tried several versions of Solaris and OpenSolaris, in my honest opinion, opening its source code to the public is a good move. :D

What’s cool in OpenSolaris 2008.5?

1. IPS - a network package management system that resembles an apt-get type of command. Thanks to Ian Murdock.

2. Bourne Again Shell - C Shell is no longer the default one. This makes majority of the Linux users comfortable when shifting to OpenSolaris.

3. OpenSolaris Developer Expert Assistance - A dedicated online support service for developers that provides technical assistance for code support, programming questions, diagnostic advice, how-to’s and best practice guidance.

4. OpenSolaris Subscription Support - Telephone and online technical support. Provides automatic notification of security updates.

June 19, 2006

GDT Explained

GDT contains a number of entries, Segment Descriptors. Usually each is 8 bytes long and marks the starting point, length, and access rights of the segment. It is stored in memory of course. The address is stored in a special 48-bit CPU register called Global Descriptor Table Register (GDTR). The lower 16 bits inform the size of the GDT while the upper 32 bits inform the location of the GDT in memory.

The GDT itself is a 64-bit long entries. These entries define whether the current segment that the processor is running is for Ring 0 or Ring 3. Ring levels are restrictions, Ring 0 is for system use while Ring 3 is for application use. Such protection exists to prevent applications from causing the kernel to crash and to tell the processor which instructions are valid.

–snipped–

May 22, 2006

Kernel head

This is a late post. Simply explains how the kernel sits in after grub.

[BITS 32]
	
global _start
extern kernel_entry
	
PAGEALIGN	equ 1<<0
MEMORYINFO	equ 1<<1
HEADERFLAGS	equ PAGEALIGN | MEMORYINFO ; 0x3 that is
HEADERMAGIC	equ 0x1BADB002
CHECKSUM	equ -(HEADERMAGIC + HEADERFLAGS)
STACKSIZE	equ 0x4000
	
section .text
ALIGN 4 	; section must be 4 byte-aligned
multibootheader	;
	dd HEADERMAGIC
	dd HEADERFLAGS
	dd CHECKSUM
	
_start:
	mov esp, stack+STACKSIZE
	push eax
	push ebx
	call kernel_entry
	jmp $
	
; GDT here
	
; ISRs here
	
section .bss
ALIGN 4
stack	resb STACKSIZE	; 16KB of memory

I’m just sad tonight, that’s why I decided to post this out of nothing. Well I guess keeping myself busy would be wise enough.

Theme designed by Joset Anthony Zamora


Digital Stronghold

↑ Get Headline Animator