mirror of
https://github.com/ioacademy-jikim/kernel
synced 2025-06-07 16:06:20 +00:00
3 commit
This commit is contained in:
parent
04c7248d09
commit
7ac63dc85c
BIN
01_day/a.out
Executable file
BIN
01_day/a.out
Executable file
Binary file not shown.
202
01_day/macro.c
Normal file
202
01_day/macro.c
Normal file
@ -0,0 +1,202 @@
|
||||
#if 1
|
||||
#include <stdio.h>
|
||||
|
||||
#define __stringify_1(x...) #x
|
||||
#define __stringify(x...) __stringify_1(x)
|
||||
|
||||
#define ___PASTE(a,b) a##b
|
||||
#define __PASTE(a,b) ___PASTE(a,b)
|
||||
|
||||
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
|
||||
// __UNIQUE_ID_license
|
||||
// __UNIQUE_ID_license10
|
||||
|
||||
#define __MODULE_INFO(tag, info) \
|
||||
static const char __UNIQUE_ID(tag)[] \
|
||||
= __stringify(tag) "=" info
|
||||
|
||||
__MODULE_INFO(license, "GPL"); __MODULE_INFO(license, "BSD");
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
|
||||
#define __stringify_1(x...) #x
|
||||
#define __stringify(x...) __stringify_1(x)
|
||||
|
||||
#define ___PASTE(a,b) a##b
|
||||
#define __PASTE(a,b) ___PASTE(a,b)
|
||||
|
||||
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__)
|
||||
// __UNIQUE_ID_license
|
||||
// __UNIQUE_ID_license10
|
||||
|
||||
#define __MODULE_INFO(tag, info) \
|
||||
static const char __UNIQUE_ID(tag)[] \
|
||||
= __stringify(tag) "=" info
|
||||
|
||||
__MODULE_INFO(license, "GPL"); // __UNIQUE_ID_license18
|
||||
__MODULE_INFO(license, "BSD"); // __UNIQUE_ID_license19
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
|
||||
#define __stringify_1(x...) #x
|
||||
#define __stringify(x...) __stringify_1(x)
|
||||
|
||||
#define __MODULE_INFO(tag, info) \
|
||||
static const char tag[] \
|
||||
= __stringify(tag) "=" info
|
||||
|
||||
__MODULE_INFO(license, "GPL");
|
||||
__MODULE_INFO(license, "BSD");
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("license =%s\n", license );
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
|
||||
static const char license[] = "license=GPL";
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("license =%s\n", license );
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char ch __attribute__((aligned(1)));
|
||||
int i __attribute__((aligned(1)));
|
||||
printf("&ch=%p\n", &ch );
|
||||
printf("&i =%p\n", &i );
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char ch __attribute__((aligned(8)));
|
||||
int i __attribute__((aligned(8)));
|
||||
printf("&ch=%p\n", &ch );
|
||||
printf("&i =%p\n", &i );
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
|
||||
int global
|
||||
__attribute__((section(".modinfo")))
|
||||
= 0x77777777;
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int local
|
||||
__attribute__((unused))
|
||||
= 0x77777777;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
|
||||
#define __used __attribute__((__used__))
|
||||
|
||||
static int global
|
||||
__used
|
||||
= 0x77777777;
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
|
||||
#define __stringify_1(x...) #x
|
||||
#define __stringify(x...) __stringify_1(x)
|
||||
|
||||
char *p = __stringify(__LINE__) "=" "GPL";
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("%s\n", p ); // "foo=GPL"
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
|
||||
#define foo bar
|
||||
|
||||
#define __stringify_1(x...) #x
|
||||
#define __stringify(x...) __stringify_1(x)
|
||||
|
||||
char *p = __stringify(foo) "=" "GPL";
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("%s\n", p ); // "foo=GPL"
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
|
||||
#define foo bar
|
||||
|
||||
#define __stringify_1(x...) #x
|
||||
// #define __stringify(x...) __stringify_1(x)
|
||||
|
||||
char *p = __stringify_1(foo) "=" "GPL";
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("%s\n", p ); // "foo=GPL"
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
#define __stringify_1(x...) #x
|
||||
#define __stringify(x...) __stringify_1(x)
|
||||
|
||||
char *p = __stringify(license) "=" "GPL";
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("%s\n", p ); // "license=GPL"
|
||||
return 0;
|
||||
}
|
||||
#endif
|
@ -6,7 +6,7 @@ int init_module(void)
|
||||
{
|
||||
int ret;
|
||||
printk("init_module\n");
|
||||
ret = __gpio_get_value( 170 );
|
||||
ret = gpio_get_value( 170 );
|
||||
printk("ret=%d\n", ret );
|
||||
return 0;
|
||||
}
|
||||
|
3680
01_day/xxx
Normal file
3680
01_day/xxx
Normal file
File diff suppressed because it is too large
Load Diff
3890
01_day/yyy
Normal file
3890
01_day/yyy
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user