@@ -69,12 +69,12 @@ static uint32_t g_apic_lvtt_copy = 0x0, g_apic_tdcr_copy = 0x0;
69
69
* NOTE: Linux's default `write_cr0/4` do not allow to change protected bits,
70
70
* so we include our own here (must be called with interrupts off).
71
71
*/
72
- inline void do_write_cr0 (unsigned long val )
72
+ static inline void do_write_cr0 (unsigned long val )
73
73
{
74
74
asm volatile ("mov %0, %%cr0" : : "r" (val ));
75
75
}
76
76
77
- inline void do_write_cr4 (unsigned long val )
77
+ static inline void do_write_cr4 (unsigned long val )
78
78
{
79
79
asm volatile ("mov %0, %%cr4" : : "r" (val ));
80
80
}
@@ -84,7 +84,7 @@ inline void do_write_cr4(unsigned long val)
84
84
*
85
85
* NOTE: CR0.WP must be set before software can set CR4.CET
86
86
*/
87
- void enable_write_protection (void )
87
+ static void enable_write_protection (void )
88
88
{
89
89
unsigned long cr0 , cr4 ;
90
90
@@ -102,7 +102,7 @@ void enable_write_protection(void)
102
102
*
103
103
* NOTE: CR0.WP cannot be cleared as long as CR4.CET = 1
104
104
*/
105
- void disable_write_protection (void )
105
+ static void disable_write_protection (void )
106
106
{
107
107
unsigned long cr0 , cr4 ;
108
108
@@ -125,7 +125,7 @@ void disable_write_protection(void)
125
125
* Copy original interrupt descriptor table (IDT) -- may be modified by
126
126
* libsgxstep; will be auto restored when closing /dev/sgx-step.
127
127
*/
128
- int save_idt (void )
128
+ static int save_idt (void )
129
129
{
130
130
asm volatile ("sidt %0\n\t"
131
131
:"=m" (g_idtr ) :: );
@@ -143,7 +143,7 @@ int save_idt(void)
143
143
* Save APIC timer configuration registers that may be modified by libsgxstep;
144
144
* will be auto restored when closing /dev/sgx-step.
145
145
*/
146
- int save_apic (void )
146
+ static int save_apic (void )
147
147
{
148
148
g_apic_lvtt_copy = apic -> read (APIC_LVTT );
149
149
g_apic_tdcr_copy = apic -> read (APIC_TDCR );
@@ -152,7 +152,7 @@ int save_apic(void)
152
152
return 0 ;
153
153
}
154
154
155
- int step_open (struct inode * inode , struct file * file )
155
+ static int step_open (struct inode * inode , struct file * file )
156
156
{
157
157
if (g_in_use )
158
158
{
@@ -176,7 +176,7 @@ int step_open(struct inode *inode, struct file *file)
176
176
* NOTE: the IDT virtual memory page is mapped write-protected by Linux, so we
177
177
* have to disable CR0.WP temporarily here.
178
178
*/
179
- void restore_idt (void )
179
+ static void restore_idt (void )
180
180
{
181
181
unsigned long flags ;
182
182
@@ -202,7 +202,7 @@ void restore_idt(void)
202
202
}
203
203
}
204
204
205
- void restore_apic (void )
205
+ static void restore_apic (void )
206
206
{
207
207
int delta = 100 ;
208
208
@@ -232,7 +232,7 @@ void restore_apic(void)
232
232
* modifications made by user-space libsgxstep here to their original values,
233
233
* such that everything runs again normally and Linux does not panic.
234
234
*/
235
- int step_release (struct inode * inode , struct file * file )
235
+ static int step_release (struct inode * inode , struct file * file )
236
236
{
237
237
restore_idt ();
238
238
restore_apic ();
@@ -245,7 +245,7 @@ int step_release(struct inode *inode, struct file *file)
245
245
246
246
/* Convenience function when editing PTEs from user space (but normally not
247
247
* needed, since SGX already flushes the TLB on enclave entry/exit) */
248
- long sgx_step_ioctl_invpg (struct file * filep , unsigned int cmd , unsigned long arg )
248
+ static long sgx_step_ioctl_invpg (struct file * filep , unsigned int cmd , unsigned long arg )
249
249
{
250
250
uint64_t addr = ((invpg_t * ) arg )-> adrs ;
251
251
@@ -254,7 +254,7 @@ long sgx_step_ioctl_invpg(struct file *filep, unsigned int cmd, unsigned long ar
254
254
return 0 ;
255
255
}
256
256
257
- long sgx_step_get_pt_mapping (struct file * filep , unsigned int cmd , unsigned long arg )
257
+ static long sgx_step_get_pt_mapping (struct file * filep , unsigned int cmd , unsigned long arg )
258
258
{
259
259
address_mapping_t * map = (address_mapping_t * ) arg ;
260
260
pgd_t * pgd = NULL ;
@@ -314,7 +314,7 @@ long sgx_step_get_pt_mapping(struct file *filep, unsigned int cmd, unsigned long
314
314
return 0 ;
315
315
}
316
316
317
- long sgx_step_ioctl_setup_isr_map (struct file * filep , unsigned int cmd , unsigned long arg )
317
+ static long sgx_step_ioctl_setup_isr_map (struct file * filep , unsigned int cmd , unsigned long arg )
318
318
{
319
319
uint64_t nr_pinned_pages ;
320
320
setup_isr_map_t * data = (setup_isr_map_t * ) arg ;
@@ -354,7 +354,7 @@ long sgx_step_ioctl_setup_isr_map(struct file *filep, unsigned int cmd, unsigned
354
354
355
355
typedef long (* ioctl_t )(struct file * filep , unsigned int cmd , unsigned long arg );
356
356
357
- long step_ioctl (struct file * filep , unsigned int cmd , unsigned long arg )
357
+ static long step_ioctl (struct file * filep , unsigned int cmd , unsigned long arg )
358
358
{
359
359
char data [256 ];
360
360
ioctl_t handler = NULL ;
0 commit comments