Skip to content

Instantly share code, notes, and snippets.

@sunnyone
sunnyone / gist:1178749
Created August 29, 2011 16:18
prtconf-D-virtionet
pci1af4,1, instance #0
Hardware properties:
name='acpi-namespace' type=string items=1
value='\_SB_.PCI0.S5__'
name='assigned-addresses' type=int items=5
value=81002810.00000000.0000c0c0.00000000.00000020
name='reg' type=int items=10
value=00002800.00000000.00000000.00000000.00000000.01002810.00000000.00000000.00000000.00000020
name='compatible' type=string items=7
value='pci1af4,1000.1af4.1.0' + 'pci1af4,1000.1af4.1' + 'pci1af4,1' + 'pci1af4,1000.0' + 'pci1af4,1000' + 'pciclass,020000' + 'pciclass,0200'
@sunnyone
sunnyone / gist:1327779
Created October 31, 2011 15:38
irc_message.c assembled by gcc(x86)
irc_message_to_string:
.LFB45:
.loc 1 399 0
.cfi_startproc
.LVL131:
pushl %ebp
.LCFI110:
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
pushl %edi
@sunnyone
sunnyone / gist:1327783
Created October 31, 2011 15:41
irc_message.c irc_message_to_string
gchar *
irc_message_to_string(IRCMessage *msg)
{
GString *string;
gchar *str;
gint i, num;
g_return_val_if_fail(msg != NULL, NULL);
g_return_val_if_fail(IS_IRC_MESSAGE(msg), NULL);
@sunnyone
sunnyone / gist:1327828
Created October 31, 2011 15:59
irc_message.c strlen sample
if (strlen(msg->parameter[i]) > 0 && strchr(msg->parameter[i], ' ') == NULL) {
g_string_append_printf(string, " %s", msg->parameter[i]);
} else {
g_string_append_printf(string, " :%s", msg->parameter[i]);
}
@sunnyone
sunnyone / gist:1327835
Created October 31, 2011 16:03
irc_message.c strlen sample assembled by gcc(x86)
.L95:
.loc 1 420 0
movl 36(%ebp), %eax
movl (%eax,%esi), %esi
cmpb $0, (%esi)
je .L99
.loc 1 420 0 is_stmt 0 discriminator 1
movl $32, 4(%esp)
movl %esi, (%esp)
call strchr
@sunnyone
sunnyone / string.h
Created October 31, 2011 16:34
string.h of eglibc
/* Return the length of S. */
#define _HAVE_STRING_ARCH_strlen 1
#define strlen(str) \
(__extension__ (__builtin_constant_p (str) \
? __builtin_strlen (str) \
: __strlen_g (str)))
__STRING_INLINE size_t __strlen_g (__const char *__str);
__STRING_INLINE size_t
__strlen_g (__const char *__str)
@sunnyone
sunnyone / gist:1327929
Created October 31, 2011 16:39
irc_message.c irc_message_to_string assembled by gcc(x86) (-fno-builtin)
.loc 2 420 0 is_stmt 1
movl 8(%ebp), %eax
movl 36(%eax), %eax
movl -36(%ebp), %edx
sall $2, %edx
addl %edx, %eax
movl (%eax), %eax
movl %eax, (%esp)
call strlen
testl %eax, %eax
@sunnyone
sunnyone / stlen.c
Created October 31, 2011 18:46
small strlen test
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void
print_length(char *s)
{
size_t len = strlen(s);
printf("Unhappy?: %ld\n", len);
}
@sunnyone
sunnyone / stlen.S
Created October 31, 2011 18:47
small strlen test assembled
.file "stlen.c"
.section .rodata
.LC0:
.string "Unhappy?: %ld\n"
.text
.globl print_length
.type print_length, @function
print_length:
.LFB0:
.cfi_startproc
@sunnyone
sunnyone / v2c.desktop
Created November 10, 2011 15:02
v2c.desktop
[Desktop Entry]
Version=1.0
Name=V2C
Exec=/home/yoichi/opt/v2c/v2c
Terminal=false
Type=Application
Icon=/home/yoichi/opt/v2c/v2cicon.png