in the name of zero

March 29, 2009

say what!?

achtung! grand douche-baggery… http://hk-magazine.com/feature/war-home

update! update! update! update! update! update! update!

http://dfa.gov.ph/?p=3962

December 24, 2008

merry christmas


November 23, 2008

negima

nodoka

ain’t she the cutest!!!!!!?????? i’m soo… like… smitten! but geez! i can’t believe i’m in love with a damn drawing!

November 8, 2008

let’s learn powerpc linux!

i’m actually using gcc4 and noticed that there are minor deviations
from the usual prolog/epilog functions since gcc3 when doing intel. i
have to read up on this.

so let’s try to follow a simple “hello world” program to see how gcc makes ppc
programs. it’s compiled with no optimizations.

int procedure1(const char *string)
{
        printf(string);
        return 0;
}
	
int main(int argc, char *argv[])
{
        return procedure1(\"hello world\n\");
}

the V4 stack frame.

	SP---->	+---------------------------------------+
		| back chain to caller			| 0
		+---------------------------------------+
		| saved LR				| 4
		+---------------------------------------+
		| Parameter save area (P)		| 8
		+---------------------------------------+
		| Alloca space (A)			| 8+P
		+---------------------------------------+
		| Local variable space (L)		| 8+P+A
		+---------------------------------------+
		| saved CR (C)				| 8+P+A+L
		+---------------------------------------+
		| Save area for GP registers (G)	| 8+P+A+L+C
		+---------------------------------------+
		| Save area for FP registers (F)	| 8+P+A+L+C+G
		+---------------------------------------+
	old SP->| back chain to caller's caller		|
		+---------------------------------------+

the V4 Registers

r0 volatile, may be used by function linkage
r1 stack pointer
r2 reserved for system
r3 .. r4 volatile, pass 1st - 2nd int args, return 1st - 2nd ints
r5 .. r10 volatile, pass 3rd - 8th int args
r11 .. r12 volatile, may be used by function linkage
r13 small data area pointer
r14 .. r31 saved
f0 volatile
f1 volatile, pass 1st float arg, return 1st float
f2 .. f8 volatile, pass 2nd - 8th float args
f9 .. f13 volatile
f14 .. f30 saved
f31 saved, static chain if needed.
lr volatile, return address
ctr volatile
xer volatile
fpscr volatile*
cr0 volatile
cr1 volatile**
cr2 .. cr4 saved
cr5 .. cr7 volatile

* The VE, OE, UE, ZE, XE, NI, and RN (rounding mode) bits of the FPSCR may be
changed only by a called function such as fpsetround that has the documented
effect of changing them, the rest of the FPSCR is volatile.

** Bit 6 of the CR (CR1 floating point invalid exception bit) is set to 1 if a
variable argument function is passed floating point arguments in registers.

the PPC architecture does not have a push/pop instruction that implicitly
operates on the stack. as such, stack management could be a little more “hands
on” on PPC in comparison to intel. the stack frame convention above is defined
to support parameter passing, reserved registers (nonvolatile) preservation and
local variables. each function which either calls another function or modifies
saved register must create a stack frame from memory set aside for use as a
stack defined by the r1 register (r1 = sp).

the stwu instruction assures that stack frame allocation is atomic. stack
space is allocated and the sp (r1) is updated in just one instruction.

parameter passing. ppc passes function parameters thru registers rather than
pushing them all in the stack.

<procedure1>
stwu    r1,-32(r1)  ; save former and allocate a new stack frame
mflr    r0          ; return addr of procedure1()
stw     r31,28(r1)  ; save r31
stw     r0,36(r1)   ; save r0
mr      r31,r1      ; mirror sp
stw     r3,8(r31)   ; save char * to stack
lwz     r3,8(r31)   ; argument to printf
bl      10010a00

li      r0,0        ; r0 = 0
mr      r3,r0       ; r3 = 0 = return value
lwz     r11,0(r1)   ; access back chain
lwz     r0,4(r11)   ; access return address
mtlr    r0          ; update link register with return addr of procedure1()
lwz     r31,-4(r11) ; restore r31
mr      r1,r11      ; restore caller’s stack
blr                 ; return to caller
	
<main>
stwu    r1,-32(r1)      ; save former frame and allocate a new stack frame
mflr    r0              ; return address of main()
stw     r31,28(r1)      ; save r31
stw     r0,36(r1)       ; save link register
mr      r31,r1          ; mirror sp
stw     r3,8(r31)       ; save r3
stw     r4,12(r31)      ; save r4
lis     r9,4096         ; lower 16 bits of string addr
addi    r3,r9,2176      ; higher 16 bits of string addr
bl      10000434
 ; procedure1(char *)
mr      r0,r3           ; r0 = return val of procedure1()
mr      r3,r0           ; r3 = 0 (retval)
lwz     r11,0(r1)       ; access back chain
lwz     r0,4(r11)       ; access return address
mtlr    r0              ; update link register
lwz     r31,-4(r11)     ; restore r31
mr      r1,r11          ; restore stack frame
blr                     ; leave main()

next time, we’ll delve more deeper and see how to access system calls directly
and how these system calls are implemented.

October 25, 2008

happy birthday

Filed under: easter eggs

oh my god i’m soo busy. for now.. a quote.

“all beautiful girls… are taken.
and all beautiful boys… are gay. “

August 18, 2008

with yoo hee

they could have gone all the way… but no… they mellowed down the ending into a mediocre open-ended love drama. THE NERVE! i hate the scriptwriters for messing with my heart like this!

August 10, 2008

avatar, the last airbender

Filed under: easter eggs

.. i finished watching the last episode of book3 a while ago… rocks! at last, there is peace.

laptop love

Filed under: hermetic studies

i got annoyed because i have four extra keys on my laptop keyboard that doesn’t
work as expected when i’m in gentoo. i’m callin’ them “compaq keys” coz i dont
know what they are called and its tiresome to know anyway…

in windows vista:

compaq key1: starts a program ‘dvdplay’ i think…
compaq key2: toggles the volume on or off
compaq key3: lowers the volume
compaw key4: does the opposite of key3

so i modified my keymap settings so that compaq keys2-4 are mapped to function keys
F13-F15 (i only have F1 to F12…)

-- .Xmodmap --
keycode 160 = F13
keycode 174 = F14
keycode 176 = F15

and my corresponding .fluxbox/keys file

 -- snip --
	
# windows key
Mod4 x  :maximize
Mod4 d  :ShowDesktop
Mod4 a :ExecCommand aterm +sb -tr -trsb -fg darkgray -fade 50%
Mod4 w :ExecCommand audacious
Mod4 e :ExecCommand /usr/bin/emelfm2
Mod4 b :ExecCommand /usr/bin/firefox
Mod4 y :ExecCommand /usr/bin/gaim
Mod4 m :ExecCommand /usr/bin/sylpheed
Mod4 v :ExecCommand /usr/bin/gvim
	
# laptop keymap
F13 :ExecCommand /bin/bash ~/.mykbd
F14 :ExecCommand /usr/bin/amixer sset PCM 5%-
F15 :ExecCommand /usr/bin/amixer sset PCM 5%+
	
 -- snip -- 

now, volume on/off toggling presented a mild challenge mainly because i didn’t
find implicit mute/unmute capability in amixer’s man page. so i did a little bash
mojo to get the desired functionality i want.

.mykdb

#!/bin/bash
SYSMIX=`which amixer`
GET_SPKR_STAT=$SYSMIX
STATUS=`$GET_SPKR_STAT get Speaker | grep -i off`
	
if [[ -z $STATUS ]]; then
        $SYSMIX sset Speaker off 1> /dev/null
else
        $SYSMIX sset Speaker on 100% 1> /dev/null
fi  

it took me a whole goddamn 10 minutes to figure out that [[ ]] needs a space
separator on its expression field.

lesson learned. seriously, don’t do bash, brainfuck, and perl when you are sleep
deprived.

July 20, 2008

magic the gathering meme

Filed under: easter eggs


Take the Magic: The Gathering ‘What Color Are You?’ Quiz.

July 13, 2008

starbucks flirting

Filed under: easter eggs

how come guys using a macbook at the local starbucks look cool? i’m running gentoo and accessing their wifi at virtual terminal two using iwconfig … but I don’t get any attention from the cute bartender “kaye”. sh* t… i must change my tactics and perhaps use vista instead.

Get free blog up and running in minutes with Blogsome | Theme designs available here