Saturday, August 20, 2011

Enabling XDMCP in Ubuntu 11.04

XDMCP is X Display Manager Control Protocol

1. install xdm
(If you installed xdm before, pass this step)
#apt-get install xdm

2. Edit /etc/gdm/custom.conf as follow: (If custom.conf is not exist, make it)
#vim /etc/dgm/custom.conf

[daemon]
User=gdm
Group=gdm

[security]
DisallowTCP=true

[xdmcp]
Enable=true
DisplaysPerHost=2
HonorIndirect=false
MaxPending=4
MaxSessions=16
MaxWait=30
MaxWaitIndirect=30
PingIntervalSeconds=60
Port=177

[greeter]

[chooser]
Multicast=false

[debug]
Enable=false

Calling Convention

X86 calling conventions

Argument Passing and Naming Conventions (C++)

- The following calling conventions are supported by the Visual C/C++ compiler.
1. cdecl: stack cleanup (caller), parameter passing (stack, right to left)
2. stdcall: stack cleanup (callee), parameter passing (stack, right to left)
3. fastcall: stack cleanup (callee), parameter passing (stored in register, then pushed on stack)

Video Tutorial - Calling Conventions

Tuesday, August 16, 2011

Linux: likely & unlikely

In the Linux,
You can see the below code

if ( likely(x == 0) )
{
// code ...
}
or
if ( unlikely(x == 1) )
{
// code ...
}

#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)


As I know, its another expression is "Branch Prediction".
It is supported gcc 2.96 or later version.

likely/unlikely macros in the Linux kernel
http://stackoverflow.com/questions/109710/likely-unlikely-macros-in-the-linux-kernel

Kernel : likely/unlikely macros
http://kerneltrap.org/node/4705

Wednesday, August 3, 2011